Merge remote-tracking branch 'origin/master' into ruby-nested-model-ref

Conflicts:
	samples/client/petstore/ruby/lib/petstore/api/pet_api.rb
	samples/client/petstore/ruby/lib/petstore/api/store_api.rb
	samples/client/petstore/ruby/lib/petstore/configuration.rb
This commit is contained in:
xhh 2016-02-18 21:13:37 +08:00
commit 71a133dafe
82 changed files with 1289 additions and 731 deletions

View File

@ -119,6 +119,8 @@ public interface CodegenConfig {
void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations);
Map<String, Object> postProcessAllModels(Map<String, Object> objs);
Map<String, Object> postProcessModels(Map<String, Object> objs);
Map<String, Object> postProcessOperations(Map<String, Object> objs);

View File

@ -77,6 +77,9 @@ public class CodegenConstants {
public static final String MODEL_PROPERTY_NAMING = "modelPropertyNaming";
public static final String MODEL_PROPERTY_NAMING_DESC = "Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name";
public static final String DOTNET_FRAMEWORK = "targetFramework";
public static final String DOTNET_FRAMEWORK_DESC = "The target .NET framework version.";
public static enum MODEL_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original}
}

View File

@ -109,12 +109,19 @@ public class DefaultCodegen {
}
}
// override with any special post-processing for all models
@SuppressWarnings("static-method")
public Map<String, Object> postProcessAllModels(Map<String, Object> objs) {
return objs;
}
// override with any special post-processing
@SuppressWarnings("static-method")
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
return objs;
}
// override with any special post-processing
@SuppressWarnings("static-method")
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {

View File

@ -183,6 +183,10 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
sortedModelKeys = updatedKeys;
}
// store all processed models
Map<String,Object> allProcessedModels = new HashMap<String, Object>();
// process models only
for (String name : sortedModelKeys) {
try {
//don't generate models that have an import mapping
@ -196,6 +200,26 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
Map<String, Object> models = processModels(config, modelMap, definitions);
models.putAll(config.additionalProperties());
allProcessedModels.put(name, models);
} catch (Exception e) {
throw new RuntimeException("Could not process model '" + name + "'", e);
}
}
// post process all processed models
allProcessedModels = config.postProcessAllModels(allProcessedModels);
// generate files based on processed models
for (String name: allProcessedModels.keySet()) {
Map<String, Object> models = (Map<String, Object>)allProcessedModels.get(name);
try {
//don't generate models that have an import mapping
if(config.importMapping().containsKey(name)) {
continue;
}
allModels.add(((List<Object>) models.get("models")).get(0));
for (String templateName : config.modelTemplateFiles().keySet()) {

View File

@ -1,5 +1,7 @@
package io.swagger.codegen.languages;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableMap;
import io.swagger.codegen.CodegenConfig;
import io.swagger.codegen.CodegenConstants;
import io.swagger.codegen.CodegenType;
@ -25,6 +27,8 @@ import org.slf4j.LoggerFactory;
public class CSharpClientCodegen extends AbstractCSharpCodegen {
@SuppressWarnings({"unused", "hiding"})
private static final Logger LOGGER = LoggerFactory.getLogger(CSharpClientCodegen.class);
private static final String NET45 = "v4.5";
private static final String NET35 = "v3.5";
protected String packageGuid = "{" + java.util.UUID.randomUUID().toString().toUpperCase() + "}";
protected String packageTitle = "Swagger Library";
@ -34,6 +38,13 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
protected String packageCopyright = "No Copyright";
protected String clientPackage = "IO.Swagger.Client";
protected String targetFramework = NET45;
protected String targetFrameworkNuget = "net45";
protected boolean supportsAsync = Boolean.TRUE;
protected final Map<String, String> frameworks;
public CSharpClientCodegen() {
super();
modelTemplateFiles.put("model.mustache", ".cs");
@ -64,6 +75,18 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
CodegenConstants.OPTIONAL_PROJECT_GUID_DESC,
null);
CliOption framework = new CliOption(
CodegenConstants.DOTNET_FRAMEWORK,
CodegenConstants.DOTNET_FRAMEWORK_DESC
);
frameworks = new ImmutableMap.Builder<String, String>()
.put(NET35, ".NET Framework 3.5 compatible")
.put(NET45, ".NET Framework 4.5+ compatible")
.build();
framework.defaultValue(this.targetFramework);
framework.setEnum(frameworks);
cliOptions.add(framework);
// CLI Switches
addSwitch(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG,
CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC,
@ -111,6 +134,24 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
additionalProperties.put("packageCompany", packageCompany);
additionalProperties.put("packageCopyright", packageCopyright);
if (additionalProperties.containsKey(CodegenConstants.DOTNET_FRAMEWORK)) {
setTargetFramework((String) additionalProperties.get(CodegenConstants.DOTNET_FRAMEWORK));
}
if (NET35.equals(this.targetFramework)) {
setTargetFrameworkNuget("net35");
setSupportsAsync(Boolean.FALSE);
if(additionalProperties.containsKey("supportsAsync")){
additionalProperties.remove("supportsAsync");
}
} else {
setTargetFrameworkNuget("net45");
setSupportsAsync(Boolean.TRUE);
additionalProperties.put("supportsAsync", this.supportsAsync);
}
additionalProperties.put("targetFrameworkNuget", this.targetFrameworkNuget);
if (additionalProperties.containsKey(CodegenConstants.OPTIONAL_PROJECT_FILE)) {
setOptionalProjectFileFlag(Boolean.valueOf(
additionalProperties.get(CodegenConstants.OPTIONAL_PROJECT_FILE).toString()));
@ -141,7 +182,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
String binRelativePath = "..\\";
for (int i = 0; i < packageDepth; i = i + 1)
binRelativePath += "..\\";
binRelativePath += "bin\\";
binRelativePath += "vendor\\";
additionalProperties.put("binRelativePath", binRelativePath);
supportingFiles.add(new SupportingFile("Configuration.mustache",
@ -153,8 +194,6 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
supportingFiles.add(new SupportingFile("ApiResponse.mustache",
clientPackageDir, "ApiResponse.cs"));
supportingFiles.add(new SupportingFile("Newtonsoft.Json.dll", "bin", "Newtonsoft.Json.dll"));
supportingFiles.add(new SupportingFile("RestSharp.dll", "bin", "RestSharp.dll"));
supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat"));
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor" + java.io.File.separator, "packages.config"));
@ -222,4 +261,20 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
this.packageGuid = packageGuid;
}
public void setTargetFramework(String dotnetFramework) {
if(!frameworks.containsKey(dotnetFramework)){
LOGGER.warn("Invalid .NET framework version, defaulting to " + this.targetFramework);
} else {
this.targetFramework = dotnetFramework;
}
LOGGER.info("Generating code for .NET Framework " + this.targetFramework);
}
public void setTargetFrameworkNuget(String targetFrameworkNuget) {
this.targetFrameworkNuget = targetFrameworkNuget;
}
public void setSupportsAsync(Boolean supportsAsync){
this.supportsAsync = supportsAsync;
}
}

View File

@ -9,6 +9,7 @@ import io.swagger.models.Swagger;
import io.swagger.models.parameters.FormParameter;
import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.*;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -531,7 +532,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
}
}
if(model.isEnum == null || model.isEnum) {
if(!BooleanUtils.toBoolean(model.isEnum)) {
// needed by all pojos, but not enums
model.imports.add("ApiModelProperty");
model.imports.add("ApiModel");
@ -542,7 +543,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
if(StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) {
model.imports.add("JsonProperty");
if(model.hasEnums != null || model.hasEnums == true) {
if(BooleanUtils.toBoolean(model.hasEnums)) {
model.imports.add("JsonValue");
}
}

View File

@ -47,16 +47,17 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
}
if (o == null || getClass() != o.getClass()) {
return false;
}
{{classname}} {{classVarName}} = ({{classname}}) o;{{#hasVars}}
return {{#vars}}Objects.equals({{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
{{/hasMore}}{{^hasMore}};{{/hasMore}}{{/vars}}{{/hasVars}}{{^hasVars}}
}{{#hasVars}}
{{classname}} {{classVarName}} = ({{classname}}) o;
return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
{{/hasMore}}{{/vars}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return true;{{/hasVars}}
}
@Override
public int hashCode() {
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}});
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
}
@Override

View File

@ -38,17 +38,17 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali
}
if (o == null || getClass() != o.getClass()) {
return false;
}
}{{#hasVars}}
{{classname}} {{classVarName}} = ({{classname}}) o;
return true {{#hasVars}}&& {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
{{/hasMore}}{{/vars}}{{/hasVars}}
{{#parent}}&& super.equals(o){{/parent}};
return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
{{/hasMore}}{{/vars}}{{#parent}} &&
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
return true;{{/hasVars}}
}
@Override
public int hashCode() {
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}},{{/hasVars}} super.hashCode(){{/parent}});
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
}
@Override

View File

@ -208,7 +208,9 @@
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
var data = response.body;
if (data == null) {
return null;
// Superagent does not always produce a body; use the unparsed response
// as a fallback
data = response.text;
}
return ApiClient.convertToType(data, returnType);
};

View File

@ -42,13 +42,13 @@
'<baseName>': <paramName><#hasMore>,</hasMore></pathParams>
};
var queryParams = {<#queryParams>
'<baseName>': <#collectionFormat>this.buildCollectionParam(<paramName>, '<collectionFormat>')</collectionFormat><^collectionFormat><paramName></collectionFormat><#hasMore>,</hasMore></queryParams>
'<baseName>': <#collectionFormat>this.apiClient.buildCollectionParam(<paramName>, '<collectionFormat>')</collectionFormat><^collectionFormat><paramName></collectionFormat><#hasMore>,</hasMore></queryParams>
};
var headerParams = {<#headerParams>
'<baseName>': <paramName><#hasMore>,</hasMore></headerParams>
};
var formParams = {<#formParams>
'<baseName>': <#collectionFormat>this.buildCollectionParam(<paramName>, '<collectionFormat>')</collectionFormat><^collectionFormat><paramName></collectionFormat><#hasMore>,</hasMore></formParams>
'<baseName>': <#collectionFormat>this.apiClient.buildCollectionParam(<paramName>, '<collectionFormat>')</collectionFormat><^collectionFormat><paramName></collectionFormat><#hasMore>,</hasMore></formParams>
};
var authNames = [<#authMethods>'<name>'<#hasMore>, </hasMore></authMethods>];

View File

@ -146,7 +146,7 @@ namespace {{packageName}}.Client
var response = RestClient.Execute(request);
return (Object) response;
}
{{#supportsAsync}}
/// <summary>
/// Makes the asynchronous HTTP request.
/// </summary>
@ -171,7 +171,7 @@ namespace {{packageName}}.Client
pathParams, contentType);
var response = await RestClient.ExecuteTaskAsync(request);
return (Object)response;
}
}{{/supportsAsync}}
/// <summary>
/// Escape string (url-encoded).
@ -367,7 +367,7 @@ namespace {{packageName}}.Client
/// <param name="source">Object to be casted</param>
/// <param name="dest">Target type</param>
/// <returns>Casted object</returns>
public static dynamic ConvertType(dynamic source, Type dest)
{{#supportsAsync}}public static dynamic ConvertType(dynamic source, Type dest){{/supportsAsync}}{{^supportsAsync}}public static object ConvertType<T>(T source, Type dest) where T : class{{/supportsAsync}}
{
return Convert.ChangeType(source, dest);
}

View File

@ -17,7 +17,7 @@ namespace {{packageName}}.Client
/// Gets or sets the error content (body json object)
/// </summary>
/// <value>The error content (Http response body).</value>
public dynamic ErrorContent { get; private set; }
public {{#supportsAsync}}dynamic{{/supportsAsync}}{{^supportsAsync}}object{{/supportsAsync}} ErrorContent { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
@ -40,7 +40,7 @@ namespace {{packageName}}.Client
/// <param name="errorCode">HTTP status code.</param>
/// <param name="message">Error message.</param>
/// <param name="errorContent">Error content.</param>
public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message)
public ApiException(int errorCode, string message, {{#supportsAsync}}dynamic{{/supportsAsync}}{{^supportsAsync}}object{{/supportsAsync}} errorContent = null) : base(message)
{
this.ErrorCode = errorCode;
this.ErrorContent = errorContent;

View File

@ -1,6 +1,5 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information

View File

@ -8,7 +8,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>{{packageTitle}}</RootNamespace>
<AssemblyName>{{packageTitle}}</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<TargetFrameworkVersion>{{targetFramework}}</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@ -41,10 +41,10 @@
<Reference Include="System.Xml" />
<Reference Include="Newtonsoft.Json">
<SpecificVersion>False</SpecificVersion>
<HintPath>{{binRelativePath}}Newtonsoft.Json.dll</HintPath>
<HintPath>{{binRelativePath}}/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RestSharp">
<HintPath>{{binRelativePath}}RestSharp.dll</HintPath>
<HintPath>{{binRelativePath}}/RestSharp.105.2.3/lib/{{targetFrameworkNuget}}/RestSharp.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>

View File

@ -6,12 +6,14 @@
- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later
NOTE: The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
```
Install-Package RestSharp
Install-Package Newtonsoft.Json
```
NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)
## Installation
Run the following command to generate the DLL
- [Mac/Linux] compile-mono.sh

View File

@ -16,6 +16,7 @@ namespace {{packageName}}.Api
/// </summary>
public interface I{{classname}}
{
#region Synchronous Operations
{{#operation}}
/// <summary>
/// {{summary}}
@ -36,7 +37,11 @@ namespace {{packageName}}.Api
{{#allParams}}/// <param name="{{paramName}}">{{description}}</param>
{{/allParams}}/// <returns>ApiResponse of {{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Object(void){{/returnType}}</returns>
ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}> {{operationId}}WithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/operation}}
#endregion Synchronous Operations
{{#supportsAsync}}
#region Asynchronous Operations
{{#operation}}
/// <summary>
/// {{summary}}
/// </summary>
@ -57,6 +62,8 @@ namespace {{packageName}}.Api
{{/allParams}}/// <returns>Task of ApiResponse{{#returnType}} ({{returnType}}){{/returnType}}</returns>
System.Threading.Tasks.Task<ApiResponse<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Object{{/returnType}}>> {{operationId}}AsyncWithHttpInfo ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
{{/operation}}
#endregion Asynchronous Operations
{{/supportsAsync}}
}
/// <summary>
@ -246,6 +253,7 @@ namespace {{packageName}}.Api
null);{{/returnType}}
}
{{#supportsAsync}}
/// <summary>
/// {{summary}} {{notes}}
/// </summary>
@ -349,7 +357,7 @@ namespace {{packageName}}.Api
{{^returnType}}return new ApiResponse<Object>(statusCode,
response.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
null);{{/returnType}}
}
}{{/supportsAsync}}
{{/operation}}
}
{{/operations}}

View File

@ -1,10 +1,17 @@
#!/usr/bin/env bash
frameworkVersion={{targetFrameworkNuget}}
netfx=${frameworkVersion#net}
wget -nc https://nuget.org/nuget.exe;
mozroots --import --sync
mono nuget.exe install vendor/packages.config -o vendor;
mkdir -p bin;
mcs -sdk:45 -r:vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll,\
vendor/RestSharp.105.2.3/lib/net45/RestSharp.dll,\
cp vendor/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp vendor/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll;
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
bin/RestSharp.dll,\
System.Runtime.Serialization.dll \
-target:library \
-out:bin/{{packageName}}.dll \

View File

@ -1,3 +1,12 @@
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/{{packageName}}.dll /recurse:src\*.cs /doc:bin/{{packageName}}.xml
@echo off
{{#supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319{{/supportsAsync}}
{{^supportsAsync}}SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5{{/supportsAsync}}
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
.\nuget.exe install vendor/packages.config -o vendor
cp vendor/Newtonsoft.Json.8.0.2/lib/{{targetFrameworkNuget}}/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll
cp vendor/RestSharp.105.1.0/lib/{{targetFrameworkNuget}}/RestSharp.dll bin/RestSharp.dll
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/{{packageName}}.dll /recurse:src\*.cs /doc:bin/{{packageName}}.xml

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="105.2.3" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" developmentDependency="true" />
<package id="RestSharp" version="105.1.0" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="{{targetFrameworkNuget}}" developmentDependency="true" />
</packages>

View File

@ -31,6 +31,7 @@ public class CSharpClientOptionsProvider implements OptionsProvider {
.put(CodegenConstants.RETURN_ICOLLECTION, "false")
.put(CodegenConstants.OPTIONAL_PROJECT_FILE, "true")
.put(CodegenConstants.OPTIONAL_PROJECT_GUID, PACKAGE_GUID_VALUE)
.put(CodegenConstants.DOTNET_FRAMEWORK, "4.x")
.build();
}

View File

@ -0,0 +1,2 @@
vendor/Newtonsoft.Json.8.0.2/
vendor/RestSharp.105.2.3/

View File

@ -1,10 +1,17 @@
#!/usr/bin/env bash
frameworkVersion=net45
netfx=${frameworkVersion#net}
wget -nc https://nuget.org/nuget.exe;
mozroots --import --sync
mono nuget.exe install vendor/packages.config -o vendor;
mkdir -p bin;
mcs -sdk:45 -r:vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll,\
vendor/RestSharp.105.2.3/lib/net45/RestSharp.dll,\
cp vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll;
cp vendor/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll;
mcs -sdk:${netfx} -r:bin/Newtonsoft.Json.dll,\
bin/RestSharp.dll,\
System.Runtime.Serialization.dll \
-target:library \
-out:bin/IO.Swagger.dll \

View File

@ -1,3 +1,12 @@
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/IO.Swagger.dll /recurse:src\*.cs /doc:bin/IO.Swagger.xml
@echo off
SET CSCPATH=%SYSTEMROOT%\Microsoft.NET\Framework\v4.0.30319
if not exist ".\nuget.exe" powershell -Command "(new-object System.Net.WebClient).DownloadFile('https://nuget.org/nuget.exe', '.\nuget.exe')"
.\nuget.exe install vendor/packages.config -o vendor
cp vendor/Newtonsoft.Json.8.0.2/lib/net45/Newtonsoft.Json.dll bin/Newtonsoft.Json.dll
cp vendor/RestSharp.105.1.0/lib/net45/RestSharp.dll bin/RestSharp.dll
%CSCPATH%\csc /reference:bin/Newtonsoft.Json.dll;bin/RestSharp.dll /target:library /out:bin/IO.Swagger.dll /recurse:src\*.cs /doc:bin/IO.Swagger.xml

View File

@ -15,6 +15,7 @@ namespace IO.Swagger.Api
/// </summary>
public interface IPetApi
{
#region Synchronous Operations
/// <summary>
/// Update an existing pet
@ -36,6 +37,200 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UpdatePetWithHttpInfo (Pet body = null);
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns></returns>
void AddPet (Pet body = null);
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> AddPetWithHttpInfo (Pet body = null);
/// <summary>
/// Finds Pets by status
/// </summary>
/// <remarks>
/// Multiple status values can be provided with comma seperated strings
/// </remarks>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>List&lt;Pet&gt;</returns>
List<Pet> FindPetsByStatus (List<string> status = null);
/// <summary>
/// Finds Pets by status
/// </summary>
/// <remarks>
/// Multiple status values can be provided with comma seperated strings
/// </remarks>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>ApiResponse of List&lt;Pet&gt;</returns>
ApiResponse<List<Pet>> FindPetsByStatusWithHttpInfo (List<string> status = null);
/// <summary>
/// Finds Pets by tags
/// </summary>
/// <remarks>
/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </remarks>
/// <param name="tags">Tags to filter by</param>
/// <returns>List&lt;Pet&gt;</returns>
List<Pet> FindPetsByTags (List<string> tags = null);
/// <summary>
/// Finds Pets by tags
/// </summary>
/// <remarks>
/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </remarks>
/// <param name="tags">Tags to filter by</param>
/// <returns>ApiResponse of List&lt;Pet&gt;</returns>
ApiResponse<List<Pet>> FindPetsByTagsWithHttpInfo (List<string> tags = null);
/// <summary>
/// Find pet by ID
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Pet</returns>
Pet GetPetById (long? petId);
/// <summary>
/// Find pet by ID
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of Pet</returns>
ApiResponse<Pet> GetPetByIdWithHttpInfo (long? petId);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns></returns>
void UpdatePetWithForm (string petId, string name = null, string status = null);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UpdatePetWithFormWithHttpInfo (string petId, string name = null, string status = null);
/// <summary>
/// Deletes a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns>
void DeletePet (long? petId, string apiKey = null);
/// <summary>
/// Deletes a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> DeletePetWithHttpInfo (long? petId, string apiKey = null);
/// <summary>
/// uploads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns></returns>
void UploadFile (long? petId, string additionalMetadata = null, Stream file = null);
/// <summary>
/// uploads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null);
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>byte[]</returns>
byte[] GetPetByIdWithByteArray (long? petId);
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of byte[]</returns>
ApiResponse<byte[]> GetPetByIdWithByteArrayWithHttpInfo (long? petId);
/// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object in the form of byte array</param>
/// <returns></returns>
void AddPetUsingByteArray (byte[] body = null);
/// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object in the form of byte array</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> AddPetUsingByteArrayWithHttpInfo (byte[] body = null);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
/// Update an existing pet
/// </summary>
@ -56,26 +251,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> UpdatePetAsyncWithHttpInfo (Pet body = null);
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns></returns>
void AddPet (Pet body = null);
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object that needs to be added to the store</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> AddPetWithHttpInfo (Pet body = null);
/// <summary>
/// Add a new pet to the store
/// </summary>
@ -96,26 +271,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> AddPetAsyncWithHttpInfo (Pet body = null);
/// <summary>
/// Finds Pets by status
/// </summary>
/// <remarks>
/// Multiple status values can be provided with comma seperated strings
/// </remarks>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>List&lt;Pet&gt;</returns>
List<Pet> FindPetsByStatus (List<string> status = null);
/// <summary>
/// Finds Pets by status
/// </summary>
/// <remarks>
/// Multiple status values can be provided with comma seperated strings
/// </remarks>
/// <param name="status">Status values that need to be considered for filter</param>
/// <returns>ApiResponse of List&lt;Pet&gt;</returns>
ApiResponse<List<Pet>> FindPetsByStatusWithHttpInfo (List<string> status = null);
/// <summary>
/// Finds Pets by status
/// </summary>
@ -136,26 +291,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (List&lt;Pet&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<Pet>>> FindPetsByStatusAsyncWithHttpInfo (List<string> status = null);
/// <summary>
/// Finds Pets by tags
/// </summary>
/// <remarks>
/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </remarks>
/// <param name="tags">Tags to filter by</param>
/// <returns>List&lt;Pet&gt;</returns>
List<Pet> FindPetsByTags (List<string> tags = null);
/// <summary>
/// Finds Pets by tags
/// </summary>
/// <remarks>
/// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </remarks>
/// <param name="tags">Tags to filter by</param>
/// <returns>ApiResponse of List&lt;Pet&gt;</returns>
ApiResponse<List<Pet>> FindPetsByTagsWithHttpInfo (List<string> tags = null);
/// <summary>
/// Finds Pets by tags
/// </summary>
@ -176,26 +311,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (List&lt;Pet&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<Pet>>> FindPetsByTagsAsyncWithHttpInfo (List<string> tags = null);
/// <summary>
/// Find pet by ID
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>Pet</returns>
Pet GetPetById (long? petId);
/// <summary>
/// Find pet by ID
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of Pet</returns>
ApiResponse<Pet> GetPetByIdWithHttpInfo (long? petId);
/// <summary>
/// Find pet by ID
/// </summary>
@ -216,30 +331,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (Pet)</returns>
System.Threading.Tasks.Task<ApiResponse<Pet>> GetPetByIdAsyncWithHttpInfo (long? petId);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns></returns>
void UpdatePetWithForm (string petId, string name = null, string status = null);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet that needs to be updated</param>
/// <param name="name">Updated name of the pet</param>
/// <param name="status">Updated status of the pet</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UpdatePetWithFormWithHttpInfo (string petId, string name = null, string status = null);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
@ -264,28 +355,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> UpdatePetWithFormAsyncWithHttpInfo (string petId, string name = null, string status = null);
/// <summary>
/// Deletes a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns></returns>
void DeletePet (long? petId, string apiKey = null);
/// <summary>
/// Deletes a pet
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">Pet id to delete</param>
/// <param name="apiKey"></param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> DeletePetWithHttpInfo (long? petId, string apiKey = null);
/// <summary>
/// Deletes a pet
/// </summary>
@ -308,30 +377,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> DeletePetAsyncWithHttpInfo (long? petId, string apiKey = null);
/// <summary>
/// uploads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns></returns>
void UploadFile (long? petId, string additionalMetadata = null, Stream file = null);
/// <summary>
/// uploads an image
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="petId">ID of pet to update</param>
/// <param name="additionalMetadata">Additional data to pass to server</param>
/// <param name="file">file to upload</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null);
/// <summary>
/// uploads an image
/// </summary>
@ -356,26 +401,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null);
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>byte[]</returns>
byte[] GetPetByIdWithByteArray (long? petId);
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
/// </summary>
/// <remarks>
/// Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </remarks>
/// <param name="petId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of byte[]</returns>
ApiResponse<byte[]> GetPetByIdWithByteArrayWithHttpInfo (long? petId);
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
/// </summary>
@ -396,26 +421,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (byte[])</returns>
System.Threading.Tasks.Task<ApiResponse<byte[]>> GetPetByIdWithByteArrayAsyncWithHttpInfo (long? petId);
/// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object in the form of byte array</param>
/// <returns></returns>
void AddPetUsingByteArray (byte[] body = null);
/// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">Pet object in the form of byte array</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> AddPetUsingByteArrayWithHttpInfo (byte[] body = null);
/// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
/// </summary>
@ -436,6 +441,8 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> AddPetUsingByteArrayAsyncWithHttpInfo (byte[] body = null);
#endregion Asynchronous Operations
}
/// <summary>
@ -599,6 +606,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Update an existing pet
/// </summary>
@ -765,6 +773,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Add a new pet to the store
/// </summary>
@ -926,6 +935,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma seperated strings
/// </summary>
@ -1088,6 +1098,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
@ -1254,6 +1265,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Find pet by ID Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
@ -1427,6 +1439,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
@ -1602,6 +1615,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Deletes a pet
/// </summary>
@ -1777,6 +1791,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// uploads an image
/// </summary>
@ -1950,6 +1965,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Fake endpoint to test byte array return by &#39;Find pet by ID&#39; Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
@ -2119,6 +2135,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Fake endpoint to test byte array in body parameter for adding a new pet to the store
/// </summary>

View File

@ -15,6 +15,7 @@ namespace IO.Swagger.Api
/// </summary>
public interface IStoreApi
{
#region Synchronous Operations
/// <summary>
/// Returns pet inventories by status
@ -34,24 +35,6 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Dictionary&lt;string, int?&gt;</returns>
ApiResponse<Dictionary<string, int?>> GetInventoryWithHttpInfo ();
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <returns>Task of Dictionary&lt;string, int?&gt;</returns>
System.Threading.Tasks.Task<Dictionary<string, int?>> GetInventoryAsync ();
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <returns>Task of ApiResponse (Dictionary&lt;string, int?&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<Dictionary<string, int?>>> GetInventoryAsyncWithHttpInfo ();
/// <summary>
/// Place an order for a pet
/// </summary>
@ -72,6 +55,68 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Order</returns>
ApiResponse<Order> PlaceOrderWithHttpInfo (Order body = null);
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </remarks>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
Order GetOrderById (string orderId);
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </remarks>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of Order</returns>
ApiResponse<Order> GetOrderByIdWithHttpInfo (string orderId);
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
void DeleteOrder (string orderId);
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> DeleteOrderWithHttpInfo (string orderId);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <returns>Task of Dictionary&lt;string, int?&gt;</returns>
System.Threading.Tasks.Task<Dictionary<string, int?>> GetInventoryAsync ();
/// <summary>
/// Returns pet inventories by status
/// </summary>
/// <remarks>
/// Returns a map of status codes to quantities
/// </remarks>
/// <returns>Task of ApiResponse (Dictionary&lt;string, int?&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<Dictionary<string, int?>>> GetInventoryAsyncWithHttpInfo ();
/// <summary>
/// Place an order for a pet
/// </summary>
@ -92,26 +137,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (Order)</returns>
System.Threading.Tasks.Task<ApiResponse<Order>> PlaceOrderAsyncWithHttpInfo (Order body = null);
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </remarks>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
Order GetOrderById (string orderId);
/// <summary>
/// Find purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </remarks>
/// <param name="orderId">ID of pet that needs to be fetched</param>
/// <returns>ApiResponse of Order</returns>
ApiResponse<Order> GetOrderByIdWithHttpInfo (string orderId);
/// <summary>
/// Find purchase order by ID
/// </summary>
@ -132,26 +157,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (Order)</returns>
System.Threading.Tasks.Task<ApiResponse<Order>> GetOrderByIdAsyncWithHttpInfo (string orderId);
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
void DeleteOrder (string orderId);
/// <summary>
/// Delete purchase order by ID
/// </summary>
/// <remarks>
/// For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </remarks>
/// <param name="orderId">ID of the order that needs to be deleted</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> DeleteOrderWithHttpInfo (string orderId);
/// <summary>
/// Delete purchase order by ID
/// </summary>
@ -172,6 +177,8 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> DeleteOrderAsyncWithHttpInfo (string orderId);
#endregion Asynchronous Operations
}
/// <summary>
@ -327,6 +334,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
@ -485,6 +493,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Place an order for a pet
/// </summary>
@ -636,6 +645,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </summary>
@ -788,6 +798,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>

View File

@ -15,6 +15,7 @@ namespace IO.Swagger.Api
/// </summary>
public interface IUserApi
{
#region Synchronous Operations
/// <summary>
/// Create user
@ -36,26 +37,6 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> CreateUserWithHttpInfo (User body = null);
/// <summary>
/// Create user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="body">Created user object</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task CreateUserAsync (User body = null);
/// <summary>
/// Create user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="body">Created user object</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> CreateUserAsyncWithHttpInfo (User body = null);
/// <summary>
/// Creates list of users with given input array
/// </summary>
@ -76,26 +57,6 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> CreateUsersWithArrayInputWithHttpInfo (List<User> body = null);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">List of user object</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List<User> body = null);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">List of user object</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> CreateUsersWithArrayInputAsyncWithHttpInfo (List<User> body = null);
/// <summary>
/// Creates list of users with given input array
/// </summary>
@ -116,6 +77,152 @@ namespace IO.Swagger.Api
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> CreateUsersWithListInputWithHttpInfo (List<User> body = null);
/// <summary>
/// Logs user into the system
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>string</returns>
string LoginUser (string username = null, string password = null);
/// <summary>
/// Logs user into the system
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>ApiResponse of string</returns>
ApiResponse<string> LoginUserWithHttpInfo (string username = null, string password = null);
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns></returns>
void LogoutUser ();
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> LogoutUserWithHttpInfo ();
/// <summary>
/// Get user by user name
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>User</returns>
User GetUserByName (string username);
/// <summary>
/// Get user by user name
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>ApiResponse of User</returns>
ApiResponse<User> GetUserByNameWithHttpInfo (string username);
/// <summary>
/// Updated user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">name that need to be deleted</param>
/// <param name="body">Updated user object</param>
/// <returns></returns>
void UpdateUser (string username, User body = null);
/// <summary>
/// Updated user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">name that need to be deleted</param>
/// <param name="body">Updated user object</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UpdateUserWithHttpInfo (string username, User body = null);
/// <summary>
/// Delete user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">The name that needs to be deleted</param>
/// <returns></returns>
void DeleteUser (string username);
/// <summary>
/// Delete user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">The name that needs to be deleted</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> DeleteUserWithHttpInfo (string username);
#endregion Synchronous Operations
#region Asynchronous Operations
/// <summary>
/// Create user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="body">Created user object</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task CreateUserAsync (User body = null);
/// <summary>
/// Create user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="body">Created user object</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> CreateUserAsyncWithHttpInfo (User body = null);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">List of user object</param>
/// <returns>Task of void</returns>
System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List<User> body = null);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="body">List of user object</param>
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> CreateUsersWithArrayInputAsyncWithHttpInfo (List<User> body = null);
/// <summary>
/// Creates list of users with given input array
/// </summary>
@ -136,28 +243,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> CreateUsersWithListInputAsyncWithHttpInfo (List<User> body = null);
/// <summary>
/// Logs user into the system
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>string</returns>
string LoginUser (string username = null, string password = null);
/// <summary>
/// Logs user into the system
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The user name for login</param>
/// <param name="password">The password for login in clear text</param>
/// <returns>ApiResponse of string</returns>
ApiResponse<string> LoginUserWithHttpInfo (string username = null, string password = null);
/// <summary>
/// Logs user into the system
/// </summary>
@ -180,24 +265,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (string)</returns>
System.Threading.Tasks.Task<ApiResponse<string>> LoginUserAsyncWithHttpInfo (string username = null, string password = null);
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns></returns>
void LogoutUser ();
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <remarks>
///
/// </remarks>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> LogoutUserWithHttpInfo ();
/// <summary>
/// Logs out current logged in user session
/// </summary>
@ -216,26 +283,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> LogoutUserAsyncWithHttpInfo ();
/// <summary>
/// Get user by user name
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>User</returns>
User GetUserByName (string username);
/// <summary>
/// Get user by user name
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="username">The name that needs to be fetched. Use user1 for testing.</param>
/// <returns>ApiResponse of User</returns>
ApiResponse<User> GetUserByNameWithHttpInfo (string username);
/// <summary>
/// Get user by user name
/// </summary>
@ -256,28 +303,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse (User)</returns>
System.Threading.Tasks.Task<ApiResponse<User>> GetUserByNameAsyncWithHttpInfo (string username);
/// <summary>
/// Updated user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">name that need to be deleted</param>
/// <param name="body">Updated user object</param>
/// <returns></returns>
void UpdateUser (string username, User body = null);
/// <summary>
/// Updated user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">name that need to be deleted</param>
/// <param name="body">Updated user object</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> UpdateUserWithHttpInfo (string username, User body = null);
/// <summary>
/// Updated user
/// </summary>
@ -300,26 +325,6 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> UpdateUserAsyncWithHttpInfo (string username, User body = null);
/// <summary>
/// Delete user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">The name that needs to be deleted</param>
/// <returns></returns>
void DeleteUser (string username);
/// <summary>
/// Delete user
/// </summary>
/// <remarks>
/// This can only be done by the logged in user.
/// </remarks>
/// <param name="username">The name that needs to be deleted</param>
/// <returns>ApiResponse of Object(void)</returns>
ApiResponse<Object> DeleteUserWithHttpInfo (string username);
/// <summary>
/// Delete user
/// </summary>
@ -340,6 +345,8 @@ namespace IO.Swagger.Api
/// <returns>Task of ApiResponse</returns>
System.Threading.Tasks.Task<ApiResponse<Object>> DeleteUserAsyncWithHttpInfo (string username);
#endregion Asynchronous Operations
}
/// <summary>
@ -496,6 +503,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
@ -647,6 +655,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
@ -798,6 +807,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
@ -947,6 +957,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Logs user into the system
/// </summary>
@ -1093,6 +1104,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Logs out current logged in user session
/// </summary>
@ -1240,6 +1252,7 @@ namespace IO.Swagger.Api
}
/// <summary>
/// Get user by user name
/// </summary>
@ -1401,6 +1414,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
@ -1555,6 +1569,7 @@ namespace IO.Swagger.Api
null);
}
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>

View File

@ -1,6 +1,5 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="105.2.3" targetFramework="net45" developmentDependency="true" />
<package id="RestSharp" version="105.1.0" targetFramework="net45" developmentDependency="true" />
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" developmentDependency="true" />
</packages>

View File

@ -20,7 +20,7 @@ mvn deploy
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
```xml
<dependency>

View File

@ -1,3 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger'
version = '1.0.0'

View File

@ -41,7 +41,7 @@ import io.swagger.client.auth.HttpBasicAuth;
import io.swagger.client.auth.ApiKeyAuth;
import io.swagger.client.auth.OAuth;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class ApiClient {
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private String basePath = "http://petstore.swagger.io/v2";
@ -83,8 +83,12 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth());
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}

View File

@ -12,7 +12,7 @@ import java.io.File;
import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class PetApi {
private ApiClient apiClient;
@ -238,7 +238,7 @@ public class PetApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" };
String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<Pet> returnType = new GenericType<Pet>() {};
@ -438,7 +438,7 @@ public class PetApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" };
String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<byte[]> returnType = new GenericType<byte[]>() {};

View File

@ -12,7 +12,7 @@ import io.swagger.client.model.Order;
import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class StoreApi {
private ApiClient apiClient;
@ -106,7 +106,7 @@ public class StoreApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
GenericType<Order> returnType = new GenericType<Order>() {};
@ -153,7 +153,7 @@ public class StoreApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
GenericType<Order> returnType = new GenericType<Order>() {};

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Category {
private Long id = null;
@ -63,10 +62,8 @@ public class Category {
return false;
}
Category category = (Category) o;
return true && Objects.equals(id, category.id) &&
Objects.equals(name, category.name)
;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override

View File

@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Order {
private Long id = null;
@ -161,14 +161,12 @@ public class Order {
return false;
}
Order order = (Order) o;
return true && Objects.equals(id, order.id) &&
Objects.equals(petId, order.petId) &&
Objects.equals(quantity, order.quantity) &&
Objects.equals(shipDate, order.shipDate) &&
Objects.equals(status, order.status) &&
Objects.equals(complete, order.complete)
;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override

View File

@ -13,7 +13,7 @@ import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Pet {
private Long id = null;
@ -163,14 +163,12 @@ public class Pet {
return false;
}
Pet pet = (Pet) o;
return true && Objects.equals(id, pet.id) &&
Objects.equals(category, pet.category) &&
Objects.equals(name, pet.name) &&
Objects.equals(photoUrls, pet.photoUrls) &&
Objects.equals(tags, pet.tags) &&
Objects.equals(status, pet.status)
;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class Tag {
private Long id = null;
@ -63,10 +62,8 @@ public class Tag {
return false;
}
Tag tag = (Tag) o;
return true && Objects.equals(id, tag.id) &&
Objects.equals(name, tag.name)
;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-12T18:48:10.013-08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:20.498+08:00")
public class User {
private Long id = null;
@ -178,16 +177,14 @@ public class User {
return false;
}
User user = (User) o;
return true && Objects.equals(id, user.id) &&
Objects.equals(username, user.username) &&
Objects.equals(firstName, user.firstName) &&
Objects.equals(lastName, user.lastName) &&
Objects.equals(email, user.email) &&
Objects.equals(password, user.password) &&
Objects.equals(phone, user.phone) &&
Objects.equals(userStatus, user.userStatus)
;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override

View File

@ -131,7 +131,13 @@ public class ApiClientTest {
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = (ApiKeyAuth) apiClient.getAuthentications().get("api_key");
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);

View File

@ -1,3 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger'
version = '1.0.0'

View File

@ -18,7 +18,7 @@ import feign.slf4j.Slf4jLogger;
import io.swagger.client.auth.*;
import io.swagger.client.auth.OAuth.AccessTokenListener;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class ApiClient {
public interface Api {}
@ -42,8 +42,16 @@ public class ApiClient {
RequestInterceptor auth;
if (authName == "petstore_auth") {
auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets");
} else if (authName == "test_api_client_id") {
auth = new ApiKeyAuth("header", "x-test_api_client_id");
} else if (authName == "test_api_client_secret") {
auth = new ApiKeyAuth("header", "x-test_api_client_secret");
} else if (authName == "api_key") {
auth = new ApiKeyAuth("header", "api_key");
} else if (authName == "test_api_key_query") {
auth = new ApiKeyAuth("query", "test_api_key_query");
} else if (authName == "test_api_key_header") {
auth = new ApiKeyAuth("header", "test_api_key_header");
} else {
throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names");
}

View File

@ -8,7 +8,7 @@ import java.io.File;
import java.util.*;
import feign.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public interface PetApi extends ApiClient.Api {
@ -122,4 +122,30 @@ public interface PetApi extends ApiClient.Api {
})
void uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file);
/**
* Fake endpoint to test byte array return by &#39;Find pet by ID&#39;
* Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
* @param petId ID of pet that needs to be fetched
* @return byte[]
*/
@RequestLine("GET /pet/{petId}?testing_byte_array=true")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
byte[] getPetByIdWithByteArray(@Param("petId") Long petId);
/**
* Fake endpoint to test byte array in body parameter for adding a new pet to the store
*
* @param body Pet object in the form of byte array
* @return void
*/
@RequestLine("POST /pet?testing_byte_array=true")
@Headers({
"Content-type: application/json",
"Accepts: application/json",
})
void addPetUsingByteArray(byte[] body);
}

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Category {
private Long id = null;
@ -19,8 +18,13 @@ public class Category {
/**
**/
public Category id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -32,8 +36,13 @@ public class Category {
/**
**/
public Category name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("name")
public String getName() {
return name;
@ -45,7 +54,7 @@ public class Category {
@Override
public boolean equals(Object o) {
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
@ -53,10 +62,8 @@ public class Category {
return false;
}
Category category = (Category) o;
return true && Objects.equals(id, category.id) &&
Objects.equals(name, category.name)
;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override
@ -79,7 +86,7 @@ public class Category {
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}

View File

@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Order {
private Long id = null;
@ -44,8 +44,13 @@ public class Order {
/**
**/
public Order id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -57,8 +62,13 @@ public class Order {
/**
**/
public Order petId(Long petId) {
this.petId = petId;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("petId")
public Long getPetId() {
return petId;
@ -70,8 +80,13 @@ public class Order {
/**
**/
public Order quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("quantity")
public Integer getQuantity() {
return quantity;
@ -83,8 +98,13 @@ public class Order {
/**
**/
public Order shipDate(Date shipDate) {
this.shipDate = shipDate;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("shipDate")
public Date getShipDate() {
return shipDate;
@ -97,8 +117,13 @@ public class Order {
/**
* Order Status
**/
public Order status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "Order Status")
@ApiModelProperty(example = "null", value = "Order Status")
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
@ -110,8 +135,13 @@ public class Order {
/**
**/
public Order complete(Boolean complete) {
this.complete = complete;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("complete")
public Boolean getComplete() {
return complete;
@ -123,7 +153,7 @@ public class Order {
@Override
public boolean equals(Object o) {
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
@ -131,14 +161,12 @@ public class Order {
return false;
}
Order order = (Order) o;
return true && Objects.equals(id, order.id) &&
Objects.equals(petId, order.petId) &&
Objects.equals(quantity, order.quantity) &&
Objects.equals(shipDate, order.shipDate) &&
Objects.equals(status, order.status) &&
Objects.equals(complete, order.complete)
;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override
@ -165,7 +193,7 @@ public class Order {
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}

View File

@ -13,7 +13,7 @@ import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Pet {
private Long id = null;
@ -46,8 +46,13 @@ public class Pet {
/**
**/
public Pet id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -59,8 +64,13 @@ public class Pet {
/**
**/
public Pet category(Category category) {
this.category = category;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("category")
public Category getCategory() {
return category;
@ -72,8 +82,13 @@ public class Pet {
/**
**/
public Pet name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(required = true, value = "")
@ApiModelProperty(example = "doggie", required = true, value = "")
@JsonProperty("name")
public String getName() {
return name;
@ -85,8 +100,13 @@ public class Pet {
/**
**/
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ApiModelProperty(required = true, value = "")
@ApiModelProperty(example = "null", required = true, value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
@ -98,8 +118,13 @@ public class Pet {
/**
**/
public Pet tags(List<Tag> tags) {
this.tags = tags;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("tags")
public List<Tag> getTags() {
return tags;
@ -112,8 +137,13 @@ public class Pet {
/**
* pet status in the store
**/
public Pet status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "pet status in the store")
@ApiModelProperty(example = "null", value = "pet status in the store")
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
@ -125,7 +155,7 @@ public class Pet {
@Override
public boolean equals(Object o) {
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
@ -133,14 +163,12 @@ public class Pet {
return false;
}
Pet pet = (Pet) o;
return true && Objects.equals(id, pet.id) &&
Objects.equals(category, pet.category) &&
Objects.equals(name, pet.name) &&
Objects.equals(photoUrls, pet.photoUrls) &&
Objects.equals(tags, pet.tags) &&
Objects.equals(status, pet.status)
;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override
@ -167,7 +195,7 @@ public class Pet {
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class Tag {
private Long id = null;
@ -19,8 +18,13 @@ public class Tag {
/**
**/
public Tag id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -32,8 +36,13 @@ public class Tag {
/**
**/
public Tag name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("name")
public String getName() {
return name;
@ -45,7 +54,7 @@ public class Tag {
@Override
public boolean equals(Object o) {
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
@ -53,10 +62,8 @@ public class Tag {
return false;
}
Tag tag = (Tag) o;
return true && Objects.equals(id, tag.id) &&
Objects.equals(name, tag.name)
;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override
@ -79,7 +86,7 @@ public class Tag {
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-11T21:48:33.457Z")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:23.375+08:00")
public class User {
private Long id = null;
@ -25,8 +24,13 @@ public class User {
/**
**/
public User id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -38,8 +42,13 @@ public class User {
/**
**/
public User username(String username) {
this.username = username;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("username")
public String getUsername() {
return username;
@ -51,8 +60,13 @@ public class User {
/**
**/
public User firstName(String firstName) {
this.firstName = firstName;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("firstName")
public String getFirstName() {
return firstName;
@ -64,8 +78,13 @@ public class User {
/**
**/
public User lastName(String lastName) {
this.lastName = lastName;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("lastName")
public String getLastName() {
return lastName;
@ -77,8 +96,13 @@ public class User {
/**
**/
public User email(String email) {
this.email = email;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("email")
public String getEmail() {
return email;
@ -90,8 +114,13 @@ public class User {
/**
**/
public User password(String password) {
this.password = password;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("password")
public String getPassword() {
return password;
@ -103,8 +132,13 @@ public class User {
/**
**/
public User phone(String phone) {
this.phone = phone;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("phone")
public String getPhone() {
return phone;
@ -117,8 +151,13 @@ public class User {
/**
* User Status
**/
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
@ApiModelProperty(value = "User Status")
@ApiModelProperty(example = "null", value = "User Status")
@JsonProperty("userStatus")
public Integer getUserStatus() {
return userStatus;
@ -130,7 +169,7 @@ public class User {
@Override
public boolean equals(Object o) {
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
@ -138,16 +177,14 @@ public class User {
return false;
}
User user = (User) o;
return true && Objects.equals(id, user.id) &&
Objects.equals(username, user.username) &&
Objects.equals(firstName, user.firstName) &&
Objects.equals(lastName, user.lastName) &&
Objects.equals(email, user.email) &&
Objects.equals(password, user.password) &&
Objects.equals(phone, user.phone) &&
Objects.equals(userStatus, user.userStatus)
;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override
@ -176,7 +213,7 @@ public class User {
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}

View File

@ -1,3 +1,6 @@
apply plugin: 'idea'
apply plugin: 'eclipse'
group = 'io.swagger'
version = '1.0.0'

View File

@ -48,7 +48,7 @@ import io.swagger.client.auth.HttpBasicAuth;
import io.swagger.client.auth.ApiKeyAuth;
import io.swagger.client.auth.OAuth;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class ApiClient {
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
private String basePath = "http://petstore.swagger.io/v2";
@ -85,7 +85,11 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
authentications.put("petstore_auth", new OAuth());
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}

View File

@ -12,7 +12,7 @@ import java.io.File;
import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class PetApi {
private ApiClient apiClient;
@ -238,7 +238,7 @@ public class PetApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" };
String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<Pet> returnType = new GenericType<Pet>() {};
@ -438,7 +438,7 @@ public class PetApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { "api_key" };
String[] authNames = new String[] { "petstore_auth", "api_key" };
GenericType<byte[]> returnType = new GenericType<byte[]>() {};

View File

@ -12,7 +12,7 @@ import io.swagger.client.model.Order;
import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class StoreApi {
private ApiClient apiClient;
@ -106,7 +106,7 @@ public class StoreApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
GenericType<Order> returnType = new GenericType<Order>() {};
@ -153,7 +153,7 @@ public class StoreApi {
};
final String contentType = apiClient.selectHeaderContentType(contentTypes);
String[] authNames = new String[] { };
String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
GenericType<Order> returnType = new GenericType<Order>() {};

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Category {
private Long id = null;
@ -19,8 +18,13 @@ public class Category {
/**
**/
public Category id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -32,8 +36,13 @@ public class Category {
/**
**/
public Category name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("name")
public String getName() {
return name;
@ -53,10 +62,8 @@ public class Category {
return false;
}
Category category = (Category) o;
return true && Objects.equals(id, category.id) &&
Objects.equals(name, category.name)
;
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override

View File

@ -11,7 +11,7 @@ import java.util.Date;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Order {
private Long id = null;
@ -44,8 +44,13 @@ public class Order {
/**
**/
public Order id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -57,8 +62,13 @@ public class Order {
/**
**/
public Order petId(Long petId) {
this.petId = petId;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("petId")
public Long getPetId() {
return petId;
@ -70,8 +80,13 @@ public class Order {
/**
**/
public Order quantity(Integer quantity) {
this.quantity = quantity;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("quantity")
public Integer getQuantity() {
return quantity;
@ -83,8 +98,13 @@ public class Order {
/**
**/
public Order shipDate(Date shipDate) {
this.shipDate = shipDate;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("shipDate")
public Date getShipDate() {
return shipDate;
@ -97,8 +117,13 @@ public class Order {
/**
* Order Status
**/
public Order status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "Order Status")
@ApiModelProperty(example = "null", value = "Order Status")
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
@ -110,8 +135,13 @@ public class Order {
/**
**/
public Order complete(Boolean complete) {
this.complete = complete;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("complete")
public Boolean getComplete() {
return complete;
@ -131,14 +161,12 @@ public class Order {
return false;
}
Order order = (Order) o;
return true && Objects.equals(id, order.id) &&
Objects.equals(petId, order.petId) &&
Objects.equals(quantity, order.quantity) &&
Objects.equals(shipDate, order.shipDate) &&
Objects.equals(status, order.status) &&
Objects.equals(complete, order.complete)
;
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override

View File

@ -13,7 +13,7 @@ import java.util.*;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Pet {
private Long id = null;
@ -46,8 +46,13 @@ public class Pet {
/**
**/
public Pet id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -59,8 +64,13 @@ public class Pet {
/**
**/
public Pet category(Category category) {
this.category = category;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("category")
public Category getCategory() {
return category;
@ -72,8 +82,13 @@ public class Pet {
/**
**/
public Pet name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(required = true, value = "")
@ApiModelProperty(example = "doggie", required = true, value = "")
@JsonProperty("name")
public String getName() {
return name;
@ -85,8 +100,13 @@ public class Pet {
/**
**/
public Pet photoUrls(List<String> photoUrls) {
this.photoUrls = photoUrls;
return this;
}
@ApiModelProperty(required = true, value = "")
@ApiModelProperty(example = "null", required = true, value = "")
@JsonProperty("photoUrls")
public List<String> getPhotoUrls() {
return photoUrls;
@ -98,8 +118,13 @@ public class Pet {
/**
**/
public Pet tags(List<Tag> tags) {
this.tags = tags;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("tags")
public List<Tag> getTags() {
return tags;
@ -112,8 +137,13 @@ public class Pet {
/**
* pet status in the store
**/
public Pet status(StatusEnum status) {
this.status = status;
return this;
}
@ApiModelProperty(value = "pet status in the store")
@ApiModelProperty(example = "null", value = "pet status in the store")
@JsonProperty("status")
public StatusEnum getStatus() {
return status;
@ -133,14 +163,12 @@ public class Pet {
return false;
}
Pet pet = (Pet) o;
return true && Objects.equals(id, pet.id) &&
Objects.equals(category, pet.category) &&
Objects.equals(name, pet.name) &&
Objects.equals(photoUrls, pet.photoUrls) &&
Objects.equals(tags, pet.tags) &&
Objects.equals(status, pet.status)
;
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class Tag {
private Long id = null;
@ -19,8 +18,13 @@ public class Tag {
/**
**/
public Tag id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -32,8 +36,13 @@ public class Tag {
/**
**/
public Tag name(String name) {
this.name = name;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("name")
public String getName() {
return name;
@ -53,10 +62,8 @@ public class Tag {
return false;
}
Tag tag = (Tag) o;
return true && Objects.equals(id, tag.id) &&
Objects.equals(name, tag.name)
;
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override

View File

@ -2,7 +2,6 @@ package io.swagger.client.model;
import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -10,7 +9,7 @@ import io.swagger.annotations.ApiModelProperty;
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-01-28T16:23:25.238+01:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2016-02-17T17:16:21.885+08:00")
public class User {
private Long id = null;
@ -25,8 +24,13 @@ public class User {
/**
**/
public User id(Long id) {
this.id = id;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("id")
public Long getId() {
return id;
@ -38,8 +42,13 @@ public class User {
/**
**/
public User username(String username) {
this.username = username;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("username")
public String getUsername() {
return username;
@ -51,8 +60,13 @@ public class User {
/**
**/
public User firstName(String firstName) {
this.firstName = firstName;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("firstName")
public String getFirstName() {
return firstName;
@ -64,8 +78,13 @@ public class User {
/**
**/
public User lastName(String lastName) {
this.lastName = lastName;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("lastName")
public String getLastName() {
return lastName;
@ -77,8 +96,13 @@ public class User {
/**
**/
public User email(String email) {
this.email = email;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("email")
public String getEmail() {
return email;
@ -90,8 +114,13 @@ public class User {
/**
**/
public User password(String password) {
this.password = password;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("password")
public String getPassword() {
return password;
@ -103,8 +132,13 @@ public class User {
/**
**/
public User phone(String phone) {
this.phone = phone;
return this;
}
@ApiModelProperty(value = "")
@ApiModelProperty(example = "null", value = "")
@JsonProperty("phone")
public String getPhone() {
return phone;
@ -117,8 +151,13 @@ public class User {
/**
* User Status
**/
public User userStatus(Integer userStatus) {
this.userStatus = userStatus;
return this;
}
@ApiModelProperty(value = "User Status")
@ApiModelProperty(example = "null", value = "User Status")
@JsonProperty("userStatus")
public Integer getUserStatus() {
return userStatus;
@ -138,16 +177,14 @@ public class User {
return false;
}
User user = (User) o;
return true && Objects.equals(id, user.id) &&
Objects.equals(username, user.username) &&
Objects.equals(firstName, user.firstName) &&
Objects.equals(lastName, user.lastName) &&
Objects.equals(email, user.email) &&
Objects.equals(password, user.password) &&
Objects.equals(phone, user.phone) &&
Objects.equals(userStatus, user.userStatus)
;
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override

View File

@ -131,7 +131,13 @@ public class ApiClientTest {
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = (ApiKeyAuth) apiClient.getAuthentications().get("api_key");
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);

View File

@ -20,7 +20,7 @@ mvn deploy
Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information.
After the client libarary is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*:
```xml
<dependency>

View File

@ -145,8 +145,12 @@ public class ApiClient {
// Setup authentications (key: authentication name, value: authentication).
authentications = new HashMap<String, Authentication>();
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("petstore_auth", new OAuth());
authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id"));
authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret"));
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query"));
authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header"));
// Prevent the authentications from being modified.
authentications = Collections.unmodifiableMap(authentications);
}

View File

@ -491,7 +491,7 @@ public class PetApi {
});
}
String[] authNames = new String[] { "api_key" };
String[] authNames = new String[] { "petstore_auth", "api_key" };
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
}
@ -936,7 +936,7 @@ public class PetApi {
});
}
String[] authNames = new String[] { "api_key" };
String[] authNames = new String[] { "petstore_auth", "api_key" };
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
}

View File

@ -180,7 +180,7 @@ public class StoreApi {
});
}
String[] authNames = new String[] { };
String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" };
return apiClient.buildCall(path, "POST", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
}
@ -288,7 +288,7 @@ public class StoreApi {
});
}
String[] authNames = new String[] { };
String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" };
return apiClient.buildCall(path, "GET", queryParams, postBody, headerParams, formParams, authNames, progressRequestListener);
}

View File

@ -52,8 +52,8 @@ public class Category {
return false;
}
Category category = (Category) o;
return Objects.equals(id, category.id) &&
Objects.equals(name, category.name);
return Objects.equals(this.id, category.id) &&
Objects.equals(this.name, category.name);
}
@Override

View File

@ -133,12 +133,12 @@ public enum StatusEnum {
return false;
}
Order order = (Order) o;
return Objects.equals(id, order.id) &&
Objects.equals(petId, order.petId) &&
Objects.equals(quantity, order.quantity) &&
Objects.equals(shipDate, order.shipDate) &&
Objects.equals(status, order.status) &&
Objects.equals(complete, order.complete);
return Objects.equals(this.id, order.id) &&
Objects.equals(this.petId, order.petId) &&
Objects.equals(this.quantity, order.quantity) &&
Objects.equals(this.shipDate, order.shipDate) &&
Objects.equals(this.status, order.status) &&
Objects.equals(this.complete, order.complete);
}
@Override

View File

@ -135,12 +135,12 @@ public enum StatusEnum {
return false;
}
Pet pet = (Pet) o;
return Objects.equals(id, pet.id) &&
Objects.equals(category, pet.category) &&
Objects.equals(name, pet.name) &&
Objects.equals(photoUrls, pet.photoUrls) &&
Objects.equals(tags, pet.tags) &&
Objects.equals(status, pet.status);
return Objects.equals(this.id, pet.id) &&
Objects.equals(this.category, pet.category) &&
Objects.equals(this.name, pet.name) &&
Objects.equals(this.photoUrls, pet.photoUrls) &&
Objects.equals(this.tags, pet.tags) &&
Objects.equals(this.status, pet.status);
}
@Override

View File

@ -52,8 +52,8 @@ public class Tag {
return false;
}
Tag tag = (Tag) o;
return Objects.equals(id, tag.id) &&
Objects.equals(name, tag.name);
return Objects.equals(this.id, tag.id) &&
Objects.equals(this.name, tag.name);
}
@Override

View File

@ -137,14 +137,14 @@ public class User {
return false;
}
User user = (User) o;
return Objects.equals(id, user.id) &&
Objects.equals(username, user.username) &&
Objects.equals(firstName, user.firstName) &&
Objects.equals(lastName, user.lastName) &&
Objects.equals(email, user.email) &&
Objects.equals(password, user.password) &&
Objects.equals(phone, user.phone) &&
Objects.equals(userStatus, user.userStatus);
return Objects.equals(this.id, user.id) &&
Objects.equals(this.username, user.username) &&
Objects.equals(this.firstName, user.firstName) &&
Objects.equals(this.lastName, user.lastName) &&
Objects.equals(this.email, user.email) &&
Objects.equals(this.password, user.password) &&
Objects.equals(this.phone, user.phone) &&
Objects.equals(this.userStatus, user.userStatus);
}
@Override

View File

@ -170,7 +170,13 @@ public class ApiClientTest {
@Test
public void testSetApiKeyAndPrefix() {
ApiKeyAuth auth = (ApiKeyAuth) apiClient.getAuthentications().get("api_key");
ApiKeyAuth auth = null;
for (Authentication _auth : apiClient.getAuthentications().values()) {
if (_auth instanceof ApiKeyAuth) {
auth = (ApiKeyAuth) _auth;
break;
}
}
auth.setApiKey(null);
auth.setApiKeyPrefix(null);

View File

@ -12,6 +12,7 @@
},
"devDependencies": {
"mocha": "~2.3.4",
"sinon": "1.17.3",
"expect.js": "~0.3.1"
}
}

View File

@ -21,6 +21,15 @@
*/
this.basePath = 'http://petstore.swagger.io/v2'.replace(/\/+$/, '');
this.authentications = {
'petstore_auth': {type: 'oauth2'},
'test_api_client_id': {type: 'apiKey', in: 'header', name: 'x-test_api_client_id'},
'test_api_client_secret': {type: 'apiKey', in: 'header', name: 'x-test_api_client_secret'},
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'},
'test_api_key_query': {type: 'apiKey', in: 'query', name: 'test_api_key_query'},
'test_api_key_header': {type: 'apiKey', in: 'header', name: 'test_api_key_header'}
};
/**
* The default HTTP headers to be included for all API calls.
*/
@ -158,6 +167,42 @@
}
};
ApiClient.prototype.applyAuthToRequest = function applyAuthToRequest(request, authNames) {
var _this = this;
authNames.forEach(function(authName) {
var auth = _this.authentications[authName];
switch (auth.type) {
case 'basic':
if (auth.username || auth.password) {
request.auth(auth.username || '', auth.password || '');
}
break;
case 'apiKey':
if (auth.apiKey) {
var data = {};
if (auth.apiKeyPrefix) {
data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
} else {
data[auth.name] = auth.apiKey;
}
if (auth.in === 'header') {
request.set(data);
} else {
request.query(data);
}
}
break;
case 'oauth2':
if (auth.accessToken) {
request.set({'Authorization': 'Bearer ' + auth.accessToken});
}
break;
default:
throw new Error('Unknown authentication type: ' + auth.type);
}
});
};
ApiClient.prototype.deserialize = function deserialize(response, returnType) {
if (response == null || returnType == null) {
return null;
@ -166,18 +211,23 @@
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
var data = response.body;
if (data == null) {
return null;
// Superagent does not always produce a body; use the unparsed response
// as a fallback
data = response.text;
}
return ApiClient.convertToType(data, returnType);
};
ApiClient.prototype.callApi = function callApi(path, httpMethod, pathParams,
queryParams, headerParams, formParams, bodyParam, contentTypes, accepts,
returnType) {
queryParams, headerParams, formParams, bodyParam, authNames, contentTypes,
accepts, returnType) {
var _this = this;
var url = this.buildUrl(path, pathParams);
var request = superagent(httpMethod, url);
// apply authentications
this.applyAuthToRequest(request, authNames);
// set query parameters
request.query(this.normalizeParams(queryParams));

View File

@ -41,6 +41,7 @@
var formParams = {
};
var authNames = ['petstore_auth'];
var contentTypes = ['application/json', 'application/xml'];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -48,7 +49,7 @@
return this.apiClient.callApi(
'/pet', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -73,6 +74,7 @@
var formParams = {
};
var authNames = ['petstore_auth'];
var contentTypes = ['application/json', 'application/xml'];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -80,7 +82,7 @@
return this.apiClient.callApi(
'/pet', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -107,6 +109,7 @@
var formParams = {
};
var authNames = ['petstore_auth'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = [Pet];
@ -114,7 +117,7 @@
return this.apiClient.callApi(
'/pet/findByStatus', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -141,6 +144,7 @@
var formParams = {
};
var authNames = ['petstore_auth'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = [Pet];
@ -148,7 +152,7 @@
return this.apiClient.callApi(
'/pet/findByTags', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -180,6 +184,7 @@
var formParams = {
};
var authNames = ['petstore_auth', 'api_key'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = Pet;
@ -187,7 +192,7 @@
return this.apiClient.callApi(
'/pet/{petId}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -222,6 +227,7 @@
'status': status
};
var authNames = ['petstore_auth'];
var contentTypes = ['application/x-www-form-urlencoded'];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -229,7 +235,7 @@
return this.apiClient.callApi(
'/pet/{petId}', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -262,6 +268,7 @@
var formParams = {
};
var authNames = ['petstore_auth'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -269,7 +276,7 @@
return this.apiClient.callApi(
'/pet/{petId}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -304,6 +311,7 @@
'file': file
};
var authNames = ['petstore_auth'];
var contentTypes = ['multipart/form-data'];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -311,7 +319,7 @@
return this.apiClient.callApi(
'/pet/{petId}/uploadImage', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -343,6 +351,7 @@
var formParams = {
};
var authNames = ['petstore_auth', 'api_key'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = 'String';
@ -350,7 +359,7 @@
return this.apiClient.callApi(
'/pet/{petId}?testing_byte_array=true', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -375,6 +384,7 @@
var formParams = {
};
var authNames = ['petstore_auth'];
var contentTypes = ['application/json', 'application/xml'];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -382,7 +392,7 @@
return this.apiClient.callApi(
'/pet?testing_byte_array=true', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}

View File

@ -41,6 +41,7 @@
var formParams = {
};
var authNames = ['api_key'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = {'String': 'Integer'};
@ -48,7 +49,7 @@
return this.apiClient.callApi(
'/store/inventory', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -74,6 +75,7 @@
var formParams = {
};
var authNames = ['test_api_client_id', 'test_api_client_secret'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = Order;
@ -81,7 +83,7 @@
return this.apiClient.callApi(
'/store/order', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -113,6 +115,7 @@
var formParams = {
};
var authNames = ['test_api_key_query', 'test_api_key_header'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = Order;
@ -120,7 +123,7 @@
return this.apiClient.callApi(
'/store/order/{orderId}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -151,6 +154,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -158,7 +162,7 @@
return this.apiClient.callApi(
'/store/order/{orderId}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}

View File

@ -41,6 +41,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -48,7 +49,7 @@
return this.apiClient.callApi(
'/user', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -73,6 +74,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -80,7 +82,7 @@
return this.apiClient.callApi(
'/user/createWithArray', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -105,6 +107,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -112,7 +115,7 @@
return this.apiClient.callApi(
'/user/createWithList', 'POST',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -141,6 +144,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = 'String';
@ -148,7 +152,7 @@
return this.apiClient.callApi(
'/user/login', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -172,6 +176,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -179,7 +184,7 @@
return this.apiClient.callApi(
'/user/logout', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -211,6 +216,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = User;
@ -218,7 +224,7 @@
return this.apiClient.callApi(
'/user/{username}', 'GET',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -250,6 +256,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -257,7 +264,7 @@
return this.apiClient.callApi(
'/user/{username}', 'PUT',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}
@ -288,6 +295,7 @@
var formParams = {
};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = null;
@ -295,7 +303,7 @@
return this.apiClient.callApi(
'/user/{username}', 'DELETE',
pathParams, queryParams, headerParams, formParams, postBody,
contentTypes, accepts, returnType
authNames, contentTypes, accepts, returnType
);
}

View File

@ -23,7 +23,11 @@
this.authentications = {
'petstore_auth': {type: 'oauth2'},
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'}
'test_api_client_id': {type: 'apiKey', in: 'header', name: 'x-test_api_client_id'},
'test_api_client_secret': {type: 'apiKey', in: 'header', name: 'x-test_api_client_secret'},
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'},
'test_api_key_query': {type: 'apiKey', in: 'query', name: 'test_api_key_query'},
'test_api_key_header': {type: 'apiKey', in: 'header', name: 'test_api_key_header'}
};
/**
@ -207,7 +211,9 @@
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
var data = response.body;
if (data == null) {
return null;
// Superagent does not always produce a body; use the unparsed response
// as a fallback
data = response.text;
}
return ApiClient.convertToType(data, returnType);
};

View File

@ -102,7 +102,7 @@
var pathParams = {
};
var queryParams = {
'status': this.buildCollectionParam(status, 'multi')
'status': this.apiClient.buildCollectionParam(status, 'multi')
};
var headerParams = {
};
@ -137,7 +137,7 @@
var pathParams = {
};
var queryParams = {
'tags': this.buildCollectionParam(tags, 'multi')
'tags': this.apiClient.buildCollectionParam(tags, 'multi')
};
var headerParams = {
};
@ -184,7 +184,7 @@
var formParams = {
};
var authNames = ['api_key'];
var authNames = ['petstore_auth', 'api_key'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = Pet;
@ -351,7 +351,7 @@
var formParams = {
};
var authNames = ['api_key'];
var authNames = ['petstore_auth', 'api_key'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = 'String';

View File

@ -75,7 +75,7 @@
var formParams = {
};
var authNames = [];
var authNames = ['test_api_client_id', 'test_api_client_secret'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = Order;
@ -115,7 +115,7 @@
var formParams = {
};
var authNames = [];
var authNames = ['test_api_key_query', 'test_api_key_header'];
var contentTypes = [];
var accepts = ['application/json', 'application/xml'];
var returnType = Order;

View File

@ -12,8 +12,28 @@ describe('ApiClient', function() {
expect(apiClient).to.be.ok();
expect(apiClient.basePath).to.be('http://petstore.swagger.io/v2');
expect(apiClient.authentications).to.eql({
'petstore_auth': {type: 'oauth2'},
'api_key': {type: 'apiKey', in: 'header', name: 'api_key'}
petstore_auth: {type: 'oauth2'},
api_key: {type: 'apiKey', in: 'header', name: 'api_key'},
test_api_client_id: {
type: 'apiKey',
in: 'header',
name: 'x-test_api_client_id'
},
test_api_client_secret: {
type: 'apiKey',
in: 'header',
name: 'x-test_api_client_secret'
},
test_api_key_query: {
type: 'apiKey',
in: 'query',
name: 'test_api_key_query'
},
test_api_key_header: {
type: 'apiKey',
in: 'header',
name: 'test_api_key_header'
}
});
});

View File

@ -2,6 +2,10 @@
require_once('autoload.php');
// increase memory limit to avoid fatal error due to findPetByStatus
// returning a lot of data
ini_set('memory_limit', '256M');
class PetApiTest extends \PHPUnit_Framework_TestCase
{