This commit is contained in:
wing328
2016-12-14 16:27:14 +08:00
64 changed files with 3577 additions and 1867 deletions

View File

@@ -799,6 +799,7 @@ Here are some companies/projects using Swagger Codegen in production. To add you
- [Plexxi](http://www.plexxi.com)
- [Pixoneye](http://www.pixoneye.com/)
- [PostAffiliatePro](https://www.postaffiliatepro.com/)
- [Prill Tecnologia](http://www.prill.com.br)
- [QAdept](http://qadept.com/)
- [QuantiModo](https://quantimo.do/)
- [Rapid7](https://rapid7.com/)

View File

@@ -93,7 +93,7 @@ public class ExampleGenerator {
};
}
} else if (property instanceof DateProperty) {
return "2000-01-23T04:56:07.000+00:00";
return "2000-01-23";
} else if (property instanceof DateTimeProperty) {
return "2000-01-23T04:56:07.000+00:00";
} else if (property instanceof DecimalProperty) {

View File

@@ -180,7 +180,7 @@ public class XmlExampleGenerator {
if (property.getExample() != null) {
return property.getExample().toString();
} else {
return "2000-01-23T04:56:07.000Z";
return "2000-01-23";
}
} else if (property instanceof IntegerProperty) {
if (property.getExample() != null) {

View File

@@ -390,7 +390,6 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
// need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
additionalProperties.put(CodegenConstants.SERIALIZABLE_MODEL, serializableModel);
LOGGER.info("CodegenConstants.SERIALIZABLE_MODEL = " + additionalProperties.get(CodegenConstants.SERIALIZABLE_MODEL));
//make api and model doc path available in mustache template
additionalProperties.put( "apiDocPath", apiDocPath );

View File

@@ -21,6 +21,9 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
protected String packageVersion = "1.0.0";
protected String clientPackage = "IO.Swagger.Client";
protected String sourceFolder = "src" + File.separator + "main" + File.separator + "CsharpDotNet2";
protected String apiDocPath = "docs/";
protected String modelDocPath = "docs/";
public CsharpDotNet2ClientCodegen() {
super();
@@ -35,6 +38,8 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
embeddedTemplateDir = templateDir = "CsharpDotNet2";
apiPackage = "IO.Swagger.Api";
modelPackage = "IO.Swagger.Model";
modelDocTemplateFiles.put("model_doc.mustache", ".md");
apiDocTemplateFiles.put("api_doc.mustache", ".md");
setReservedWordsLowerCase(
Arrays.asList(
@@ -122,6 +127,9 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
additionalProperties.put(CLIENT_PACKAGE, clientPackage);
}
additionalProperties.put("apiDocPath", apiDocPath);
additionalProperties.put("modelDocPath", modelDocPath);
supportingFiles.add(new SupportingFile("Configuration.mustache",
sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "Configuration.cs"));
supportingFiles.add(new SupportingFile("ApiClient.mustache",
@@ -130,7 +138,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
sourceFolder + File.separator + clientPackage.replace(".", java.io.File.separator), "ApiException.cs"));
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor", "packages.config"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
}
@@ -292,4 +300,14 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege
return input.replace("*/", "*_/").replace("/*", "/_*");
}
@Override
public String apiDocFileFolder() {
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
}
@Override
public String modelDocFileFolder() {
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
}
}

View File

@@ -1,10 +0,0 @@
# Csharp-DotNet2
This generator creates C# code targeting the .Net 2.0 framework. The resulting DLLs can be used in places where .Net 2.0 is the maximum supported version, such as in the Unity3d.
## Dependencies
- Mono compiler
- Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator.

View File

@@ -0,0 +1,153 @@
# {{packageName}} - the C# library for the {{appName}}
{{#appDescription}}
{{{appDescription}}}
{{/appDescription}}
This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: {{appVersion}}
- SDK version: {{packageVersion}}
{{^hideGenerationTimestamp}}
- Build date: {{generatedDate}}
{{/hideGenerationTimestamp}}
- Build package: {{generatorClass}}
{{#infoUrl}}
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
{{/infoUrl}}
<a name="frameworks-supported"></a>
## Frameworks supported
{{^supportUWP}}
- .NET 2.0
{{/supportUWP}}
{{#supportUWP}}
- UWP
{{/supportUWP}}
<a name="dependencies"></a>
## Dependencies
- Mono compiler
- Newtonsoft.Json.7.0.1
- RestSharp.Net2.1.1.11
Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator
<a name="installation"></a>
## Installation
Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh compile-mono.sh`
- [Windows] TODO
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using {{packageName}}.{{apiPackage}};
using {{packageName}}.Client;
using {{packageName}}.{{modelPackage}};
```
<a name="getting-started"></a>
## Getting Started
```csharp
using System;
using System.Diagnostics;
using {{apiPackage}};
using {{packageName}}.Client;
using {{modelPackage}};
namespace Example
{
public class {{operationId}}Example
{
public void main()
{
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}}
Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
var apiInstance = new {{classname}}();
{{#allParams}}
{{#isPrimitiveType}}
var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/isPrimitiveType}}
{{/allParams}}
try
{
{{#summary}}
// {{{.}}}
{{/summary}}
{{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
Debug.WriteLine(result);{{/returnType}}
}
catch (Exception e)
{
Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
}
}
}
}{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *{{{basePath}}}*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}}
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
<a name="documentation-for-models"></a>
## Documentation for Models
{{#modelPackage}}
{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
{{/model}}{{/models}}
{{/modelPackage}}
{{^modelPackage}}
No model defined in this package
{{/modelPackage}}
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
{{^authMethods}}
All endpoints do not require authorization.
{{/authMethods}}
{{#authMethods}}
{{#last}}
Authentication schemes defined for the API:
{{/last}}
{{/authMethods}}
{{#authMethods}}
<a name="{{name}}"></a>
### {{name}}
{{#isApiKey}}- **Type**: API key
- **API key parameter name**: {{keyParamName}}
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
{{/isApiKey}}
{{#isBasic}}- **Type**: HTTP basic authentication
{{/isBasic}}
{{#isOAuth}}- **Type**: OAuth
- **Flow**: {{flow}}
- **Authorization URL**: {{authorizationUrl}}
- **Scopes**: {{^scopes}}N/A{{/scopes}}
{{#scopes}} - {{scope}}: {{description}}
{{/scopes}}
{{/isOAuth}}
{{/authMethods}}

View File

@@ -0,0 +1,97 @@
# {{packageName}}.{{apiPackage}}.{{classname}}{{#description}}
{{description}}{{/description}}
All URIs are relative to *{{{basePath}}}*
Method | HTTP request | Description
------------- | ------------- | -------------
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
{{/operation}}{{/operations}}
{{#operations}}
{{#operation}}
<a name="{{{operationIdLowerCase}}}"></a>
# **{{{operationId}}}**
> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
{{{summary}}}{{#notes}}
{{{notes}}}{{/notes}}
### Example
```csharp
using System;
using System.Diagnostics;
using {{packageName}}.Api;
using {{packageName}}.Client;
using {{modelPackage}};
namespace Example
{
public class {{operationId}}Example
{
public void main()
{
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
// Configure HTTP basic authorization: {{{name}}}
Configuration.Default.Username = "YOUR_USERNAME";
Configuration.Default.Password = "YOUR_PASSWORD";{{/isBasic}}{{#isApiKey}}
// Configure API key authorization: {{{name}}}
Configuration.Default.ApiKey.Add("{{{keyParamName}}}", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("{{{keyParamName}}}", "Bearer");{{/isApiKey}}{{#isOAuth}}
// Configure OAuth2 access token for authorization: {{{name}}}
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";{{/isOAuth}}{{/authMethods}}
{{/hasAuthMethods}}
var apiInstance = new {{classname}}();
{{#allParams}}
{{#isPrimitiveType}}
var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/isPrimitiveType}}
{{^isPrimitiveType}}
var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
{{/isPrimitiveType}}
{{/allParams}}
try
{
{{#summary}}
// {{{.}}}
{{/summary}}
{{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}}
Debug.WriteLine(result);{{/returnType}}
}
catch (Exception e)
{
Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message );
}
}
}
}
```
### Parameters
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
{{/allParams}}
### Return type
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
### Authorization
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
### HTTP request headers
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
- **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
{{/operation}}
{{/operations}}

View File

@@ -0,0 +1,14 @@
{{#models}}
{{#model}}
# {{{packageName}}}.Model.{{{classname}}}
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
{{/vars}}
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
{{/model}}
{{/models}}

View File

@@ -37,7 +37,7 @@ public interface {{classname}} {
@Produces({ {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} })
{{/hasProduces}}
@ApiOperation(value = "{{summary}}", tags={ {{#vendorExtensions.x-tags}}"{{tag}}"{{#hasMore}}, {{/hasMore}}{{/vendorExtensions.x-tags}} })
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/operation}}
}
{{/operations}}

View File

@@ -28,7 +28,7 @@ import org.springframework.stereotype.Service;
public class {{classname}}ServiceImpl implements {{classname}} {
{{#operations}}
{{#operation}}
public {{#returnType}}{{{returnType}}} {{/returnType}}{{^returnType}}void {{/returnType}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
public {{>returnTypes}} {{nickname}}({{#allParams}}{{>queryParamsImpl}}{{>pathParamsImpl}}{{>headerParamsImpl}}{{>bodyParams}}{{>formParamsImpl}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) {
// TODO: Implement...
{{^vendorExtensions.x-java-is-response-void}}return null;{{/vendorExtensions.x-java-is-response-void}}

View File

@@ -103,7 +103,7 @@ public class {{classname}}Test {
{{#allParams}}
{{^isFile}}{{{dataType}}} {{paramName}} = null;{{/isFile}}{{#isFile}}org.apache.cxf.jaxrs.ext.multipart.Attachment {{paramName}} = null;{{/isFile}}
{{/allParams}}
//{{^vendorExtensions.x-java-is-response-void}}{{{returnType}}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
//{{^vendorExtensions.x-java-is-response-void}}{{>returnTypes}} response = {{/vendorExtensions.x-java-is-response-void}}api.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{^vendorExtensions.x-java-is-response-void}}//assertNotNull(response);{{/vendorExtensions.x-java-is-response-void}}
// TODO: test validations

View File

@@ -0,0 +1 @@
{{#returnContainer}}{{#isMapContainer}}Map<String, {{{returnType}}}>{{/isMapContainer}}{{#isListContainer}}List<{{{returnType}}}>{{/isListContainer}}{{/returnContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}}

View File

@@ -0,0 +1,7 @@
# {{classname}}
## Enum
{{#allowableValues}}{{#enumVars}}
* `{{name}}` (value: `{{{value}}}`)
{{/enumVars}}{{/allowableValues}}

View File

@@ -2,38 +2,38 @@
package {{invokerPackage}};
public class Pair {
private String name = "";
private String value = "";
private String name = "";
private String value = "";
public Pair(String name, String value) {
setName(name);
setValue(value);
}
public Pair(String name, String value) {
setName(name);
setValue(value);
}
private void setName(String name) {
if (!isValidString(name)) return;
private void setName(String name) {
if (!isValidString(name)) return;
this.name = name;
}
this.name = name;
}
private void setValue(String value) {
if (!isValidString(value)) return;
private void setValue(String value) {
if (!isValidString(value)) return;
this.value = value;
}
this.value = value;
}
public String getName() {
return this.name;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
public String getValue() {
return this.value;
}
private boolean isValidString(String arg) {
if (arg == null) return false;
if (arg.trim().isEmpty()) return false;
private boolean isValidString(String arg) {
if (arg == null) return false;
if (arg.trim().isEmpty()) return false;
return true;
}
return true;
}
}

View File

@@ -54,83 +54,89 @@ public class {{classname}} {
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
*/
public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}}{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) {
Object postBody = {{#bodyParam}}{{paramName}}{{/bodyParam}}{{^bodyParam}}null{{/bodyParam}};
{{#allParams}}
{{#required}}
// verify the required parameter '{{paramName}}' is set
if ({{paramName}} == null) {
VolleyError error = new VolleyError("Missing the required parameter '{{paramName}}' when calling {{nickname}}",
new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{nickname}}"));
}
{{/required}}{{/allParams}}
new ApiException(400, "Missing the required parameter '{{paramName}}' when calling {{nickname}}"));
}
{{/required}}
{{/allParams}}
// create path and map variables
String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
// create path and map variables
String path = "{{path}}".replaceAll("\\{format\\}","json"){{#pathParams}}.replaceAll("\\{" + "{{baseName}}" + "\\}", apiInvoker.escapeString({{{paramName}}}.toString())){{/pathParams}};
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
{{#queryParams}}
queryParams.addAll(ApiInvoker.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));
{{/queryParams}}
{{#headerParams}}
headerParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
{{/headerParams}}
String[] contentTypes = {
{{#consumes}}
"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}
{{/consumes}}
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
{{#queryParams}}
queryParams.addAll(ApiInvoker.parameterToPairs("{{#collectionFormat}}{{{collectionFormat}}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));
{{/queryParams}}
{{#headerParams}}
headerParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
{{/headerParams}}
String[] contentTypes = {
{{#consumes}}"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}{{/consumes}}
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
{{#formParams}}{{#notFile}}
if ({{paramName}} != null) {
localVarBuilder.addTextBody("{{baseName}}", ApiInvoker.parameterToString({{paramName}}), ApiInvoker.TEXT_PLAIN_UTF8);
}
{{/notFile}}{{#isFile}}
if ({{paramName}} != null) {
localVarBuilder.addBinaryBody("{{baseName}}", {{paramName}});
}
{{/isFile}}{{/formParams}}
{{#formParams}}
{{^isFile}}
if ({{paramName}} != null) {
localVarBuilder.addTextBody("{{baseName}}", ApiInvoker.parameterToString({{paramName}}), ApiInvoker.TEXT_PLAIN_UTF8);
}
{{/isFile}}
{{#isFile}}
if ({{paramName}} != null) {
localVarBuilder.addBinaryBody("{{baseName}}", {{paramName}});
}
{{/isFile}}
{{/formParams}}
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
{{#formParams}}{{#notFile}}formParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));{{/notFile}}
{{/formParams}}
{{#formParams}}
{{^isFile}}
formParams.put("{{baseName}}", ApiInvoker.parameterToString({{paramName}}));
{{/isFile}}
{{/formParams}}
}
String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "{{httpMethod}}", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return {{#returnType}}({{{returnType}}}) ApiInvoker.deserialize(localVarResponse, "{{returnContainer}}", {{returnBaseType}}.class){{/returnType}};
} else {
return {{#returnType}}null{{/returnType}};
}
String[] authNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "{{httpMethod}}", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return {{#returnType}}({{{returnType}}}) ApiInvoker.deserialize(localVarResponse, "{{returnContainer}}", {{returnBaseType}}.class){{/returnType}};
} else {
return {{#returnType}}null{{/returnType}};
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**

View File

@@ -12,18 +12,38 @@ public class ApiException extends Exception {
this.message = message;
}
/**
* Get the HTTP status code.
*
* @return HTTP status code
*/
public int getCode() {
return code;
}
/**
* Set the HTTP status code.
*
* @param code HTTP status code.
*/
public void setCode(int code) {
this.code = code;
}
/**
* Get the error message.
*
* @return Error message.
*/
public String getMessage() {
return message;
}
/**
* Set the error messages.
*
* @param message Error message.
*/
public void setMessage(String message) {
this.message = message;
}

View File

@@ -179,48 +179,48 @@ public class ApiInvoker {
}
public static void initializeInstance() {
initializeInstance(null);
initializeInstance(null);
}
public static void initializeInstance(Cache cache) {
initializeInstance(cache, null, 0, null, 30);
initializeInstance(cache, null, 0, null, 30);
}
public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/android{{/httpUserAgent}}");
INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{artifactVersion}}}/android{{/httpUserAgent}}");
// Setup authentications (key: authentication name, value: authentication).
INSTANCE.authentications = new HashMap<String, Authentication>();
{{#authMethods}}
{{#isApiKey}}
INSTANCE.authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));
{{/isApiKey}}
{{#isBasic}}
INSTANCE.authentications.put("{{name}}", new HttpBasicAuth());
{{/isBasic}}
{{#isOAuth}}
// TODO: comment out below as OAuth does not exist
//INSTANCE.authentications.put("{{name}}", new OAuth());
{{/isOAuth}}
{{/authMethods}}
// Prevent the authentications from being modified.
INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
// Setup authentications (key: authentication name, value: authentication).
INSTANCE.authentications = new HashMap<String, Authentication>();
{{#authMethods}}
{{#isApiKey}}
INSTANCE.authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));
{{/isApiKey}}
{{#isBasic}}
INSTANCE.authentications.put("{{name}}", new HttpBasicAuth());
{{/isBasic}}
{{#isOAuth}}
// TODO: comment out below as OAuth does not exist
//INSTANCE.authentications.put("{{name}}", new OAuth());
{{/isOAuth}}
{{/authMethods}}
// Prevent the authentications from being modified.
INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
private ApiInvoker(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
if(cache == null) cache = new NoCache();
if(network == null) {
HttpStack stack = new HurlStack();
network = new BasicNetwork(stack);
}
if(cache == null) cache = new NoCache();
if(network == null) {
HttpStack stack = new HurlStack();
network = new BasicNetwork(stack);
}
if(delivery == null) {
initConnectionRequest(cache, network);
} else {
initConnectionRequest(cache, network, threadPoolSize, delivery);
}
this.connectionTimeout = connectionTimeout;
if(delivery == null) {
initConnectionRequest(cache, network);
} else {
initConnectionRequest(cache, network, threadPoolSize, delivery);
}
this.connectionTimeout = connectionTimeout;
}
public static ApiInvoker getInstance() {
@@ -273,25 +273,25 @@ public class ApiInvoker {
}
/**
* Get authentications (key: authentication name, value: authentication).
*/
* Get authentications (key: authentication name, value: authentication).
*/
public Map<String, Authentication> getAuthentications() {
return authentications;
}
/**
* Get authentication for the given name.
*
* @param authName The authentication name
* @return The authentication, null if not found
*/
* Get authentication for the given name.
*
* @param authName The authentication name
* @return The authentication, null if not found
*/
public Authentication getAuthentication(String authName) {
return authentications.get(authName);
}
/**
* Helper method to set username for the first HTTP basic authentication.
*/
* Helper method to set username for the first HTTP basic authentication.
*/
public void setUsername(String username) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
@@ -303,21 +303,21 @@ public class ApiInvoker {
}
/**
* Helper method to set password for the first HTTP basic authentication.
*/
* Helper method to set password for the first HTTP basic authentication.
*/
public void setPassword(String password) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
* Helper method to set API key value for the first API key authentication.
*/
* Helper method to set API key value for the first API key authentication.
*/
public void setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -329,8 +329,8 @@ public class ApiInvoker {
}
/**
* Helper method to set API key prefix for the first API key authentication.
*/
* Helper method to set API key prefix for the first API key authentication.
*/
public void setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -342,18 +342,18 @@ public class ApiInvoker {
}
public void setConnectionTimeout(int connectionTimeout){
this.connectionTimeout = connectionTimeout;
this.connectionTimeout = connectionTimeout;
}
public int getConnectionTimeout() {
return connectionTimeout;
return connectionTimeout;
}
/**
* Update query and header parameters based on authentication settings.
*
* @param authNames The authentications to apply
*/
* Update query and header parameters based on authentication settings.
*
* @param authNames The authentications to apply
*/
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
@@ -363,17 +363,21 @@ public class ApiInvoker {
}
public String invokeAPI(String host, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType, String[] authNames) throws ApiException, InterruptedException, ExecutionException, TimeoutException {
RequestFuture<String> future = RequestFuture.newFuture();
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
if(request != null) {
mRequestQueue.add(request);
return future.get(connectionTimeout, TimeUnit.SECONDS);
} else return "no data";
RequestFuture<String> future = RequestFuture.newFuture();
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
if(request != null) {
mRequestQueue.add(request);
return future.get(connectionTimeout, TimeUnit.SECONDS);
} else {
return "no data";
}
}
public void invokeAPI(String host, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType, String[] authNames, Response.Listener<String> stringRequest, Response.ErrorListener errorListener) throws ApiException {
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
if (request != null) mRequestQueue.add(request);
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
if (request != null) {
mRequestQueue.add(request);
}
}
public Request<String> createRequest(String host, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType, String[] authNames, Response.Listener<String> stringRequest, Response.ErrorListener errorListener) throws ApiException {
@@ -503,16 +507,16 @@ public class ApiInvoker {
}
private void initConnectionRequest(Cache cache, Network network) {
mRequestQueue = new RequestQueue(cache, network);
mRequestQueue.start();
mRequestQueue = new RequestQueue(cache, network);
mRequestQueue.start();
}
private void initConnectionRequest(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) {
mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
mRequestQueue.start();
mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
mRequestQueue.start();
}
public void stopQueue() {
mRequestQueue.stop();
mRequestQueue.stop();
}
}

View File

@@ -46,7 +46,7 @@ public class ApiKeyAuth implements Authentication {
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
String value;
if (apiKey == null) {
return;
return;
}
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;

View File

@@ -9,28 +9,28 @@ import java.util.Map;
import java.util.List;
public class HttpBasicAuth implements Authentication {
private String username;
private String password;
private String username;
private String password;
public String getUsername() {
return username;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes(), Base64.DEFAULT));
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes(), Base64.DEFAULT));
}
}

View File

@@ -7,8 +7,8 @@ import java.util.Map;
import java.util.List;
public class OAuth implements Authentication {
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
// TODO stub
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
// TODO stub
}
}

View File

@@ -19,75 +19,75 @@ import java.util.Map;
public class DeleteRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public DeleteRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.DELETE, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public DeleteRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.DELETE, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -19,75 +19,75 @@ import java.util.Map;
public class PatchRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public PatchRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PATCH, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public PatchRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PATCH, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -19,75 +19,75 @@ import java.util.Map;
public class PostRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public PostRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.POST, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public PostRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.POST, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -19,75 +19,75 @@ import java.util.Map;
public class PutRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public PutRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PUT, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public PutRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PUT, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -2,5 +2,5 @@ export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | () => string;
accessToken: string | (() => string);
}

View File

@@ -2,5 +2,5 @@ export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | () => string;
accessToken: string | (() => string);
}

View File

@@ -23,18 +23,38 @@ public class ApiException extends Exception {
this.message = message;
}
/**
* Get the HTTP status code.
*
* @return HTTP status code
*/
public int getCode() {
return code;
}
/**
* Set the HTTP status code.
*
* @param code HTTP status code.
*/
public void setCode(int code) {
this.code = code;
}
/**
* Get the error message.
*
* @return Error message.
*/
public String getMessage() {
return message;
}
/**
* Set the error messages.
*
* @param message Error message.
*/
public void setMessage(String message) {
this.message = message;
}

View File

@@ -190,39 +190,39 @@ public class ApiInvoker {
}
public static void initializeInstance() {
initializeInstance(null);
initializeInstance(null);
}
public static void initializeInstance(Cache cache) {
initializeInstance(cache, null, 0, null, 30);
initializeInstance(cache, null, 0, null, 30);
}
public static void initializeInstance(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
setUserAgent("Swagger-Codegen/1.0.0/android");
INSTANCE = new ApiInvoker(cache, network, threadPoolSize, delivery, connectionTimeout);
setUserAgent("Swagger-Codegen/1.0.0/android");
// Setup authentications (key: authentication name, value: authentication).
INSTANCE.authentications = new HashMap<String, Authentication>();
INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
// TODO: comment out below as OAuth does not exist
//INSTANCE.authentications.put("petstore_auth", new OAuth());
// Prevent the authentications from being modified.
INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
// Setup authentications (key: authentication name, value: authentication).
INSTANCE.authentications = new HashMap<String, Authentication>();
INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
// TODO: comment out below as OAuth does not exist
//INSTANCE.authentications.put("petstore_auth", new OAuth());
// Prevent the authentications from being modified.
INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications);
}
private ApiInvoker(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery, int connectionTimeout) {
if(cache == null) cache = new NoCache();
if(network == null) {
HttpStack stack = new HurlStack();
network = new BasicNetwork(stack);
}
if(cache == null) cache = new NoCache();
if(network == null) {
HttpStack stack = new HurlStack();
network = new BasicNetwork(stack);
}
if(delivery == null) {
initConnectionRequest(cache, network);
} else {
initConnectionRequest(cache, network, threadPoolSize, delivery);
}
this.connectionTimeout = connectionTimeout;
if(delivery == null) {
initConnectionRequest(cache, network);
} else {
initConnectionRequest(cache, network, threadPoolSize, delivery);
}
this.connectionTimeout = connectionTimeout;
}
public static ApiInvoker getInstance() {
@@ -275,25 +275,25 @@ public class ApiInvoker {
}
/**
* Get authentications (key: authentication name, value: authentication).
*/
* Get authentications (key: authentication name, value: authentication).
*/
public Map<String, Authentication> getAuthentications() {
return authentications;
}
/**
* Get authentication for the given name.
*
* @param authName The authentication name
* @return The authentication, null if not found
*/
* Get authentication for the given name.
*
* @param authName The authentication name
* @return The authentication, null if not found
*/
public Authentication getAuthentication(String authName) {
return authentications.get(authName);
}
/**
* Helper method to set username for the first HTTP basic authentication.
*/
* Helper method to set username for the first HTTP basic authentication.
*/
public void setUsername(String username) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
@@ -305,21 +305,21 @@ public class ApiInvoker {
}
/**
* Helper method to set password for the first HTTP basic authentication.
*/
* Helper method to set password for the first HTTP basic authentication.
*/
public void setPassword(String password) {
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
for (Authentication auth : authentications.values()) {
if (auth instanceof HttpBasicAuth) {
((HttpBasicAuth) auth).setPassword(password);
return;
}
}
throw new RuntimeException("No HTTP basic authentication configured!");
}
/**
* Helper method to set API key value for the first API key authentication.
*/
* Helper method to set API key value for the first API key authentication.
*/
public void setApiKey(String apiKey) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -331,8 +331,8 @@ public class ApiInvoker {
}
/**
* Helper method to set API key prefix for the first API key authentication.
*/
* Helper method to set API key prefix for the first API key authentication.
*/
public void setApiKeyPrefix(String apiKeyPrefix) {
for (Authentication auth : authentications.values()) {
if (auth instanceof ApiKeyAuth) {
@@ -344,18 +344,18 @@ public class ApiInvoker {
}
public void setConnectionTimeout(int connectionTimeout){
this.connectionTimeout = connectionTimeout;
this.connectionTimeout = connectionTimeout;
}
public int getConnectionTimeout() {
return connectionTimeout;
return connectionTimeout;
}
/**
* Update query and header parameters based on authentication settings.
*
* @param authNames The authentications to apply
*/
* Update query and header parameters based on authentication settings.
*
* @param authNames The authentications to apply
*/
private void updateParamsForAuth(String[] authNames, List<Pair> queryParams, Map<String, String> headerParams) {
for (String authName : authNames) {
Authentication auth = authentications.get(authName);
@@ -365,17 +365,21 @@ public class ApiInvoker {
}
public String invokeAPI(String host, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType, String[] authNames) throws ApiException, InterruptedException, ExecutionException, TimeoutException {
RequestFuture<String> future = RequestFuture.newFuture();
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
if(request != null) {
mRequestQueue.add(request);
return future.get(connectionTimeout, TimeUnit.SECONDS);
} else return "no data";
RequestFuture<String> future = RequestFuture.newFuture();
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, future, future);
if(request != null) {
mRequestQueue.add(request);
return future.get(connectionTimeout, TimeUnit.SECONDS);
} else {
return "no data";
}
}
public void invokeAPI(String host, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType, String[] authNames, Response.Listener<String> stringRequest, Response.ErrorListener errorListener) throws ApiException {
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
if (request != null) mRequestQueue.add(request);
Request request = createRequest(host, path, method, queryParams, body, headerParams, formParams, contentType, authNames, stringRequest, errorListener);
if (request != null) {
mRequestQueue.add(request);
}
}
public Request<String> createRequest(String host, String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, String> formParams, String contentType, String[] authNames, Response.Listener<String> stringRequest, Response.ErrorListener errorListener) throws ApiException {
@@ -505,16 +509,16 @@ public class ApiInvoker {
}
private void initConnectionRequest(Cache cache, Network network) {
mRequestQueue = new RequestQueue(cache, network);
mRequestQueue.start();
mRequestQueue = new RequestQueue(cache, network);
mRequestQueue.start();
}
private void initConnectionRequest(Cache cache, Network network, int threadPoolSize, ResponseDelivery delivery) {
mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
mRequestQueue.start();
mRequestQueue = new RequestQueue(cache, network, threadPoolSize, delivery);
mRequestQueue.start();
}
public void stopQueue() {
mRequestQueue.stop();
mRequestQueue.stop();
}
}

View File

@@ -13,38 +13,38 @@
package io.swagger.client;
public class Pair {
private String name = "";
private String value = "";
private String name = "";
private String value = "";
public Pair(String name, String value) {
setName(name);
setValue(value);
}
public Pair(String name, String value) {
setName(name);
setValue(value);
}
private void setName(String name) {
if (!isValidString(name)) return;
private void setName(String name) {
if (!isValidString(name)) return;
this.name = name;
}
this.name = name;
}
private void setValue(String value) {
if (!isValidString(value)) return;
private void setValue(String value) {
if (!isValidString(value)) return;
this.value = value;
}
this.value = value;
}
public String getName() {
return this.name;
}
public String getName() {
return this.name;
}
public String getValue() {
return this.value;
}
public String getValue() {
return this.value;
}
private boolean isValidString(String arg) {
if (arg == null) return false;
if (arg.trim().isEmpty()) return false;
private boolean isValidString(String arg) {
if (arg == null) return false;
if (arg.trim().isEmpty()) return false;
return true;
}
return true;
}
}

View File

@@ -63,61 +63,56 @@ public class PetApi {
* @return void
*/
public void addPet (Pet body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = body;
Object postBody = body;
// create path and map variables
String path = "/pet".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/pet".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
"application/json",
"application/xml"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
"application/json","application/xml"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { "petstore_auth" };
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -185,68 +180,60 @@ public class PetApi {
* @return void
*/
public void deletePet (Long petId, String apiKey) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling deletePet",
new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"));
}
new ApiException(400, "Missing the required parameter 'petId' when calling deletePet"));
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
headerParams.put("api_key", ApiInvoker.parameterToString(apiKey));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { "petstore_auth" };
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -320,62 +307,55 @@ public class PetApi {
* @return List<Pet>
*/
public List<Pet> findPetsByStatus (List<String> status) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
Object postBody = null;
// create path and map variables
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/pet/findByStatus".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { "petstore_auth" };
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (List<Pet>) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (List<Pet>) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -447,62 +427,55 @@ public class PetApi {
* @return List<Pet>
*/
public List<Pet> findPetsByTags (List<String> tags) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
Object postBody = null;
// create path and map variables
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/pet/findByTags".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { "petstore_auth" };
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (List<Pet>) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (List<Pet>) ApiInvoker.deserialize(localVarResponse, "array", Pet.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -574,67 +547,59 @@ public class PetApi {
* @return Pet
*/
public Pet getPetById (Long petId) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling getPetById",
new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"));
}
new ApiException(400, "Missing the required parameter 'petId' when calling getPetById"));
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { "api_key", "petstore_auth" };
String[] authNames = new String[] { "api_key", "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (Pet) ApiInvoker.deserialize(localVarResponse, "", Pet.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (Pet) ApiInvoker.deserialize(localVarResponse, "", Pet.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -711,61 +676,56 @@ public class PetApi {
* @return void
*/
public void updatePet (Pet body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = body;
Object postBody = body;
// create path and map variables
String path = "/pet".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/pet".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
"application/json",
"application/xml"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
"application/json","application/xml"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { "petstore_auth" };
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -834,77 +794,68 @@ public class PetApi {
* @return void
*/
public void updatePetWithForm (String petId, String name, String status) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling updatePetWithForm",
new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"));
}
new ApiException(400, "Missing the required parameter 'petId' when calling updatePetWithForm"));
}
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// create path and map variables
String path = "/pet/{petId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
"application/x-www-form-urlencoded"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
"application/x-www-form-urlencoded"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
if (name != null) {
localVarBuilder.addTextBody("name", ApiInvoker.parameterToString(name), ApiInvoker.TEXT_PLAIN_UTF8);
}
if (status != null) {
localVarBuilder.addTextBody("status", ApiInvoker.parameterToString(status), ApiInvoker.TEXT_PLAIN_UTF8);
}
if (name != null) {
localVarBuilder.addTextBody("name", ApiInvoker.parameterToString(name), ApiInvoker.TEXT_PLAIN_UTF8);
}
if (status != null) {
localVarBuilder.addTextBody("status", ApiInvoker.parameterToString(status), ApiInvoker.TEXT_PLAIN_UTF8);
}
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
formParams.put("name", ApiInvoker.parameterToString(name));
formParams.put("status", ApiInvoker.parameterToString(status));
formParams.put("name", ApiInvoker.parameterToString(name));
formParams.put("status", ApiInvoker.parameterToString(status));
}
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -989,77 +940,67 @@ formParams.put("status", ApiInvoker.parameterToString(status));
* @return void
*/
public void uploadFile (Long petId, String additionalMetadata, File file) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
Object postBody = null;
// verify the required parameter 'petId' is set
if (petId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'petId' when calling uploadFile",
new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"));
}
new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile"));
}
// create path and map variables
String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// create path and map variables
String path = "/pet/{petId}/uploadImage".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
"multipart/form-data"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
"multipart/form-data"
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
if (additionalMetadata != null) {
localVarBuilder.addTextBody("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata), ApiInvoker.TEXT_PLAIN_UTF8);
}
if (file != null) {
localVarBuilder.addBinaryBody("file", file);
}
if (additionalMetadata != null) {
localVarBuilder.addTextBody("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata), ApiInvoker.TEXT_PLAIN_UTF8);
}
if (file != null) {
localVarBuilder.addBinaryBody("file", file);
}
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata));
formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata));
}
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
String[] authNames = new String[] { "petstore_auth" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**

View File

@@ -63,67 +63,59 @@ public class StoreApi {
* @return void
*/
public void deleteOrder (String orderId) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling deleteOrder",
new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"));
}
new ApiException(400, "Missing the required parameter 'orderId' when calling deleteOrder"));
}
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -195,61 +187,54 @@ public class StoreApi {
* @return Map<String, Integer>
*/
public Map<String, Integer> getInventory () throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
Object postBody = null;
// create path and map variables
String path = "/store/inventory".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/store/inventory".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { "api_key" };
String[] authNames = new String[] { "api_key" };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (Map<String, Integer>) ApiInvoker.deserialize(localVarResponse, "map", Map.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (Map<String, Integer>) ApiInvoker.deserialize(localVarResponse, "map", Map.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -320,67 +305,59 @@ public class StoreApi {
* @return Order
*/
public Order getOrderById (String orderId) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
Object postBody = null;
// verify the required parameter 'orderId' is set
if (orderId == null) {
VolleyError error = new VolleyError("Missing the required parameter 'orderId' when calling getOrderById",
new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"));
}
new ApiException(400, "Missing the required parameter 'orderId' when calling getOrderById"));
}
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
// create path and map variables
String path = "/store/order/{orderId}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "orderId" + "\\}", apiInvoker.escapeString(orderId.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (Order) ApiInvoker.deserialize(localVarResponse, "", Order.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (Order) ApiInvoker.deserialize(localVarResponse, "", Order.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -457,61 +434,54 @@ public class StoreApi {
* @return Order
*/
public Order placeOrder (Order body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = body;
Object postBody = body;
// create path and map variables
String path = "/store/order".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/store/order".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (Order) ApiInvoker.deserialize(localVarResponse, "", Order.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (Order) ApiInvoker.deserialize(localVarResponse, "", Order.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**

View File

@@ -63,61 +63,54 @@ public class UserApi {
* @return void
*/
public void createUser (User body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = body;
Object postBody = body;
// create path and map variables
String path = "/user".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/user".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -184,61 +177,54 @@ public class UserApi {
* @return void
*/
public void createUsersWithArrayInput (List<User> body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = body;
Object postBody = body;
// create path and map variables
String path = "/user/createWithArray".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/user/createWithArray".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -305,61 +291,54 @@ public class UserApi {
* @return void
*/
public void createUsersWithListInput (List<User> body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = body;
Object postBody = body;
// create path and map variables
String path = "/user/createWithList".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/user/createWithList".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "POST", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -426,67 +405,59 @@ public class UserApi {
* @return void
*/
public void deleteUser (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
VolleyError error = new VolleyError("Missing the required parameter 'username' when calling deleteUser",
new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"));
}
new ApiException(400, "Missing the required parameter 'username' when calling deleteUser"));
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "DELETE", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -559,67 +530,59 @@ public class UserApi {
* @return User
*/
public User getUserByName (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
Object postBody = null;
// verify the required parameter 'username' is set
if (username == null) {
VolleyError error = new VolleyError("Missing the required parameter 'username' when calling getUserByName",
new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"));
}
new ApiException(400, "Missing the required parameter 'username' when calling getUserByName"));
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (User) ApiInvoker.deserialize(localVarResponse, "", User.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (User) ApiInvoker.deserialize(localVarResponse, "", User.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -697,63 +660,56 @@ public class UserApi {
* @return String
*/
public String loginUser (String username, String password) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
Object postBody = null;
// create path and map variables
String path = "/user/login".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/user/login".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
queryParams.addAll(ApiInvoker.parameterToPairs("", "username", username));
queryParams.addAll(ApiInvoker.parameterToPairs("", "password", password));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
queryParams.addAll(ApiInvoker.parameterToPairs("", "username", username));
queryParams.addAll(ApiInvoker.parameterToPairs("", "password", password));
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return (String) ApiInvoker.deserialize(localVarResponse, "", String.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return (String) ApiInvoker.deserialize(localVarResponse, "", String.class);
} else {
return null;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -825,61 +781,54 @@ public class UserApi {
* @return void
*/
public void logoutUser () throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = null;
Object postBody = null;
// create path and map variables
String path = "/user/logout".replaceAll("\\{format\\}","json");
// create path and map variables
String path = "/user/logout".replaceAll("\\{format\\}","json");
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**
@@ -947,67 +896,59 @@ public class UserApi {
* @return void
*/
public void updateUser (String username, User body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
Object postBody = body;
// verify the required parameter 'username' is set
if (username == null) {
Object postBody = body;
// verify the required parameter 'username' is set
if (username == null) {
VolleyError error = new VolleyError("Missing the required parameter 'username' when calling updateUser",
new ApiException(400, "Missing the required parameter 'username' when calling updateUser"));
}
new ApiException(400, "Missing the required parameter 'username' when calling updateUser"));
}
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// create path and map variables
String path = "/user/{username}".replaceAll("\\{format\\}","json").replaceAll("\\{" + "username" + "\\}", apiInvoker.escapeString(username.toString()));
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
// query params
List<Pair> queryParams = new ArrayList<Pair>();
// header params
Map<String, String> headerParams = new HashMap<String, String>();
// form params
Map<String, String> formParams = new HashMap<String, String>();
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
String[] contentTypes = {
};
String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";
if (contentType.startsWith("multipart/form-data")) {
if (contentType.startsWith("multipart/form-data")) {
// file uploading
MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();
HttpEntity httpEntity = localVarBuilder.build();
postBody = httpEntity;
} else {
} else {
// normal form params
}
}
String[] authNames = new String[] { };
String[] authNames = new String[] { };
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames);
if(localVarResponse != null){
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if(ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
try {
String localVarResponse = apiInvoker.invokeAPI (basePath, path, "PUT", queryParams, postBody, headerParams, formParams, contentType, authNames);
if (localVarResponse != null) {
return ;
} else {
return ;
}
} catch (ApiException ex) {
throw ex;
} catch (InterruptedException ex) {
throw ex;
} catch (ExecutionException ex) {
if (ex.getCause() instanceof VolleyError) {
VolleyError volleyError = (VolleyError)ex.getCause();
if (volleyError.networkResponse != null) {
throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());
}
}
throw ex;
} catch (TimeoutException ex) {
throw ex;
}
}
/**

View File

@@ -57,7 +57,7 @@ public class ApiKeyAuth implements Authentication {
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
String value;
if (apiKey == null) {
return;
return;
}
if (apiKeyPrefix != null) {
value = apiKeyPrefix + " " + apiKey;

View File

@@ -20,28 +20,28 @@ import java.util.Map;
import java.util.List;
public class HttpBasicAuth implements Authentication {
private String username;
private String password;
private String username;
private String password;
public String getUsername() {
return username;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes(), Base64.DEFAULT));
}
@Override
public void applyToParams(List<Pair> queryParams, Map<String, String> headerParams) {
String str = (username == null ? "" : username) + ":" + (password == null ? "" : password);
headerParams.put("Authorization", "Basic " + Base64.encodeToString(str.getBytes(), Base64.DEFAULT));
}
}

View File

@@ -30,75 +30,75 @@ import java.util.Map;
public class DeleteRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public DeleteRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.DELETE, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public DeleteRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.DELETE, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -30,75 +30,75 @@ import java.util.Map;
public class PatchRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public PatchRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PATCH, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public PatchRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PATCH, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -30,75 +30,75 @@ import java.util.Map;
public class PostRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public PostRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.POST, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public PostRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.POST, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -30,75 +30,75 @@ import java.util.Map;
public class PutRequest extends Request<String> {
HttpEntity entity;
HttpEntity entity;
private final Response.Listener<String> mListener;
private final Response.Listener<String> mListener;
String contentType;
Map<String, String> apiHeaders;
public PutRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PUT, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
String contentType;
Map<String, String> apiHeaders;
public PutRequest(String url, Map<String, String> apiHeaders, String contentType, HttpEntity entity, Response.Listener<String> listener, Response.ErrorListener errorListener) {
super(Method.PUT, url, errorListener);
mListener = listener;
this.entity = entity;
this.contentType = contentType;
this.apiHeaders = apiHeaders;
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
@Override
public String getBodyContentType() {
if(entity == null) {
return null;
}
return entity.getContentType().getValue();
}
@Override
public byte[] getBody() throws AuthFailureError {
if(entity == null) {
return null;
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
try {
entity.writeTo(bos);
}
catch (IOException e) {
VolleyLog.e("IOException writing to ByteArrayOutputStream");
}
return bos.toByteArray();
}
@Override
protected Response<String> parseNetworkResponse(NetworkResponse response) {
String parsed;
try {
parsed = new String(response.data, HttpHeaderParser.parseCharset(response.headers));
} catch (UnsupportedEncodingException e) {
parsed = new String(response.data);
}
return Response.success(parsed, HttpHeaderParser.parseCacheHeaders(response));
}
@Override
protected void deliverResponse(String response) {
mListener.onResponse(response);
}
/* (non-Javadoc)
* @see com.android.volley.Request#getHeaders()
*/
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
Map<String, String> headers = super.getHeaders();
if (headers == null || headers.equals(Collections.emptyMap())) {
headers = new HashMap<String, String>();
}
if (apiHeaders != null && !apiHeaders.equals(Collections.emptyMap())) {
headers.putAll(apiHeaders);
}
if(contentType != null) {
headers.put("Content-Type", contentType);
}
return headers;
}
return headers;
}
}

View File

@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -1,10 +1,132 @@
# Csharp-DotNet2
# IO.Swagger - the C# library for the Swagger Petstore
This generator creates C# code targeting the .Net 2.0 framework. The resulting DLLs can be used in places where .Net 2.0 is the maximum supported version, such as in the Unity3d.
This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.
This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
- API version: 1.0.0
- SDK version: 1.0.0
- Build date: 2016-12-09T16:46:08.135+08:00
- Build package: class io.swagger.codegen.languages.CsharpDotNet2ClientCodegen
<a name="frameworks-supported"></a>
## Frameworks supported
- .NET 2.0
<a name="dependencies"></a>
## Dependencies
- Mono compiler
- Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator.
- Newtonsoft.Json.7.0.1
- RestSharp.Net2.1.1.11
Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator
<a name="installation"></a>
## Installation
Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh compile-mono.sh`
- [Windows] TODO
Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using IO.Swagger.IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.IO.Swagger.Model;
```
<a name="getting-started"></a>
## Getting Started
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class Example
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Add a new pet to the store
apiInstance.AddPet(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
}
}
}
}
```
<a name="documentation-for-api-endpoints"></a>
## Documentation for API Endpoints
All URIs are relative to *http://petstore.swagger.io/v2*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
*PetApi* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
*PetApi* | [**FindPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
*PetApi* | [**GetPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
*PetApi* | [**UpdatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
*PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
*PetApi* | [**UploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
*StoreApi* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
*StoreApi* | [**GetOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
*StoreApi* | [**PlaceOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
*UserApi* | [**CreateUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="documentation-for-models"></a>
## Documentation for Models
- [IO.Swagger.Model.ApiResponse](docs/ApiResponse.md)
- [IO.Swagger.Model.Category](docs/Category.md)
- [IO.Swagger.Model.Order](docs/Order.md)
- [IO.Swagger.Model.Pet](docs/Pet.md)
- [IO.Swagger.Model.Tag](docs/Tag.md)
- [IO.Swagger.Model.User](docs/User.md)
<a name="documentation-for-authorization"></a>
## Documentation for Authorization
<a name="api_key"></a>
### api_key
- **Type**: API key
- **API key parameter name**: api_key
- **Location**: HTTP header
<a name="petstore_auth"></a>
### petstore_auth
- **Type**: OAuth
- **Flow**: implicit
- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog
- **Scopes**:
- write:pets: modify pets in your account
- read:pets: read your pets

View File

@@ -0,0 +1,11 @@
# IO.Swagger.Model.ApiResponse
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **int?** | | [optional] [default to null]
**Type** | **string** | | [optional] [default to null]
**Message** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# IO.Swagger.Model.Category
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional] [default to null]
**Name** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,14 @@
# IO.Swagger.Model.Order
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional] [default to null]
**PetId** | **long?** | | [optional] [default to null]
**Quantity** | **int?** | | [optional] [default to null]
**ShipDate** | **DateTime?** | | [optional] [default to null]
**Status** | **string** | Order Status | [optional] [default to null]
**Complete** | **bool?** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,14 @@
# IO.Swagger.Model.Pet
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional] [default to null]
**Category** | [**Category**](Category.md) | | [optional] [default to null]
**Name** | **string** | | [default to null]
**PhotoUrls** | **List&lt;string&gt;** | | [default to null]
**Tags** | [**List&lt;Tag&gt;**](Tag.md) | | [optional] [default to null]
**Status** | **string** | pet status in the store | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,544 @@
# IO.Swagger..PetApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**AddPet**](PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
[**DeletePet**](PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
[**FindPetsByStatus**](PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
[**FindPetsByTags**](PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
[**GetPetById**](PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
[**UpdatePet**](PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
[**UpdatePetWithForm**](PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
[**UploadFile**](PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
<a name="addpet"></a>
# **AddPet**
> void AddPet (Pet body)
Add a new pet to the store
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class AddPetExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Add a new pet to the store
apiInstance.AddPet(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deletepet"></a>
# **DeletePet**
> void DeletePet (long? petId, string apiKey)
Deletes a pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class DeletePetExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var petId = 789; // long? | Pet id to delete
var apiKey = apiKey_example; // string | (optional)
try
{
// Deletes a pet
apiInstance.DeletePet(petId, apiKey);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| Pet id to delete |
**apiKey** | **string**| | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbystatus"></a>
# **FindPetsByStatus**
> List<Pet> FindPetsByStatus (List<string> status)
Finds Pets by status
Multiple status values can be provided with comma separated strings
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FindPetsByStatusExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var status = new List<string>(); // List<string> | Status values that need to be considered for filter
try
{
// Finds Pets by status
List&lt;Pet&gt; result = apiInstance.FindPetsByStatus(status);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**status** | [**List<string>**](string.md)| Status values that need to be considered for filter |
### Return type
[**List<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="findpetsbytags"></a>
# **FindPetsByTags**
> List<Pet> FindPetsByTags (List<string> tags)
Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class FindPetsByTagsExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var tags = new List<string>(); // List<string> | Tags to filter by
try
{
// Finds Pets by tags
List&lt;Pet&gt; result = apiInstance.FindPetsByTags(tags);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**tags** | [**List<string>**](string.md)| Tags to filter by |
### Return type
[**List<Pet>**](Pet.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getpetbyid"></a>
# **GetPetById**
> Pet GetPetById (long? petId)
Find pet by ID
Returns a single pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetPetByIdExample
{
public void main()
{
// Configure API key authorization: api_key
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
var apiInstance = new PetApi();
var petId = 789; // long? | ID of pet to return
try
{
// Find pet by ID
Pet result = apiInstance.GetPetById(petId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet to return |
### Return type
[**Pet**](Pet.md)
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepet"></a>
# **UpdatePet**
> void UpdatePet (Pet body)
Update an existing pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UpdatePetExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var body = new Pet(); // Pet | Pet object that needs to be added to the store
try
{
// Update an existing pet
apiInstance.UpdatePet(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/json, application/xml
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updatepetwithform"></a>
# **UpdatePetWithForm**
> void UpdatePetWithForm (long? petId, string name, string status)
Updates a pet in the store with form data
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UpdatePetWithFormExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
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)
try
{
// Updates a pet in the store with form data
apiInstance.UpdatePetWithForm(petId, name, status);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet that needs to be updated |
**name** | **string**| Updated name of the pet | [optional]
**status** | **string**| Updated status of the pet | [optional]
### Return type
void (empty response body)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: application/x-www-form-urlencoded
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="uploadfile"></a>
# **UploadFile**
> ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file)
uploads an image
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UploadFileExample
{
public void main()
{
// Configure OAuth2 access token for authorization: petstore_auth
Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN";
var apiInstance = new PetApi();
var petId = 789; // long? | ID of pet to update
var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional)
var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional)
try
{
// uploads an image
ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**petId** | **long?**| ID of pet to update |
**additionalMetadata** | **string**| Additional data to pass to server | [optional]
**file** | **System.IO.Stream**| file to upload | [optional]
### Return type
[**ApiResponse**](ApiResponse.md)
### Authorization
[petstore_auth](../README.md#petstore_auth)
### HTTP request headers
- **Content-Type**: multipart/form-data
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,260 @@
# IO.Swagger..StoreApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**DeleteOrder**](StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
[**GetOrderById**](StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
[**PlaceOrder**](StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
<a name="deleteorder"></a>
# **DeleteOrder**
> void DeleteOrder (string orderId)
Delete purchase order by ID
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class DeleteOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = orderId_example; // string | ID of the order that needs to be deleted
try
{
// Delete purchase order by ID
apiInstance.DeleteOrder(orderId);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **string**| ID of the order that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getinventory"></a>
# **GetInventory**
> Dictionary<String, int?> GetInventory ()
Returns pet inventories by status
Returns a map of status codes to quantities
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetInventoryExample
{
public void main()
{
// Configure API key authorization: api_key
Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer");
var apiInstance = new StoreApi();
try
{
// Returns pet inventories by status
Dictionary&lt;String, int?&gt; result = apiInstance.GetInventory();
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
**Dictionary<String, int?>**
### Authorization
[api_key](../README.md#api_key)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getorderbyid"></a>
# **GetOrderById**
> Order GetOrderById (long? orderId)
Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetOrderByIdExample
{
public void main()
{
var apiInstance = new StoreApi();
var orderId = 789; // long? | ID of pet that needs to be fetched
try
{
// Find purchase order by ID
Order result = apiInstance.GetOrderById(orderId);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**orderId** | **long?**| ID of pet that needs to be fetched |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="placeorder"></a>
# **PlaceOrder**
> Order PlaceOrder (Order body)
Place an order for a pet
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class PlaceOrderExample
{
public void main()
{
var apiInstance = new StoreApi();
var body = new Order(); // Order | order placed for purchasing the pet
try
{
// Place an order for a pet
Order result = apiInstance.PlaceOrder(body);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Order**](Order.md)| order placed for purchasing the pet |
### Return type
[**Order**](Order.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -0,0 +1,10 @@
# IO.Swagger.Model.Tag
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional] [default to null]
**Name** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,16 @@
# IO.Swagger.Model.User
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Id** | **long?** | | [optional] [default to null]
**Username** | **string** | | [optional] [default to null]
**FirstName** | **string** | | [optional] [default to null]
**LastName** | **string** | | [optional] [default to null]
**Email** | **string** | | [optional] [default to null]
**Password** | **string** | | [optional] [default to null]
**Phone** | **string** | | [optional] [default to null]
**UserStatus** | **int?** | User Status | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,506 @@
# IO.Swagger..UserApi
All URIs are relative to *http://petstore.swagger.io/v2*
Method | HTTP request | Description
------------- | ------------- | -------------
[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user
[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system
[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user
<a name="createuser"></a>
# **CreateUser**
> void CreateUser (User body)
Create user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class CreateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new User(); // User | Created user object
try
{
// Create user
apiInstance.CreateUser(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**User**](User.md)| Created user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswitharrayinput"></a>
# **CreateUsersWithArrayInput**
> void CreateUsersWithArrayInput (List<User> body)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class CreateUsersWithArrayInputExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithArrayInput(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List<User>**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="createuserswithlistinput"></a>
# **CreateUsersWithListInput**
> void CreateUsersWithListInput (List<User> body)
Creates list of users with given input array
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class CreateUsersWithListInputExample
{
public void main()
{
var apiInstance = new UserApi();
var body = new List<User>(); // List<User> | List of user object
try
{
// Creates list of users with given input array
apiInstance.CreateUsersWithListInput(body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**List<User>**](User.md)| List of user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="deleteuser"></a>
# **DeleteUser**
> void DeleteUser (string username)
Delete user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class DeleteUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be deleted
try
{
// Delete user
apiInstance.DeleteUser(username);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be deleted |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="getuserbyname"></a>
# **GetUserByName**
> User GetUserByName (string username)
Get user by user name
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class GetUserByNameExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The name that needs to be fetched. Use user1 for testing.
try
{
// Get user by user name
User result = apiInstance.GetUserByName(username);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
### Return type
[**User**](User.md)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="loginuser"></a>
# **LoginUser**
> string LoginUser (string username, string password)
Logs user into the system
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class LoginUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | The user name for login
var password = password_example; // string | The password for login in clear text
try
{
// Logs user into the system
string result = apiInstance.LoginUser(username, password);
Debug.WriteLine(result);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| The user name for login |
**password** | **string**| The password for login in clear text |
### Return type
**string**
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="logoutuser"></a>
# **LogoutUser**
> void LogoutUser ()
Logs out current logged in user session
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class LogoutUserExample
{
public void main()
{
var apiInstance = new UserApi();
try
{
// Logs out current logged in user session
apiInstance.LogoutUser();
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message );
}
}
}
}
```
### Parameters
This endpoint does not need any parameter.
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
<a name="updateuser"></a>
# **UpdateUser**
> void UpdateUser (string username, User body)
Updated user
This can only be done by the logged in user.
### Example
```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace Example
{
public class UpdateUserExample
{
public void main()
{
var apiInstance = new UserApi();
var username = username_example; // string | name that need to be deleted
var body = new User(); // User | Updated user object
try
{
// Updated user
apiInstance.UpdateUser(username, body);
}
catch (Exception e)
{
Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message );
}
}
}
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**username** | **string**| name that need to be deleted |
**body** | [**User**](User.md)| Updated user object |
### Return type
void (empty response body)
### Authorization
No authorization required
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/xml, application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

View File

@@ -257,13 +257,13 @@ namespace IO.Swagger.Client
// determine which one to use
switch(auth)
{
case "petstore_auth":
//TODO support oauth
break;
case "api_key":
headerParams["api_key"] = GetApiKeyWithPrefix("api_key");
break;
case "petstore_auth":
//TODO support oauth
break;
default:
//TODO show warning about security definition not found

View File

@@ -8,7 +8,7 @@ using Newtonsoft.Json;
namespace IO.Swagger.Model {
/// <summary>
///
/// Describes the result of uploading an image resource
/// </summary>
[DataContract]
public class ApiResponse {

View File

@@ -8,7 +8,7 @@ using Newtonsoft.Json;
namespace IO.Swagger.Model {
/// <summary>
///
/// A category for a pet
/// </summary>
[DataContract]
public class Category {

View File

@@ -8,7 +8,7 @@ using Newtonsoft.Json;
namespace IO.Swagger.Model {
/// <summary>
///
/// An order for a pets from the pet store
/// </summary>
[DataContract]
public class Order {

View File

@@ -8,7 +8,7 @@ using Newtonsoft.Json;
namespace IO.Swagger.Model {
/// <summary>
///
/// A pet for sale in the pet store
/// </summary>
[DataContract]
public class Pet {

View File

@@ -8,7 +8,7 @@ using Newtonsoft.Json;
namespace IO.Swagger.Model {
/// <summary>
///
/// A tag for a pet
/// </summary>
[DataContract]
public class Tag {

View File

@@ -8,7 +8,7 @@ using Newtonsoft.Json;
namespace IO.Swagger.Model {
/// <summary>
///
/// A User who is purchasing from the pet store
/// </summary>
[DataContract]
public class User {

View File

@@ -2,5 +2,5 @@ export class Configuration {
apiKey: string;
username: string;
password: string;
accessToken: string | () => string;
accessToken: string | (() => string);
}

View File

@@ -1,8 +1,8 @@
package io.swagger.api;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.model.Pet;
import java.io.InputStream;
import java.io.OutputStream;
@@ -18,8 +18,6 @@ import io.swagger.annotations.ApiOperation;
@Path("/")
@Api(value = "/", description = "")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface PetApi {
@POST
@@ -27,51 +25,51 @@ public interface PetApi {
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Add a new pet to the store", tags={ "pet", })
public void addPet(Pet body);
public void addPet(Pet body);
@DELETE
@Path("/pet/{petId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Deletes a pet", tags={ "pet", })
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
public void deletePet(@PathParam("petId") Long petId, @HeaderParam("api_key") String apiKey);
@GET
@Path("/pet/findByStatus")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by status", tags={ "pet", })
public Pet findPetsByStatus(@QueryParam("status")List<String> status);
public List<Pet> findPetsByStatus(@QueryParam("status")List<String> status);
@GET
@Path("/pet/findByTags")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Finds Pets by tags", tags={ "pet", })
public Pet findPetsByTags(@QueryParam("tags")List<String> tags);
public List<Pet> findPetsByTags(@QueryParam("tags")List<String> tags);
@GET
@Path("/pet/{petId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find pet by ID", tags={ "pet", })
public Pet getPetById(@PathParam("petId") Long petId);
public Pet getPetById(@PathParam("petId") Long petId);
@PUT
@Path("/pet")
@Consumes({ "application/json", "application/xml" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Update an existing pet", tags={ "pet", })
public void updatePet(Pet body);
public void updatePet(Pet body);
@POST
@Path("/pet/{petId}")
@Consumes({ "application/x-www-form-urlencoded" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Updates a pet in the store with form data", tags={ "pet", })
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
public void updatePetWithForm(@PathParam("petId") Long petId, @Multipart(value = "name", required = false) String name, @Multipart(value = "status", required = false) String status);
@POST
@Path("/pet/{petId}/uploadImage")
@Consumes({ "multipart/form-data" })
@Produces({ "application/json" })
@ApiOperation(value = "uploads an image", tags={ "pet" })
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
public ModelApiResponse uploadFile(@PathParam("petId") Long petId, @Multipart(value = "additionalMetadata", required = false) String additionalMetadata, @Multipart(value = "file" , required = false) Attachment fileDetail);
}

View File

@@ -17,32 +17,30 @@ import io.swagger.annotations.ApiOperation;
@Path("/")
@Api(value = "/", description = "")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface StoreApi {
@DELETE
@Path("/store/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Delete purchase order by ID", tags={ "store", })
public void deleteOrder(@PathParam("orderId") String orderId);
public void deleteOrder(@PathParam("orderId") String orderId);
@GET
@Path("/store/inventory")
@Produces({ "application/json" })
@ApiOperation(value = "Returns pet inventories by status", tags={ "store", })
public Integer getInventory();
public Map<String, Integer> getInventory();
@GET
@Path("/store/order/{orderId}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Find purchase order by ID", tags={ "store", })
public Order getOrderById(@PathParam("orderId") Long orderId);
public Order getOrderById(@PathParam("orderId") Long orderId);
@POST
@Path("/store/order")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Place an order for a pet", tags={ "store" })
public Order placeOrder(Order body);
public Order placeOrder(Order body);
}

View File

@@ -1,7 +1,7 @@
package io.swagger.api;
import io.swagger.model.User;
import java.util.List;
import io.swagger.model.User;
import java.io.InputStream;
import java.io.OutputStream;
@@ -17,56 +17,54 @@ import io.swagger.annotations.ApiOperation;
@Path("/")
@Api(value = "/", description = "")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface UserApi {
@POST
@Path("/user")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Create user", tags={ "user", })
public void createUser(User body);
public void createUser(User body);
@POST
@Path("/user/createWithArray")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
public void createUsersWithArrayInput(List<User> body);
public void createUsersWithArrayInput(List<User> body);
@POST
@Path("/user/createWithList")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Creates list of users with given input array", tags={ "user", })
public void createUsersWithListInput(List<User> body);
public void createUsersWithListInput(List<User> body);
@DELETE
@Path("/user/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Delete user", tags={ "user", })
public void deleteUser(@PathParam("username") String username);
public void deleteUser(@PathParam("username") String username);
@GET
@Path("/user/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get user by user name", tags={ "user", })
public User getUserByName(@PathParam("username") String username);
public User getUserByName(@PathParam("username") String username);
@GET
@Path("/user/login")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Logs user into the system", tags={ "user", })
public String loginUser(@QueryParam("username")String username, @QueryParam("password")String password);
public String loginUser(@QueryParam("username")String username, @QueryParam("password")String password);
@GET
@Path("/user/logout")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Logs out current logged in user session", tags={ "user", })
public void logoutUser();
public void logoutUser();
@PUT
@Path("/user/{username}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Updated user", tags={ "user" })
public void updateUser(@PathParam("username") String username, User body);
public void updateUser(@PathParam("username") String username, User body);
}

View File

@@ -1,9 +1,9 @@
package io.swagger.api.impl;
import io.swagger.api.*;
import io.swagger.model.Pet;
import io.swagger.model.ModelApiResponse;
import java.io.File;
import io.swagger.model.ModelApiResponse;
import io.swagger.model.Pet;
import java.io.InputStream;
import java.io.OutputStream;
@@ -19,49 +19,49 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
import io.swagger.annotations.Api;
public class PetApiServiceImpl implements PetApi {
public void addPet(Pet body) {
public void addPet(Pet body) {
// TODO: Implement...
}
public void deletePet(Long petId, String apiKey) {
public void deletePet(Long petId, String apiKey) {
// TODO: Implement...
}
public Pet findPetsByStatus(List<String> status) {
public List<Pet> findPetsByStatus(List<String> status) {
// TODO: Implement...
return null;
}
public Pet findPetsByTags(List<String> tags) {
public List<Pet> findPetsByTags(List<String> tags) {
// TODO: Implement...
return null;
}
public Pet getPetById(Long petId) {
public Pet getPetById(Long petId) {
// TODO: Implement...
return null;
}
public void updatePet(Pet body) {
public void updatePet(Pet body) {
// TODO: Implement...
}
public void updatePetWithForm(Long petId, String name, String status) {
public void updatePetWithForm(Long petId, String name, String status) {
// TODO: Implement...
}
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Attachment fileDetail) {
public ModelApiResponse uploadFile(Long petId, String additionalMetadata, Attachment fileDetail) {
// TODO: Implement...
return null;

View File

@@ -18,25 +18,25 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
import io.swagger.annotations.Api;
public class StoreApiServiceImpl implements StoreApi {
public void deleteOrder(String orderId) {
public void deleteOrder(String orderId) {
// TODO: Implement...
}
public Integer getInventory() {
public Map<String, Integer> getInventory() {
// TODO: Implement...
return null;
}
public Order getOrderById(Long orderId) {
public Order getOrderById(Long orderId) {
// TODO: Implement...
return null;
}
public Order placeOrder(Order body) {
public Order placeOrder(Order body) {
// TODO: Implement...
return null;

View File

@@ -1,8 +1,8 @@
package io.swagger.api.impl;
import io.swagger.api.*;
import io.swagger.model.User;
import java.util.List;
import io.swagger.model.User;
import java.io.InputStream;
import java.io.OutputStream;
@@ -18,49 +18,49 @@ import org.apache.cxf.jaxrs.ext.multipart.*;
import io.swagger.annotations.Api;
public class UserApiServiceImpl implements UserApi {
public void createUser(User body) {
public void createUser(User body) {
// TODO: Implement...
}
public void createUsersWithArrayInput(List<User> body) {
public void createUsersWithArrayInput(List<User> body) {
// TODO: Implement...
}
public void createUsersWithListInput(List<User> body) {
public void createUsersWithListInput(List<User> body) {
// TODO: Implement...
}
public void deleteUser(String username) {
public void deleteUser(String username) {
// TODO: Implement...
}
public User getUserByName(String username) {
public User getUserByName(String username) {
// TODO: Implement...
return null;
}
public String loginUser(String username, String password) {
public String loginUser(String username, String password) {
// TODO: Implement...
return null;
}
public void logoutUser() {
public void logoutUser() {
// TODO: Implement...
}
public void updateUser(String username, User body) {
public void updateUser(String username, User body) {
// TODO: Implement...