forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen into issue1948
This commit is contained in:
commit
aa9e19f3d9
11
.gitignore
vendored
11
.gitignore
vendored
@ -43,6 +43,7 @@ samples/server-generator/scalatra/output/.history
|
||||
# nodejs
|
||||
samples/server-generator/node/output/node_modules
|
||||
samples/server/petstore/nodejs/node_modules
|
||||
samples/server/petstore/nodejs-server/node_modules
|
||||
|
||||
# qt5 cpp
|
||||
samples/client/petstore/qt5cpp/PetStore/moc_*
|
||||
@ -55,6 +56,12 @@ samples/client/petstore/qt5cpp/PetStore/Makefile
|
||||
**/.gradle/
|
||||
samples/client/petstore/java/hello.txt
|
||||
samples/client/petstore/android/default/hello.txt
|
||||
samples/client/petstore/android/volley/.gradle/
|
||||
samples/client/petstore/android/volley/build/
|
||||
samples/client/petstore/java/jersey2/.gradle/
|
||||
samples/client/petstore/java/jersey2/build/
|
||||
samples/client/petstore/java/okhttp-gson/.gradle/
|
||||
samples/client/petstore/java/okhttp-gson/build/
|
||||
|
||||
#PHP
|
||||
samples/client/petstore/php/SwaggerClient-php/composer.lock
|
||||
@ -87,6 +94,10 @@ samples/client/petstore/csharp/SwaggerClientTest/bin
|
||||
samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/vendor/
|
||||
samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/
|
||||
samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/
|
||||
samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/nuget.exe
|
||||
samples/client/petstore/csharp/SwaggerClientTest/TestResult.xml
|
||||
samples/client/petstore/csharp/SwaggerClientTest/nuget.exe
|
||||
samples/client/petstore/csharp/SwaggerClientTest/testrunner/
|
||||
|
||||
# Python
|
||||
*.pyc
|
||||
|
@ -65,7 +65,7 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
Swagger Codegen Version | Release Date | OpenAPI Spec compatibility | Notes
|
||||
-------------------------- | ------------ | -------------------------- | -----
|
||||
2.1.7-SNAPSHOT | | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
|
||||
2.1.6 (**current stable**) | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.5)
|
||||
2.1.6 (**current stable**) | 2016-04-06 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.6](https://github.com/swagger-api/swagger-codegen/tree/v2.1.6)
|
||||
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
|
||||
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)
|
||||
|
||||
|
@ -32,6 +32,7 @@ public class CodegenProperty {
|
||||
public Boolean exclusiveMinimum;
|
||||
public Boolean exclusiveMaximum;
|
||||
public Boolean hasMore, required, secondaryParam;
|
||||
public Boolean hasMoreNonReadOnly; // for model constructor, true if next properyt is not readonly
|
||||
public Boolean isPrimitiveType, isContainer, isNotContainer;
|
||||
public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;
|
||||
public Boolean isListContainer, isMapContainer;
|
||||
@ -63,6 +64,7 @@ public class CodegenProperty {
|
||||
result = prime * result + ((exclusiveMinimum == null) ? 0 : exclusiveMinimum.hashCode());
|
||||
result = prime * result + ((getter == null) ? 0 : getter.hashCode());
|
||||
result = prime * result + ((hasMore == null) ? 0 : hasMore.hashCode());
|
||||
result = prime * result + ((hasMoreNonReadOnly == null) ? 0 : hasMoreNonReadOnly.hashCode());
|
||||
result = prime * result + ((isContainer == null) ? 0 : isContainer.hashCode());
|
||||
result = prime * result + (isEnum ? 1231 : 1237);
|
||||
result = prime * result + ((isNotContainer == null) ? 0 : isNotContainer.hashCode());
|
||||
|
@ -2220,9 +2220,12 @@ public class DefaultCodegen {
|
||||
}
|
||||
|
||||
private void addVars(CodegenModel m, List<CodegenProperty> vars, Map<String, Property> properties, Set<String> mandatory) {
|
||||
final int totalCount = properties.size();
|
||||
int count = 0;
|
||||
for (Map.Entry<String, Property> entry : properties.entrySet()) {
|
||||
// convert set to list so that we can access the next entry in the loop
|
||||
List<Map.Entry<String, Property>> propertyList = new ArrayList<Map.Entry<String, Property>>(properties.entrySet());
|
||||
final int totalCount = propertyList.size();
|
||||
for (int i = 0; i < totalCount; i++) {
|
||||
Map.Entry<String, Property> entry = propertyList.get(i);
|
||||
|
||||
final String key = entry.getKey();
|
||||
final Property prop = entry.getValue();
|
||||
|
||||
@ -2236,13 +2239,19 @@ public class DefaultCodegen {
|
||||
// m.hasEnums to be set incorrectly if allProperties has enumerations but properties does not.
|
||||
m.hasEnums = true;
|
||||
}
|
||||
count++;
|
||||
if (count != totalCount) {
|
||||
|
||||
if (i+1 != totalCount) {
|
||||
cp.hasMore = true;
|
||||
// check the next entry to see if it's read only
|
||||
if (!Boolean.TRUE.equals(propertyList.get(i+1).getValue().getReadOnly())) {
|
||||
cp.hasMoreNonReadOnly = true; // next entry is not ready only
|
||||
}
|
||||
}
|
||||
|
||||
if (cp.isContainer != null) {
|
||||
addImport(m, typeMapping.get("array"));
|
||||
}
|
||||
|
||||
addImport(m, cp.baseType);
|
||||
addImport(m, cp.complexType);
|
||||
vars.add(cp);
|
||||
|
@ -101,6 +101,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("string", "string");
|
||||
typeMapping.put("binary", "byte[]");
|
||||
typeMapping.put("bytearray", "byte[]");
|
||||
typeMapping.put("boolean", "bool?");
|
||||
typeMapping.put("integer", "int?");
|
||||
typeMapping.put("float", "float?");
|
||||
|
@ -52,9 +52,8 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
Arrays.asList(
|
||||
"String",
|
||||
"bool",
|
||||
"num",
|
||||
"int",
|
||||
"float")
|
||||
"double")
|
||||
);
|
||||
instantiationTypes.put("array", "List");
|
||||
instantiationTypes.put("map", "Map");
|
||||
@ -66,11 +65,11 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("boolean", "bool");
|
||||
typeMapping.put("string", "String");
|
||||
typeMapping.put("int", "int");
|
||||
typeMapping.put("float", "num");
|
||||
typeMapping.put("float", "double");
|
||||
typeMapping.put("long", "int");
|
||||
typeMapping.put("short", "int");
|
||||
typeMapping.put("char", "String");
|
||||
typeMapping.put("double", "num");
|
||||
typeMapping.put("double", "double");
|
||||
typeMapping.put("object", "Object");
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("Date", "DateTime");
|
||||
|
@ -131,6 +131,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||
supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh"));
|
||||
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
|
||||
supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "Configuration.go"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -4,6 +4,7 @@ import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
@ -36,6 +37,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected String license = "MIT";
|
||||
protected String gitRepoURL = "https://github.com/swagger-api/swagger-codegen";
|
||||
protected String[] specialWords = {"new", "copy"};
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
public ObjcClientCodegen() {
|
||||
super();
|
||||
@ -46,6 +49,8 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
apiTemplateFiles.put("api-header.mustache", ".h");
|
||||
apiTemplateFiles.put("api-body.mustache", ".m");
|
||||
embeddedTemplateDir = templateDir = "objc";
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
|
||||
defaultIncludes.clear();
|
||||
defaultIncludes.add("bool");
|
||||
@ -199,6 +204,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
additionalProperties.put(GIT_REPO_URL, gitRepoURL);
|
||||
additionalProperties.put(LICENSE, license);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
String swaggerFolder = podName;
|
||||
|
||||
modelPackage = swaggerFolder;
|
||||
@ -388,6 +397,26 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace("/", File.separator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace("/", File.separator);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separatorChar + apiPackage();
|
||||
@ -562,4 +591,75 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
String example;
|
||||
|
||||
if (p.defaultValue == null) {
|
||||
example = p.example;
|
||||
} else {
|
||||
example = p.defaultValue;
|
||||
}
|
||||
|
||||
String type = p.baseType;
|
||||
if (type == null) {
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
if ("NSString*".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
}
|
||||
example = "@\"" + escapeText(example) + "\"";
|
||||
} else if ("NSNumber*".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
example = "@" + example;
|
||||
/* OBJC uses NSNumber to represent both int, long, double and float
|
||||
} else if ("Float".equalsIgnoreCase(type) || "Double".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
} */
|
||||
} else if ("BOOLEAN".equalsIgnoreCase(type) || "bool".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "True";
|
||||
}
|
||||
} else if ("NSURL*".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "/path/to/file";
|
||||
}
|
||||
//[NSURL fileURLWithPath:@"path/to/file"]
|
||||
example = "[NSURL fileURLWithPath:@\"" + escapeText(example) + "\"]";
|
||||
/*} else if ("NSDate".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20";
|
||||
}
|
||||
example = "'" + escapeText(example) + "'";*/
|
||||
} else if ("NSDate*".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20T19:20:30+01:00";
|
||||
}
|
||||
example = "@\"" + escapeText(example) + "\"";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
type = type.replace("*", "");
|
||||
// e.g. [[SWGPet alloc] init
|
||||
example = "[[" + type + " alloc] init]";
|
||||
} else {
|
||||
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
example = "NULL";
|
||||
} else if (Boolean.TRUE.equals(p.isListContainer)) {
|
||||
example = "@[" + example + "]";
|
||||
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
|
||||
example = "@{@\"key\" : " + example + "}";
|
||||
}
|
||||
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping = new HashMap<String, String>();
|
||||
typeMapping.put("integer", "int");
|
||||
typeMapping.put("long", "int");
|
||||
typeMapping.put("number", "float");
|
||||
typeMapping.put("float", "float");
|
||||
typeMapping.put("double", "double");
|
||||
typeMapping.put("string", "string");
|
||||
|
@ -3,6 +3,7 @@ package io.swagger.codegen.languages;
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
@ -17,6 +18,8 @@ import org.apache.commons.lang.StringUtils;
|
||||
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected String packageName;
|
||||
protected String packageVersion;
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
public PythonClientCodegen() {
|
||||
super();
|
||||
@ -28,6 +31,9 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
apiTemplateFiles.put("api.mustache", ".py");
|
||||
embeddedTemplateDir = templateDir = "python";
|
||||
|
||||
modelDocTemplateFiles.put("model_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
|
||||
languageSpecificPrimitives.clear();
|
||||
languageSpecificPrimitives.add("int");
|
||||
languageSpecificPrimitives.add("float");
|
||||
@ -36,6 +42,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
languageSpecificPrimitives.add("str");
|
||||
languageSpecificPrimitives.add("datetime");
|
||||
languageSpecificPrimitives.add("date");
|
||||
languageSpecificPrimitives.add("object");
|
||||
|
||||
typeMapping.clear();
|
||||
typeMapping.put("integer", "int");
|
||||
@ -97,6 +104,10 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName);
|
||||
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion);
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
String swaggerFolder = packageName;
|
||||
|
||||
modelPackage = swaggerFolder + File.separatorChar + "models";
|
||||
@ -138,6 +149,27 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return "_" + name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return toModelName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String apiFileFolder() {
|
||||
return outputFolder + File.separatorChar + apiPackage().replace('.', File.separatorChar);
|
||||
@ -388,4 +420,70 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
String example;
|
||||
|
||||
if (p.defaultValue == null) {
|
||||
example = p.example;
|
||||
} else {
|
||||
example = p.defaultValue;
|
||||
}
|
||||
|
||||
String type = p.baseType;
|
||||
if (type == null) {
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
if ("String".equalsIgnoreCase(type) || "str".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = p.paramName + "_example";
|
||||
}
|
||||
example = "'" + escapeText(example) + "'";
|
||||
} else if ("Integer".equals(type) || "int".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
} else if ("Float".equalsIgnoreCase(type) || "Double".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
}
|
||||
} else if ("BOOLEAN".equalsIgnoreCase(type) || "bool".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "True";
|
||||
}
|
||||
} else if ("file".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "/path/to/file";
|
||||
}
|
||||
example = "'" + escapeText(example) + "'";
|
||||
} else if ("Date".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20";
|
||||
}
|
||||
example = "'" + escapeText(example) + "'";
|
||||
} else if ("DateTime".equalsIgnoreCase(type)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20T19:20:30+01:00";
|
||||
}
|
||||
example = "'" + escapeText(example) + "'";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = this.packageName + "." + type + "()";
|
||||
} else {
|
||||
LOGGER.warn("Type " + type + " not handled properly in setParameterExampleValue");
|
||||
}
|
||||
|
||||
if (example == null) {
|
||||
example = "NULL";
|
||||
} else if (Boolean.TRUE.equals(p.isListContainer)) {
|
||||
example = "[" + example + "]";
|
||||
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
|
||||
example = "{'key': " + example + "}";
|
||||
}
|
||||
|
||||
p.example = example;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -74,6 +74,8 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
"Int",
|
||||
"Int32",
|
||||
"Int64",
|
||||
"Float",
|
||||
"Double",
|
||||
"Bool",
|
||||
@ -115,10 +117,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("string", "String");
|
||||
typeMapping.put("char", "Character");
|
||||
typeMapping.put("short", "Int");
|
||||
typeMapping.put("int", "Int");
|
||||
typeMapping.put("long", "Int");
|
||||
typeMapping.put("integer", "Int");
|
||||
typeMapping.put("Integer", "Int");
|
||||
typeMapping.put("int", "Int32");
|
||||
typeMapping.put("long", "Int64");
|
||||
typeMapping.put("integer", "Int32");
|
||||
typeMapping.put("Integer", "Int32");
|
||||
typeMapping.put("float", "Float");
|
||||
typeMapping.put("number", "Double");
|
||||
typeMapping.put("double", "Double");
|
||||
|
@ -46,6 +46,10 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided 'javax.annotation:jsr250-api:1.0'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
@ -41,7 +41,7 @@ namespace {{packageName}}.Model
|
||||
/// </summary>
|
||||
{{#vars}}{{^isReadOnly}} /// <param name="{{name}}">{{#description}}{{description}}{{/description}}{{^description}}{{name}}{{/description}}{{#required}} (required){{/required}}{{#defaultValue}} (default to {{defaultValue}}){{/defaultValue}}.</param>
|
||||
{{/isReadOnly}}{{/vars}}
|
||||
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{#hasMore}}, {{/hasMore}}{{/isReadOnly}}{{/vars}})
|
||||
public {{classname}}({{#vars}}{{^isReadOnly}}{{{datatypeWithEnum}}} {{name}} = null{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/isReadOnly}}{{/vars}})
|
||||
{
|
||||
{{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null)
|
||||
if ({{name}} == null)
|
||||
|
@ -18,5 +18,5 @@ part 'auth/http_basic_auth.dart';
|
||||
|
||||
{{#apiInfo}}{{#apis}}part 'api/{{classVarName}}_api.dart';
|
||||
{{/apis}}{{/apiInfo}}
|
||||
{{#models}}{{#model}}part 'model/{{classVarName}}.dart';
|
||||
{{#models}}{{#model}}part 'model/{{classFilename}}.dart';
|
||||
{{/model}}{{/models}}
|
@ -12,18 +12,22 @@ import (
|
||||
)
|
||||
|
||||
type {{classname}} struct {
|
||||
basePath string
|
||||
Configuration Configuration
|
||||
}
|
||||
|
||||
func New{{classname}}() *{{classname}}{
|
||||
configuration := NewConfiguration()
|
||||
return &{{classname}} {
|
||||
basePath: "{{basePath}}",
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
func New{{classname}}WithBasePath(basePath string) *{{classname}}{
|
||||
configuration := NewConfiguration()
|
||||
configuration.BasePath = basePath
|
||||
|
||||
return &{{classname}} {
|
||||
basePath: basePath,
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +41,7 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}}{
|
||||
//func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) {
|
||||
func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) {
|
||||
|
||||
_sling := sling.New().{{httpMethod}}(a.basePath)
|
||||
_sling := sling.New().{{httpMethod}}(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "{{basePathWithoutHost}}{{path}}"
|
||||
|
@ -0,0 +1,25 @@
|
||||
package {{packageName}}
|
||||
|
||||
import (
|
||||
|
||||
)
|
||||
|
||||
type Configuration struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
ApiKey string `json:"apiKey,omitempty"`
|
||||
Debug bool `json:"debug,omitempty"`
|
||||
DebugFile string `json:"debugFile,omitempty"`
|
||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||
Timeout int `json:"timeout,omitempty"`
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
return &Configuration{
|
||||
BasePath: "{{basePath}}",
|
||||
UserName: "",
|
||||
Debug: false,
|
||||
}
|
||||
}
|
@ -716,11 +716,11 @@ static void (^reachabilityChangeBlock)(int);
|
||||
for (NSString *auth in authSettings) {
|
||||
NSDictionary *authSetting = [[config authSettings] objectForKey:auth];
|
||||
|
||||
if (authSetting) {
|
||||
if ([authSetting[@"in"] isEqualToString:@"header"]) {
|
||||
if (authSetting) { // auth setting is set only if the key is non-empty
|
||||
if ([authSetting[@"in"] isEqualToString:@"header"] && [authSetting[@"key"] length] != 0) {
|
||||
[headersWithAuth setObject:authSetting[@"value"] forKey:authSetting[@"key"]];
|
||||
}
|
||||
else if ([authSetting[@"in"] isEqualToString:@"query"]) {
|
||||
else if ([authSetting[@"in"] isEqualToString:@"query"] && [authSetting[@"key"] length] != 0) {
|
||||
[querysWithAuth setObject:authSetting[@"value"] forKey:authSetting[@"key"]];
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@
|
||||
self.host = @"{{basePath}}";
|
||||
self.username = @"";
|
||||
self.password = @"";
|
||||
self.accessToken= @"";
|
||||
self.tempFolderPath = nil;
|
||||
self.debug = NO;
|
||||
self.verifySSL = YES;
|
||||
@ -42,18 +43,23 @@
|
||||
#pragma mark - Instance Methods
|
||||
|
||||
- (NSString *) getApiKeyWithPrefix:(NSString *)key {
|
||||
if ([self.apiKeyPrefix objectForKey:key] && [self.apiKey objectForKey:key]) {
|
||||
if ([self.apiKeyPrefix objectForKey:key] && [self.apiKey objectForKey:key] != (id)[NSNull null] && [[self.apiKey objectForKey:key] length] != 0) { // both api key prefix and api key are set
|
||||
return [NSString stringWithFormat:@"%@ %@", [self.apiKeyPrefix objectForKey:key], [self.apiKey objectForKey:key]];
|
||||
}
|
||||
else if ([self.apiKey objectForKey:key]) {
|
||||
else if ([self.apiKey objectForKey:key] != (id)[NSNull null] && [[self.apiKey objectForKey:key] length] != 0) { // only api key, no api key prefix
|
||||
return [NSString stringWithFormat:@"%@", [self.apiKey objectForKey:key]];
|
||||
}
|
||||
else {
|
||||
else { // return empty string if nothing is set
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) getBasicAuthToken {
|
||||
// return empty string if username and password are empty
|
||||
if (self.username.length == 0 && self.password.length == 0){
|
||||
return @"";
|
||||
}
|
||||
|
||||
NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", self.username, self.password];
|
||||
NSData *data = [basicAuthCredentials dataUsingEncoding:NSUTF8StringEncoding];
|
||||
basicAuthCredentials = [NSString stringWithFormat:@"Basic %@", [data base64EncodedStringWithOptions:0]];
|
||||
@ -61,6 +67,15 @@
|
||||
return basicAuthCredentials;
|
||||
}
|
||||
|
||||
- (NSString *) getAccessToken {
|
||||
if (self.accessToken.length == 0) { // token not set, return empty string
|
||||
return @"";
|
||||
}
|
||||
else {
|
||||
return [NSString stringWithFormat:@"BEARER %@", self.accessToken];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Setter Methods
|
||||
|
||||
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString *)identifier {
|
||||
@ -126,6 +141,15 @@
|
||||
@"value": [self getBasicAuthToken]
|
||||
},
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}
|
||||
@"{{name}}":
|
||||
@{
|
||||
@"type": @"oauth",
|
||||
@"in": @"header",
|
||||
@"key": @"Authorization",
|
||||
@"value": [self getAccessToken]
|
||||
},
|
||||
{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
};
|
||||
}
|
||||
|
@ -46,6 +46,11 @@
|
||||
*/
|
||||
@property (nonatomic) NSString *password;
|
||||
|
||||
/**
|
||||
* Access token for OAuth
|
||||
*/
|
||||
@property (nonatomic) NSString *accessToken;
|
||||
|
||||
/**
|
||||
* Temp folder for file download
|
||||
*/
|
||||
@ -132,6 +137,11 @@
|
||||
*/
|
||||
- (NSString *) getBasicAuthToken;
|
||||
|
||||
/**
|
||||
* Gets OAuth access token
|
||||
*/
|
||||
- (NSString *) getAccessToken;
|
||||
|
||||
/**
|
||||
* Gets Authentication Setings
|
||||
*/
|
||||
|
@ -1,20 +1,147 @@
|
||||
# {{podName}}
|
||||
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
|
||||
This ObjC package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
- Package version: {{artifactVersion}}
|
||||
- Build date: {{generatedDate}}
|
||||
- Build package: {{generatorClass}}
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
## Requirements
|
||||
|
||||
The API client library requires ARC (Automatic Reference Counting) to be enabled in your Xcode project.
|
||||
The SDK requires [**ARC (Automatic Reference Counting)**](http://stackoverflow.com/questions/7778356/how-to-enable-disable-automatic-reference-counting) to be enabled in the Xcode project.
|
||||
|
||||
## Installation
|
||||
## Installation & Usage
|
||||
### Install from Github using [CocoaPods](https://cocoapods.org/)
|
||||
|
||||
To install it, put the API client library in your project and then simply add the following line to your Podfile:
|
||||
Add the following to the Podfile:
|
||||
|
||||
```ruby
|
||||
pod "{{podName}}", :path => "/path/to/lib"
|
||||
pod '{{podName}}', :git => 'https://github.com/{{gitUserId}}/{{gitRepoId}}.git'
|
||||
```
|
||||
|
||||
To specify a particular branch, append `, :branch => 'branch-name-here'`
|
||||
|
||||
To specify a particular commit, append `, :commit => '11aa22'`
|
||||
|
||||
### Install from local path using [CocoaPods](https://cocoapods.org/)
|
||||
|
||||
Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/{{podName}}) and then add the following to the Podfile:
|
||||
|
||||
```ruby
|
||||
pod '{{podName}}', :path => 'Vendor/{{podName}}'
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Import the following:
|
||||
```objc
|
||||
#import <{{podName}}/{{{classPrefix}}}ApiClient.h>
|
||||
#import <{{podName}}/{{{classPrefix}}}Configuration.h>
|
||||
// load models
|
||||
{{#models}}{{#model}}#import <{{podName}}/{{{classname}}}.h>
|
||||
{{/model}}{{/models}}// load API classes for accessing endpoints
|
||||
{{#apiInfo}}{{#apis}}#import <{{podName}}/{{{classname}}}.h>
|
||||
{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issue.
|
||||
It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issue.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
```objc
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}
|
||||
{{#hasAuthMethods}}
|
||||
{{classPrefix}}Configuration *apiConfig = [{{classPrefix}}Configuration sharedConfig];
|
||||
{{#authMethods}}{{#isBasic}}// Configure HTTP basic authorization (authentication scheme: {{{name}}})
|
||||
[apiConfig setUsername:@"YOUR_USERNAME"];
|
||||
[apiConfig setPassword:@"YOUR_PASSWORD"];
|
||||
{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: (authentication scheme: {{{name}}})
|
||||
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"{{{keyParamName}}}"];
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
//[apiConfig setApiKeyPrefix:@"BEARER" forApiKeyIdentifier:@"{{{keyParamName}}}"];
|
||||
{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: (authentication scheme: {{{name}}})
|
||||
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
|
||||
{{/isOAuth}}{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{#allParams}}{{{dataType}}} *{{paramName}} = {{{example}}}; // {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
@try
|
||||
{
|
||||
{{classname}} *apiInstance = [[{{classname}} alloc] init];
|
||||
|
||||
{{#summary}} // {{{.}}}
|
||||
{{/summary}} [apiInstance {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{nickname}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}}
|
||||
{{paramName}}{{/secondaryParam}}:{{paramName}}{{/allParams}}
|
||||
{{#hasParams}}completionHandler: {{/hasParams}}^({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error)) {
|
||||
{{#returnType}}
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
}
|
||||
{{/returnType}}
|
||||
if (error) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
@catch (NSException *exception)
|
||||
{
|
||||
NSLog(@"Exception when calling {{classname}}->{{operationId}}: %@ ", exception.name);
|
||||
NSLog(@"Reason: %@ ", exception.reason);
|
||||
}
|
||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
{{^authMethods}} All endpoints do not require authorization.
|
||||
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||
{{#authMethods}}## {{{name}}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
- **API key parameter name**: {{{keyParamName}}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}- **Type**: OAuth
|
||||
- **Flow**: {{{flow}}}
|
||||
- **Authorizatoin URL**: {{{authorizationUrl}}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - **{{{scope}}}**: {{{description}}}
|
||||
{{/scopes}}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -0,0 +1,93 @@
|
||||
# {{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
# **{{{operationId}}}**
|
||||
```objc
|
||||
-(NSNumber*) {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{nickname}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}}
|
||||
{{paramName}}{{/secondaryParam}}: ({{{dataType}}}) {{paramName}}{{/allParams}}
|
||||
{{#hasParams}}completionHandler: {{/hasParams}}(void (^)({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error)) handler;
|
||||
```
|
||||
|
||||
{{{summary}}}{{#notes}}
|
||||
|
||||
{{{notes}}}{{/notes}}
|
||||
|
||||
### Example
|
||||
```objc
|
||||
{{#hasAuthMethods}}
|
||||
{{classPrefix}}Configuration *apiConfig = [{{classPrefix}}Configuration sharedConfig];
|
||||
{{#authMethods}}{{#isBasic}}// Configure HTTP basic authorization (authentication scheme: {{{name}}})
|
||||
[apiConfig setUsername:@"YOUR_USERNAME"];
|
||||
[apiConfig setPassword:@"YOUR_PASSWORD"];
|
||||
{{/isBasic}}{{#isApiKey}}
|
||||
// Configure API key authorization: (authentication scheme: {{{name}}})
|
||||
[apiConfig setApiKey:@"YOUR_API_KEY" forApiKeyIdentifier:@"{{{keyParamName}}}"];
|
||||
// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
//[apiConfig setApiKeyPrefix:@"BEARER" forApiKeyIdentifier:@"{{{keyParamName}}}"];
|
||||
{{/isApiKey}}{{#isOAuth}}
|
||||
// Configure OAuth2 access token for authorization: (authentication scheme: {{{name}}})
|
||||
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
|
||||
{{/isOAuth}}{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
{{#allParams}}{{{dataType}}} {{paramName}} = {{{example}}}; // {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
@try
|
||||
{
|
||||
{{classname}} *apiInstance = [[{{classname}} alloc] init];
|
||||
|
||||
{{#summary}} // {{{.}}}
|
||||
{{/summary}} [apiInstance {{#vendorExtensions.x-objc-operationId}}{{vendorExtensions.x-objc-operationId}}{{/vendorExtensions.x-objc-operationId}}{{^vendorExtensions.x-objc-operationId}}{{nickname}}{{#hasParams}}With{{vendorExtensions.firstParamAltName}}{{/hasParams}}{{^hasParams}}WithCompletionHandler: {{/hasParams}}{{/vendorExtensions.x-objc-operationId}}{{#allParams}}{{#secondaryParam}}
|
||||
{{paramName}}{{/secondaryParam}}:{{paramName}}{{/allParams}}
|
||||
{{#hasParams}}completionHandler: {{/hasParams}}^({{#returnBaseType}}{{{returnType}}} output, {{/returnBaseType}}NSError* error) {
|
||||
{{#returnType}}
|
||||
if (output) {
|
||||
NSLog(@"%@", output);
|
||||
}
|
||||
{{/returnType}}
|
||||
if (error) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
@catch (NSException *exception)
|
||||
{
|
||||
NSLog(@"Exception when calling {{classname}}->{{operationId}}: %@ ", exception.name);
|
||||
NSLog(@"Reason: %@ ", exception.reason);
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
@ -0,0 +1,11 @@
|
||||
{{#models}}{{#model}}# {{classname}}
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
|
||||
{{/vars}}
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
{{/model}}{{/models}}
|
@ -259,7 +259,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Accept (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderAccept($accept)
|
||||
public function selectHeaderAccept($accept)
|
||||
{
|
||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||
return null;
|
||||
@ -277,7 +277,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Content-Type (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderContentType($content_type)
|
||||
public function selectHeaderContentType($content_type)
|
||||
{
|
||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||
return 'application/json';
|
||||
@ -299,9 +299,9 @@ class ApiClient
|
||||
{
|
||||
// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
|
||||
$headers = array();
|
||||
$key = ''; // [+]
|
||||
$key = '';
|
||||
|
||||
foreach(explode("\n", $raw_headers) as $i => $h)
|
||||
foreach(explode("\n", $raw_headers) as $h)
|
||||
{
|
||||
$h = explode(':', $h, 2);
|
||||
|
||||
@ -311,26 +311,22 @@ class ApiClient
|
||||
$headers[$h[0]] = trim($h[1]);
|
||||
elseif (is_array($headers[$h[0]]))
|
||||
{
|
||||
// $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
|
||||
}
|
||||
else
|
||||
{
|
||||
// $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
|
||||
}
|
||||
|
||||
$key = $h[0]; // [+]
|
||||
$key = $h[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($h[0], 0, 1) == "\t")
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]);
|
||||
elseif (!$key)
|
||||
$headers[0] = trim($h[0]);trim($h[0]);
|
||||
}
|
||||
else // [+]
|
||||
{ // [+]
|
||||
if (substr($h[0], 0, 1) == "\t") // [+]
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]); // [+]
|
||||
elseif (!$key) // [+]
|
||||
$headers[0] = trim($h[0]);trim($h[0]); // [+]
|
||||
} // [+]
|
||||
}
|
||||
|
||||
return $headers;
|
||||
|
@ -55,14 +55,14 @@ class ObjectSerializer
|
||||
public static function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif ($data instanceof \DateTime) {
|
||||
$sanitized = $data->format(\DateTime::ATOM);
|
||||
return $data->format(\DateTime::ATOM);
|
||||
} elseif (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = self::sanitizeForSerialization($value);
|
||||
}
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::swaggerTypes()) as $property) {
|
||||
@ -71,12 +71,10 @@ class ObjectSerializer
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($data->$getter());
|
||||
}
|
||||
}
|
||||
$sanitized = (object)$values;
|
||||
return (object)$values;
|
||||
} else {
|
||||
$sanitized = (string)$data;
|
||||
return (string)$data;
|
||||
}
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,7 +222,7 @@ class ObjectSerializer
|
||||
public static function deserialize($data, $class, $httpHeaders=null, $discriminator=null)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
|
||||
$inner = substr($class, 4, -1);
|
||||
$deserialized = array();
|
||||
@ -235,16 +233,17 @@ class ObjectSerializer
|
||||
$deserialized[$key] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
}
|
||||
return $deserialized;
|
||||
} elseif (strcasecmp(substr($class, -2), '[]') == 0) {
|
||||
$subClass = substr($class, 0, -2);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
$deserialized = $values;
|
||||
return $values;
|
||||
} elseif ($class === 'object') {
|
||||
settype($data, 'array');
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\DateTime') {
|
||||
// Some API's return an invalid, empty string as a
|
||||
// date-time property. DateTime::__construct() will return
|
||||
@ -253,13 +252,13 @@ class ObjectSerializer
|
||||
// be interpreted as a missing field/value. Let's handle
|
||||
// this graceful.
|
||||
if (!empty($data)) {
|
||||
$deserialized = new \DateTime($data);
|
||||
return new \DateTime($data);
|
||||
} else {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
}
|
||||
} elseif (in_array($class, array({{&primitives}}))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
// determine file name
|
||||
if (array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
||||
@ -270,6 +269,7 @@ class ObjectSerializer
|
||||
$deserialized = new \SplFileObject($filename, "w");
|
||||
$byte_written = $deserialized->fwrite($data);
|
||||
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.\n", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
||||
return $deserialized;
|
||||
|
||||
} else {
|
||||
// If a discriminator is defined and points to a valid subclass, use it.
|
||||
@ -292,9 +292,7 @@ class ObjectSerializer
|
||||
$instance->$propertySetter(self::deserialize($propertyValue, $type, null, $discriminator));
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
return $instance;
|
||||
}
|
||||
|
||||
return $deserialized;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
*/
|
||||
public function {{operationId}}({{#allParams}}${{paramName}}{{^required}} = null{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
list($response) = $this->{{operationId}}WithHttpInfo ({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -130,11 +130,11 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array({{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array({{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}}));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array({{#consumes}}'{{mediaType}}'{{#hasMore}},{{/hasMore}}{{/consumes}}));
|
||||
|
||||
{{#queryParams}}// query params
|
||||
{{#collectionFormat}}
|
||||
@ -223,14 +223,14 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\{{invokerPackage}}\ObjectSerializer::deserialize($response, '{{returnType}}', $httpHeader{{#discriminator}}, '{{discriminator}}'{{/discriminator}}), $statusCode, $httpHeader);
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '{{returnType}}', $httpHeader{{#discriminator}}, '{{discriminator}}'{{/discriminator}}), $statusCode, $httpHeader);
|
||||
{{/returnType}}{{^returnType}}
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
{{/returnType}}
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) { {{#responses}}{{#dataType}}
|
||||
{{^isWildcard}}case {{code}}:{{/isWildcard}}{{#isWildcard}}default:{{/isWildcard}}
|
||||
$data = \{{invokerPackage}}\ObjectSerializer::deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '{{dataType}}', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;{{/dataType}}{{/responses}}
|
||||
}
|
||||
|
@ -192,11 +192,11 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
|
||||
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
{{/model}}
|
||||
|
@ -1,73 +1,122 @@
|
||||
# {{packageName}}
|
||||
{{#appDescription}}
|
||||
{{{appDescription}}}
|
||||
{{/appDescription}}
|
||||
|
||||
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: {{appVersion}}
|
||||
- Package version: {{packageVersion}}
|
||||
- Build date: {{generatedDate}}
|
||||
- Build package: {{generatorClass}}
|
||||
{{#infoUrl}}
|
||||
For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}})
|
||||
{{/infoUrl}}
|
||||
|
||||
## Requirements.
|
||||
Python 2.7 and later.
|
||||
|
||||
## Setuptools
|
||||
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
|
||||
Python 2.7 and 3.4+
|
||||
|
||||
## Installation & Usage
|
||||
### pip install
|
||||
|
||||
If the python package is hosted on Github, you can install directly from Github
|
||||
|
||||
```sh
|
||||
python setup.py install
|
||||
pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git
|
||||
```
|
||||
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/{{{gitUserId}}}/{{{gitRepoId}}}.git`)
|
||||
|
||||
Then import the package:
|
||||
```python
|
||||
import {{{packageName}}}
|
||||
```
|
||||
|
||||
Or you can install from Github via pip:
|
||||
### Setuptools
|
||||
|
||||
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
|
||||
|
||||
```sh
|
||||
pip install git+https://github.com/geekerzp/swagger_client.git
|
||||
python setup.py install --user
|
||||
```
|
||||
(or `sudo python setup.py install` to install the package for all users)
|
||||
|
||||
To use the bindings, import the pacakge:
|
||||
|
||||
Then import the package:
|
||||
```python
|
||||
import swagger_client
|
||||
```
|
||||
|
||||
## Manual Installation
|
||||
If you do not wish to use setuptools, you can download the latest release.
|
||||
Then, to use the bindings, import the package:
|
||||
|
||||
```python
|
||||
import path.to.swagger_client
|
||||
import {{{packageName}}}
|
||||
```
|
||||
|
||||
## Getting Started
|
||||
|
||||
TODO
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
## Documentation
|
||||
```python
|
||||
import time
|
||||
import {{{packageName}}}
|
||||
from {{{packageName}}}.rest import ApiException
|
||||
from pprint import pprint
|
||||
{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
||||
# Configure HTTP basic authorization: {{{name}}}
|
||||
{{{packageName}}}.configuration.username = 'YOUR_USERNAME'
|
||||
{{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
|
||||
# Configure API key authorization: {{{name}}}
|
||||
{{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
|
||||
# Configure OAuth2 access token for authorization: {{{name}}}
|
||||
{{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
# create an instance of the API class
|
||||
api_instance = {{{packageName}}}.{{{classname}}}
|
||||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
TODO
|
||||
|
||||
## Tests
|
||||
|
||||
(Please make sure you have [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) installed)
|
||||
|
||||
Execute the following command to run the tests in the current Python (v2 or v3) environment:
|
||||
|
||||
```sh
|
||||
$ make test
|
||||
[... magically installs dependencies and runs tests on your virtualenv]
|
||||
Ran 7 tests in 19.289s
|
||||
|
||||
OK
|
||||
try:
|
||||
{{#summary}} # {{{.}}}
|
||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
||||
pprint(api_response){{/returnType}}
|
||||
except ApiException as e:
|
||||
print "Exception when calling {{classname}}->{{operationId}}: %s\n" % e
|
||||
{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}}
|
||||
```
|
||||
or
|
||||
|
||||
```
|
||||
$ mvn integration-test -rf :PythonPetstoreClientTests
|
||||
Using 2195432783 as seed
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] BUILD SUCCESS
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Total time: 37.594 s
|
||||
[INFO] Finished at: 2015-05-16T18:00:35+08:00
|
||||
[INFO] Final Memory: 11M/156M
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
```
|
||||
If you want to run the tests in all the python platforms:
|
||||
## Documentation for API Endpoints
|
||||
|
||||
```sh
|
||||
$ make test-all
|
||||
[... tox creates a virtualenv for every platform and runs tests inside of each]
|
||||
py27: commands succeeded
|
||||
py34: commands succeeded
|
||||
congratulations :)
|
||||
```
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
{{^authMethods}} All endpoints do not require authorization.
|
||||
{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}}
|
||||
{{#authMethods}}## {{{name}}}
|
||||
|
||||
{{#isApiKey}}- **Type**: API key
|
||||
- **API key parameter name**: {{{keyParamName}}}
|
||||
- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}}
|
||||
{{/isApiKey}}
|
||||
{{#isBasic}}- **Type**: HTTP basic authentication
|
||||
{{/isBasic}}
|
||||
{{#isOAuth}}- **Type**: OAuth
|
||||
- **Flow**: {{{flow}}}
|
||||
- **Authorizatoin URL**: {{{authorizationUrl}}}
|
||||
- **Scopes**: {{^scopes}}N/A{{/scopes}}
|
||||
{{#scopes}} - **{{{scope}}}**: {{{description}}}
|
||||
{{/scopes}}
|
||||
{{/isOAuth}}
|
||||
|
||||
{{/authMethods}}
|
||||
|
||||
## Author
|
||||
|
||||
{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}}
|
||||
{{/hasMore}}{{/apis}}{{/apiInfo}}
|
||||
|
@ -47,7 +47,7 @@ class {{classname}}(object):
|
||||
self.api_client = config.api_client
|
||||
{{#operation}}
|
||||
|
||||
def {{nickname}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs):
|
||||
def {{operationId}}(self, {{#sortParamsByRequiredFlag}}{{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}{{/sortParamsByRequiredFlag}}**kwargs):
|
||||
"""
|
||||
{{{summary}}}
|
||||
{{{notes}}}
|
||||
@ -59,10 +59,10 @@ class {{classname}}(object):
|
||||
>>> pprint(response)
|
||||
>>>
|
||||
{{#sortParamsByRequiredFlag}}
|
||||
>>> thread = api.{{nickname}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function)
|
||||
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}callback=callback_function)
|
||||
{{/sortParamsByRequiredFlag}}
|
||||
{{^sortParamsByRequiredFlag}}
|
||||
>>> thread = api.{{nickname}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function)
|
||||
>>> thread = api.{{operationId}}({{#allParams}}{{#required}}{{paramName}}={{paramName}}_value, {{/required}}{{/allParams}}callback=callback_function)
|
||||
{{/sortParamsByRequiredFlag}}
|
||||
|
||||
:param callback function: The callback function
|
||||
@ -83,7 +83,7 @@ class {{classname}}(object):
|
||||
if key not in all_params:
|
||||
raise TypeError(
|
||||
"Got an unexpected keyword argument '%s'"
|
||||
" to method {{nickname}}" % key
|
||||
" to method {{operationId}}" % key
|
||||
)
|
||||
params[key] = val
|
||||
del params['kwargs']
|
||||
@ -92,7 +92,7 @@ class {{classname}}(object):
|
||||
{{#required}}
|
||||
# verify the required parameter '{{paramName}}' is set
|
||||
if ('{{paramName}}' not in params) or (params['{{paramName}}'] is None):
|
||||
raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{nickname}}`")
|
||||
raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`")
|
||||
{{/required}}
|
||||
{{/allParams}}
|
||||
|
||||
|
@ -371,7 +371,8 @@ class ApiClient(object):
|
||||
elif method == "DELETE":
|
||||
return self.rest_client.DELETE(url,
|
||||
query_params=query_params,
|
||||
headers=headers)
|
||||
headers=headers,
|
||||
body=body)
|
||||
else:
|
||||
raise ValueError(
|
||||
"http method must be `GET`, `HEAD`,"
|
||||
|
@ -0,0 +1,74 @@
|
||||
# {{packageName}}.{{classname}}{{#description}}
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
# **{{{operationId}}}**
|
||||
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{#required}}{{{paramName}}}{{/required}}{{^required}}{{{paramName}}}={{{paramName}}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
|
||||
|
||||
{{{summary}}}{{#notes}}
|
||||
|
||||
{{{notes}}}{{/notes}}
|
||||
|
||||
### Example
|
||||
```python
|
||||
import time
|
||||
import {{{packageName}}}
|
||||
from {{{packageName}}}.rest import ApiException
|
||||
from pprint import pprint
|
||||
{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}}
|
||||
# Configure HTTP basic authorization: {{{name}}}
|
||||
{{{packageName}}}.configuration.username = 'YOUR_USERNAME'
|
||||
{{{packageName}}}.configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}}
|
||||
# Configure API key authorization: {{{name}}}
|
||||
{{{packageName}}}.configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY'
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# {{{packageName}}}.configuration.api_key_prefix['{{{keyParamName}}}'] = 'BEARER'{{/isApiKey}}{{#isOAuth}}
|
||||
# Configure OAuth2 access token for authorization: {{{name}}}
|
||||
{{{packageName}}}.configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}}
|
||||
{{/hasAuthMethods}}
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = {{{packageName}}}.{{{classname}}}()
|
||||
{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
try:
|
||||
{{#summary}} # {{{.}}}
|
||||
{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}}
|
||||
pprint(api_response){{/returnType}}
|
||||
except ApiException as e:
|
||||
print "Exception when calling {{classname}}->{{operationId}}: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}}
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||
{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}
|
||||
{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
@ -0,0 +1,11 @@
|
||||
{{#models}}{{#model}}# {{classname}}
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
|
||||
{{/vars}}
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
{{/model}}{{/models}}
|
@ -133,8 +133,8 @@ class RESTClientObject(object):
|
||||
headers['Content-Type'] = 'application/json'
|
||||
|
||||
try:
|
||||
# For `POST`, `PUT`, `PATCH`, `OPTIONS`
|
||||
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS']:
|
||||
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
||||
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
||||
if query_params:
|
||||
url += '?' + urlencode(query_params)
|
||||
if headers['Content-Type'] == 'application/json':
|
||||
@ -154,7 +154,7 @@ class RESTClientObject(object):
|
||||
fields=post_params,
|
||||
encode_multipart=True,
|
||||
headers=headers)
|
||||
# For `GET`, `HEAD`, `DELETE`
|
||||
# For `GET`, `HEAD`
|
||||
else:
|
||||
r = self.pool_manager.request(method, url,
|
||||
fields=query_params,
|
||||
@ -195,10 +195,11 @@ class RESTClientObject(object):
|
||||
post_params=post_params,
|
||||
body=body)
|
||||
|
||||
def DELETE(self, url, headers=None, query_params=None):
|
||||
def DELETE(self, url, headers=None, query_params=None, body=None):
|
||||
return self.request("DELETE", url,
|
||||
headers=headers,
|
||||
query_params=query_params)
|
||||
query_params=query_params,
|
||||
body=body)
|
||||
|
||||
def POST(self, url, headers=None, query_params=None, post_params=None, body=None):
|
||||
return self.request("POST", url,
|
||||
|
@ -21,7 +21,7 @@ module {{moduleName}}
|
||||
{{#allParams}}{{^required}} # @option opts [{{{dataType}}}] :{{paramName}} {{description}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}}
|
||||
{{/required}}{{/allParams}} # @return [{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}nil{{/returnType}}]
|
||||
def {{operationId}}({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts = {})
|
||||
{{#returnType}}data, status_code, headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts)
|
||||
{{#returnType}}data, _status_code, _headers = {{/returnType}}{{operationId}}_with_http_info({{#allParams}}{{#required}}{{paramName}}, {{/required}}{{/allParams}}opts)
|
||||
{{#returnType}}return data{{/returnType}}{{^returnType}}return nil{{/returnType}}
|
||||
end
|
||||
|
||||
@ -58,12 +58,12 @@ module {{moduleName}}
|
||||
header_params = {}
|
||||
|
||||
# HTTP header 'Accept' (if needed)
|
||||
_header_accept = [{{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]
|
||||
_header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
|
||||
local_header_accept = [{{#produces}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/produces}}]
|
||||
local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
|
||||
|
||||
# HTTP header 'Content-Type'
|
||||
_header_content_type = [{{#consumes}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type){{#headerParams}}{{#required}}
|
||||
local_header_content_type = [{{#consumes}}'{{mediaType}}'{{#hasMore}}, {{/hasMore}}{{/consumes}}]
|
||||
header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type){{#headerParams}}{{#required}}
|
||||
header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param({{{paramName}}}, :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}{{{paramName}}}{{/collectionFormat}}{{/required}}{{/headerParams}}{{#headerParams}}{{^required}}
|
||||
header_params[:'{{{baseName}}}'] = {{#collectionFormat}}@api_client.build_collection_param(opts[:'{{{paramName}}}'], :{{{collectionFormat}}}){{/collectionFormat}}{{^collectionFormat}}opts[:'{{{paramName}}}']{{/collectionFormat}} if opts[:'{{{paramName}}}']{{/required}}{{/headerParams}}
|
||||
|
||||
|
@ -19,6 +19,8 @@ module {{moduleName}}
|
||||
# @return [Hash]
|
||||
attr_accessor :default_headers
|
||||
|
||||
# Initializes the ApiClient
|
||||
# @option config [Configuration] Configuraiton for initializing the object, default to Configuration.default
|
||||
def initialize(config = Configuration.default)
|
||||
@config = config
|
||||
@user_agent = "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/#{VERSION}/ruby{{/httpUserAgent}}"
|
||||
@ -59,6 +61,15 @@ module {{moduleName}}
|
||||
return data, response.code, response.headers
|
||||
end
|
||||
|
||||
# Builds the HTTP request
|
||||
#
|
||||
# @param [String] http_method HTTP method/verb (e.g. POST)
|
||||
# @param [String] path URL path (e.g. /account/new)
|
||||
# @option opts [Hash] :header_params Header parameters
|
||||
# @option opts [Hash] :query_params Query parameters
|
||||
# @option opts [Hash] :form_params Query parameters
|
||||
# @option opts [Object] :body HTTP body (JSON/XML)
|
||||
# @return [Typhoeus::Request] A Typhoeus Request
|
||||
def build_request(http_method, path, opts = {})
|
||||
url = build_request_url(path)
|
||||
http_method = http_method.to_sym.downcase
|
||||
@ -100,12 +111,15 @@ module {{moduleName}}
|
||||
# application/json
|
||||
# application/json; charset=UTF8
|
||||
# APPLICATION/JSON
|
||||
# @param [String] mime MIME
|
||||
# @return [Boolean] True if the MIME is applicaton/json
|
||||
def json_mime?(mime)
|
||||
!!(mime =~ /\Aapplication\/json(;.*)?\z/i)
|
||||
!(mime =~ /\Aapplication\/json(;.*)?\z/i).nil?
|
||||
end
|
||||
|
||||
# Deserialize the response to the given return type.
|
||||
#
|
||||
# @param [Response] response HTTP response
|
||||
# @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
|
||||
def deserialize(response, return_type)
|
||||
body = response.body
|
||||
@ -136,6 +150,9 @@ module {{moduleName}}
|
||||
end
|
||||
|
||||
# Convert data to the given return type.
|
||||
# @param [Object] data Data to be converted
|
||||
# @param [String] return_type Return type
|
||||
# @return [Mixed] Data in a particular type
|
||||
def convert_to_type(data, return_type)
|
||||
return nil if data.nil?
|
||||
case return_type
|
||||
@ -208,7 +225,7 @@ module {{moduleName}}
|
||||
# @param [String] filename the filename to be sanitized
|
||||
# @return [String] the sanitized filename
|
||||
def sanitize_filename(filename)
|
||||
filename.gsub /.*[\/\\]/, ''
|
||||
filename.gsub(/.*[\/\\]/, '')
|
||||
end
|
||||
|
||||
def build_request_url(path)
|
||||
@ -217,6 +234,12 @@ module {{moduleName}}
|
||||
URI.encode(@config.base_url + path)
|
||||
end
|
||||
|
||||
# Builds the HTTP request body
|
||||
#
|
||||
# @param [Hash] header_params Header parameters
|
||||
# @param [Hash] form_params Query parameters
|
||||
# @param [Object] body HTTP body (JSON/XML)
|
||||
# @return [String] HTTP body data in the form of string
|
||||
def build_request_body(header_params, form_params, body)
|
||||
# http form
|
||||
if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
||||
@ -240,6 +263,10 @@ module {{moduleName}}
|
||||
end
|
||||
|
||||
# Update hearder and query params based on authentication settings.
|
||||
#
|
||||
# @param [Hash] header_params Header parameters
|
||||
# @param [Hash] form_params Query parameters
|
||||
# @param [String] auth_names Authentication scheme name
|
||||
def update_params_for_auth!(header_params, query_params, auth_names)
|
||||
Array(auth_names).each do |auth_name|
|
||||
auth_setting = @config.auth_settings[auth_name]
|
||||
@ -252,6 +279,9 @@ module {{moduleName}}
|
||||
end
|
||||
end
|
||||
|
||||
# Sets user agent in HTTP header
|
||||
#
|
||||
# @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
|
||||
def user_agent=(user_agent)
|
||||
@user_agent = user_agent
|
||||
@default_headers['User-Agent'] = @user_agent
|
||||
@ -283,13 +313,13 @@ module {{moduleName}}
|
||||
# @return [String] JSON string representation of the object
|
||||
def object_to_http_body(model)
|
||||
return model if model.nil? || model.is_a?(String)
|
||||
_body = nil
|
||||
local_body = nil
|
||||
if model.is_a?(Array)
|
||||
_body = model.map{|m| object_to_hash(m) }
|
||||
local_body = model.map{|m| object_to_hash(m) }
|
||||
else
|
||||
_body = object_to_hash(model)
|
||||
local_body = object_to_hash(model)
|
||||
end
|
||||
_body.to_json
|
||||
local_body.to_json
|
||||
end
|
||||
|
||||
# Convert object(non-array) to hash.
|
||||
|
@ -1,23 +1,27 @@
|
||||
# build the object from hash
|
||||
# Builds the object from hash
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
# @return [Object] Returns the model itself
|
||||
def build_from_hash(attributes)
|
||||
return nil unless attributes.is_a?(Hash)
|
||||
self.class.swagger_types.each_pair do |key, type|
|
||||
if type =~ /^Array<(.*)>/i
|
||||
# check to ensure the input is an array given that the the attribute
|
||||
# is documented as an array but the input is not
|
||||
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
||||
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
||||
else
|
||||
#TODO show warning in debug mode
|
||||
end
|
||||
elsif !attributes[self.class.attribute_map[key]].nil?
|
||||
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
||||
else
|
||||
# data not found in attributes(hash), not an issue as the data can be optional
|
||||
end
|
||||
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
||||
end
|
||||
|
||||
self
|
||||
end
|
||||
|
||||
# Deserializes the data based on type
|
||||
# @param string type Data type
|
||||
# @param string value Value to be deserialized
|
||||
# @return [Object] Deserialized data
|
||||
def _deserialize(type, value)
|
||||
case type.to_sym
|
||||
when :DateTime
|
||||
@ -51,21 +55,25 @@
|
||||
end
|
||||
end
|
||||
else # model
|
||||
_model = {{moduleName}}.const_get(type).new
|
||||
_model.build_from_hash(value)
|
||||
temp_model = {{moduleName}}.const_get(type).new
|
||||
temp_model.build_from_hash(value)
|
||||
end
|
||||
end
|
||||
|
||||
# Returns the string representation of the object
|
||||
# @return [String] String presentation of the object
|
||||
def to_s
|
||||
to_hash.to_s
|
||||
end
|
||||
|
||||
# to_body is an alias to to_body (backward compatibility))
|
||||
# to_body is an alias to to_hash (backward compatibility)
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_body
|
||||
to_hash
|
||||
end
|
||||
|
||||
# return the object in the form of hash
|
||||
# Returns the object in the form of hash
|
||||
# @return [Hash] Returns the object in the form of hash
|
||||
def to_hash
|
||||
hash = {}
|
||||
self.class.attribute_map.each_pair do |attr, param|
|
||||
@ -76,8 +84,10 @@
|
||||
hash
|
||||
end
|
||||
|
||||
# Method to output non-array value in the form of hash
|
||||
# Outputs non-array value in the form of hash
|
||||
# For object, use to_hash. Otherwise, just return the value
|
||||
# @param [Object] value Any valid value
|
||||
# @return [Hash] Returns the value in the form of hash
|
||||
def _to_hash(value)
|
||||
if value.is_a?(Array)
|
||||
value.compact.map{ |v| _to_hash(v) }
|
||||
|
@ -28,11 +28,13 @@ module {{moduleName}}{{#models}}{{#model}}{{#description}}
|
||||
}
|
||||
end
|
||||
|
||||
# Initializes the object
|
||||
# @param [Hash] attributes Model attributes in the form of hash
|
||||
def initialize(attributes = {})
|
||||
return unless attributes.is_a?(Hash)
|
||||
|
||||
# convert string to symbol for hash key
|
||||
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
||||
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
||||
|
||||
{{#vars}}
|
||||
if attributes[:'{{{baseName}}}']
|
||||
@ -46,6 +48,7 @@ module {{moduleName}}{{#models}}{{#model}}{{#description}}
|
||||
end
|
||||
{{#vars}}{{#isEnum}}
|
||||
# Custom attribute writer method checking allowed values (enum).
|
||||
# @param [Object] {{{name}}} Object to be assigned
|
||||
def {{{name}}}=({{{name}}})
|
||||
allowed_values = [{{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]
|
||||
if {{{name}}} && !allowed_values.include?({{{name}}})
|
||||
@ -54,7 +57,8 @@ module {{moduleName}}{{#models}}{{#model}}{{#description}}
|
||||
@{{{name}}} = {{{name}}}
|
||||
end
|
||||
{{/isEnum}}{{/vars}}
|
||||
# Check equality by comparing each attribute.
|
||||
# Checks equality by comparing each attribute.
|
||||
# @param [Object] Object to be compared
|
||||
def ==(o)
|
||||
return true if self.equal?(o)
|
||||
self.class == o.class{{#vars}} &&
|
||||
@ -62,11 +66,13 @@ module {{moduleName}}{{#models}}{{#model}}{{#description}}
|
||||
end
|
||||
|
||||
# @see the `==` method
|
||||
# @param [Object] Object to be compared
|
||||
def eql?(o)
|
||||
self == o
|
||||
end
|
||||
|
||||
# Calculate hash code according to all attributes.
|
||||
# Calculates hash code according to all attributes.
|
||||
# @return [Fixnum] Hash code
|
||||
def hash
|
||||
[{{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}].hash
|
||||
end
|
||||
|
@ -19,6 +19,14 @@ extension Int: JSONEncodable {
|
||||
func encodeToJSON() -> AnyObject { return self }
|
||||
}
|
||||
|
||||
extension Int32: JSONEncodable {
|
||||
func encodeToJSON() -> AnyObject { return NSNumber(int: self) }
|
||||
}
|
||||
|
||||
extension Int64: JSONEncodable {
|
||||
func encodeToJSON() -> AnyObject { return NSNumber(longLong: self) }
|
||||
}
|
||||
|
||||
extension Double: JSONEncodable {
|
||||
func encodeToJSON() -> AnyObject { return self }
|
||||
}
|
||||
|
@ -56,6 +56,12 @@ class Decoders {
|
||||
|
||||
static func decode<T>(clazz clazz: T.Type, source: AnyObject) -> T {
|
||||
initialize()
|
||||
if T.self is Int32.Type && source is NSNumber {
|
||||
return source.intValue as! T;
|
||||
}
|
||||
if T.self is Int64.Type && source is NSNumber {
|
||||
return source.longLongValue as! T;
|
||||
}
|
||||
if source is T {
|
||||
return source as! T
|
||||
}
|
||||
|
@ -25,8 +25,10 @@ public class {{classname}}: JSONEncodable {
|
||||
|
||||
// MARK: JSONEncodable
|
||||
func encodeToJSON() -> AnyObject {
|
||||
var nillableDictionary = [String:AnyObject?](){{#vars}}{{#isNotContainer}}{{#isPrimitiveType}}{{^isEnum}}
|
||||
nillableDictionary["{{baseName}}"] = self.{{name}}{{/isEnum}}{{/isPrimitiveType}}{{#isEnum}}
|
||||
var nillableDictionary = [String:AnyObject?](){{#vars}}{{#isNotContainer}}{{#isPrimitiveType}}{{^isEnum}}{{#isInteger}}
|
||||
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isInteger}}{{#isLong}}
|
||||
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isLong}}{{^isLong}}{{^isInteger}}
|
||||
nillableDictionary["{{baseName}}"] = self.{{name}}{{/isInteger}}{{/isLong}}{{/isEnum}}{{/isPrimitiveType}}{{#isEnum}}
|
||||
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.rawValue{{/isEnum}}{{^isPrimitiveType}}
|
||||
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isPrimitiveType}}{{/isNotContainer}}{{#isContainer}}
|
||||
nillableDictionary["{{baseName}}"] = self.{{name}}{{^unwrapRequired}}?{{/unwrapRequired}}{{#unwrapRequired}}{{^required}}?{{/required}}{{/unwrapRequired}}.encodeToJSON(){{/isContainer}}{{/vars}}
|
||||
|
@ -1314,12 +1314,16 @@
|
||||
},
|
||||
"Name": {
|
||||
"description": "Model for testing model name same as property name",
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"snake_case": {
|
||||
"readOnly": true,
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
}
|
||||
@ -1375,6 +1379,59 @@
|
||||
"type" : "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"format_test" : {
|
||||
"type" : "object",
|
||||
"required": [
|
||||
"number"
|
||||
],
|
||||
"properties" : {
|
||||
"integer" : {
|
||||
"type": "integer"
|
||||
},
|
||||
"int32" : {
|
||||
"type": "integer",
|
||||
"format": "int32"
|
||||
},
|
||||
"int64" : {
|
||||
"type": "integer",
|
||||
"format": "int64"
|
||||
},
|
||||
"number" : {
|
||||
"type": "number"
|
||||
},
|
||||
"float" : {
|
||||
"type": "number",
|
||||
"format": "float"
|
||||
},
|
||||
"double" : {
|
||||
"type": "number",
|
||||
"format": "double"
|
||||
},
|
||||
"string" : {
|
||||
"type": "string"
|
||||
},
|
||||
"byte" : {
|
||||
"type": "string",
|
||||
"format": "byte"
|
||||
},
|
||||
"binary" : {
|
||||
"type": "string",
|
||||
"format": "binary"
|
||||
},
|
||||
"date" : {
|
||||
"type": "string",
|
||||
"format": "date"
|
||||
},
|
||||
"dateTime" : {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"dateTime" : {
|
||||
"type": "string",
|
||||
"format": "password"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ info:
|
||||
For this sample, you can use the api key `special-key` to test the authorization filters
|
||||
version: "1.0.0"
|
||||
title: Swagger Petstore
|
||||
termsOfService: http://helloreverb.com/terms/
|
||||
termsOfService: http://swagger.io/terms/
|
||||
contact:
|
||||
name: apiteam@swagger.io
|
||||
license:
|
||||
|
2
pom.xml
2
pom.xml
@ -570,7 +570,7 @@
|
||||
<commons-lang-version>2.4</commons-lang-version>
|
||||
<slf4j-version>1.7.12</slf4j-version>
|
||||
<scala-maven-plugin-version>3.2.1</scala-maven-plugin-version>
|
||||
<jmustache-version>1.9</jmustache-version>
|
||||
<jmustache-version>1.12</jmustache-version>
|
||||
<testng-version>6.9.6</testng-version>
|
||||
<surefire-version>2.18.1</surefire-version>
|
||||
<jmockit-version>1.19</jmockit-version>
|
||||
|
@ -0,0 +1,291 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace IO.Swagger.Model
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
public partial class FormatTest : IEquatable<FormatTest>
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="FormatTest" /> class.
|
||||
/// Initializes a new instance of the <see cref="FormatTest" />class.
|
||||
/// </summary>
|
||||
/// <param name="Integer">Integer.</param>
|
||||
/// <param name="Int32">Int32.</param>
|
||||
/// <param name="Int64">Int64.</param>
|
||||
/// <param name="Number">Number (required).</param>
|
||||
/// <param name="_Float">_Float.</param>
|
||||
/// <param name="_Double">_Double.</param>
|
||||
/// <param name="_String">_String.</param>
|
||||
/// <param name="_Byte">_Byte.</param>
|
||||
/// <param name="Binary">Binary.</param>
|
||||
/// <param name="Date">Date.</param>
|
||||
/// <param name="DateTime">DateTime.</param>
|
||||
|
||||
public FormatTest(int? Integer = null, int? Int32 = null, long? Int64 = null, double? Number = null, float? _Float = null, double? _Double = null, string _String = null, byte[] _Byte = null, byte[] Binary = null, DateTime? Date = null, string DateTime = null)
|
||||
{
|
||||
// to ensure "Number" is required (not null)
|
||||
if (Number == null)
|
||||
{
|
||||
throw new InvalidDataException("Number is a required property for FormatTest and cannot be null");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Number = Number;
|
||||
}
|
||||
this.Integer = Integer;
|
||||
this.Int32 = Int32;
|
||||
this.Int64 = Int64;
|
||||
this._Float = _Float;
|
||||
this._Double = _Double;
|
||||
this._String = _String;
|
||||
this._Byte = _Byte;
|
||||
this.Binary = Binary;
|
||||
this.Date = Date;
|
||||
this.DateTime = DateTime;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Integer
|
||||
/// </summary>
|
||||
[DataMember(Name="integer", EmitDefaultValue=false)]
|
||||
public int? Integer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Int32
|
||||
/// </summary>
|
||||
[DataMember(Name="int32", EmitDefaultValue=false)]
|
||||
public int? Int32 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Int64
|
||||
/// </summary>
|
||||
[DataMember(Name="int64", EmitDefaultValue=false)]
|
||||
public long? Int64 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Number
|
||||
/// </summary>
|
||||
[DataMember(Name="number", EmitDefaultValue=false)]
|
||||
public double? Number { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Float
|
||||
/// </summary>
|
||||
[DataMember(Name="float", EmitDefaultValue=false)]
|
||||
public float? _Float { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Double
|
||||
/// </summary>
|
||||
[DataMember(Name="double", EmitDefaultValue=false)]
|
||||
public double? _Double { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _String
|
||||
/// </summary>
|
||||
[DataMember(Name="string", EmitDefaultValue=false)]
|
||||
public string _String { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets _Byte
|
||||
/// </summary>
|
||||
[DataMember(Name="byte", EmitDefaultValue=false)]
|
||||
public byte[] _Byte { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Binary
|
||||
/// </summary>
|
||||
[DataMember(Name="binary", EmitDefaultValue=false)]
|
||||
public byte[] Binary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets Date
|
||||
/// </summary>
|
||||
[DataMember(Name="date", EmitDefaultValue=false)]
|
||||
public DateTime? Date { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or Sets DateTime
|
||||
/// </summary>
|
||||
[DataMember(Name="dateTime", EmitDefaultValue=false)]
|
||||
public string DateTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>String presentation of the object</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.Append("class FormatTest {\n");
|
||||
sb.Append(" Integer: ").Append(Integer).Append("\n");
|
||||
sb.Append(" Int32: ").Append(Int32).Append("\n");
|
||||
sb.Append(" Int64: ").Append(Int64).Append("\n");
|
||||
sb.Append(" Number: ").Append(Number).Append("\n");
|
||||
sb.Append(" _Float: ").Append(_Float).Append("\n");
|
||||
sb.Append(" _Double: ").Append(_Double).Append("\n");
|
||||
sb.Append(" _String: ").Append(_String).Append("\n");
|
||||
sb.Append(" _Byte: ").Append(_Byte).Append("\n");
|
||||
sb.Append(" Binary: ").Append(Binary).Append("\n");
|
||||
sb.Append(" Date: ").Append(Date).Append("\n");
|
||||
sb.Append(" DateTime: ").Append(DateTime).Append("\n");
|
||||
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
/// <returns>JSON string presentation of the object</returns>
|
||||
public string ToJson()
|
||||
{
|
||||
return JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if objects are equal
|
||||
/// </summary>
|
||||
/// <param name="obj">Object to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
return this.Equals(obj as FormatTest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if FormatTest instances are equal
|
||||
/// </summary>
|
||||
/// <param name="other">Instance of FormatTest to be compared</param>
|
||||
/// <returns>Boolean</returns>
|
||||
public bool Equals(FormatTest other)
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/10454552/677735
|
||||
if (other == null)
|
||||
return false;
|
||||
|
||||
return
|
||||
(
|
||||
this.Integer == other.Integer ||
|
||||
this.Integer != null &&
|
||||
this.Integer.Equals(other.Integer)
|
||||
) &&
|
||||
(
|
||||
this.Int32 == other.Int32 ||
|
||||
this.Int32 != null &&
|
||||
this.Int32.Equals(other.Int32)
|
||||
) &&
|
||||
(
|
||||
this.Int64 == other.Int64 ||
|
||||
this.Int64 != null &&
|
||||
this.Int64.Equals(other.Int64)
|
||||
) &&
|
||||
(
|
||||
this.Number == other.Number ||
|
||||
this.Number != null &&
|
||||
this.Number.Equals(other.Number)
|
||||
) &&
|
||||
(
|
||||
this._Float == other._Float ||
|
||||
this._Float != null &&
|
||||
this._Float.Equals(other._Float)
|
||||
) &&
|
||||
(
|
||||
this._Double == other._Double ||
|
||||
this._Double != null &&
|
||||
this._Double.Equals(other._Double)
|
||||
) &&
|
||||
(
|
||||
this._String == other._String ||
|
||||
this._String != null &&
|
||||
this._String.Equals(other._String)
|
||||
) &&
|
||||
(
|
||||
this._Byte == other._Byte ||
|
||||
this._Byte != null &&
|
||||
this._Byte.Equals(other._Byte)
|
||||
) &&
|
||||
(
|
||||
this.Binary == other.Binary ||
|
||||
this.Binary != null &&
|
||||
this.Binary.Equals(other.Binary)
|
||||
) &&
|
||||
(
|
||||
this.Date == other.Date ||
|
||||
this.Date != null &&
|
||||
this.Date.Equals(other.Date)
|
||||
) &&
|
||||
(
|
||||
this.DateTime == other.DateTime ||
|
||||
this.DateTime != null &&
|
||||
this.DateTime.Equals(other.DateTime)
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the hash code
|
||||
/// </summary>
|
||||
/// <returns>Hash code</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
// credit: http://stackoverflow.com/a/263416/677735
|
||||
unchecked // Overflow is fine, just wrap
|
||||
{
|
||||
int hash = 41;
|
||||
// Suitable nullity checks etc, of course :)
|
||||
|
||||
if (this.Integer != null)
|
||||
hash = hash * 59 + this.Integer.GetHashCode();
|
||||
|
||||
if (this.Int32 != null)
|
||||
hash = hash * 59 + this.Int32.GetHashCode();
|
||||
|
||||
if (this.Int64 != null)
|
||||
hash = hash * 59 + this.Int64.GetHashCode();
|
||||
|
||||
if (this.Number != null)
|
||||
hash = hash * 59 + this.Number.GetHashCode();
|
||||
|
||||
if (this._Float != null)
|
||||
hash = hash * 59 + this._Float.GetHashCode();
|
||||
|
||||
if (this._Double != null)
|
||||
hash = hash * 59 + this._Double.GetHashCode();
|
||||
|
||||
if (this._String != null)
|
||||
hash = hash * 59 + this._String.GetHashCode();
|
||||
|
||||
if (this._Byte != null)
|
||||
hash = hash * 59 + this._Byte.GetHashCode();
|
||||
|
||||
if (this.Binary != null)
|
||||
hash = hash * 59 + this.Binary.GetHashCode();
|
||||
|
||||
if (this.Date != null)
|
||||
hash = hash * 59 + this.Date.GetHashCode();
|
||||
|
||||
if (this.DateTime != null)
|
||||
hash = hash * 59 + this.DateTime.GetHashCode();
|
||||
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -22,13 +22,19 @@ namespace IO.Swagger.Model
|
||||
/// Initializes a new instance of the <see cref="Name" /> class.
|
||||
/// Initializes a new instance of the <see cref="Name" />class.
|
||||
/// </summary>
|
||||
/// <param name="_Name">_Name.</param>
|
||||
/// <param name="SnakeCase">SnakeCase.</param>
|
||||
/// <param name="_Name">_Name (required).</param>
|
||||
|
||||
public Name(int? _Name = null, int? SnakeCase = null)
|
||||
public Name(int? _Name = null)
|
||||
{
|
||||
// to ensure "_Name" is required (not null)
|
||||
if (_Name == null)
|
||||
{
|
||||
throw new InvalidDataException("_Name is a required property for Name and cannot be null");
|
||||
}
|
||||
else
|
||||
{
|
||||
this._Name = _Name;
|
||||
this.SnakeCase = SnakeCase;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -43,7 +49,7 @@ namespace IO.Swagger.Model
|
||||
/// Gets or Sets SnakeCase
|
||||
/// </summary>
|
||||
[DataMember(Name="snake_case", EmitDefaultValue=false)]
|
||||
public int? SnakeCase { get; set; }
|
||||
public int? SnakeCase { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the string presentation of the object
|
||||
|
@ -66,6 +66,10 @@
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Name.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Task.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Model200Response.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Animal.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Cat.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Dog.cs" />
|
||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\FormatTest.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
|
@ -1,9 +1,11 @@
|
||||
<Properties StartupItem="SwaggerClientTest.csproj">
|
||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs">
|
||||
<MonoDevelop.Ide.Workbench ActiveDocument="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs">
|
||||
<Files>
|
||||
<File FileName="TestPet.cs" Line="23" Column="17" />
|
||||
<File FileName="TestPet.cs" Line="1" Column="1" />
|
||||
<File FileName="TestOrder.cs" Line="1" Column="1" />
|
||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Cat.cs" Line="1" Column="1" />
|
||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Name.cs" Line="18" Column="50" />
|
||||
</Files>
|
||||
</MonoDevelop.Ide.Workbench>
|
||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||
|
25
samples/client/petstore/go/swagger/Configuration.go
Normal file
25
samples/client/petstore/go/swagger/Configuration.go
Normal file
@ -0,0 +1,25 @@
|
||||
package swagger
|
||||
|
||||
import (
|
||||
|
||||
)
|
||||
|
||||
type Configuration struct {
|
||||
UserName string `json:"userName,omitempty"`
|
||||
ApiKey string `json:"apiKey,omitempty"`
|
||||
Debug bool `json:"debug,omitempty"`
|
||||
DebugFile string `json:"debugFile,omitempty"`
|
||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||
Timeout int `json:"timeout,omitempty"`
|
||||
BasePath string `json:"basePath,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Scheme string `json:"scheme,omitempty"`
|
||||
}
|
||||
|
||||
func NewConfiguration() *Configuration {
|
||||
return &Configuration{
|
||||
BasePath: "http://petstore.swagger.io/v2",
|
||||
UserName: "",
|
||||
Debug: false,
|
||||
}
|
||||
}
|
@ -1,29 +1,36 @@
|
||||
package swagger
|
||||
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/dghubble/sling"
|
||||
|
||||
)
|
||||
|
||||
type PetApi struct {
|
||||
basePath string
|
||||
Configuration Configuration
|
||||
}
|
||||
|
||||
func NewPetApi() *PetApi{
|
||||
configuration := NewConfiguration()
|
||||
return &PetApi {
|
||||
basePath: "http://petstore.swagger.io/v2",
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
func NewPetApiWithBasePath(basePath string) *PetApi{
|
||||
configuration := NewConfiguration()
|
||||
configuration.BasePath = basePath
|
||||
|
||||
return &PetApi {
|
||||
basePath: basePath,
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a new pet to the store
|
||||
*
|
||||
@ -33,13 +40,15 @@ func NewPetApiWithBasePath(basePath string) *PetApi{
|
||||
//func (a PetApi) AddPet (body Pet) (error) {
|
||||
func (a PetApi) AddPet (body Pet) (error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
_sling := sling.New().Post(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/pets"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -47,6 +56,7 @@ func (a PetApi) AddPet (body Pet) (error) {
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
@ -84,6 +94,7 @@ func (a PetApi) AddPet (body Pet) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes a pet
|
||||
*
|
||||
@ -94,14 +105,16 @@ func (a PetApi) AddPet (body Pet) (error) {
|
||||
//func (a PetApi) DeletePet (apiKey string, petId int64) (error) {
|
||||
func (a PetApi) DeletePet (apiKey string, petId int64) (error) {
|
||||
|
||||
_sling := sling.New().Delete(a.basePath)
|
||||
_sling := sling.New().Delete(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/pets/{petId}"
|
||||
path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -114,6 +127,7 @@ func (a PetApi) DeletePet (apiKey string, petId int64) (error) {
|
||||
|
||||
|
||||
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
@ -146,6 +160,7 @@ func (a PetApi) DeletePet (apiKey string, petId int64) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by status
|
||||
* Multiple status values can be provided with comma seperated strings
|
||||
@ -155,11 +170,12 @@ func (a PetApi) DeletePet (apiKey string, petId int64) (error) {
|
||||
//func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
|
||||
func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
_sling := sling.New().Get(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/pets/findByStatus"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
type QueryParams struct {
|
||||
@ -167,6 +183,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
|
||||
|
||||
}
|
||||
_sling = _sling.QueryStruct(&QueryParams{ status: status })
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -175,6 +192,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
var successPayload = new([]Pet)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
@ -209,6 +227,7 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds Pets by tags
|
||||
* Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
@ -218,11 +237,12 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) {
|
||||
//func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
|
||||
func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
_sling := sling.New().Get(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/pets/findByTags"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
type QueryParams struct {
|
||||
@ -230,6 +250,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
|
||||
|
||||
}
|
||||
_sling = _sling.QueryStruct(&QueryParams{ tags: tags })
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -238,6 +259,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
var successPayload = new([]Pet)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
@ -272,6 +294,7 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
/**
|
||||
* Find pet by ID
|
||||
* Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
@ -281,14 +304,16 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) {
|
||||
//func (a PetApi) GetPetById (petId int64) (Pet, error) {
|
||||
func (a PetApi) GetPetById (petId int64) (Pet, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
_sling := sling.New().Get(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/pets/{petId}"
|
||||
path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -297,6 +322,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, error) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
var successPayload = new(Pet)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
@ -331,6 +357,7 @@ func (a PetApi) GetPetById (petId int64) (Pet, error) {
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an existing pet
|
||||
*
|
||||
@ -340,13 +367,15 @@ func (a PetApi) GetPetById (petId int64) (Pet, error) {
|
||||
//func (a PetApi) UpdatePet (body Pet) (error) {
|
||||
func (a PetApi) UpdatePet (body Pet) (error) {
|
||||
|
||||
_sling := sling.New().Put(a.basePath)
|
||||
_sling := sling.New().Put(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/pets"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -354,6 +383,7 @@ func (a PetApi) UpdatePet (body Pet) (error) {
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
@ -391,6 +421,7 @@ func (a PetApi) UpdatePet (body Pet) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates a pet in the store with form data
|
||||
*
|
||||
@ -402,14 +433,16 @@ func (a PetApi) UpdatePet (body Pet) (error) {
|
||||
//func (a PetApi) UpdatePetWithForm (petId string, name string, status string) (error) {
|
||||
func (a PetApi) UpdatePetWithForm (petId string, name string, status string) (error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
_sling := sling.New().Post(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/pets/{petId}"
|
||||
path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -420,11 +453,13 @@ func (a PetApi) UpdatePetWithForm (petId string, name string, status string) (er
|
||||
type FormParams struct {
|
||||
name string `url:"name,omitempty"`
|
||||
status string `url:"status,omitempty"`
|
||||
|
||||
}
|
||||
_sling = _sling.BodyForm(&FormParams{ name: name,status: status })
|
||||
|
||||
|
||||
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
@ -457,3 +492,5 @@ func (a PetApi) UpdatePetWithForm (petId string, name string, status string) (er
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,29 +1,36 @@
|
||||
package swagger
|
||||
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/dghubble/sling"
|
||||
|
||||
)
|
||||
|
||||
type StoreApi struct {
|
||||
basePath string
|
||||
Configuration Configuration
|
||||
}
|
||||
|
||||
func NewStoreApi() *StoreApi{
|
||||
configuration := NewConfiguration()
|
||||
return &StoreApi {
|
||||
basePath: "http://petstore.swagger.io/v2",
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
func NewStoreApiWithBasePath(basePath string) *StoreApi{
|
||||
configuration := NewConfiguration()
|
||||
configuration.BasePath = basePath
|
||||
|
||||
return &StoreApi {
|
||||
basePath: basePath,
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Delete purchase order by ID
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
@ -33,14 +40,16 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi{
|
||||
//func (a StoreApi) DeleteOrder (orderId string) (error) {
|
||||
func (a StoreApi) DeleteOrder (orderId string) (error) {
|
||||
|
||||
_sling := sling.New().Delete(a.basePath)
|
||||
_sling := sling.New().Delete(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/stores/order/{orderId}"
|
||||
path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -51,6 +60,7 @@ func (a StoreApi) DeleteOrder (orderId string) (error) {
|
||||
|
||||
|
||||
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
@ -83,6 +93,7 @@ func (a StoreApi) DeleteOrder (orderId string) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Find purchase order by ID
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
@ -92,14 +103,16 @@ func (a StoreApi) DeleteOrder (orderId string) (error) {
|
||||
//func (a StoreApi) GetOrderById (orderId string) (Order, error) {
|
||||
func (a StoreApi) GetOrderById (orderId string) (Order, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
_sling := sling.New().Get(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/stores/order/{orderId}"
|
||||
path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -108,6 +121,7 @@ func (a StoreApi) GetOrderById (orderId string) (Order, error) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
var successPayload = new(Order)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
@ -142,6 +156,7 @@ func (a StoreApi) GetOrderById (orderId string) (Order, error) {
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
/**
|
||||
* Place an order for a pet
|
||||
*
|
||||
@ -151,13 +166,15 @@ func (a StoreApi) GetOrderById (orderId string) (Order, error) {
|
||||
//func (a StoreApi) PlaceOrder (body Order) (Order, error) {
|
||||
func (a StoreApi) PlaceOrder (body Order) (Order, error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
_sling := sling.New().Post(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/stores/order"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -165,6 +182,7 @@ func (a StoreApi) PlaceOrder (body Order) (Order, error) {
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
@ -202,3 +220,5 @@ func (a StoreApi) PlaceOrder (body Order) (Order, error) {
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,29 +1,36 @@
|
||||
package swagger
|
||||
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"fmt"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"github.com/dghubble/sling"
|
||||
|
||||
)
|
||||
|
||||
type UserApi struct {
|
||||
basePath string
|
||||
Configuration Configuration
|
||||
}
|
||||
|
||||
func NewUserApi() *UserApi{
|
||||
configuration := NewConfiguration()
|
||||
return &UserApi {
|
||||
basePath: "http://petstore.swagger.io/v2",
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
func NewUserApiWithBasePath(basePath string) *UserApi{
|
||||
configuration := NewConfiguration()
|
||||
configuration.BasePath = basePath
|
||||
|
||||
return &UserApi {
|
||||
basePath: basePath,
|
||||
Configuration: *configuration,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create user
|
||||
* This can only be done by the logged in user.
|
||||
@ -33,13 +40,15 @@ func NewUserApiWithBasePath(basePath string) *UserApi{
|
||||
//func (a UserApi) CreateUser (body User) (error) {
|
||||
func (a UserApi) CreateUser (body User) (error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
_sling := sling.New().Post(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -47,6 +56,7 @@ func (a UserApi) CreateUser (body User) (error) {
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
@ -84,6 +94,7 @@ func (a UserApi) CreateUser (body User) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
@ -93,13 +104,15 @@ func (a UserApi) CreateUser (body User) (error) {
|
||||
//func (a UserApi) CreateUsersWithArrayInput (body []User) (error) {
|
||||
func (a UserApi) CreateUsersWithArrayInput (body []User) (error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
_sling := sling.New().Post(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users/createWithArray"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -107,6 +120,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error) {
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
@ -144,6 +158,7 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates list of users with given input array
|
||||
*
|
||||
@ -153,13 +168,15 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error) {
|
||||
//func (a UserApi) CreateUsersWithListInput (body []User) (error) {
|
||||
func (a UserApi) CreateUsersWithListInput (body []User) (error) {
|
||||
|
||||
_sling := sling.New().Post(a.basePath)
|
||||
_sling := sling.New().Post(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users/createWithList"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -167,6 +184,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error) {
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
@ -204,6 +222,7 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete user
|
||||
* This can only be done by the logged in user.
|
||||
@ -213,14 +232,16 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error) {
|
||||
//func (a UserApi) DeleteUser (username string) (error) {
|
||||
func (a UserApi) DeleteUser (username string) (error) {
|
||||
|
||||
_sling := sling.New().Delete(a.basePath)
|
||||
_sling := sling.New().Delete(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users/{username}"
|
||||
path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -231,6 +252,7 @@ func (a UserApi) DeleteUser (username string) (error) {
|
||||
|
||||
|
||||
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
@ -263,6 +285,7 @@ func (a UserApi) DeleteUser (username string) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Get user by user name
|
||||
*
|
||||
@ -272,14 +295,16 @@ func (a UserApi) DeleteUser (username string) (error) {
|
||||
//func (a UserApi) GetUserByName (username string) (User, error) {
|
||||
func (a UserApi) GetUserByName (username string) (User, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
_sling := sling.New().Get(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users/{username}"
|
||||
path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -288,6 +313,7 @@ func (a UserApi) GetUserByName (username string) (User, error) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
var successPayload = new(User)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
@ -322,6 +348,7 @@ func (a UserApi) GetUserByName (username string) (User, error) {
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs user into the system
|
||||
*
|
||||
@ -332,11 +359,12 @@ func (a UserApi) GetUserByName (username string) (User, error) {
|
||||
//func (a UserApi) LoginUser (username string, password string) (string, error) {
|
||||
func (a UserApi) LoginUser (username string, password string) (string, error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
_sling := sling.New().Get(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users/login"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
type QueryParams struct {
|
||||
@ -345,6 +373,7 @@ func (a UserApi) LoginUser (username string, password string) (string, error) {
|
||||
|
||||
}
|
||||
_sling = _sling.QueryStruct(&QueryParams{ username: username,password: password })
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -353,6 +382,7 @@ func (a UserApi) LoginUser (username string, password string) (string, error) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
var successPayload = new(string)
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
@ -387,6 +417,7 @@ func (a UserApi) LoginUser (username string, password string) (string, error) {
|
||||
|
||||
return *successPayload, err
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs out current logged in user session
|
||||
*
|
||||
@ -395,13 +426,15 @@ func (a UserApi) LoginUser (username string, password string) (string, error) {
|
||||
//func (a UserApi) LogoutUser () (error) {
|
||||
func (a UserApi) LogoutUser () (error) {
|
||||
|
||||
_sling := sling.New().Get(a.basePath)
|
||||
_sling := sling.New().Get(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users/logout"
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -412,6 +445,7 @@ func (a UserApi) LogoutUser () (error) {
|
||||
|
||||
|
||||
|
||||
|
||||
// We use this map (below) so that any arbitrary error JSON can be handled.
|
||||
// FIXME: This is in the absence of this Go generator honoring the non-2xx
|
||||
// response (error) models, which needs to be implemented at some point.
|
||||
@ -444,6 +478,7 @@ func (a UserApi) LogoutUser () (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
/**
|
||||
* Updated user
|
||||
* This can only be done by the logged in user.
|
||||
@ -454,14 +489,16 @@ func (a UserApi) LogoutUser () (error) {
|
||||
//func (a UserApi) UpdateUser (username string, body User) (error) {
|
||||
func (a UserApi) UpdateUser (username string, body User) (error) {
|
||||
|
||||
_sling := sling.New().Put(a.basePath)
|
||||
_sling := sling.New().Put(a.Configuration.BasePath)
|
||||
|
||||
// create path and map variables
|
||||
path := "/v2/users/{username}"
|
||||
path = strings.Replace(path, "{" + "username" + "}", fmt.Sprintf("%v", username), -1)
|
||||
|
||||
|
||||
_sling = _sling.Path(path)
|
||||
|
||||
|
||||
// accept header
|
||||
accepts := []string { "application/json", "application/xml" }
|
||||
for key := range accepts {
|
||||
@ -469,6 +506,7 @@ func (a UserApi) UpdateUser (username string, body User) (error) {
|
||||
break // only use the first Accept
|
||||
}
|
||||
|
||||
|
||||
// body params
|
||||
_sling = _sling.BodyJSON(body)
|
||||
|
||||
@ -506,3 +544,5 @@ func (a UserApi) UpdateUser (username string, body User) (error) {
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,6 +46,10 @@ if(hasProperty('target') && target == 'android') {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided 'javax.annotation:jsr250-api:1.0'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
|
@ -1,20 +1,200 @@
|
||||
# SwaggerClient
|
||||
|
||||
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
|
||||
This ObjC package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version:
|
||||
- Build date: 2016-04-05T23:29:02.396+08:00
|
||||
- Build package: class io.swagger.codegen.languages.ObjcClientCodegen
|
||||
|
||||
## Requirements
|
||||
|
||||
The API client library requires ARC (Automatic Reference Counting) to be enabled in your Xcode project.
|
||||
The SDK requires [**ARC (Automatic Reference Counting)**](http://stackoverflow.com/questions/7778356/how-to-enable-disable-automatic-reference-counting) to be enabled in the Xcode project.
|
||||
|
||||
## Installation
|
||||
## Installation & Usage
|
||||
### Install from Github using [CocoaPods](https://cocoapods.org/)
|
||||
|
||||
To install it, put the API client library in your project and then simply add the following line to your Podfile:
|
||||
Add the following to the Podfile:
|
||||
|
||||
```ruby
|
||||
pod "SwaggerClient", :path => "/path/to/lib"
|
||||
pod 'SwaggerClient', :git => 'https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git'
|
||||
```
|
||||
|
||||
To specify a particular branch, append `, :branch => 'branch-name-here'`
|
||||
|
||||
To specify a particular commit, append `, :commit => '11aa22'`
|
||||
|
||||
### Install from local path using [CocoaPods](https://cocoapods.org/)
|
||||
|
||||
Put the SDK under your project folder (e.g. /path/to/objc_project/Vendor/SwaggerClient) and then add the following to the Podfile:
|
||||
|
||||
```ruby
|
||||
pod 'SwaggerClient', :path => 'Vendor/SwaggerClient'
|
||||
```
|
||||
|
||||
### Usage
|
||||
|
||||
Import the following:
|
||||
```objc
|
||||
#import <SwaggerClient/SWGApiClient.h>
|
||||
#import <SwaggerClient/SWGConfiguration.h>
|
||||
// load models
|
||||
#import <SwaggerClient/SWG200Response.h>
|
||||
#import <SwaggerClient/SWGAnimal.h>
|
||||
#import <SwaggerClient/SWGCat.h>
|
||||
#import <SwaggerClient/SWGCategory.h>
|
||||
#import <SwaggerClient/SWGDog.h>
|
||||
#import <SwaggerClient/SWGInlineResponse200.h>
|
||||
#import <SwaggerClient/SWGName.h>
|
||||
#import <SwaggerClient/SWGOrder.h>
|
||||
#import <SwaggerClient/SWGPet.h>
|
||||
#import <SwaggerClient/SWGReturn.h>
|
||||
#import <SwaggerClient/SWGSpecialModelName_.h>
|
||||
#import <SwaggerClient/SWGTag.h>
|
||||
#import <SwaggerClient/SWGUser.h>
|
||||
// load API classes for accessing endpoints
|
||||
#import <SwaggerClient/SWGPetApi.h>
|
||||
#import <SwaggerClient/SWGStoreApi.h>
|
||||
#import <SwaggerClient/SWGUserApi.h>
|
||||
|
||||
```
|
||||
|
||||
## Recommendation
|
||||
|
||||
It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issue.
|
||||
It's recommended to create an instance of ApiClient per thread in a multi-threaded environment to avoid any potential issue.
|
||||
|
||||
## Getting Started
|
||||
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
```objc
|
||||
|
||||
SWGConfiguration *apiConfig = [SWGConfiguration sharedConfig];
|
||||
|
||||
// Configure OAuth2 access token for authorization: (authentication scheme: petstore_auth)
|
||||
[apiConfig setAccessToken:@"YOUR_ACCESS_TOKEN"];
|
||||
|
||||
|
||||
SWGPet* *body = [[SWGPet alloc] init]; // Pet object that needs to be added to the store (optional)
|
||||
|
||||
@try
|
||||
{
|
||||
SWGPetApi *apiInstance = [[SWGPetApi alloc] init];
|
||||
|
||||
// Add a new pet to the store
|
||||
[apiInstance addPetWithBody:body
|
||||
completionHandler: ^(NSError* error)) {
|
||||
if (error) {
|
||||
NSLog(@"Error: %@", error);
|
||||
}
|
||||
}];
|
||||
}
|
||||
@catch (NSException *exception)
|
||||
{
|
||||
NSLog(@"Exception when calling SWGPetApi->addPet: %@ ", exception.name);
|
||||
NSLog(@"Reason: %@ ", exception.reason);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*SWGPetApi* | [**addPet**](docs/SWGPetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
*SWGPetApi* | [**addPetUsingByteArray**](docs/SWGPetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*SWGPetApi* | [**deletePet**](docs/SWGPetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*SWGPetApi* | [**findPetsByStatus**](docs/SWGPetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*SWGPetApi* | [**findPetsByTags**](docs/SWGPetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*SWGPetApi* | [**getPetById**](docs/SWGPetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
||||
*SWGPetApi* | [**getPetByIdInObject**](docs/SWGPetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
*SWGPetApi* | [**petPetIdtestingByteArraytrueGet**](docs/SWGPetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
*SWGPetApi* | [**updatePet**](docs/SWGPetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*SWGPetApi* | [**updatePetWithForm**](docs/SWGPetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*SWGPetApi* | [**uploadFile**](docs/SWGPetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*SWGStoreApi* | [**deleteOrder**](docs/SWGStoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*SWGStoreApi* | [**findOrdersByStatus**](docs/SWGStoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status
|
||||
*SWGStoreApi* | [**getInventory**](docs/SWGStoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*SWGStoreApi* | [**getInventoryInObject**](docs/SWGStoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
*SWGStoreApi* | [**getOrderById**](docs/SWGStoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*SWGStoreApi* | [**placeOrder**](docs/SWGStoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*SWGUserApi* | [**createUser**](docs/SWGUserApi.md#createuser) | **POST** /user | Create user
|
||||
*SWGUserApi* | [**createUsersWithArrayInput**](docs/SWGUserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*SWGUserApi* | [**createUsersWithListInput**](docs/SWGUserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*SWGUserApi* | [**deleteUser**](docs/SWGUserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user
|
||||
*SWGUserApi* | [**getUserByName**](docs/SWGUserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name
|
||||
*SWGUserApi* | [**loginUser**](docs/SWGUserApi.md#loginuser) | **GET** /user/login | Logs user into the system
|
||||
*SWGUserApi* | [**logoutUser**](docs/SWGUserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session
|
||||
*SWGUserApi* | [**updateUser**](docs/SWGUserApi.md#updateuser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [SWG200Response](docs/SWG200Response.md)
|
||||
- [SWGAnimal](docs/SWGAnimal.md)
|
||||
- [SWGCat](docs/SWGCat.md)
|
||||
- [SWGCategory](docs/SWGCategory.md)
|
||||
- [SWGDog](docs/SWGDog.md)
|
||||
- [SWGInlineResponse200](docs/SWGInlineResponse200.md)
|
||||
- [SWGName](docs/SWGName.md)
|
||||
- [SWGOrder](docs/SWGOrder.md)
|
||||
- [SWGPet](docs/SWGPet.md)
|
||||
- [SWGReturn](docs/SWGReturn.md)
|
||||
- [SWGSpecialModelName_](docs/SWGSpecialModelName_.md)
|
||||
- [SWGTag](docs/SWGTag.md)
|
||||
- [SWGUser](docs/SWGUser.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## test_api_key_header
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_http_basic
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
## test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_api_client_id
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_api_key_query
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
|
@ -13,7 +13,10 @@
|
||||
*/
|
||||
|
||||
#import "SWG200Response.h"
|
||||
#import "SWGAnimal.h"
|
||||
#import "SWGCat.h"
|
||||
#import "SWGCategory.h"
|
||||
#import "SWGDog.h"
|
||||
#import "SWGInlineResponse200.h"
|
||||
#import "SWGName.h"
|
||||
#import "SWGOrder.h"
|
||||
@ -81,7 +84,7 @@ extern NSString *const SWGResponseObjectErrorKey;
|
||||
+(bool) getOfflineState;
|
||||
|
||||
/**
|
||||
* Sets the client reachability, this may be override by the reachability manager if reachability changes
|
||||
* Sets the client reachability, this may be overridden by the reachability manager if reachability changes
|
||||
*
|
||||
* @param The client reachability.
|
||||
*/
|
||||
|
@ -716,11 +716,11 @@ static void (^reachabilityChangeBlock)(int);
|
||||
for (NSString *auth in authSettings) {
|
||||
NSDictionary *authSetting = [[config authSettings] objectForKey:auth];
|
||||
|
||||
if (authSetting) {
|
||||
if ([authSetting[@"in"] isEqualToString:@"header"]) {
|
||||
if (authSetting) { // auth setting is set only if the key is non-empty
|
||||
if ([authSetting[@"in"] isEqualToString:@"header"] && [authSetting[@"key"] length] != 0) {
|
||||
[headersWithAuth setObject:authSetting[@"value"] forKey:authSetting[@"key"]];
|
||||
}
|
||||
else if ([authSetting[@"in"] isEqualToString:@"query"]) {
|
||||
else if ([authSetting[@"in"] isEqualToString:@"query"] && [authSetting[@"key"] length] != 0) {
|
||||
[querysWithAuth setObject:authSetting[@"value"] forKey:authSetting[@"key"]];
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +46,11 @@
|
||||
*/
|
||||
@property (nonatomic) NSString *password;
|
||||
|
||||
/**
|
||||
* Access token for OAuth
|
||||
*/
|
||||
@property (nonatomic) NSString *accessToken;
|
||||
|
||||
/**
|
||||
* Temp folder for file download
|
||||
*/
|
||||
@ -132,6 +137,11 @@
|
||||
*/
|
||||
- (NSString *) getBasicAuthToken;
|
||||
|
||||
/**
|
||||
* Gets OAuth access token
|
||||
*/
|
||||
- (NSString *) getAccessToken;
|
||||
|
||||
/**
|
||||
* Gets Authentication Setings
|
||||
*/
|
||||
|
@ -29,6 +29,7 @@
|
||||
self.host = @"http://petstore.swagger.io/v2";
|
||||
self.username = @"";
|
||||
self.password = @"";
|
||||
self.accessToken= @"";
|
||||
self.tempFolderPath = nil;
|
||||
self.debug = NO;
|
||||
self.verifySSL = YES;
|
||||
@ -42,18 +43,23 @@
|
||||
#pragma mark - Instance Methods
|
||||
|
||||
- (NSString *) getApiKeyWithPrefix:(NSString *)key {
|
||||
if ([self.apiKeyPrefix objectForKey:key] && [self.apiKey objectForKey:key]) {
|
||||
if ([self.apiKeyPrefix objectForKey:key] && [self.apiKey objectForKey:key] != (id)[NSNull null] && [[self.apiKey objectForKey:key] length] != 0) { // both api key prefix and api key are set
|
||||
return [NSString stringWithFormat:@"%@ %@", [self.apiKeyPrefix objectForKey:key], [self.apiKey objectForKey:key]];
|
||||
}
|
||||
else if ([self.apiKey objectForKey:key]) {
|
||||
else if ([self.apiKey objectForKey:key] != (id)[NSNull null] && [[self.apiKey objectForKey:key] length] != 0) { // only api key, no api key prefix
|
||||
return [NSString stringWithFormat:@"%@", [self.apiKey objectForKey:key]];
|
||||
}
|
||||
else {
|
||||
else { // return empty string if nothing is set
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *) getBasicAuthToken {
|
||||
// return empty string if username and password are empty
|
||||
if (self.username.length == 0 && self.password.length == 0){
|
||||
return @"";
|
||||
}
|
||||
|
||||
NSString *basicAuthCredentials = [NSString stringWithFormat:@"%@:%@", self.username, self.password];
|
||||
NSData *data = [basicAuthCredentials dataUsingEncoding:NSUTF8StringEncoding];
|
||||
basicAuthCredentials = [NSString stringWithFormat:@"Basic %@", [data base64EncodedStringWithOptions:0]];
|
||||
@ -61,6 +67,15 @@
|
||||
return basicAuthCredentials;
|
||||
}
|
||||
|
||||
- (NSString *) getAccessToken {
|
||||
if (self.accessToken.length == 0) { // token not set, return empty string
|
||||
return @"";
|
||||
}
|
||||
else {
|
||||
return [NSString stringWithFormat:@"BEARER %@", self.accessToken];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Setter Methods
|
||||
|
||||
- (void) setApiKey:(NSString *)apiKey forApiKeyIdentifier:(NSString *)identifier {
|
||||
@ -149,6 +164,13 @@
|
||||
@"key": @"test_api_key_query",
|
||||
@"value": [self getApiKeyWithPrefix:@"test_api_key_query"]
|
||||
},
|
||||
@"petstore_auth":
|
||||
@{
|
||||
@"type": @"oauth",
|
||||
@"in": @"header",
|
||||
@"key": @"Authorization",
|
||||
@"value": [self getAccessToken]
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@ This PHP package is automatically generated by the [Swagger Codegen](https://git
|
||||
|
||||
- API version: 1.0.0
|
||||
- Package version: 1.0.0
|
||||
- Build date: 2016-03-30T20:57:56.803+08:00
|
||||
- Build date: 2016-04-09T18:00:55.578+08:00
|
||||
- Build package: class io.swagger.codegen.languages.PhpClientCodegen
|
||||
|
||||
## Requirements
|
||||
@ -80,20 +80,20 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
*PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status
|
||||
*StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
*StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user
|
||||
|
@ -5,13 +5,13 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**addPetUsingByteArray**](PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
[**addPetUsingByteArray**](PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**getPetByIdInObject**](PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
[**petPetIdtestingByteArraytrueGet**](PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
[**getPetByIdInObject**](PetApi.md#getPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
[**petPetIdtestingByteArraytrueGet**](PetApi.md#petPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
@ -7,7 +7,7 @@ Method | HTTP request | Description
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**findOrdersByStatus**](StoreApi.md#findOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getInventoryInObject**](StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
[**getInventoryInObject**](StoreApi.md#getInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
@ -90,7 +90,6 @@ class PetApi
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* addPet
|
||||
*
|
||||
@ -102,7 +101,7 @@ class PetApi
|
||||
*/
|
||||
public function addPet($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->addPetWithHttpInfo ($body);
|
||||
list($response) = $this->addPetWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -126,11 +125,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json','application/xml'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml'));
|
||||
|
||||
|
||||
|
||||
@ -156,7 +155,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -166,7 +164,6 @@ class PetApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -174,7 +171,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* addPetUsingByteArray
|
||||
*
|
||||
@ -186,7 +182,7 @@ class PetApi
|
||||
*/
|
||||
public function addPetUsingByteArray($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->addPetUsingByteArrayWithHttpInfo ($body);
|
||||
list($response) = $this->addPetUsingByteArrayWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -205,16 +201,16 @@ class PetApi
|
||||
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet?testing_byte_array=true";
|
||||
$resourcePath = "/pet?testing_byte_array=true";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json','application/xml'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml'));
|
||||
|
||||
|
||||
|
||||
@ -240,7 +236,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -250,7 +245,6 @@ class PetApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -258,7 +252,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* deletePet
|
||||
*
|
||||
@ -271,7 +264,7 @@ class PetApi
|
||||
*/
|
||||
public function deletePet($pet_id, $api_key = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->deletePetWithHttpInfo ($pet_id, $api_key);
|
||||
list($response) = $this->deletePetWithHttpInfo ($pet_id, $api_key);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -300,20 +293,18 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
// header params
|
||||
|
||||
if ($api_key !== null) {
|
||||
$headerParams['api_key'] = $this->apiClient->getSerializer()->toHeaderValue($api_key);
|
||||
}
|
||||
// path params
|
||||
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "petId" . "}",
|
||||
@ -338,7 +329,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -348,7 +338,6 @@ class PetApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -356,7 +345,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByStatus
|
||||
*
|
||||
@ -368,7 +356,7 @@ class PetApi
|
||||
*/
|
||||
public function findPetsByStatus($status = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->findPetsByStatusWithHttpInfo ($status);
|
||||
list($response) = $this->findPetsByStatusWithHttpInfo ($status);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -392,18 +380,16 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
if (is_array($status)) {
|
||||
$status = $this->apiClient->getSerializer()->serializeCollection($status, 'multi', true);
|
||||
}
|
||||
|
||||
if ($status !== null) {
|
||||
$queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status);
|
||||
}
|
||||
@ -426,7 +412,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -434,17 +419,15 @@ class PetApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\Pet[]'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -452,7 +435,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* findPetsByTags
|
||||
*
|
||||
@ -464,7 +446,7 @@ class PetApi
|
||||
*/
|
||||
public function findPetsByTags($tags = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->findPetsByTagsWithHttpInfo ($tags);
|
||||
list($response) = $this->findPetsByTagsWithHttpInfo ($tags);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -488,18 +470,16 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
if (is_array($tags)) {
|
||||
$tags = $this->apiClient->getSerializer()->serializeCollection($tags, 'multi', true);
|
||||
}
|
||||
|
||||
if ($tags !== null) {
|
||||
$queryParams['tags'] = $this->apiClient->getSerializer()->toQueryValue($tags);
|
||||
}
|
||||
@ -522,7 +502,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -530,17 +509,15 @@ class PetApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\Pet[]'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet[]', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet[]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -548,7 +525,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getPetById
|
||||
*
|
||||
@ -560,7 +536,7 @@ class PetApi
|
||||
*/
|
||||
public function getPetById($pet_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getPetByIdWithHttpInfo ($pet_id);
|
||||
list($response) = $this->getPetByIdWithHttpInfo ($pet_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -588,16 +564,15 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "petId" . "}",
|
||||
@ -629,7 +604,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -637,17 +611,15 @@ class PetApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\Pet'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Pet', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Pet', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -655,7 +627,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getPetByIdInObject
|
||||
*
|
||||
@ -667,7 +638,7 @@ class PetApi
|
||||
*/
|
||||
public function getPetByIdInObject($pet_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getPetByIdInObjectWithHttpInfo ($pet_id);
|
||||
list($response) = $this->getPetByIdInObjectWithHttpInfo ($pet_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -690,21 +661,20 @@ class PetApi
|
||||
}
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}?response=inline_arbitrary_object";
|
||||
$resourcePath = "/pet/{petId}?response=inline_arbitrary_object";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "petId" . "}",
|
||||
@ -736,7 +706,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -744,17 +713,15 @@ class PetApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\InlineResponse200'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -762,7 +729,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* petPetIdtestingByteArraytrueGet
|
||||
*
|
||||
@ -774,7 +740,7 @@ class PetApi
|
||||
*/
|
||||
public function petPetIdtestingByteArraytrueGet($pet_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->petPetIdtestingByteArraytrueGetWithHttpInfo ($pet_id);
|
||||
list($response) = $this->petPetIdtestingByteArraytrueGetWithHttpInfo ($pet_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -797,21 +763,20 @@ class PetApi
|
||||
}
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/pet/{petId}?testing_byte_array=true";
|
||||
$resourcePath = "/pet/{petId}?testing_byte_array=true";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "petId" . "}",
|
||||
@ -843,7 +808,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -851,17 +815,15 @@ class PetApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, 'string'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -869,7 +831,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updatePet
|
||||
*
|
||||
@ -881,7 +842,7 @@ class PetApi
|
||||
*/
|
||||
public function updatePet($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->updatePetWithHttpInfo ($body);
|
||||
list($response) = $this->updatePetWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -905,11 +866,11 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/json','application/xml'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml'));
|
||||
|
||||
|
||||
|
||||
@ -935,7 +896,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -945,7 +905,6 @@ class PetApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -953,7 +912,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updatePetWithForm
|
||||
*
|
||||
@ -967,7 +925,7 @@ class PetApi
|
||||
*/
|
||||
public function updatePetWithForm($pet_id, $name = null, $status = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->updatePetWithFormWithHttpInfo ($pet_id, $name, $status);
|
||||
list($response) = $this->updatePetWithFormWithHttpInfo ($pet_id, $name, $status);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -997,16 +955,15 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('application/x-www-form-urlencoded'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/x-www-form-urlencoded'));
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "petId" . "}",
|
||||
@ -1019,16 +976,10 @@ class PetApi
|
||||
|
||||
// form params
|
||||
if ($name !== null) {
|
||||
|
||||
|
||||
$formParams['name'] = $this->apiClient->getSerializer()->toFormValue($name);
|
||||
|
||||
}// form params
|
||||
if ($status !== null) {
|
||||
|
||||
|
||||
$formParams['status'] = $this->apiClient->getSerializer()->toFormValue($status);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1043,7 +994,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -1053,7 +1003,6 @@ class PetApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -1061,7 +1010,6 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* uploadFile
|
||||
*
|
||||
@ -1075,7 +1023,7 @@ class PetApi
|
||||
*/
|
||||
public function uploadFile($pet_id, $additional_metadata = null, $file = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->uploadFileWithHttpInfo ($pet_id, $additional_metadata, $file);
|
||||
list($response) = $this->uploadFileWithHttpInfo ($pet_id, $additional_metadata, $file);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -1105,16 +1053,15 @@ class PetApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array('multipart/form-data'));
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('multipart/form-data'));
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($pet_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "petId" . "}",
|
||||
@ -1127,13 +1074,9 @@ class PetApi
|
||||
|
||||
// form params
|
||||
if ($additional_metadata !== null) {
|
||||
|
||||
|
||||
$formParams['additionalMetadata'] = $this->apiClient->getSerializer()->toFormValue($additional_metadata);
|
||||
|
||||
}// form params
|
||||
if ($file !== null) {
|
||||
|
||||
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
|
||||
// See: https://wiki.php.net/rfc/curl-file-upload
|
||||
if (function_exists('curl_file_create')) {
|
||||
@ -1141,8 +1084,6 @@ class PetApi
|
||||
} else {
|
||||
$formParams['file'] = '@' . $this->apiClient->getSerializer()->toFormValue($file);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1157,7 +1098,6 @@ class PetApi
|
||||
if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -1167,7 +1107,6 @@ class PetApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -1175,5 +1114,4 @@ class PetApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ class StoreApi
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* deleteOrder
|
||||
*
|
||||
@ -102,7 +101,7 @@ class StoreApi
|
||||
*/
|
||||
public function deleteOrder($order_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->deleteOrderWithHttpInfo ($order_id);
|
||||
list($response) = $this->deleteOrderWithHttpInfo ($order_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -130,16 +129,15 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($order_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "orderId" . "}",
|
||||
@ -159,7 +157,6 @@ class StoreApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -169,7 +166,6 @@ class StoreApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -177,7 +173,6 @@ class StoreApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* findOrdersByStatus
|
||||
*
|
||||
@ -189,7 +184,7 @@ class StoreApi
|
||||
*/
|
||||
public function findOrdersByStatus($status = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->findOrdersByStatusWithHttpInfo ($status);
|
||||
list($response) = $this->findOrdersByStatusWithHttpInfo ($status);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -213,14 +208,13 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
if ($status !== null) {
|
||||
$queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status);
|
||||
}
|
||||
@ -252,7 +246,6 @@ class StoreApi
|
||||
$headerParams['x-test_api_client_secret'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -260,17 +253,15 @@ class StoreApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\Order[]'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Order[]', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order[]', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order[]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order[]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -278,7 +269,6 @@ class StoreApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getInventory
|
||||
*
|
||||
@ -289,7 +279,7 @@ class StoreApi
|
||||
*/
|
||||
public function getInventory()
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getInventoryWithHttpInfo ();
|
||||
list($response) = $this->getInventoryWithHttpInfo ();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -312,11 +302,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@ -340,7 +330,6 @@ class StoreApi
|
||||
$headerParams['api_key'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -348,17 +337,15 @@ class StoreApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, 'map[string,int]'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'map[string,int]', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'map[string,int]', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'map[string,int]', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -366,7 +353,6 @@ class StoreApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getInventoryInObject
|
||||
*
|
||||
@ -377,7 +363,7 @@ class StoreApi
|
||||
*/
|
||||
public function getInventoryInObject()
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getInventoryInObjectWithHttpInfo ();
|
||||
list($response) = $this->getInventoryInObjectWithHttpInfo ();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -395,16 +381,16 @@ class StoreApi
|
||||
|
||||
|
||||
// parse inputs
|
||||
$resourcePath = "/store/inventory?response=arbitrary_object";
|
||||
$resourcePath = "/store/inventory?response=arbitrary_object";
|
||||
$httpBody = '';
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@ -428,7 +414,6 @@ class StoreApi
|
||||
$headerParams['api_key'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -436,17 +421,15 @@ class StoreApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, 'object'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -454,7 +437,6 @@ class StoreApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getOrderById
|
||||
*
|
||||
@ -466,7 +448,7 @@ class StoreApi
|
||||
*/
|
||||
public function getOrderById($order_id)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getOrderByIdWithHttpInfo ($order_id);
|
||||
list($response) = $this->getOrderByIdWithHttpInfo ($order_id);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -494,16 +476,15 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($order_id !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "orderId" . "}",
|
||||
@ -537,7 +518,6 @@ class StoreApi
|
||||
$queryParams['test_api_key_query'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -545,17 +525,15 @@ class StoreApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\Order'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -563,7 +541,6 @@ class StoreApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* placeOrder
|
||||
*
|
||||
@ -575,7 +552,7 @@ class StoreApi
|
||||
*/
|
||||
public function placeOrder($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->placeOrderWithHttpInfo ($body);
|
||||
list($response) = $this->placeOrderWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -599,11 +576,11 @@ class StoreApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@ -638,7 +615,6 @@ class StoreApi
|
||||
$headerParams['x-test_api_client_secret'] = $apiKey;
|
||||
}
|
||||
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -646,17 +622,15 @@ class StoreApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\Order'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -664,5 +638,4 @@ class StoreApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -90,7 +90,6 @@ class UserApi
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* createUser
|
||||
*
|
||||
@ -102,7 +101,7 @@ class UserApi
|
||||
*/
|
||||
public function createUser($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->createUserWithHttpInfo ($body);
|
||||
list($response) = $this->createUserWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -126,11 +125,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@ -151,7 +150,6 @@ class UserApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -161,7 +159,6 @@ class UserApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -169,7 +166,6 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithArrayInput
|
||||
*
|
||||
@ -181,7 +177,7 @@ class UserApi
|
||||
*/
|
||||
public function createUsersWithArrayInput($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->createUsersWithArrayInputWithHttpInfo ($body);
|
||||
list($response) = $this->createUsersWithArrayInputWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -205,11 +201,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@ -230,7 +226,6 @@ class UserApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -240,7 +235,6 @@ class UserApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -248,7 +242,6 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* createUsersWithListInput
|
||||
*
|
||||
@ -260,7 +253,7 @@ class UserApi
|
||||
*/
|
||||
public function createUsersWithListInput($body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->createUsersWithListInputWithHttpInfo ($body);
|
||||
list($response) = $this->createUsersWithListInputWithHttpInfo ($body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -284,11 +277,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@ -309,7 +302,6 @@ class UserApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -319,7 +311,6 @@ class UserApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -327,7 +318,6 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* deleteUser
|
||||
*
|
||||
@ -339,7 +329,7 @@ class UserApi
|
||||
*/
|
||||
public function deleteUser($username)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->deleteUserWithHttpInfo ($username);
|
||||
list($response) = $this->deleteUserWithHttpInfo ($username);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -367,16 +357,15 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($username !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "username" . "}",
|
||||
@ -401,7 +390,6 @@ class UserApi
|
||||
if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) {
|
||||
$headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -411,7 +399,6 @@ class UserApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -419,7 +406,6 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* getUserByName
|
||||
*
|
||||
@ -431,7 +417,7 @@ class UserApi
|
||||
*/
|
||||
public function getUserByName($username)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->getUserByNameWithHttpInfo ($username);
|
||||
list($response) = $this->getUserByNameWithHttpInfo ($username);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -459,16 +445,15 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($username !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "username" . "}",
|
||||
@ -488,7 +473,6 @@ class UserApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -496,17 +480,15 @@ class UserApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, '\Swagger\Client\Model\User'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\User', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), '\Swagger\Client\Model\User', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\User', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -514,7 +496,6 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* loginUser
|
||||
*
|
||||
@ -527,7 +508,7 @@ class UserApi
|
||||
*/
|
||||
public function loginUser($username = null, $password = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->loginUserWithHttpInfo ($username, $password);
|
||||
list($response) = $this->loginUserWithHttpInfo ($username, $password);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -552,18 +533,16 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
// query params
|
||||
|
||||
if ($username !== null) {
|
||||
$queryParams['username'] = $this->apiClient->getSerializer()->toQueryValue($username);
|
||||
}// query params
|
||||
|
||||
if ($password !== null) {
|
||||
$queryParams['password'] = $this->apiClient->getSerializer()->toQueryValue($password);
|
||||
}
|
||||
@ -581,7 +560,6 @@ class UserApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -589,17 +567,15 @@ class UserApi
|
||||
$queryParams, $httpBody,
|
||||
$headerParams, 'string'
|
||||
);
|
||||
|
||||
if (!$response) {
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
}
|
||||
|
||||
return array(\Swagger\Client\ObjectSerializer::deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
|
||||
return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader);
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
case 200:
|
||||
$data = \Swagger\Client\ObjectSerializer::deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders());
|
||||
$e->setResponseObject($data);
|
||||
break;
|
||||
}
|
||||
@ -607,7 +583,6 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* logoutUser
|
||||
*
|
||||
@ -618,7 +593,7 @@ class UserApi
|
||||
*/
|
||||
public function logoutUser()
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->logoutUserWithHttpInfo ();
|
||||
list($response) = $this->logoutUserWithHttpInfo ();
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -641,11 +616,11 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
@ -662,7 +637,6 @@ class UserApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -672,7 +646,6 @@ class UserApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -680,7 +653,6 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* updateUser
|
||||
*
|
||||
@ -693,7 +665,7 @@ class UserApi
|
||||
*/
|
||||
public function updateUser($username, $body = null)
|
||||
{
|
||||
list($response, $statusCode, $httpHeader) = $this->updateUserWithHttpInfo ($username, $body);
|
||||
list($response) = $this->updateUserWithHttpInfo ($username, $body);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@ -722,16 +694,15 @@ class UserApi
|
||||
$queryParams = array();
|
||||
$headerParams = array();
|
||||
$formParams = array();
|
||||
$_header_accept = ApiClient::selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
$_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml'));
|
||||
if (!is_null($_header_accept)) {
|
||||
$headerParams['Accept'] = $_header_accept;
|
||||
}
|
||||
$headerParams['Content-Type'] = ApiClient::selectHeaderContentType(array());
|
||||
$headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array());
|
||||
|
||||
|
||||
|
||||
// path params
|
||||
|
||||
if ($username !== null) {
|
||||
$resourcePath = str_replace(
|
||||
"{" . "username" . "}",
|
||||
@ -755,7 +726,6 @@ class UserApi
|
||||
} elseif (count($formParams) > 0) {
|
||||
$httpBody = $formParams; // for HTTP post (form)
|
||||
}
|
||||
|
||||
// make the API Call
|
||||
try {
|
||||
list($response, $statusCode, $httpHeader) = $this->apiClient->callApi(
|
||||
@ -765,7 +735,6 @@ class UserApi
|
||||
);
|
||||
|
||||
return array(null, $statusCode, $httpHeader);
|
||||
|
||||
} catch (ApiException $e) {
|
||||
switch ($e->getCode()) {
|
||||
}
|
||||
@ -773,5 +742,4 @@ class UserApi
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Accept (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderAccept($accept)
|
||||
public function selectHeaderAccept($accept)
|
||||
{
|
||||
if (count($accept) === 0 or (count($accept) === 1 and $accept[0] === '')) {
|
||||
return null;
|
||||
@ -277,7 +277,7 @@ class ApiClient
|
||||
*
|
||||
* @return string Content-Type (e.g. application/json)
|
||||
*/
|
||||
public static function selectHeaderContentType($content_type)
|
||||
public function selectHeaderContentType($content_type)
|
||||
{
|
||||
if (count($content_type) === 0 or (count($content_type) === 1 and $content_type[0] === '')) {
|
||||
return 'application/json';
|
||||
@ -299,9 +299,9 @@ class ApiClient
|
||||
{
|
||||
// ref/credit: http://php.net/manual/en/function.http-parse-headers.php#112986
|
||||
$headers = array();
|
||||
$key = ''; // [+]
|
||||
$key = '';
|
||||
|
||||
foreach(explode("\n", $raw_headers) as $i => $h)
|
||||
foreach(explode("\n", $raw_headers) as $h)
|
||||
{
|
||||
$h = explode(':', $h, 2);
|
||||
|
||||
@ -311,26 +311,22 @@ class ApiClient
|
||||
$headers[$h[0]] = trim($h[1]);
|
||||
elseif (is_array($headers[$h[0]]))
|
||||
{
|
||||
// $tmp = array_merge($headers[$h[0]], array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge($headers[$h[0]], array(trim($h[1])));
|
||||
}
|
||||
else
|
||||
{
|
||||
// $tmp = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [-]
|
||||
// $headers[$h[0]] = $tmp; // [-]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1]))); // [+]
|
||||
$headers[$h[0]] = array_merge(array($headers[$h[0]]), array(trim($h[1])));
|
||||
}
|
||||
|
||||
$key = $h[0]; // [+]
|
||||
$key = $h[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (substr($h[0], 0, 1) == "\t")
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]);
|
||||
elseif (!$key)
|
||||
$headers[0] = trim($h[0]);trim($h[0]);
|
||||
}
|
||||
else // [+]
|
||||
{ // [+]
|
||||
if (substr($h[0], 0, 1) == "\t") // [+]
|
||||
$headers[$key] .= "\r\n\t".trim($h[0]); // [+]
|
||||
elseif (!$key) // [+]
|
||||
$headers[0] = trim($h[0]);trim($h[0]); // [+]
|
||||
} // [+]
|
||||
}
|
||||
|
||||
return $headers;
|
||||
|
@ -94,14 +94,12 @@ class Animal implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $class_name
|
||||
* @var string
|
||||
*/
|
||||
protected $class_name;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -113,7 +111,6 @@ class Animal implements ArrayAccess
|
||||
$this->class_name = $data["class_name"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets class_name
|
||||
* @return string
|
||||
@ -134,7 +131,6 @@ class Animal implements ArrayAccess
|
||||
$this->class_name = $class_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -182,10 +178,10 @@ class Animal implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,14 +94,12 @@ class Cat extends Animal implements ArrayAccess
|
||||
return parent::getters() + self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $declawed
|
||||
* @var bool
|
||||
*/
|
||||
protected $declawed;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -113,7 +111,6 @@ class Cat extends Animal implements ArrayAccess
|
||||
$this->declawed = $data["declawed"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets declawed
|
||||
* @return bool
|
||||
@ -134,7 +131,6 @@ class Cat extends Animal implements ArrayAccess
|
||||
$this->declawed = $declawed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -182,10 +178,10 @@ class Cat extends Animal implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,20 +98,17 @@ class Category implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $id
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -124,7 +121,6 @@ class Category implements ArrayAccess
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@ -145,7 +141,6 @@ class Category implements ArrayAccess
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return string
|
||||
@ -166,7 +161,6 @@ class Category implements ArrayAccess
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -214,10 +208,10 @@ class Category implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,14 +94,12 @@ class Dog extends Animal implements ArrayAccess
|
||||
return parent::getters() + self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $breed
|
||||
* @var string
|
||||
*/
|
||||
protected $breed;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -113,7 +111,6 @@ class Dog extends Animal implements ArrayAccess
|
||||
$this->breed = $data["breed"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets breed
|
||||
* @return string
|
||||
@ -134,7 +131,6 @@ class Dog extends Animal implements ArrayAccess
|
||||
$this->breed = $breed;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -182,10 +178,10 @@ class Dog extends Animal implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,44 +114,37 @@ class InlineResponse200 implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $tags
|
||||
* @var \Swagger\Client\Model\Tag[]
|
||||
*/
|
||||
protected $tags;
|
||||
|
||||
/**
|
||||
* $id
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* $category
|
||||
* @var object
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
/**
|
||||
* $status pet status in the store
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* $photo_urls
|
||||
* @var string[]
|
||||
*/
|
||||
protected $photo_urls;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -168,7 +161,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
$this->photo_urls = $data["photo_urls"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets tags
|
||||
* @return \Swagger\Client\Model\Tag[]
|
||||
@ -189,7 +181,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
$this->tags = $tags;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@ -210,7 +201,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets category
|
||||
* @return object
|
||||
@ -231,7 +221,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
$this->category = $category;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets status
|
||||
* @return string
|
||||
@ -255,7 +244,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return string
|
||||
@ -276,7 +264,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets photo_urls
|
||||
* @return string[]
|
||||
@ -297,7 +284,6 @@ class InlineResponse200 implements ArrayAccess
|
||||
$this->photo_urls = $photo_urls;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -345,10 +331,10 @@ class InlineResponse200 implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ use \ArrayAccess;
|
||||
* Model200Response Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @description Model for testing model name starting with number
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
@ -94,14 +94,12 @@ class Model200Response implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var int
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -113,7 +111,6 @@ class Model200Response implements ArrayAccess
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return int
|
||||
@ -134,7 +131,6 @@ class Model200Response implements ArrayAccess
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -182,10 +178,10 @@ class Model200Response implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ use \ArrayAccess;
|
||||
* ModelReturn Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @description Model for testing reserved words
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
@ -94,14 +94,12 @@ class ModelReturn implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $return
|
||||
* @var int
|
||||
*/
|
||||
protected $return;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -113,7 +111,6 @@ class ModelReturn implements ArrayAccess
|
||||
$this->return = $data["return"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets return
|
||||
* @return int
|
||||
@ -134,7 +131,6 @@ class ModelReturn implements ArrayAccess
|
||||
$this->return = $return;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -182,10 +178,10 @@ class ModelReturn implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ use \ArrayAccess;
|
||||
* Name Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @description Model for testing model name same as property name
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
@ -98,20 +98,17 @@ class Name implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var int
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* $snake_case
|
||||
* @var int
|
||||
*/
|
||||
protected $snake_case;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -124,7 +121,6 @@ class Name implements ArrayAccess
|
||||
$this->snake_case = $data["snake_case"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return int
|
||||
@ -145,7 +141,6 @@ class Name implements ArrayAccess
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets snake_case
|
||||
* @return int
|
||||
@ -166,7 +161,6 @@ class Name implements ArrayAccess
|
||||
$this->snake_case = $snake_case;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -214,10 +208,10 @@ class Name implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,44 +114,37 @@ class Order implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $id
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* $pet_id
|
||||
* @var int
|
||||
*/
|
||||
protected $pet_id;
|
||||
|
||||
/**
|
||||
* $quantity
|
||||
* @var int
|
||||
*/
|
||||
protected $quantity;
|
||||
|
||||
/**
|
||||
* $ship_date
|
||||
* @var \DateTime
|
||||
*/
|
||||
protected $ship_date;
|
||||
|
||||
/**
|
||||
* $status Order Status
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
/**
|
||||
* $complete
|
||||
* @var bool
|
||||
*/
|
||||
protected $complete;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -168,7 +161,6 @@ class Order implements ArrayAccess
|
||||
$this->complete = $data["complete"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@ -189,7 +181,6 @@ class Order implements ArrayAccess
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets pet_id
|
||||
* @return int
|
||||
@ -210,7 +201,6 @@ class Order implements ArrayAccess
|
||||
$this->pet_id = $pet_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets quantity
|
||||
* @return int
|
||||
@ -231,7 +221,6 @@ class Order implements ArrayAccess
|
||||
$this->quantity = $quantity;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets ship_date
|
||||
* @return \DateTime
|
||||
@ -252,7 +241,6 @@ class Order implements ArrayAccess
|
||||
$this->ship_date = $ship_date;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets status
|
||||
* @return string
|
||||
@ -276,7 +264,6 @@ class Order implements ArrayAccess
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets complete
|
||||
* @return bool
|
||||
@ -297,7 +284,6 @@ class Order implements ArrayAccess
|
||||
$this->complete = $complete;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -345,10 +331,10 @@ class Order implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -114,44 +114,37 @@ class Pet implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $id
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* $category
|
||||
* @var \Swagger\Client\Model\Category
|
||||
*/
|
||||
protected $category;
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
/**
|
||||
* $photo_urls
|
||||
* @var string[]
|
||||
*/
|
||||
protected $photo_urls;
|
||||
|
||||
/**
|
||||
* $tags
|
||||
* @var \Swagger\Client\Model\Tag[]
|
||||
*/
|
||||
protected $tags;
|
||||
|
||||
/**
|
||||
* $status pet status in the store
|
||||
* @var string
|
||||
*/
|
||||
protected $status;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -168,7 +161,6 @@ class Pet implements ArrayAccess
|
||||
$this->status = $data["status"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@ -189,7 +181,6 @@ class Pet implements ArrayAccess
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets category
|
||||
* @return \Swagger\Client\Model\Category
|
||||
@ -210,7 +201,6 @@ class Pet implements ArrayAccess
|
||||
$this->category = $category;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return string
|
||||
@ -231,7 +221,6 @@ class Pet implements ArrayAccess
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets photo_urls
|
||||
* @return string[]
|
||||
@ -252,7 +241,6 @@ class Pet implements ArrayAccess
|
||||
$this->photo_urls = $photo_urls;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets tags
|
||||
* @return \Swagger\Client\Model\Tag[]
|
||||
@ -273,7 +261,6 @@ class Pet implements ArrayAccess
|
||||
$this->tags = $tags;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets status
|
||||
* @return string
|
||||
@ -297,7 +284,6 @@ class Pet implements ArrayAccess
|
||||
$this->status = $status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -345,10 +331,10 @@ class Pet implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,14 +94,12 @@ class SpecialModelName implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $special_property_name
|
||||
* @var int
|
||||
*/
|
||||
protected $special_property_name;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -113,7 +111,6 @@ class SpecialModelName implements ArrayAccess
|
||||
$this->special_property_name = $data["special_property_name"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets special_property_name
|
||||
* @return int
|
||||
@ -134,7 +131,6 @@ class SpecialModelName implements ArrayAccess
|
||||
$this->special_property_name = $special_property_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -182,10 +178,10 @@ class SpecialModelName implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,20 +98,17 @@ class Tag implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $id
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* $name
|
||||
* @var string
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -124,7 +121,6 @@ class Tag implements ArrayAccess
|
||||
$this->name = $data["name"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@ -145,7 +141,6 @@ class Tag implements ArrayAccess
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets name
|
||||
* @return string
|
||||
@ -166,7 +161,6 @@ class Tag implements ArrayAccess
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -214,10 +208,10 @@ class Tag implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -122,56 +122,47 @@ class User implements ArrayAccess
|
||||
return self::$getters;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* $id
|
||||
* @var int
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
/**
|
||||
* $username
|
||||
* @var string
|
||||
*/
|
||||
protected $username;
|
||||
|
||||
/**
|
||||
* $first_name
|
||||
* @var string
|
||||
*/
|
||||
protected $first_name;
|
||||
|
||||
/**
|
||||
* $last_name
|
||||
* @var string
|
||||
*/
|
||||
protected $last_name;
|
||||
|
||||
/**
|
||||
* $email
|
||||
* @var string
|
||||
*/
|
||||
protected $email;
|
||||
|
||||
/**
|
||||
* $password
|
||||
* @var string
|
||||
*/
|
||||
protected $password;
|
||||
|
||||
/**
|
||||
* $phone
|
||||
* @var string
|
||||
*/
|
||||
protected $phone;
|
||||
|
||||
/**
|
||||
* $user_status User Status
|
||||
* @var int
|
||||
*/
|
||||
protected $user_status;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* @param mixed[] $data Associated array of property value initalizing the model
|
||||
@ -190,7 +181,6 @@ class User implements ArrayAccess
|
||||
$this->user_status = $data["user_status"];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets id
|
||||
* @return int
|
||||
@ -211,7 +201,6 @@ class User implements ArrayAccess
|
||||
$this->id = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets username
|
||||
* @return string
|
||||
@ -232,7 +221,6 @@ class User implements ArrayAccess
|
||||
$this->username = $username;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets first_name
|
||||
* @return string
|
||||
@ -253,7 +241,6 @@ class User implements ArrayAccess
|
||||
$this->first_name = $first_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets last_name
|
||||
* @return string
|
||||
@ -274,7 +261,6 @@ class User implements ArrayAccess
|
||||
$this->last_name = $last_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets email
|
||||
* @return string
|
||||
@ -295,7 +281,6 @@ class User implements ArrayAccess
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets password
|
||||
* @return string
|
||||
@ -316,7 +301,6 @@ class User implements ArrayAccess
|
||||
$this->password = $password;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets phone
|
||||
* @return string
|
||||
@ -337,7 +321,6 @@ class User implements ArrayAccess
|
||||
$this->phone = $phone;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets user_status
|
||||
* @return int
|
||||
@ -358,7 +341,6 @@ class User implements ArrayAccess
|
||||
$this->user_status = $user_status;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if offset exists. False otherwise.
|
||||
* @param integer $offset Offset
|
||||
@ -406,10 +388,10 @@ class User implements ArrayAccess
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if (defined('JSON_PRETTY_PRINT')) {
|
||||
if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||
} else {
|
||||
}
|
||||
|
||||
return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,14 +55,14 @@ class ObjectSerializer
|
||||
public static function sanitizeForSerialization($data)
|
||||
{
|
||||
if (is_scalar($data) || null === $data) {
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif ($data instanceof \DateTime) {
|
||||
$sanitized = $data->format(\DateTime::ATOM);
|
||||
return $data->format(\DateTime::ATOM);
|
||||
} elseif (is_array($data)) {
|
||||
foreach ($data as $property => $value) {
|
||||
$data[$property] = self::sanitizeForSerialization($value);
|
||||
}
|
||||
$sanitized = $data;
|
||||
return $data;
|
||||
} elseif (is_object($data)) {
|
||||
$values = array();
|
||||
foreach (array_keys($data::swaggerTypes()) as $property) {
|
||||
@ -71,12 +71,10 @@ class ObjectSerializer
|
||||
$values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($data->$getter());
|
||||
}
|
||||
}
|
||||
$sanitized = (object)$values;
|
||||
return (object)$values;
|
||||
} else {
|
||||
$sanitized = (string)$data;
|
||||
return (string)$data;
|
||||
}
|
||||
|
||||
return $sanitized;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -224,7 +222,7 @@ class ObjectSerializer
|
||||
public static function deserialize($data, $class, $httpHeaders=null, $discriminator=null)
|
||||
{
|
||||
if (null === $data) {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
} elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int]
|
||||
$inner = substr($class, 4, -1);
|
||||
$deserialized = array();
|
||||
@ -235,16 +233,17 @@ class ObjectSerializer
|
||||
$deserialized[$key] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
}
|
||||
return $deserialized;
|
||||
} elseif (strcasecmp(substr($class, -2), '[]') == 0) {
|
||||
$subClass = substr($class, 0, -2);
|
||||
$values = array();
|
||||
foreach ($data as $key => $value) {
|
||||
$values[] = self::deserialize($value, $subClass, null, $discriminator);
|
||||
}
|
||||
$deserialized = $values;
|
||||
return $values;
|
||||
} elseif ($class === 'object') {
|
||||
settype($data, 'array');
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\DateTime') {
|
||||
// Some API's return an invalid, empty string as a
|
||||
// date-time property. DateTime::__construct() will return
|
||||
@ -253,13 +252,13 @@ class ObjectSerializer
|
||||
// be interpreted as a missing field/value. Let's handle
|
||||
// this graceful.
|
||||
if (!empty($data)) {
|
||||
$deserialized = new \DateTime($data);
|
||||
return new \DateTime($data);
|
||||
} else {
|
||||
$deserialized = null;
|
||||
return null;
|
||||
}
|
||||
} elseif (in_array($class, array('integer', 'int', 'void', 'number', 'object', 'double', 'float', 'byte', 'DateTime', 'string', 'mixed', 'boolean', 'bool'))) {
|
||||
settype($data, $class);
|
||||
$deserialized = $data;
|
||||
return $data;
|
||||
} elseif ($class === '\SplFileObject') {
|
||||
// determine file name
|
||||
if (array_key_exists('Content-Disposition', $httpHeaders) && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) {
|
||||
@ -270,6 +269,7 @@ class ObjectSerializer
|
||||
$deserialized = new \SplFileObject($filename, "w");
|
||||
$byte_written = $deserialized->fwrite($data);
|
||||
error_log("[INFO] Written $byte_written byte to $filename. Please move the file to a proper folder or delete the temp file after processing.\n", 3, Configuration::getDefaultConfiguration()->getDebugFile());
|
||||
return $deserialized;
|
||||
|
||||
} else {
|
||||
// If a discriminator is defined and points to a valid subclass, use it.
|
||||
@ -292,9 +292,7 @@ class ObjectSerializer
|
||||
$instance->$propertySetter(self::deserialize($propertyValue, $type, null, $discriminator));
|
||||
}
|
||||
}
|
||||
$deserialized = $instance;
|
||||
return $instance;
|
||||
}
|
||||
|
||||
return $deserialized;
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ namespace Swagger\Client\Model;
|
||||
* Model200ResponseTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @description Model for testing model name starting with number
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
|
@ -37,7 +37,7 @@ namespace Swagger\Client\Model;
|
||||
* ModelReturnTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @description Model for testing reserved words
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
|
@ -37,7 +37,7 @@ namespace Swagger\Client\Model;
|
||||
* NameTest Class Doc Comment
|
||||
*
|
||||
* @category Class
|
||||
* @description
|
||||
* @description Model for testing model name same as property name
|
||||
* @package Swagger\Client
|
||||
* @author http://github.com/swagger-api/swagger-codegen
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache Licene v2
|
||||
|
@ -64,7 +64,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test case for addPet
|
||||
*
|
||||
@ -74,7 +73,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_addPet() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for addPetUsingByteArray
|
||||
*
|
||||
@ -84,7 +82,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_addPetUsingByteArray() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for deletePet
|
||||
*
|
||||
@ -94,7 +91,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_deletePet() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for findPetsByStatus
|
||||
*
|
||||
@ -104,7 +100,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_findPetsByStatus() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for findPetsByTags
|
||||
*
|
||||
@ -114,7 +109,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_findPetsByTags() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getPetById
|
||||
*
|
||||
@ -124,7 +118,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getPetById() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getPetByIdInObject
|
||||
*
|
||||
@ -134,7 +127,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getPetByIdInObject() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for petPetIdtestingByteArraytrueGet
|
||||
*
|
||||
@ -144,7 +136,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_petPetIdtestingByteArraytrueGet() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for updatePet
|
||||
*
|
||||
@ -154,7 +145,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_updatePet() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for updatePetWithForm
|
||||
*
|
||||
@ -164,7 +154,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_updatePetWithForm() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for uploadFile
|
||||
*
|
||||
@ -174,5 +163,4 @@ class PetApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_uploadFile() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test case for deleteOrder
|
||||
*
|
||||
@ -74,7 +73,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_deleteOrder() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for findOrdersByStatus
|
||||
*
|
||||
@ -84,7 +82,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_findOrdersByStatus() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getInventory
|
||||
*
|
||||
@ -94,7 +91,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getInventory() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getInventoryInObject
|
||||
*
|
||||
@ -104,7 +100,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getInventoryInObject() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getOrderById
|
||||
*
|
||||
@ -114,7 +109,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getOrderById() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for placeOrder
|
||||
*
|
||||
@ -124,5 +118,4 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_placeOrder() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test case for createUser
|
||||
*
|
||||
@ -74,7 +73,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_createUser() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for createUsersWithArrayInput
|
||||
*
|
||||
@ -84,7 +82,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_createUsersWithArrayInput() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for createUsersWithListInput
|
||||
*
|
||||
@ -94,7 +91,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_createUsersWithListInput() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for deleteUser
|
||||
*
|
||||
@ -104,7 +100,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_deleteUser() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for getUserByName
|
||||
*
|
||||
@ -114,7 +109,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_getUserByName() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for loginUser
|
||||
*
|
||||
@ -124,7 +118,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_loginUser() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for logoutUser
|
||||
*
|
||||
@ -134,7 +127,6 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_logoutUser() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test case for updateUser
|
||||
*
|
||||
@ -144,5 +136,4 @@ class UserApiTest extends \PHPUnit_Framework_TestCase
|
||||
public function test_updateUser() {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,28 +1,49 @@
|
||||
# swagger_client
|
||||
This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
|
||||
|
||||
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||
|
||||
- API verion: 1.0.0
|
||||
- Package version:
|
||||
- Build date: 2016-03-30T17:18:44.943+08:00
|
||||
- Build package: class io.swagger.codegen.languages.PythonClientCodegen
|
||||
|
||||
## Requirements.
|
||||
Python 2.7 and later.
|
||||
|
||||
## Setuptools
|
||||
You can install the bindings via [Setuptools](http://pypi.python.org/pypi/setuptools).
|
||||
Python 2.7 and 3.4+
|
||||
|
||||
## Installation & Usage
|
||||
### pip install
|
||||
|
||||
If the python package is hosted on Github, you can install directly from Github
|
||||
|
||||
```sh
|
||||
python setup.py install
|
||||
pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git
|
||||
```
|
||||
(you may need to run the command with root permission: `sudo pip install git+https://github.com/YOUR_GIT_USR_ID/YOUR_GIT_REPO_ID.git`)
|
||||
|
||||
Or you can install from Github via pip:
|
||||
|
||||
```sh
|
||||
pip install git+https://github.com/geekerzp/swagger_client.git
|
||||
```
|
||||
|
||||
To use the bindings, import the pacakge:
|
||||
|
||||
Import the pacakge:
|
||||
```python
|
||||
import swagger_client
|
||||
```
|
||||
|
||||
## Manual Installation
|
||||
If you do not wish to use setuptools, you can download the latest release.
|
||||
Then, to use the bindings, import the package:
|
||||
### Setuptools
|
||||
|
||||
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
|
||||
|
||||
```sh
|
||||
python setup.py install --user
|
||||
```
|
||||
(or `sudo python setup.py install` to install the package for all users)
|
||||
|
||||
Import the pacakge:
|
||||
```python
|
||||
import swagger_client
|
||||
```
|
||||
|
||||
### Manual Installation
|
||||
|
||||
Download the latest release to the project folder (e.g. ./path/to/swagger_client) and import the package:
|
||||
|
||||
```python
|
||||
import path.to.swagger_client
|
||||
@ -30,44 +51,126 @@ import path.to.swagger_client
|
||||
|
||||
## Getting Started
|
||||
|
||||
TODO
|
||||
Please follow the [installation procedure](#installation--usage) and then run the following:
|
||||
|
||||
## Documentation
|
||||
```python
|
||||
import time
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
|
||||
TODO
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi
|
||||
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
## Tests
|
||||
|
||||
(Please make sure you have [virtualenv](http://docs.python-guide.org/en/latest/dev/virtualenvs/) installed)
|
||||
|
||||
Execute the following command to run the tests in the current Python (v2 or v3) environment:
|
||||
|
||||
```sh
|
||||
$ make test
|
||||
[... magically installs dependencies and runs tests on your virtualenv]
|
||||
Ran 7 tests in 19.289s
|
||||
|
||||
OK
|
||||
```
|
||||
or
|
||||
try:
|
||||
# Add a new pet to the store
|
||||
api_instance.add_pet(body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->add_pet: %s\n" % e
|
||||
|
||||
```
|
||||
$ mvn integration-test -rf :PythonPetstoreClientTests
|
||||
Using 2195432783 as seed
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] BUILD SUCCESS
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
[INFO] Total time: 37.594 s
|
||||
[INFO] Finished at: 2015-05-16T18:00:35+08:00
|
||||
[INFO] Final Memory: 11M/156M
|
||||
[INFO] ------------------------------------------------------------------------
|
||||
```
|
||||
If you want to run the tests in all the python platforms:
|
||||
|
||||
```sh
|
||||
$ make test-all
|
||||
[... tox creates a virtualenv for every platform and runs tests inside of each]
|
||||
py27: commands succeeded
|
||||
py34: commands succeeded
|
||||
congratulations :)
|
||||
```
|
||||
## Documentation for API Endpoints
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
*PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
*StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
|
||||
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
|
||||
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
|
||||
*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
## Documentation For Models
|
||||
|
||||
- [Animal](docs/Animal.md)
|
||||
- [Cat](docs/Cat.md)
|
||||
- [Category](docs/Category.md)
|
||||
- [Dog](docs/Dog.md)
|
||||
- [InlineResponse200](docs/InlineResponse200.md)
|
||||
- [Model200Response](docs/Model200Response.md)
|
||||
- [ModelReturn](docs/ModelReturn.md)
|
||||
- [Name](docs/Name.md)
|
||||
- [Order](docs/Order.md)
|
||||
- [Pet](docs/Pet.md)
|
||||
- [SpecialModelName](docs/SpecialModelName.md)
|
||||
- [Tag](docs/Tag.md)
|
||||
- [User](docs/User.md)
|
||||
|
||||
|
||||
## Documentation For Authorization
|
||||
|
||||
|
||||
## test_api_key_header
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_header
|
||||
- **Location**: HTTP header
|
||||
|
||||
## api_key
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: api_key
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_http_basic
|
||||
|
||||
- **Type**: HTTP basic authentication
|
||||
|
||||
## test_api_client_secret
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_secret
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_api_client_id
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: x-test_api_client_id
|
||||
- **Location**: HTTP header
|
||||
|
||||
## test_api_key_query
|
||||
|
||||
- **Type**: API key
|
||||
- **API key parameter name**: test_api_key_query
|
||||
- **Location**: URL query string
|
||||
|
||||
## petstore_auth
|
||||
|
||||
- **Type**: OAuth
|
||||
- **Flow**: implicit
|
||||
- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog
|
||||
- **Scopes**:
|
||||
- **write:pets**: modify pets in your account
|
||||
- **read:pets**: read your pets
|
||||
|
||||
|
||||
## Author
|
||||
|
||||
apiteam@swagger.io
|
||||
|
||||
|
10
samples/client/petstore/python/docs/Animal.md
Normal file
10
samples/client/petstore/python/docs/Animal.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Animal
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **str** | |
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/petstore/python/docs/Cat.md
Normal file
11
samples/client/petstore/python/docs/Cat.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Cat
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **str** | |
|
||||
**declawed** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/petstore/python/docs/Category.md
Normal file
11
samples/client/petstore/python/docs/Category.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Category
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/petstore/python/docs/Dog.md
Normal file
11
samples/client/petstore/python/docs/Dog.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Dog
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**class_name** | **str** | |
|
||||
**breed** | **str** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
15
samples/client/petstore/python/docs/InlineResponse200.md
Normal file
15
samples/client/petstore/python/docs/InlineResponse200.md
Normal file
@ -0,0 +1,15 @@
|
||||
# InlineResponse200
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**tags** | [**list[Tag]**](Tag.md) | | [optional]
|
||||
**id** | **int** | |
|
||||
**category** | **object** | | [optional]
|
||||
**status** | **str** | pet status in the store | [optional]
|
||||
**name** | **str** | | [optional]
|
||||
**photo_urls** | **list[str]** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
10
samples/client/petstore/python/docs/Model200Response.md
Normal file
10
samples/client/petstore/python/docs/Model200Response.md
Normal file
@ -0,0 +1,10 @@
|
||||
# Model200Response
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **int** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
10
samples/client/petstore/python/docs/ModelReturn.md
Normal file
10
samples/client/petstore/python/docs/ModelReturn.md
Normal file
@ -0,0 +1,10 @@
|
||||
# ModelReturn
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**_return** | **int** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
11
samples/client/petstore/python/docs/Name.md
Normal file
11
samples/client/petstore/python/docs/Name.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Name
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**name** | **int** | | [optional]
|
||||
**snake_case** | **int** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
15
samples/client/petstore/python/docs/Order.md
Normal file
15
samples/client/petstore/python/docs/Order.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Order
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**pet_id** | **int** | | [optional]
|
||||
**quantity** | **int** | | [optional]
|
||||
**ship_date** | **datetime** | | [optional]
|
||||
**status** | **str** | Order Status | [optional]
|
||||
**complete** | **bool** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
15
samples/client/petstore/python/docs/Pet.md
Normal file
15
samples/client/petstore/python/docs/Pet.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Pet
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**category** | [**Category**](Category.md) | | [optional]
|
||||
**name** | **str** | |
|
||||
**photo_urls** | **list[str]** | |
|
||||
**tags** | [**list[Tag]**](Tag.md) | | [optional]
|
||||
**status** | **str** | pet status in the store | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
596
samples/client/petstore/python/docs/PetApi.md
Normal file
596
samples/client/petstore/python/docs/PetApi.md
Normal file
@ -0,0 +1,596 @@
|
||||
# swagger_client\PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **add_pet**
|
||||
> add_pet(body=body)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
try:
|
||||
# Add a new pet to the store
|
||||
api_instance.add_pet(body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->add_pet: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **add_pet_using_byte_array**
|
||||
> add_pet_using_byte_array(body=body)
|
||||
|
||||
Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
body = 'B' # str | Pet object in the form of byte array (optional)
|
||||
|
||||
try:
|
||||
# Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
api_instance.add_pet_using_byte_array(body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->add_pet_using_byte_array: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | **str**| Pet object in the form of byte array | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **delete_pet**
|
||||
> delete_pet(pet_id, api_key=api_key)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
pet_id = 789 # int | Pet id to delete
|
||||
api_key = 'api_key_example' # str | (optional)
|
||||
|
||||
try:
|
||||
# Deletes a pet
|
||||
api_instance.delete_pet(pet_id, api_key=api_key);
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->delete_pet: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| Pet id to delete |
|
||||
**api_key** | **str**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **find_pets_by_status**
|
||||
> list[Pet] find_pets_by_status(status=status)
|
||||
|
||||
Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
status = ['available'] # list[str] | Status values that need to be considered for query (optional) (default to available)
|
||||
|
||||
try:
|
||||
# Finds Pets by status
|
||||
api_response = api_instance.find_pets_by_status(status=status);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->find_pets_by_status: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**list[str]**](str.md)| Status values that need to be considered for query | [optional] [default to available]
|
||||
|
||||
### Return type
|
||||
|
||||
[**list[Pet]**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **find_pets_by_tags**
|
||||
> list[Pet] find_pets_by_tags(tags=tags)
|
||||
|
||||
Finds Pets by tags
|
||||
|
||||
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
tags = ['tags_example'] # list[str] | Tags to filter by (optional)
|
||||
|
||||
try:
|
||||
# Finds Pets by tags
|
||||
api_response = api_instance.find_pets_by_tags(tags=tags);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->find_pets_by_tags: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**list[str]**](str.md)| Tags to filter by | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**list[Pet]**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_pet_by_id**
|
||||
> Pet get_pet_by_id(pet_id)
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
pet_id = 789 # int | ID of pet that needs to be fetched
|
||||
|
||||
try:
|
||||
# Find pet by ID
|
||||
api_response = api_instance.get_pet_by_id(pet_id);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->get_pet_by_id: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_pet_by_id_in_object**
|
||||
> InlineResponse200 get_pet_by_id_in_object(pet_id)
|
||||
|
||||
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
pet_id = 789 # int | ID of pet that needs to be fetched
|
||||
|
||||
try:
|
||||
# Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
api_response = api_instance.get_pet_by_id_in_object(pet_id);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->get_pet_by_id_in_object: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**InlineResponse200**](InlineResponse200.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **pet_pet_idtesting_byte_arraytrue_get**
|
||||
> str pet_pet_idtesting_byte_arraytrue_get(pet_id)
|
||||
|
||||
Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
pet_id = 789 # int | ID of pet that needs to be fetched
|
||||
|
||||
try:
|
||||
# Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
api_response = api_instance.pet_pet_idtesting_byte_arraytrue_get(pet_id);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_pet**
|
||||
> update_pet(body=body)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional)
|
||||
|
||||
try:
|
||||
# Update an existing pet
|
||||
api_instance.update_pet(body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->update_pet: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_pet_with_form**
|
||||
> update_pet_with_form(pet_id, name=name, status=status)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
pet_id = 'pet_id_example' # str | ID of pet that needs to be updated
|
||||
name = 'name_example' # str | Updated name of the pet (optional)
|
||||
status = 'status_example' # str | Updated status of the pet (optional)
|
||||
|
||||
try:
|
||||
# Updates a pet in the store with form data
|
||||
api_instance.update_pet_with_form(pet_id, name=name, status=status);
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->update_pet_with_form: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **str**| ID of pet that needs to be updated |
|
||||
**name** | **str**| Updated name of the pet | [optional]
|
||||
**status** | **str**| Updated status of the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **upload_file**
|
||||
> upload_file(pet_id, additional_metadata=additional_metadata, file=file)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure OAuth2 access token for authorization: petstore_auth
|
||||
swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.PetApi()
|
||||
pet_id = 789 # int | ID of pet to update
|
||||
additional_metadata = 'additional_metadata_example' # str | Additional data to pass to server (optional)
|
||||
file = '/path/to/file.txt' # file | file to upload (optional)
|
||||
|
||||
try:
|
||||
# uploads an image
|
||||
api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file);
|
||||
except ApiException as e:
|
||||
print "Exception when calling PetApi->upload_file: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet to update |
|
||||
**additional_metadata** | **str**| Additional data to pass to server | [optional]
|
||||
**file** | **file**| file to upload | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](../README.md#petstore_auth)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
10
samples/client/petstore/python/docs/SpecialModelName.md
Normal file
10
samples/client/petstore/python/docs/SpecialModelName.md
Normal file
@ -0,0 +1,10 @@
|
||||
# SpecialModelName
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**special_property_name** | **int** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
330
samples/client/petstore/python/docs/StoreApi.md
Normal file
330
samples/client/petstore/python/docs/StoreApi.md
Normal file
@ -0,0 +1,330 @@
|
||||
# swagger_client\StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
|
||||
[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **delete_order**
|
||||
> delete_order(order_id)
|
||||
|
||||
Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.StoreApi()
|
||||
order_id = 'order_id_example' # str | ID of the order that needs to be deleted
|
||||
|
||||
try:
|
||||
# Delete purchase order by ID
|
||||
api_instance.delete_order(order_id);
|
||||
except ApiException as e:
|
||||
print "Exception when calling StoreApi->delete_order: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order_id** | **str**| ID of the order that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **find_orders_by_status**
|
||||
> list[Order] find_orders_by_status(status=status)
|
||||
|
||||
Finds orders by status
|
||||
|
||||
A single status value can be provided as a string
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: test_api_client_id
|
||||
swagger_client.configuration.api_key['x-test_api_client_id'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['x-test_api_client_id'] = 'BEARER'
|
||||
# Configure API key authorization: test_api_client_secret
|
||||
swagger_client.configuration.api_key['x-test_api_client_secret'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['x-test_api_client_secret'] = 'BEARER'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.StoreApi()
|
||||
status = 'placed' # str | Status value that needs to be considered for query (optional) (default to placed)
|
||||
|
||||
try:
|
||||
# Finds orders by status
|
||||
api_response = api_instance.find_orders_by_status(status=status);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling StoreApi->find_orders_by_status: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **str**| Status value that needs to be considered for query | [optional] [default to placed]
|
||||
|
||||
### Return type
|
||||
|
||||
[**list[Order]**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_inventory**
|
||||
> dict(str, int) get_inventory()
|
||||
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.StoreApi()
|
||||
|
||||
try:
|
||||
# Returns pet inventories by status
|
||||
api_response = api_instance.get_inventory();
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling StoreApi->get_inventory: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
[**dict(str, int)**](dict.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_inventory_in_object**
|
||||
> object get_inventory_in_object()
|
||||
|
||||
Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
|
||||
Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: api_key
|
||||
swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.StoreApi()
|
||||
|
||||
try:
|
||||
# Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
api_response = api_instance.get_inventory_in_object();
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling StoreApi->get_inventory_in_object: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
**object**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](../README.md#api_key)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_order_by_id**
|
||||
> Order get_order_by_id(order_id)
|
||||
|
||||
Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: test_api_key_header
|
||||
swagger_client.configuration.api_key['test_api_key_header'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['test_api_key_header'] = 'BEARER'
|
||||
# Configure API key authorization: test_api_key_query
|
||||
swagger_client.configuration.api_key['test_api_key_query'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['test_api_key_query'] = 'BEARER'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.StoreApi()
|
||||
order_id = 'order_id_example' # str | ID of pet that needs to be fetched
|
||||
|
||||
try:
|
||||
# Find purchase order by ID
|
||||
api_response = api_instance.get_order_by_id(order_id);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling StoreApi->get_order_by_id: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order_id** | **str**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **place_order**
|
||||
> Order place_order(body=body)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure API key authorization: test_api_client_id
|
||||
swagger_client.configuration.api_key['x-test_api_client_id'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['x-test_api_client_id'] = 'BEARER'
|
||||
# Configure API key authorization: test_api_client_secret
|
||||
swagger_client.configuration.api_key['x-test_api_client_secret'] = 'YOUR_API_KEY';
|
||||
# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed
|
||||
# swagger_client.configuration.api_key_prefix['x-test_api_client_secret'] = 'BEARER'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.StoreApi()
|
||||
body = swagger_client.Order() # Order | order placed for purchasing the pet (optional)
|
||||
|
||||
try:
|
||||
# Place an order for a pet
|
||||
api_response = api_instance.place_order(body=body);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling StoreApi->place_order: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
11
samples/client/petstore/python/docs/Tag.md
Normal file
11
samples/client/petstore/python/docs/Tag.md
Normal file
@ -0,0 +1,11 @@
|
||||
# Tag
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **str** | | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
17
samples/client/petstore/python/docs/User.md
Normal file
17
samples/client/petstore/python/docs/User.md
Normal file
@ -0,0 +1,17 @@
|
||||
# User
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**username** | **str** | | [optional]
|
||||
**first_name** | **str** | | [optional]
|
||||
**last_name** | **str** | | [optional]
|
||||
**email** | **str** | | [optional]
|
||||
**password** | **str** | | [optional]
|
||||
**phone** | **str** | | [optional]
|
||||
**user_status** | **int** | User Status | [optional]
|
||||
|
||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||
|
||||
|
398
samples/client/petstore/python/docs/UserApi.md
Normal file
398
samples/client/petstore/python/docs/UserApi.md
Normal file
@ -0,0 +1,398 @@
|
||||
# swagger_client\UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**create_user**](UserApi.md#create_user) | **POST** /user | Create user
|
||||
[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
|
||||
[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
|
||||
[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system
|
||||
[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **create_user**
|
||||
> create_user(body=body)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
body = swagger_client.User() # User | Created user object (optional)
|
||||
|
||||
try:
|
||||
# Create user
|
||||
api_instance.create_user(body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->create_user: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **create_users_with_array_input**
|
||||
> create_users_with_array_input(body=body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
body = [swagger_client.User()] # list[User] | List of user object (optional)
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
api_instance.create_users_with_array_input(body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->create_users_with_array_input: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](User.md)| List of user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **create_users_with_list_input**
|
||||
> create_users_with_list_input(body=body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
body = [swagger_client.User()] # list[User] | List of user object (optional)
|
||||
|
||||
try:
|
||||
# Creates list of users with given input array
|
||||
api_instance.create_users_with_list_input(body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->create_users_with_list_input: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**list[User]**](User.md)| List of user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **delete_user**
|
||||
> delete_user(username)
|
||||
|
||||
Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# Configure HTTP basic authorization: test_http_basic
|
||||
swagger_client.configuration.username = 'YOUR_USERNAME'
|
||||
swagger_client.configuration.password = 'YOUR_PASSWORD'
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
username = 'username_example' # str | The name that needs to be deleted
|
||||
|
||||
try:
|
||||
# Delete user
|
||||
api_instance.delete_user(username);
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->delete_user: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **str**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[test_http_basic](../README.md#test_http_basic)
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **get_user_by_name**
|
||||
> User get_user_by_name(username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
username = 'username_example' # str | The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
try:
|
||||
# Get user by user name
|
||||
api_response = api_instance.get_user_by_name(username);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->get_user_by_name: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **str**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**User**](User.md)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **login_user**
|
||||
> str login_user(username=username, password=password)
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
username = 'username_example' # str | The user name for login (optional)
|
||||
password = 'password_example' # str | The password for login in clear text (optional)
|
||||
|
||||
try:
|
||||
# Logs user into the system
|
||||
api_response = api_instance.login_user(username=username, password=password);
|
||||
pprint(api_response)
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->login_user: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **str**| The user name for login | [optional]
|
||||
**password** | **str**| The password for login in clear text | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**str**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **logout_user**
|
||||
> logout_user()
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
|
||||
try:
|
||||
# Logs out current logged in user session
|
||||
api_instance.logout_user();
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->logout_user: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
||||
# **update_user**
|
||||
> update_user(username, body=body)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```python
|
||||
import swagger_client
|
||||
from swagger_client.rest import ApiException
|
||||
from pprint import pprint
|
||||
import time
|
||||
|
||||
|
||||
# create an instance of the API class
|
||||
api_instance = swagger_client.UserApi()
|
||||
username = 'username_example' # str | name that need to be deleted
|
||||
body = swagger_client.User() # User | Updated user object (optional)
|
||||
|
||||
try:
|
||||
# Updated user
|
||||
api_instance.update_user(username, body=body);
|
||||
except ApiException as e:
|
||||
print "Exception when calling UserApi->update_user: %s\n" % e
|
||||
```
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **str**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP reuqest headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user