forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen into pointer
# Conflicts: # modules/swagger-codegen/src/main/resources/go/api.mustache # samples/client/petstore/go/go-petstore/pet_api.go # samples/client/petstore/go/go-petstore/store_api.go # samples/client/petstore/go/go-petstore/user_api.go
This commit is contained in:
commit
3168de5f74
30
bin/groovy-petstore.sh
Executable file
30
bin/groovy-petstore.sh
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
SCRIPT="$0"
|
||||||
|
|
||||||
|
while [ -h "$SCRIPT" ] ; do
|
||||||
|
ls=`ls -ld "$SCRIPT"`
|
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
SCRIPT="$link"
|
||||||
|
else
|
||||||
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d "${APP_DIR}" ]; then
|
||||||
|
APP_DIR=`dirname "$SCRIPT"`/..
|
||||||
|
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||||
|
fi
|
||||||
|
|
||||||
|
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$executable" ]
|
||||||
|
then
|
||||||
|
mvn clean package
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l groovy -o samples/client/petstore/groovy -DhideGenerationTimestamp=true"
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
@ -26,6 +26,6 @@ fi
|
|||||||
|
|
||||||
# if you've executed sbt assembly previously it will use that instead.
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l javascript -o samples/client/petstore/javascript"
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/Javascript -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l javascript -o samples/client/petstore/javascript"
|
||||||
|
|
||||||
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags
|
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags
|
||||||
|
@ -20,7 +20,7 @@ public class CodegenModel {
|
|||||||
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
|
public List<CodegenProperty> requiredVars = new ArrayList<CodegenProperty>(); // a list of required properties
|
||||||
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
|
public List<CodegenProperty> optionalVars = new ArrayList<CodegenProperty>(); // a list of optional properties
|
||||||
public List<CodegenProperty> allVars;
|
public List<CodegenProperty> allVars;
|
||||||
public List<String> allowableValues;
|
public Map<String, Object> allowableValues;
|
||||||
|
|
||||||
// Sorted sets of required parameters.
|
// Sorted sets of required parameters.
|
||||||
public Set<String> mandatory = new TreeSet<String>();
|
public Set<String> mandatory = new TreeSet<String>();
|
||||||
|
@ -133,6 +133,161 @@ public class DefaultCodegen {
|
|||||||
return objs;
|
return objs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* post process enum defined in model's properties
|
||||||
|
*
|
||||||
|
* @param objs Map of models
|
||||||
|
* @return maps of models with better enum support
|
||||||
|
*/
|
||||||
|
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
|
||||||
|
List<Object> models = (List<Object>) objs.get("models");
|
||||||
|
for (Object _mo : models) {
|
||||||
|
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||||
|
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||||
|
|
||||||
|
// for enum model
|
||||||
|
if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) {
|
||||||
|
Map<String, Object> allowableValues = cm.allowableValues;
|
||||||
|
|
||||||
|
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||||
|
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||||
|
String commonPrefix = findCommonPrefixOfVars(values);
|
||||||
|
int truncateIdx = commonPrefix.length();
|
||||||
|
for (Object value : values) {
|
||||||
|
Map<String, String> enumVar = new HashMap<String, String>();
|
||||||
|
String enumName;
|
||||||
|
if (truncateIdx == 0) {
|
||||||
|
enumName = value.toString();
|
||||||
|
} else {
|
||||||
|
enumName = value.toString().substring(truncateIdx);
|
||||||
|
if ("".equals(enumName)) {
|
||||||
|
enumName = value.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumVar.put("name", toEnumVarName(enumName, cm.dataType));
|
||||||
|
enumVar.put("value", toEnumValue(value.toString(), cm.dataType));
|
||||||
|
enumVars.add(enumVar);
|
||||||
|
}
|
||||||
|
cm.allowableValues.put("enumVars", enumVars);
|
||||||
|
}
|
||||||
|
|
||||||
|
// for enum model's properties
|
||||||
|
for (CodegenProperty var : cm.vars) {
|
||||||
|
Map<String, Object> allowableValues = var.allowableValues;
|
||||||
|
|
||||||
|
// handle ArrayProperty
|
||||||
|
if (var.items != null) {
|
||||||
|
allowableValues = var.items.allowableValues;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (allowableValues == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
//List<String> values = (List<String>) allowableValues.get("values");
|
||||||
|
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||||
|
if (values == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// put "enumVars" map into `allowableValues", including `name` and `value`
|
||||||
|
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||||
|
String commonPrefix = findCommonPrefixOfVars(values);
|
||||||
|
int truncateIdx = commonPrefix.length();
|
||||||
|
for (Object value : values) {
|
||||||
|
Map<String, String> enumVar = new HashMap<String, String>();
|
||||||
|
String enumName;
|
||||||
|
if (truncateIdx == 0) {
|
||||||
|
enumName = value.toString();
|
||||||
|
} else {
|
||||||
|
enumName = value.toString().substring(truncateIdx);
|
||||||
|
if ("".equals(enumName)) {
|
||||||
|
enumName = value.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
enumVar.put("name", toEnumVarName(enumName, var.datatype));
|
||||||
|
enumVar.put("value", toEnumValue(value.toString(), var.datatype));
|
||||||
|
enumVars.add(enumVar);
|
||||||
|
}
|
||||||
|
allowableValues.put("enumVars", enumVars);
|
||||||
|
// handle default value for enum, e.g. available => StatusEnum.AVAILABLE
|
||||||
|
if (var.defaultValue != null) {
|
||||||
|
String enumName = null;
|
||||||
|
for (Map<String, String> enumVar : enumVars) {
|
||||||
|
if (toEnumValue(var.defaultValue, var.datatype).equals(enumVar.get("value"))) {
|
||||||
|
enumName = enumVar.get("name");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (enumName != null) {
|
||||||
|
var.defaultValue = toEnumDefaultValue(enumName, var.datatypeWithEnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the common prefix of variables for enum naming
|
||||||
|
*
|
||||||
|
* @param vars List of variable names
|
||||||
|
* @return the common prefix for naming
|
||||||
|
*/
|
||||||
|
public String findCommonPrefixOfVars(List<Object> vars) {
|
||||||
|
try {
|
||||||
|
String[] listStr = vars.toArray(new String[vars.size()]);
|
||||||
|
|
||||||
|
String prefix = StringUtils.getCommonPrefix(listStr);
|
||||||
|
// exclude trailing characters that should be part of a valid variable
|
||||||
|
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
||||||
|
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
||||||
|
} catch (ArrayStoreException e) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the enum default value in the language specifed format
|
||||||
|
*
|
||||||
|
* @param value enum variable name
|
||||||
|
* @param datatype data type
|
||||||
|
* @return the default value for the enum
|
||||||
|
*/
|
||||||
|
public String toEnumDefaultValue(String value, String datatype) {
|
||||||
|
return datatype + "." + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the enum value in the language specifed format
|
||||||
|
* e.g. status becomes "status"
|
||||||
|
*
|
||||||
|
* @param value enum variable name
|
||||||
|
* @param datatype data type
|
||||||
|
* @return the sanitized value for enum
|
||||||
|
*/
|
||||||
|
public String toEnumValue(String value, String datatype) {
|
||||||
|
if ("number".equalsIgnoreCase(datatype)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return "\"" + escapeText(value) + "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the sanitized variable name for enum
|
||||||
|
*
|
||||||
|
* @param value enum variable name
|
||||||
|
* @param datatype data type
|
||||||
|
* @return the sanitized variable name for enum
|
||||||
|
*/
|
||||||
|
public String toEnumVarName(String value, String datatype) {
|
||||||
|
String var = value.replaceAll("\\W+", "_").toUpperCase();
|
||||||
|
if (var.matches("\\d.*")) {
|
||||||
|
return "_" + var;
|
||||||
|
} else {
|
||||||
|
return var;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// override with any special post-processing
|
// override with any special post-processing
|
||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
@ -456,7 +611,7 @@ public class DefaultCodegen {
|
|||||||
/**
|
/**
|
||||||
* Return the Enum name (e.g. StatusEnum given 'status')
|
* Return the Enum name (e.g. StatusEnum given 'status')
|
||||||
*
|
*
|
||||||
* @param property Codegen property object
|
* @param property Codegen property
|
||||||
* @return the Enum name
|
* @return the Enum name
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("static-method")
|
@SuppressWarnings("static-method")
|
||||||
@ -1012,7 +1167,9 @@ public class DefaultCodegen {
|
|||||||
ModelImpl impl = (ModelImpl) model;
|
ModelImpl impl = (ModelImpl) model;
|
||||||
if(impl.getEnum() != null && impl.getEnum().size() > 0) {
|
if(impl.getEnum() != null && impl.getEnum().size() > 0) {
|
||||||
m.isEnum = true;
|
m.isEnum = true;
|
||||||
m.allowableValues = impl.getEnum();
|
// comment out below as allowableValues is not set in post processing model enum
|
||||||
|
m.allowableValues = new HashMap<String, Object>();
|
||||||
|
m.allowableValues.put("values", impl.getEnum());
|
||||||
Property p = PropertyBuilder.build(impl.getType(), impl.getFormat(), null);
|
Property p = PropertyBuilder.build(impl.getType(), impl.getFormat(), null);
|
||||||
m.dataType = getSwaggerType(p);
|
m.dataType = getSwaggerType(p);
|
||||||
}
|
}
|
||||||
@ -1144,7 +1301,8 @@ public class DefaultCodegen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p instanceof BaseIntegerProperty) {
|
// type is integer and without format
|
||||||
|
if (p instanceof BaseIntegerProperty && !(p instanceof IntegerProperty) && !(p instanceof LongProperty)) {
|
||||||
BaseIntegerProperty sp = (BaseIntegerProperty) p;
|
BaseIntegerProperty sp = (BaseIntegerProperty) p;
|
||||||
property.isInteger = true;
|
property.isInteger = true;
|
||||||
/*if (sp.getEnum() != null) {
|
/*if (sp.getEnum() != null) {
|
||||||
@ -1210,7 +1368,8 @@ public class DefaultCodegen {
|
|||||||
property.isByteArray = true;
|
property.isByteArray = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p instanceof DecimalProperty) {
|
// type is number and without format
|
||||||
|
if (p instanceof DecimalProperty && !(p instanceof DoubleProperty) && !(p instanceof FloatProperty)) {
|
||||||
DecimalProperty sp = (DecimalProperty) p;
|
DecimalProperty sp = (DecimalProperty) p;
|
||||||
property.isFloat = true;
|
property.isFloat = true;
|
||||||
/*if (sp.getEnum() != null) {
|
/*if (sp.getEnum() != null) {
|
||||||
|
@ -88,7 +88,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
"Int32",
|
"Int32",
|
||||||
"Int64",
|
"Int64",
|
||||||
"Float",
|
"Float",
|
||||||
"Guid",
|
"Guid?",
|
||||||
"System.IO.Stream", // not really a primitive, we include it to avoid model import
|
"System.IO.Stream", // not really a primitive, we include it to avoid model import
|
||||||
"Object")
|
"Object")
|
||||||
);
|
);
|
||||||
@ -115,7 +115,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
typeMapping.put("list", "List");
|
typeMapping.put("list", "List");
|
||||||
typeMapping.put("map", "Dictionary");
|
typeMapping.put("map", "Dictionary");
|
||||||
typeMapping.put("object", "Object");
|
typeMapping.put("object", "Object");
|
||||||
typeMapping.put("uuid", "Guid");
|
typeMapping.put("uuid", "Guid?");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setReturnICollection(boolean returnICollection) {
|
public void setReturnICollection(boolean returnICollection) {
|
||||||
@ -203,11 +203,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toEnumName(CodegenProperty property) {
|
|
||||||
return StringUtils.capitalize(property.name) + "Enum?";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||||
List<Object> models = (List<Object>) objs.get("models");
|
List<Object> models = (List<Object>) objs.get("models");
|
||||||
@ -223,7 +218,8 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return objs;
|
// process enum in models
|
||||||
|
return postProcessModelsEnum(objs);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -544,4 +540,54 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co
|
|||||||
public void setSourceFolder(String sourceFolder) {
|
public void setSourceFolder(String sourceFolder) {
|
||||||
this.sourceFolder = sourceFolder;
|
this.sourceFolder = sourceFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumVarName(String name, String datatype) {
|
||||||
|
String enumName = sanitizeName(name);
|
||||||
|
|
||||||
|
enumName = enumName.replaceFirst("^_", "");
|
||||||
|
enumName = enumName.replaceFirst("_$", "");
|
||||||
|
|
||||||
|
enumName = camelize(enumName) + "Enum";
|
||||||
|
|
||||||
|
LOGGER.info("toEnumVarName = " + enumName);
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
return sanitizeName(camelize(property.name)) + "Enum";
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
@Override
|
||||||
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
String enumName = sanitizeName(property.name);
|
||||||
|
if (!StringUtils.isEmpty(modelNamePrefix)) {
|
||||||
|
enumName = modelNamePrefix + "_" + enumName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(modelNameSuffix)) {
|
||||||
|
enumName = enumName + "_" + modelNameSuffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (isReservedWord(enumName)) {
|
||||||
|
LOGGER.warn(enumName + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + enumName));
|
||||||
|
enumName = "model_" + enumName; // e.g. return => ModelReturn (after camelize)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
// mapped to String as a workaround
|
// mapped to String as a workaround
|
||||||
typeMapping.put("binary", "string");
|
typeMapping.put("binary", "string");
|
||||||
typeMapping.put("ByteArray", "string");
|
typeMapping.put("ByteArray", "string");
|
||||||
|
typeMapping.put("UUID", "string");
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
|
cliOptions.add(new CliOption(CodegenConstants.MODEL_PROPERTY_NAMING, CodegenConstants.MODEL_PROPERTY_NAMING_DESC).defaultValue("camelCase"));
|
||||||
|
|
||||||
@ -230,4 +231,59 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumValue(String value, String datatype) {
|
||||||
|
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return "\'" + escapeText(value) + "\'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumDefaultValue(String value, String datatype) {
|
||||||
|
return datatype + "_" + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumVarName(String name, String datatype) {
|
||||||
|
// number
|
||||||
|
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||||
|
String varName = new String(name);
|
||||||
|
varName = varName.replaceAll("-", "MINUS_");
|
||||||
|
varName = varName.replaceAll("\\+", "PLUS_");
|
||||||
|
varName = varName.replaceAll("\\.", "_DOT_");
|
||||||
|
return varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string
|
||||||
|
String enumName = sanitizeName(underscore(name).toUpperCase());
|
||||||
|
enumName = enumName.replaceFirst("^_", "");
|
||||||
|
enumName = enumName.replaceFirst("_$", "");
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
String enumName = toModelName(property.name) + "Enum";
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||||
|
// process enum in models
|
||||||
|
return postProcessModelsEnum(objs);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -308,75 +308,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessModels(Map<String, Object> objMap) {
|
public Map<String, Object> postProcessModels(Map<String, Object> objMap) {
|
||||||
Map<String, Object> objs = super.postProcessModels(objMap);
|
return super.postProcessModels(objMap);
|
||||||
|
|
||||||
List<Object> models = (List<Object>) objs.get("models");
|
|
||||||
for (Object _mo : models) {
|
|
||||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
|
||||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
|
||||||
for (CodegenProperty var : cm.vars) {
|
|
||||||
Map<String, Object> allowableValues = var.allowableValues;
|
|
||||||
|
|
||||||
// handle ArrayProperty
|
|
||||||
if (var.items != null) {
|
|
||||||
allowableValues = var.items.allowableValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allowableValues == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<String> values = (List<String>) allowableValues.get("values");
|
|
||||||
if (values == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// put "enumVars" map into `allowableValues", including `name` and `value`
|
|
||||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
|
||||||
String commonPrefix = findCommonPrefixOfVars(values);
|
|
||||||
int truncateIdx = commonPrefix.length();
|
|
||||||
for (String value : values) {
|
|
||||||
Map<String, String> enumVar = new HashMap<String, String>();
|
|
||||||
String enumName;
|
|
||||||
if (truncateIdx == 0) {
|
|
||||||
enumName = value;
|
|
||||||
} else {
|
|
||||||
enumName = value.substring(truncateIdx);
|
|
||||||
if ("".equals(enumName)) {
|
|
||||||
enumName = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
enumVar.put("name", toEnumVarName(enumName));
|
|
||||||
enumVar.put("jsonname", value);
|
|
||||||
enumVar.put("value", value);
|
|
||||||
enumVars.add(enumVar);
|
|
||||||
}
|
|
||||||
allowableValues.put("enumVars", enumVars);
|
|
||||||
// handle default value for enum, e.g. available => StatusEnum.AVAILABLE
|
|
||||||
|
|
||||||
// HACK: strip ? from enum
|
|
||||||
if (var.datatypeWithEnum != null) {
|
|
||||||
var.vendorExtensions.put(DATA_TYPE_WITH_ENUM_EXTENSION, var.datatypeWithEnum.substring(0, var.datatypeWithEnum.length() - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (var.defaultValue != null) {
|
|
||||||
String enumName = null;
|
|
||||||
|
|
||||||
for (Map<String, String> enumVar : enumVars) {
|
|
||||||
|
|
||||||
if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) {
|
|
||||||
enumName = enumVar.get("name");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (enumName != null && var.vendorExtensions.containsKey(DATA_TYPE_WITH_ENUM_EXTENSION)) {
|
|
||||||
var.defaultValue = var.vendorExtensions.get(DATA_TYPE_WITH_ENUM_EXTENSION) + "." + enumName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return objs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTargetFramework(String dotnetFramework) {
|
public void setTargetFramework(String dotnetFramework) {
|
||||||
@ -436,18 +368,34 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen {
|
|||||||
return codegenModel;
|
return codegenModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String findCommonPrefixOfVars(List<String> vars) {
|
@Override
|
||||||
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
public String toEnumValue(String value, String datatype) {
|
||||||
// exclude trailing characters that should be part of a valid variable
|
if ("int?".equalsIgnoreCase(datatype) || "long?".equalsIgnoreCase(datatype) ||
|
||||||
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
"double?".equalsIgnoreCase(datatype) || "float?".equalsIgnoreCase(datatype)) {
|
||||||
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
return value;
|
||||||
|
} else {
|
||||||
|
return "\"" + escapeText(value) + "\"";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String toEnumVarName(String value) {
|
@Override
|
||||||
|
public String toEnumVarName(String value, String datatype) {
|
||||||
|
// number
|
||||||
|
if ("int?".equals(datatype) || "long?".equals(datatype) ||
|
||||||
|
"double?".equals(datatype) || "float?".equals(datatype)) {
|
||||||
|
String varName = "NUMBER_" + value;
|
||||||
|
varName = varName.replaceAll("-", "MINUS_");
|
||||||
|
varName = varName.replaceAll("\\+", "PLUS_");
|
||||||
|
varName = varName.replaceAll("\\.", "_DOT_");
|
||||||
|
return varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string
|
||||||
String var = value.replaceAll("_", " ");
|
String var = value.replaceAll("_", " ");
|
||||||
var = WordUtils.capitalizeFully(var);
|
var = WordUtils.capitalizeFully(var);
|
||||||
var = var.replaceAll("\\W+", "");
|
var = var.replaceAll("\\W+", "");
|
||||||
|
|
||||||
|
|
||||||
if (var.matches("\\d.*")) {
|
if (var.matches("\\d.*")) {
|
||||||
return "_" + var;
|
return "_" + var;
|
||||||
} else {
|
} else {
|
||||||
|
@ -11,6 +11,7 @@ import io.swagger.models.parameters.Parameter;
|
|||||||
import io.swagger.models.properties.*;
|
import io.swagger.models.properties.*;
|
||||||
import org.apache.commons.lang.BooleanUtils;
|
import org.apache.commons.lang.BooleanUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.apache.commons.lang.WordUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -89,6 +90,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
instantiationTypes.put("map", "HashMap");
|
instantiationTypes.put("map", "HashMap");
|
||||||
typeMapping.put("date", "Date");
|
typeMapping.put("date", "Date");
|
||||||
typeMapping.put("file", "File");
|
typeMapping.put("file", "File");
|
||||||
|
typeMapping.put("UUID", "String");
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||||
@ -651,6 +653,28 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
return codegenModel;
|
return codegenModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessModelsEnum(Map<String, Object> objs) {
|
||||||
|
objs = super.postProcessModelsEnum(objs);
|
||||||
|
String lib = getLibrary();
|
||||||
|
if (StringUtils.isEmpty(lib) || "feign".equals(lib) || "jersey2".equals(lib)) {
|
||||||
|
List<Map<String, String>> imports = (List<Map<String, String>>)objs.get("imports");
|
||||||
|
List<Object> models = (List<Object>) objs.get("models");
|
||||||
|
for (Object _mo : models) {
|
||||||
|
Map<String, Object> mo = (Map<String, Object>) _mo;
|
||||||
|
CodegenModel cm = (CodegenModel) mo.get("model");
|
||||||
|
// for enum model
|
||||||
|
if (Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) {
|
||||||
|
cm.imports.add(importMapping.get("JsonValue"));
|
||||||
|
Map<String, String> item = new HashMap<String, String>();
|
||||||
|
item.put("import", importMapping.get("JsonValue"));
|
||||||
|
imports.add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
public void postProcessModelProperty(CodegenModel model, CodegenProperty property) {
|
||||||
if(serializeBigDecimalAsString) {
|
if(serializeBigDecimalAsString) {
|
||||||
@ -696,63 +720,7 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||||
List<Object> models = (List<Object>) objs.get("models");
|
return postProcessModelsEnum(objs);
|
||||||
for (Object _mo : models) {
|
|
||||||
Map<String, Object> mo = (Map<String, Object>) _mo;
|
|
||||||
CodegenModel cm = (CodegenModel) mo.get("model");
|
|
||||||
|
|
||||||
for (CodegenProperty var : cm.vars) {
|
|
||||||
Map<String, Object> allowableValues = var.allowableValues;
|
|
||||||
|
|
||||||
// handle ArrayProperty
|
|
||||||
if (var.items != null) {
|
|
||||||
allowableValues = var.items.allowableValues;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allowableValues == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<String> values = (List<String>) allowableValues.get("values");
|
|
||||||
if (values == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// put "enumVars" map into `allowableValues", including `name` and `value`
|
|
||||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
|
||||||
String commonPrefix = findCommonPrefixOfVars(values);
|
|
||||||
int truncateIdx = commonPrefix.length();
|
|
||||||
for (String value : values) {
|
|
||||||
Map<String, String> enumVar = new HashMap<String, String>();
|
|
||||||
String enumName;
|
|
||||||
if (truncateIdx == 0) {
|
|
||||||
enumName = value;
|
|
||||||
} else {
|
|
||||||
enumName = value.substring(truncateIdx);
|
|
||||||
if ("".equals(enumName)) {
|
|
||||||
enumName = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
enumVar.put("name", toEnumVarName(enumName));
|
|
||||||
enumVar.put("value", value);
|
|
||||||
enumVars.add(enumVar);
|
|
||||||
}
|
|
||||||
allowableValues.put("enumVars", enumVars);
|
|
||||||
// handle default value for enum, e.g. available => StatusEnum.AVAILABLE
|
|
||||||
if (var.defaultValue != null) {
|
|
||||||
String enumName = null;
|
|
||||||
for (Map<String, String> enumVar : enumVars) {
|
|
||||||
if (var.defaultValue.equals(enumVar.get("value"))) {
|
|
||||||
enumName = enumVar.get("name");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (enumName != null) {
|
|
||||||
var.defaultValue = var.datatypeWithEnum + "." + enumName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return objs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -848,16 +816,35 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
protected boolean needToImport(String type) {
|
protected boolean needToImport(String type) {
|
||||||
return super.needToImport(type) && type.indexOf(".") < 0;
|
return super.needToImport(type) && type.indexOf(".") < 0;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
private static String findCommonPrefixOfVars(List<String> vars) {
|
@Override
|
||||||
|
public String findCommonPrefixOfVars(List<String> vars) {
|
||||||
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
||||||
// exclude trailing characters that should be part of a valid variable
|
// exclude trailing characters that should be part of a valid variable
|
||||||
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
||||||
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private static String toEnumVarName(String value) {
|
@Override
|
||||||
String var = value.replaceAll("\\W+", "_").toUpperCase();
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
return sanitizeName(camelize(property.name)) + "Enum";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumVarName(String value, String datatype) {
|
||||||
|
// number
|
||||||
|
if ("Integer".equals(datatype) || "Long".equals(datatype) ||
|
||||||
|
"Float".equals(datatype) || "Double".equals(datatype)) {
|
||||||
|
String varName = "NUMBER_" + value;
|
||||||
|
varName = varName.replaceAll("-", "MINUS_");
|
||||||
|
varName = varName.replaceAll("\\+", "PLUS_");
|
||||||
|
varName = varName.replaceAll("\\.", "_DOT_");
|
||||||
|
return varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string
|
||||||
|
String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase();
|
||||||
if (var.matches("\\d.*")) {
|
if (var.matches("\\d.*")) {
|
||||||
return "_" + var;
|
return "_" + var;
|
||||||
} else {
|
} else {
|
||||||
@ -865,6 +852,16 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumValue(String value, String datatype) {
|
||||||
|
if ("Integer".equals(datatype) || "Long".equals(datatype) ||
|
||||||
|
"Float".equals(datatype) || "Double".equals(datatype)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return "\"" + escapeText(value) + "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
||||||
// This generator uses inline classes to define enums, which breaks when
|
// This generator uses inline classes to define enums, which breaks when
|
||||||
// dealing with models that have subTypes. To clean this up, we will analyze
|
// dealing with models that have subTypes. To clean this up, we will analyze
|
||||||
|
@ -136,6 +136,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
// binary not supported in JavaScript client right now, using String as a workaround
|
// binary not supported in JavaScript client right now, using String as a workaround
|
||||||
typeMapping.put("ByteArray", "String"); // I don't see ByteArray defined in the Swagger docs.
|
typeMapping.put("ByteArray", "String"); // I don't see ByteArray defined in the Swagger docs.
|
||||||
typeMapping.put("binary", "String");
|
typeMapping.put("binary", "String");
|
||||||
|
typeMapping.put("UUID", "String");
|
||||||
|
|
||||||
importMapping.clear();
|
importMapping.clear();
|
||||||
|
|
||||||
@ -870,7 +871,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
if (allowableValues == null) {
|
if (allowableValues == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<String> values = (List<String>) allowableValues.get("values");
|
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||||
if (values == null) {
|
if (values == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -879,19 +880,19 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
List<Map<String, String>> enumVars = new ArrayList<Map<String, String>>();
|
||||||
String commonPrefix = findCommonPrefixOfVars(values);
|
String commonPrefix = findCommonPrefixOfVars(values);
|
||||||
int truncateIdx = commonPrefix.length();
|
int truncateIdx = commonPrefix.length();
|
||||||
for (String value : values) {
|
for (Object value : values) {
|
||||||
Map<String, String> enumVar = new HashMap<String, String>();
|
Map<String, String> enumVar = new HashMap<String, String>();
|
||||||
String enumName;
|
String enumName;
|
||||||
if (truncateIdx == 0) {
|
if (truncateIdx == 0) {
|
||||||
enumName = value;
|
enumName = value.toString();
|
||||||
} else {
|
} else {
|
||||||
enumName = value.substring(truncateIdx);
|
enumName = value.toString().substring(truncateIdx);
|
||||||
if ("".equals(enumName)) {
|
if ("".equals(enumName)) {
|
||||||
enumName = value;
|
enumName = value.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
enumVar.put("name", toEnumVarName(enumName));
|
enumVar.put("name", toEnumVarName(enumName, var.datatype));
|
||||||
enumVar.put("value", value);
|
enumVar.put("value",toEnumValue(value.toString(), var.datatype));
|
||||||
enumVars.add(enumVar);
|
enumVars.add(enumVar);
|
||||||
}
|
}
|
||||||
allowableValues.put("enumVars", enumVars);
|
allowableValues.put("enumVars", enumVars);
|
||||||
@ -928,22 +929,15 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
return !defaultIncludes.contains(type)
|
return !defaultIncludes.contains(type)
|
||||||
&& !languageSpecificPrimitives.contains(type);
|
&& !languageSpecificPrimitives.contains(type);
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
private static String findCommonPrefixOfVars(List<String> vars) {
|
@Override
|
||||||
|
public String findCommonPrefixOfVars(List<String> vars) {
|
||||||
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
String prefix = StringUtils.getCommonPrefix(vars.toArray(new String[vars.size()]));
|
||||||
// exclude trailing characters that should be part of a valid variable
|
// exclude trailing characters that should be part of a valid variable
|
||||||
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
// e.g. ["status-on", "status-off"] => "status-" (not "status-o")
|
||||||
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
return prefix.replaceAll("[a-zA-Z0-9]+\\z", "");
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
private static String toEnumVarName(String value) {
|
|
||||||
String var = value.replaceAll("\\W+", "_").toUpperCase();
|
|
||||||
if (var.matches("\\d.*")) {
|
|
||||||
return "_" + var;
|
|
||||||
} else {
|
|
||||||
return var;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
private static CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
||||||
// This generator uses inline classes to define enums, which breaks when
|
// This generator uses inline classes to define enums, which breaks when
|
||||||
@ -1002,4 +996,41 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo
|
|||||||
return packageName;
|
return packageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
return sanitizeName(camelize(property.name)) + "Enum";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumVarName(String value, String datatype) {
|
||||||
|
return value;
|
||||||
|
/*
|
||||||
|
// number
|
||||||
|
if ("Integer".equals(datatype) || "Number".equals(datatype)) {
|
||||||
|
String varName = "NUMBER_" + value;
|
||||||
|
varName = varName.replaceAll("-", "MINUS_");
|
||||||
|
varName = varName.replaceAll("\\+", "PLUS_");
|
||||||
|
varName = varName.replaceAll("\\.", "_DOT_");
|
||||||
|
return varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string
|
||||||
|
String var = value.replaceAll("\\W+", "_").replaceAll("_+", "_").toUpperCase();
|
||||||
|
if (var.matches("\\d.*")) {
|
||||||
|
return "_" + var;
|
||||||
|
} else {
|
||||||
|
return var;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumValue(String value, String datatype) {
|
||||||
|
if ("Integer".equals(datatype) || "Number".equals(datatype)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return "\"" + escapeText(value) + "\"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import io.swagger.codegen.CliOption;
|
|||||||
import io.swagger.codegen.CodegenConfig;
|
import io.swagger.codegen.CodegenConfig;
|
||||||
import io.swagger.codegen.CodegenConstants;
|
import io.swagger.codegen.CodegenConstants;
|
||||||
import io.swagger.codegen.CodegenParameter;
|
import io.swagger.codegen.CodegenParameter;
|
||||||
|
import io.swagger.codegen.CodegenProperty;
|
||||||
import io.swagger.codegen.CodegenType;
|
import io.swagger.codegen.CodegenType;
|
||||||
import io.swagger.codegen.DefaultCodegen;
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
import io.swagger.codegen.SupportingFile;
|
import io.swagger.codegen.SupportingFile;
|
||||||
@ -12,6 +13,7 @@ import io.swagger.models.properties.*;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
|
|
||||||
@ -111,6 +113,7 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
typeMapping.put("object", "object");
|
typeMapping.put("object", "object");
|
||||||
typeMapping.put("binary", "string");
|
typeMapping.put("binary", "string");
|
||||||
typeMapping.put("ByteArray", "string");
|
typeMapping.put("ByteArray", "string");
|
||||||
|
typeMapping.put("UUID", "string");
|
||||||
|
|
||||||
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.MODEL_PACKAGE, CodegenConstants.MODEL_PACKAGE_DESC));
|
||||||
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC));
|
||||||
@ -566,4 +569,57 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
p.example = example;
|
p.example = example;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumValue(String value, String datatype) {
|
||||||
|
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return "\'" + escapeText(value) + "\'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumDefaultValue(String value, String datatype) {
|
||||||
|
return datatype + "_" + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumVarName(String name, String datatype) {
|
||||||
|
// number
|
||||||
|
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||||
|
String varName = new String(name);
|
||||||
|
varName = varName.replaceAll("-", "MINUS_");
|
||||||
|
varName = varName.replaceAll("\\+", "PLUS_");
|
||||||
|
varName = varName.replaceAll("\\.", "_DOT_");
|
||||||
|
return varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string
|
||||||
|
String enumName = sanitizeName(underscore(name).toUpperCase());
|
||||||
|
enumName = enumName.replaceFirst("^_", "");
|
||||||
|
enumName = enumName.replaceFirst("_$", "");
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
String enumName = underscore(toModelName(property.name)).toUpperCase();
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||||
|
// process enum in models
|
||||||
|
return postProcessModelsEnum(objs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,7 @@ public class RubyClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
typeMapping.put("file", "File");
|
typeMapping.put("file", "File");
|
||||||
typeMapping.put("binary", "String");
|
typeMapping.put("binary", "String");
|
||||||
typeMapping.put("ByteArray", "String");
|
typeMapping.put("ByteArray", "String");
|
||||||
|
typeMapping.put("UUID", "String");
|
||||||
|
|
||||||
// remove modelPackage and apiPackage added by default
|
// remove modelPackage and apiPackage added by default
|
||||||
Iterator<CliOption> itr = cliOptions.iterator();
|
Iterator<CliOption> itr = cliOptions.iterator();
|
||||||
|
@ -335,8 +335,10 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
swiftEnums.add(map);
|
swiftEnums.add(map);
|
||||||
}
|
}
|
||||||
codegenProperty.allowableValues.put("values", swiftEnums);
|
codegenProperty.allowableValues.put("values", swiftEnums);
|
||||||
codegenProperty.datatypeWithEnum =
|
codegenProperty.datatypeWithEnum = toEnumName(codegenProperty);
|
||||||
StringUtils.left(codegenProperty.datatypeWithEnum, codegenProperty.datatypeWithEnum.length() - "Enum".length());
|
//codegenProperty.datatypeWithEnum =
|
||||||
|
// StringUtils.left(codegenProperty.datatypeWithEnum, codegenProperty.datatypeWithEnum.length() - "Enum".length());
|
||||||
|
|
||||||
// Ensure that the enum type doesn't match a reserved word or
|
// Ensure that the enum type doesn't match a reserved word or
|
||||||
// the variable name doesn't match the generated enum type or the
|
// the variable name doesn't match the generated enum type or the
|
||||||
// Swift compiler will generate an error
|
// Swift compiler will generate an error
|
||||||
@ -483,4 +485,59 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
public void setResponseAs(String[] responseAs) {
|
public void setResponseAs(String[] responseAs) {
|
||||||
this.responseAs = responseAs;
|
this.responseAs = responseAs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumValue(String value, String datatype) {
|
||||||
|
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||||
|
return value;
|
||||||
|
} else {
|
||||||
|
return "\'" + escapeText(value) + "\'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumDefaultValue(String value, String datatype) {
|
||||||
|
return datatype + "_" + value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumVarName(String name, String datatype) {
|
||||||
|
// number
|
||||||
|
if ("int".equals(datatype) || "double".equals(datatype) || "float".equals(datatype)) {
|
||||||
|
String varName = new String(name);
|
||||||
|
varName = varName.replaceAll("-", "MINUS_");
|
||||||
|
varName = varName.replaceAll("\\+", "PLUS_");
|
||||||
|
varName = varName.replaceAll("\\.", "_DOT_");
|
||||||
|
return varName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// string
|
||||||
|
String enumName = sanitizeName(underscore(name).toUpperCase());
|
||||||
|
enumName = enumName.replaceFirst("^_", "");
|
||||||
|
enumName = enumName.replaceFirst("_$", "");
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
String enumName = underscore(toModelName(property.name)).toUpperCase();
|
||||||
|
|
||||||
|
if (enumName.matches("\\d.*")) { // starts with number
|
||||||
|
return "_" + enumName;
|
||||||
|
} else {
|
||||||
|
return enumName;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessModels(Map<String, Object> objs) {
|
||||||
|
// process enum in models
|
||||||
|
return postProcessModelsEnum(objs);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
|
|
||||||
public enum {{{datatypeWithEnum}}} {
|
|
||||||
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
|
|
||||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
{{{datatypeWithEnum}}}(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@JsonValue
|
|
||||||
public String toString() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
public enum {{classname}} {
|
|
||||||
{{#allowableValues}}{{.}}{{^-last}}, {{/-last}}{{/allowableValues}}
|
|
||||||
}
|
|
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||||
|
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||||
|
{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
|
||||||
|
private {{datatype}} value;
|
||||||
|
|
||||||
|
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +0,0 @@
|
|||||||
public enum {{{datatypeWithEnum}}} {
|
|
||||||
{{#allowableValues}}{{#enumVars}}@SerializedName("{{{value}}}")
|
|
||||||
{{{name}}}("{{{value}}}"){{^-last}},
|
|
||||||
|
|
||||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
|
||||||
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
{{{datatypeWithEnum}}}(String value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
{{#allowableValues}}{{#enumVars}}
|
{{#allowableValues}}{{#enumVars}}
|
||||||
* `{{name}}` (value: `{{value}}`)
|
* `{{name}}` (value: `{{value}}`)
|
||||||
{{#enumVars}}{{/allowableValues}}
|
{{/enumVars}}{{/allowableValues}}
|
||||||
|
@ -8,78 +8,7 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
|
|
||||||
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
|
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
|
||||||
{{#models}}
|
{{#models}}
|
||||||
|
{{#model}}
|
||||||
{{#model}}{{#description}}
|
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}}
|
||||||
/**
|
|
||||||
* {{description}}
|
|
||||||
**/{{/description}}
|
|
||||||
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
|
|
||||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
|
||||||
{{#vars}}{{#isEnum}}
|
|
||||||
|
|
||||||
{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
|
||||||
|
|
||||||
{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
|
|
||||||
@SerializedName("{{baseName}}")
|
|
||||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
|
||||||
{{/vars}}
|
|
||||||
|
|
||||||
{{#vars}}
|
|
||||||
/**{{#description}}
|
|
||||||
* {{{description}}}{{/description}}{{#minimum}}
|
|
||||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
|
||||||
* maximum: {{maximum}}{{/maximum}}
|
|
||||||
**/
|
|
||||||
@ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
|
||||||
public {{{datatypeWithEnum}}} {{getter}}() {
|
|
||||||
return {{name}};
|
|
||||||
}{{^isReadOnly}}
|
|
||||||
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
|
||||||
this.{{name}} = {{name}};
|
|
||||||
}{{/isReadOnly}}
|
|
||||||
|
|
||||||
{{/vars}}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object o) {
|
|
||||||
if (this == o) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (o == null || getClass() != o.getClass()) {
|
|
||||||
return false;
|
|
||||||
}{{#hasVars}}
|
|
||||||
{{classname}} {{classVarName}} = ({{classname}}) o;
|
|
||||||
return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
|
|
||||||
{{/hasMore}}{{/vars}}{{#parent}} &&
|
|
||||||
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
|
||||||
return true;{{/hasVars}}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("class {{classname}} {\n");
|
|
||||||
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
|
|
||||||
{{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
|
||||||
{{/vars}}sb.append("}");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert the given object to string with each line indented by 4 spaces
|
|
||||||
* (except the first line).
|
|
||||||
*/
|
|
||||||
private String toIndentedString(Object o) {
|
|
||||||
if (o == null) {
|
|
||||||
return "null";
|
|
||||||
}
|
|
||||||
return o.toString().replace("\n", "\n ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{name}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||||
|
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||||
|
{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
|
||||||
|
private {{dataType}} value;
|
||||||
|
|
||||||
|
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||||
|
{{#allowableValues}}{{#enumVars}}@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||||
|
{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
|
||||||
|
private {{datatype}} value;
|
||||||
|
|
||||||
|
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
/**
|
||||||
|
* {{#description}}{{description}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||||
|
*/{{#description}}
|
||||||
|
@ApiModel(description = "{{{description}}}"){{/description}}
|
||||||
|
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||||
|
{{#vars}}{{#isEnum}}
|
||||||
|
|
||||||
|
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||||
|
|
||||||
|
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||||
|
@SerializedName("{{baseName}}")
|
||||||
|
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
{{#vars}}
|
||||||
|
/**{{#description}}
|
||||||
|
* {{{description}}}{{/description}}{{#minimum}}
|
||||||
|
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||||
|
* maximum: {{maximum}}{{/maximum}}
|
||||||
|
**/
|
||||||
|
@ApiModelProperty({{#required}}required = {{required}}, {{/required}}value = "{{{description}}}")
|
||||||
|
public {{{datatypeWithEnum}}} {{getter}}() {
|
||||||
|
return {{name}};
|
||||||
|
}{{^isReadOnly}}
|
||||||
|
public void {{setter}}({{{datatypeWithEnum}}} {{name}}) {
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
}{{/isReadOnly}}
|
||||||
|
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o == null || getClass() != o.getClass()) {
|
||||||
|
return false;
|
||||||
|
}{{#hasVars}}
|
||||||
|
{{classname}} {{classVarName}} = ({{classname}}) o;
|
||||||
|
return {{#vars}}Objects.equals(this.{{name}}, {{classVarName}}.{{name}}){{#hasMore}} &&
|
||||||
|
{{/hasMore}}{{/vars}}{{#parent}} &&
|
||||||
|
super.equals(o){{/parent}};{{/hasVars}}{{^hasVars}}
|
||||||
|
return true;{{/hasVars}}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash({{#vars}}{{name}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{#parent}}{{#hasVars}}, {{/hasVars}}super.hashCode(){{/parent}});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("class {{classname}} {\n");
|
||||||
|
{{#parent}}sb.append(" ").append(toIndentedString(super.toString())).append("\n");{{/parent}}
|
||||||
|
{{#vars}}sb.append(" {{name}}: ").append(toIndentedString({{name}})).append("\n");
|
||||||
|
{{/vars}}sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the given object to string with each line indented by 4 spaces
|
||||||
|
* (except the first line).
|
||||||
|
*/
|
||||||
|
private String toIndentedString(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
return o.toString().replace("\n", "\n ");
|
||||||
|
}
|
||||||
|
}
|
@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||||
{{#vars}}{{#isEnum}}
|
{{#vars}}{{#isEnum}}
|
||||||
|
|
||||||
{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||||
|
|
||||||
{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
|
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||||
@SerializedName("{{baseName}}")
|
@SerializedName("{{baseName}}")
|
||||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
@ -17,9 +17,9 @@ import com.google.gson.annotations.SerializedName;
|
|||||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||||
{{#vars}}{{#isEnum}}
|
{{#vars}}{{#isEnum}}
|
||||||
|
|
||||||
{{>libraries/okhttp-gson/enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
{{>libraries/common/modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||||
|
|
||||||
{{>libraries/okhttp-gson/enumClass}}{{/items}}{{/items.isEnum}}
|
{{>libraries/common/modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||||
@SerializedName("{{baseName}}")
|
@SerializedName("{{baseName}}")
|
||||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
@ -6,11 +6,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
|
{{#serializableModel}}import java.io.Serializable;{{/serializableModel}}
|
||||||
{{#models}}
|
{{#models}}
|
||||||
{{#model}}{{#description}}
|
{{#model}}
|
||||||
/**
|
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>pojo}}{{/isEnum}}
|
||||||
* {{description}}
|
|
||||||
**/{{/description}}
|
|
||||||
{{#isEnum}}{{>enumOuterClass}}{{/isEnum}}
|
|
||||||
{{^isEnum}}{{>pojo}}{{/isEnum}}
|
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||||
|
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
|
||||||
|
private {{dataType}} value;
|
||||||
|
|
||||||
|
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{dataType}} value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonValue
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||||
|
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
|
||||||
|
private {{datatype}} value;
|
||||||
|
|
||||||
|
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@JsonValue
|
||||||
|
public String toString() {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
{{#description}}@ApiModel(description = "{{{description}}}"){{/description}}
|
/**
|
||||||
|
* {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||||
|
*/{{#description}}
|
||||||
|
@ApiModel(description = "{{{description}}}"){{/description}}
|
||||||
{{>generatedAnnotation}}
|
{{>generatedAnnotation}}
|
||||||
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#serializableModel}}implements Serializable{{/serializableModel}} {
|
||||||
{{#vars}}{{#isEnum}}
|
{{#vars}}{{#isEnum}}
|
||||||
|
|
||||||
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
{{>modelInnerEnum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||||
|
|
||||||
{{>enumClass}}{{/items}}{{/items.isEnum}}
|
{{>modelInnerEnum}}{{/items}}{{/items.isEnum}}
|
||||||
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}}
|
||||||
|
|
||||||
{{#vars}}{{^isReadOnly}}
|
{{#vars}}{{^isReadOnly}}
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||||
|
{{#allowableValues}}
|
||||||
|
{{#enumVars}}
|
||||||
|
{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
|
||||||
public enum {{{datatypeWithEnum}}} {
|
{{/-last}}{{#-last}};
|
||||||
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
|
{{/-last}}
|
||||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
{{/enumVars}}
|
||||||
|
{{/allowableValues}}
|
||||||
|
private {{datatype}} value;
|
||||||
|
|
||||||
private String value;
|
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||||
|
|
||||||
{{{datatypeWithEnum}}}(String value) {
|
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JsonValue
|
@JsonValue
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value;
|
return String.valueOf(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
*/
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||||
|
{{#allowableValues}}
|
||||||
|
{{#enumVars}}
|
||||||
|
{{{name}}}({{{value}}}){{^-last}},
|
||||||
|
|
||||||
public enum {{{datatypeWithEnum}}} {
|
{{/-last}}{{#-last}};
|
||||||
{{#allowableValues}}{{#enumVars}}{{{name}}}("{{{value}}}"){{^-last}},
|
{{/-last}}
|
||||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
{{/enumVars}}
|
||||||
|
{{/allowableValues}}
|
||||||
|
private {{datatype}} value;
|
||||||
|
|
||||||
private String value;
|
{{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}({{datatype}} value) {
|
||||||
|
|
||||||
{{{datatypeWithEnum}}}(String value) {
|
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@JsonValue
|
@JsonValue
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return value;
|
return String.valueOf(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,17 @@
|
|||||||
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||||
* @readonly
|
* @readonly
|
||||||
*/{{/emitJSDoc}}
|
*/{{/emitJSDoc}}
|
||||||
exports.{{datatypeWithEnum}} = { {{#allowableValues}}{{#enumVars}}
|
exports.{{datatypeWithEnum}} = {
|
||||||
{{#emitJSDoc}} /**
|
{{#allowableValues}}
|
||||||
* value: {{value}}
|
{{#enumVars}}
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* value: {{{value}}}
|
||||||
* @const
|
* @const
|
||||||
*/
|
*/
|
||||||
{{/emitJSDoc}} {{name}}: "{{value}}"{{^-last}},
|
{{/emitJSDoc}}
|
||||||
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
"{{name}}": {{{value}}}{{^-last}},
|
||||||
|
{{/-last}}
|
||||||
|
{{/enumVars}}
|
||||||
|
{{/allowableValues}}
|
||||||
};
|
};
|
@ -15,91 +15,6 @@
|
|||||||
}(this, function(ApiClient{{#imports}}, {{import}}{{/imports}}) {
|
}(this, function(ApiClient{{#imports}}, {{import}}{{/imports}}) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
{{#models}}{{#model}}{{#emitJSDoc}} /**
|
{{#models}}{{#model}}
|
||||||
* The {{classname}} model module.
|
{{#isEnum}}{{>partial_model_enum_class}}{{/isEnum}}{{^isEnum}}{{>partial_model_generic}}{{/isEnum}}
|
||||||
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
{{/model}}{{/models}}
|
||||||
* @version {{projectVersion}}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new <code>{{classname}}</code>.{{#description}}
|
|
||||||
* {{description}}{{/description}}
|
|
||||||
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
|
||||||
* @class{{#useInheritance}}{{#parent}}
|
|
||||||
* @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}}
|
|
||||||
* @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
|
|
||||||
* @param {{.}}{{/vendorExtensions.x-all-required}}
|
|
||||||
*/
|
|
||||||
{{/emitJSDoc}} var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
|
|
||||||
var _this = this;
|
|
||||||
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array();
|
|
||||||
Object.setPrototypeOf(_this, exports);
|
|
||||||
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
|
|
||||||
{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});
|
|
||||||
{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}}
|
|
||||||
{{/vars}}{{#parent}}{{^parentModel}} return _this;
|
|
||||||
{{/parentModel}}{{/parent}} };
|
|
||||||
|
|
||||||
{{#emitJSDoc}} /**
|
|
||||||
* Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
|
|
||||||
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
|
||||||
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
|
||||||
* @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
|
|
||||||
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
|
|
||||||
*/
|
|
||||||
{{/emitJSDoc}} exports.constructFromObject = function(data, obj) {
|
|
||||||
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
|
|
||||||
obj = obj || new exports();
|
|
||||||
{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}});
|
|
||||||
{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}}
|
|
||||||
{{#interfaces}} {{.}}.constructFromObject(data, obj);
|
|
||||||
{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) {
|
|
||||||
obj['{{baseName}}']{{{defaultValueWithParam}}}
|
|
||||||
}
|
|
||||||
{{/vars}} }
|
|
||||||
return obj;
|
|
||||||
}
|
|
||||||
{{#useInheritance}}{{#parentModel}}
|
|
||||||
exports.prototype = Object.create({{classname}}.prototype);
|
|
||||||
exports.prototype.constructor = exports;
|
|
||||||
{{/parentModel}}{{/useInheritance}}
|
|
||||||
{{#vars}}{{#emitJSDoc}}
|
|
||||||
/**{{#description}}
|
|
||||||
* {{{description}}}{{/description}}
|
|
||||||
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
|
||||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
|
||||||
*/
|
|
||||||
{{/emitJSDoc}} exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
|
||||||
{{/vars}}{{#useInheritance}}{{#interfaceModels}}
|
|
||||||
// Implement {{classname}} interface:{{#allVars}}{{#emitJSDoc}}
|
|
||||||
/**{{#description}}
|
|
||||||
* {{{description}}}{{/description}}
|
|
||||||
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
|
||||||
* @default {{{defaultValue}}}{{/defaultValue}}
|
|
||||||
*/
|
|
||||||
{{/emitJSDoc}} exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
|
||||||
{{/allVars}}{{/interfaceModels}}{{/useInheritance}}
|
|
||||||
{{#emitModelMethods}}{{#vars}}{{#emitJSDoc}} /**{{#description}}
|
|
||||||
* Returns {{{description}}}{{/description}}{{#minimum}}
|
|
||||||
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
|
||||||
* maximum: {{maximum}}{{/maximum}}
|
|
||||||
* @return {{{vendorExtensions.x-jsdoc-type}}}
|
|
||||||
*/
|
|
||||||
{{/emitJSDoc}} exports.prototype.{{getter}} = function() {
|
|
||||||
return this['{{baseName}}'];
|
|
||||||
}
|
|
||||||
|
|
||||||
{{#emitJSDoc}} /**{{#description}}
|
|
||||||
* Sets {{{description}}}{{/description}}
|
|
||||||
* @param {{{vendorExtensions.x-jsdoc-type}}} {{name}}{{#description}} {{{description}}}{{/description}}
|
|
||||||
*/
|
|
||||||
{{/emitJSDoc}} exports.prototype.{{setter}} = function({{name}}) {
|
|
||||||
this['{{baseName}}'] = {{name}};
|
|
||||||
}
|
|
||||||
|
|
||||||
{{/vars}}{{/emitModelMethods}}
|
|
||||||
{{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
|
||||||
{{>enumClass}}{{/items}}*/{{/items.isEnum}}{{/vars}}
|
|
||||||
|
|
||||||
return exports;
|
|
||||||
{{/model}}{{/models}}}));
|
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* Enum class {{classname}}.
|
||||||
|
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
exports.{{classname}} = {
|
||||||
|
{{#allowableValues}}
|
||||||
|
{{#values}}
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* value: {{{.}}}
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
"{{{.}}}": "{{{.}}}"{{^-last}},
|
||||||
|
{{/-last}}
|
||||||
|
{{/values}}
|
||||||
|
{{/allowableValues}}
|
||||||
|
};
|
||||||
|
|
||||||
|
return exports;
|
||||||
|
}));
|
@ -0,0 +1,103 @@
|
|||||||
|
|
||||||
|
{{#models}}{{#model}}
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* The {{classname}} model module.
|
||||||
|
* @module {{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||||
|
* @version {{projectVersion}}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new <code>{{classname}}</code>.{{#description}}
|
||||||
|
* {{description}}{{/description}}
|
||||||
|
* @alias module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}
|
||||||
|
* @class{{#useInheritance}}{{#parent}}
|
||||||
|
* @extends {{#parentModel}}module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{classname}}{{/parentModel}}{{^parentModel}}{{#vendorExtensions.x-isArray}}Array{{/vendorExtensions.x-isArray}}{{#vendorExtensions.x-isMap}}Object{{/vendorExtensions.x-isMap}}{{/parentModel}}{{/parent}}{{#interfaces}}
|
||||||
|
* @implements module:{{#invokerPackage}}{{invokerPackage}}/{{/invokerPackage}}{{#modelPackage}}{{modelPackage}}/{{/modelPackage}}{{.}}{{/interfaces}}{{/useInheritance}}{{#vendorExtensions.x-all-required}}
|
||||||
|
* @param {{.}}{{/vendorExtensions.x-all-required}}
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
var exports = function({{#vendorExtensions.x-all-required}}{{.}}{{^-last}}, {{/-last}}{{/vendorExtensions.x-all-required}}) {
|
||||||
|
var _this = this;
|
||||||
|
{{#parent}}{{^parentModel}}{{#vendorExtensions.x-isArray}} _this = new Array();
|
||||||
|
Object.setPrototypeOf(_this, exports);
|
||||||
|
{{/vendorExtensions.x-isArray}}{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});{{/parentModel}}
|
||||||
|
{{#interfaceModels}} {{classname}}.call(_this{{#vendorExtensions.x-all-required}}, {{.}}{{/vendorExtensions.x-all-required}});
|
||||||
|
{{/interfaceModels}}{{/useInheritance}}{{#vars}}{{#required}} _this['{{baseName}}'] = {{name}};{{/required}}
|
||||||
|
{{/vars}}{{#parent}}{{^parentModel}} return _this;
|
||||||
|
{{/parentModel}}{{/parent}} };
|
||||||
|
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* Constructs a <code>{{classname}}</code> from a plain JavaScript object, optionally creating a new instance.
|
||||||
|
* Copies all relevant properties from <code>data</code> to <code>obj</code> if supplied or a new instance if not.
|
||||||
|
* @param {Object} data The plain JavaScript object bearing properties of interest.
|
||||||
|
* @param {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> obj Optional instance to populate.
|
||||||
|
* @return {{=< >=}}{module:<#invokerPackage><invokerPackage>/</invokerPackage><#modelPackage><modelPackage>/</modelPackage><classname>}<={{ }}=> The populated <code>{{classname}}</code> instance.
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
exports.constructFromObject = function(data, obj) {
|
||||||
|
if (data){{! TODO: support polymorphism: discriminator property on data determines class to instantiate.}} {
|
||||||
|
obj = obj || new exports();
|
||||||
|
{{#parent}}{{^parentModel}} ApiClient.constructFromObject(data, obj, {{vendorExtensions.x-itemType}});
|
||||||
|
{{/parentModel}}{{/parent}}{{#useInheritance}}{{#parentModel}} {{classname}}.constructFromObject(data, obj);{{/parentModel}}
|
||||||
|
{{#interfaces}} {{.}}.constructFromObject(data, obj);
|
||||||
|
{{/interfaces}}{{/useInheritance}}{{#vars}} if (data.hasOwnProperty('{{baseName}}')) {
|
||||||
|
obj['{{baseName}}']{{{defaultValueWithParam}}}
|
||||||
|
}
|
||||||
|
{{/vars}} }
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
{{#useInheritance}}{{#parentModel}}
|
||||||
|
exports.prototype = Object.create({{classname}}.prototype);
|
||||||
|
exports.prototype.constructor = exports;
|
||||||
|
{{/parentModel}}{{/useInheritance}}
|
||||||
|
{{#vars}}
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**{{#description}}
|
||||||
|
* {{{description}}}{{/description}}
|
||||||
|
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
||||||
|
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||||
|
{{/vars}}{{#useInheritance}}{{#interfaceModels}}
|
||||||
|
// Implement {{classname}} interface:{{#allVars}}
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**{{#description}}
|
||||||
|
* {{{description}}}{{/description}}
|
||||||
|
* @member {{{vendorExtensions.x-jsdoc-type}}} {{baseName}}{{#defaultValue}}
|
||||||
|
* @default {{{defaultValue}}}{{/defaultValue}}
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
exports.prototype['{{baseName}}'] = {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}undefined{{/defaultValue}};
|
||||||
|
{{/allVars}}{{/interfaceModels}}{{/useInheritance}}
|
||||||
|
{{#emitModelMethods}}{{#vars}}
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**{{#description}}
|
||||||
|
* Returns {{{description}}}{{/description}}{{#minimum}}
|
||||||
|
* minimum: {{minimum}}{{/minimum}}{{#maximum}}
|
||||||
|
* maximum: {{maximum}}{{/maximum}}
|
||||||
|
* @return {{{vendorExtensions.x-jsdoc-type}}}
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
exports.prototype.{{getter}} = function() {
|
||||||
|
return this['{{baseName}}'];
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**{{#description}}
|
||||||
|
* Sets {{{description}}}{{/description}}
|
||||||
|
* @param {{{vendorExtensions.x-jsdoc-type}}} {{name}}{{#description}} {{{description}}}{{/description}}
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
exports.prototype.{{setter}} = function({{name}}) {
|
||||||
|
this['{{baseName}}'] = {{name}};
|
||||||
|
}
|
||||||
|
|
||||||
|
{{/vars}}{{/emitModelMethods}}
|
||||||
|
{{#vars}}{{#isEnum}}{{>partial_model_inner_enum}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
||||||
|
{{>partial_model_inner_enum}}{{/items}}*/{{/items.isEnum}}{{/vars}}
|
||||||
|
|
||||||
|
return exports;
|
||||||
|
{{/model}}{{/models}}}));
|
@ -0,0 +1,21 @@
|
|||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* Allowed values for the <code>{{baseName}}</code> property.
|
||||||
|
* @enum {{=<% %>=}}{<%datatype%>}<%={{ }}=%>
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
exports.{{datatypeWithEnum}} = {
|
||||||
|
{{#allowableValues}}
|
||||||
|
{{#enumVars}}
|
||||||
|
{{#emitJSDoc}}
|
||||||
|
/**
|
||||||
|
* value: {{{value}}}
|
||||||
|
* @const
|
||||||
|
*/
|
||||||
|
{{/emitJSDoc}}
|
||||||
|
"{{name}}": {{{value}}}{{^-last}},
|
||||||
|
{{/-last}}
|
||||||
|
{{/enumVars}}
|
||||||
|
{{/allowableValues}}
|
||||||
|
};
|
@ -1,6 +1,15 @@
|
|||||||
public enum {{vendorExtensions.plainDatatypeWithEnum}} {
|
/// <summary>
|
||||||
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
/// </summary>{{#description}}
|
||||||
|
/// <value>{{{description}}}</value>{{/description}}
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||||
|
{
|
||||||
{{#allowableValues}}{{#enumVars}}
|
{{#allowableValues}}{{#enumVars}}
|
||||||
[EnumMember(Value = "{{jsonname}}")]
|
/// <summary>
|
||||||
{{name}}{{^-last}},
|
/// Enum {{name}} for {{{value}}}
|
||||||
{{/-last}}{{#-last}}{{/-last}}{{/enumVars}}{{/allowableValues}}
|
/// </summary>
|
||||||
|
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
|
||||||
|
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}},
|
||||||
|
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
}
|
}
|
||||||
|
@ -13,145 +13,7 @@ using Newtonsoft.Json.Converters;
|
|||||||
{{#model}}
|
{{#model}}
|
||||||
namespace {{packageName}}.Model
|
namespace {{packageName}}.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}}
|
||||||
/// {{description}}
|
|
||||||
/// </summary>
|
|
||||||
[DataContract]
|
|
||||||
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>
|
|
||||||
{ {{#vars}}{{#isEnum}}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
|
||||||
/// </summary>{{#description}}
|
|
||||||
/// <value>{{{description}}}</value>{{/description}}
|
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
|
||||||
{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}
|
|
||||||
{{>enumClass}}{{/items}}{{/items.isEnum}}{{/vars}}
|
|
||||||
{{#vars}}{{#isEnum}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
|
||||||
/// </summary>{{#description}}
|
|
||||||
/// <value>{{{description}}}</value>{{/description}}
|
|
||||||
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
|
||||||
public {{{datatypeWithEnum}}} {{name}} { get; set; }
|
|
||||||
{{/isEnum}}{{/vars}}
|
|
||||||
/// <summary>
|
|
||||||
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
|
||||||
/// Initializes a new instance of the <see cref="{{classname}}" />class.
|
|
||||||
/// </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{{/isReadOnly}}{{#hasMoreNonReadOnly}}, {{/hasMoreNonReadOnly}}{{/vars}})
|
|
||||||
{
|
|
||||||
{{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null)
|
|
||||||
if ({{name}} == null)
|
|
||||||
{
|
|
||||||
throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.{{name}} = {{name}};
|
|
||||||
}
|
|
||||||
{{/required}}{{/isReadOnly}}{{/vars}}{{#vars}}{{^isReadOnly}}{{^required}}{{#defaultValue}}// use default value if no "{{name}}" provided
|
|
||||||
if ({{name}} == null)
|
|
||||||
{
|
|
||||||
this.{{name}} = {{{defaultValue}}};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.{{name}} = {{name}};
|
|
||||||
}
|
|
||||||
{{/defaultValue}}{{^defaultValue}}this.{{name}} = {{name}};
|
|
||||||
{{/defaultValue}}{{/required}}{{/isReadOnly}}{{/vars}}
|
|
||||||
}
|
|
||||||
|
|
||||||
{{#vars}}{{^isEnum}}
|
|
||||||
/// <summary>
|
|
||||||
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
|
||||||
/// </summary>{{#description}}
|
|
||||||
/// <value>{{description}}</value>{{/description}}
|
|
||||||
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
|
||||||
public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
|
||||||
{{/isEnum}}{{/vars}}
|
|
||||||
/// <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 {{classname}} {\n");
|
|
||||||
{{#vars}}
|
|
||||||
sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
|
||||||
{{/vars}}
|
|
||||||
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 {{#parent}} new {{/parent}}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 {{classname}});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Returns true if {{classname}} instances are equal
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">Instance of {{classname}} to be compared</param>
|
|
||||||
/// <returns>Boolean</returns>
|
|
||||||
public bool Equals({{classname}} other)
|
|
||||||
{
|
|
||||||
// credit: http://stackoverflow.com/a/10454552/677735
|
|
||||||
if (other == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return {{#vars}}{{#isNotContainer}}
|
|
||||||
(
|
|
||||||
this.{{name}} == other.{{name}} ||
|
|
||||||
this.{{name}} != null &&
|
|
||||||
this.{{name}}.Equals(other.{{name}})
|
|
||||||
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}}
|
|
||||||
(
|
|
||||||
this.{{name}} == other.{{name}} ||
|
|
||||||
this.{{name}} != null &&
|
|
||||||
this.{{name}}.SequenceEqual(other.{{name}})
|
|
||||||
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}}{{^vars}}false{{/vars}};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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 :)
|
|
||||||
{{#vars}}
|
|
||||||
if (this.{{name}} != null)
|
|
||||||
hash = hash * 59 + this.{{name}}.GetHashCode();
|
|
||||||
{{/vars}}
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
{{/model}}
|
{{/model}}
|
||||||
{{/models}}
|
{{/models}}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
/// <summary>
|
||||||
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
/// </summary>{{#description}}
|
||||||
|
/// <value>{{{description}}}</value>{{/description}}
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||||
|
{
|
||||||
|
{{#allowableValues}}{{#enumVars}}
|
||||||
|
/// <summary>
|
||||||
|
/// Enum {{name}} for {{{value}}}
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = {{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}})]
|
||||||
|
{{name}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}},
|
||||||
|
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
}
|
@ -0,0 +1,150 @@
|
|||||||
|
/// <summary>
|
||||||
|
/// {{#description}}{{.}}{{/description}}{{^description}}{{classname}}{{/description}}
|
||||||
|
/// </summary>
|
||||||
|
[DataContract]
|
||||||
|
public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}} IEquatable<{{classname}}>
|
||||||
|
{
|
||||||
|
{{#vars}}
|
||||||
|
{{#isEnum}}
|
||||||
|
{{>modelInnerEnum}}
|
||||||
|
{{/isEnum}}
|
||||||
|
{{#items.isEnum}}
|
||||||
|
{{#items}}
|
||||||
|
{{>modelInnerEnum}}
|
||||||
|
{{/items}}
|
||||||
|
{{/items.isEnum}}
|
||||||
|
{{/vars}}
|
||||||
|
{{#vars}}
|
||||||
|
{{#isEnum}}
|
||||||
|
/// <summary>
|
||||||
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
/// </summary>{{#description}}
|
||||||
|
/// <value>{{{description}}}</value>{{/description}}
|
||||||
|
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
||||||
|
public {{{datatypeWithEnum}}}{{#isEnum}}?{{/isEnum}} {{name}} { get; set; }
|
||||||
|
{{/isEnum}}
|
||||||
|
{{/vars}}
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="{{classname}}" /> class.
|
||||||
|
/// </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}}}{{#isEnum}}?{{/isEnum}} {{name}} = null{{#hasMore}}, {{/hasMore}}{{/isReadOnly}}{{/vars}})
|
||||||
|
{
|
||||||
|
{{#vars}}{{^isReadOnly}}{{#required}}// to ensure "{{name}}" is required (not null)
|
||||||
|
if ({{name}} == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("{{name}} is a required property for {{classname}} and cannot be null");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
}
|
||||||
|
{{/required}}{{/isReadOnly}}{{/vars}}
|
||||||
|
{{#vars}}{{^isReadOnly}}{{^required}}
|
||||||
|
{{#defaultValue}}// use default value if no "{{name}}" provided
|
||||||
|
if ({{name}} == null)
|
||||||
|
{
|
||||||
|
this.{{name}} = {{{defaultValue}}};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
}
|
||||||
|
{{/defaultValue}}
|
||||||
|
{{^defaultValue}}
|
||||||
|
this.{{name}} = {{name}};
|
||||||
|
{{/defaultValue}}
|
||||||
|
{{/required}}{{/isReadOnly}}{{/vars}}
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#vars}}
|
||||||
|
{{^isEnum}}
|
||||||
|
/// <summary>
|
||||||
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||||
|
/// </summary>{{#description}}
|
||||||
|
/// <value>{{description}}</value>{{/description}}
|
||||||
|
[DataMember(Name="{{baseName}}", EmitDefaultValue={{emitDefaultValue}})]
|
||||||
|
public {{{datatype}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; }
|
||||||
|
{{/isEnum}}
|
||||||
|
{{/vars}}
|
||||||
|
/// <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 {{classname}} {\n");
|
||||||
|
{{#vars}}sb.Append(" {{name}}: ").Append({{name}}).Append("\n");
|
||||||
|
{{/vars}}
|
||||||
|
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 {{#parent}} new {{/parent}}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 {{classname}});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if {{classname}} instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">Instance of {{classname}} to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals({{classname}} other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return {{#vars}}{{#isNotContainer}}
|
||||||
|
(
|
||||||
|
this.{{name}} == other.{{name}} ||
|
||||||
|
this.{{name}} != null &&
|
||||||
|
this.{{name}}.Equals(other.{{name}})
|
||||||
|
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}}
|
||||||
|
(
|
||||||
|
this.{{name}} == other.{{name}} ||
|
||||||
|
this.{{name}} != null &&
|
||||||
|
this.{{name}}.SequenceEqual(other.{{name}})
|
||||||
|
){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}}{{^vars}}false{{/vars}};
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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 :)
|
||||||
|
{{#vars}}
|
||||||
|
if (this.{{name}} != null)
|
||||||
|
hash = hash * 59 + this.{{name}}.GetHashCode();
|
||||||
|
{{/vars}}
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,15 @@
|
|||||||
|
/// <summary>
|
||||||
|
/// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||||
|
/// </summary>{{#description}}
|
||||||
|
/// <value>{{{description}}}</value>{{/description}}
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}}
|
||||||
|
{
|
||||||
|
{{#allowableValues}}{{#enumVars}}
|
||||||
|
/// <summary>
|
||||||
|
/// Enum {{name}} for {{{value}}}
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = {{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isFloat}}"{{/isFloat}}{{#isDouble}}"{{/isDouble}}{{{value}}}{{#isLong}}"{{/isLong}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isFloat}}"{{/isFloat}})]
|
||||||
|
{{name}}{{#isLong}} = {{{value}}}{{/isLong}}{{#isInteger}} = {{{value}}}{{/isInteger}}{{^-last}},
|
||||||
|
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
}
|
@ -5,7 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"fmt"
|
"fmt"
|
||||||
"errors"
|
"errors"
|
||||||
{{#imports}} "{{import}}"
|
{{#imports}}"{{import}}"
|
||||||
{{/imports}}
|
{{/imports}}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -13,45 +13,41 @@ type {{classname}} struct {
|
|||||||
Configuration Configuration
|
Configuration Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
func New{{classname}}() *{{classname}}{
|
func New{{classname}}() *{{classname}} {
|
||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
return &{{classname}} {
|
return &{{classname}}{
|
||||||
Configuration: *configuration,
|
Configuration: *configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func New{{classname}}WithBasePath(basePath string) *{{classname}}{
|
func New{{classname}}WithBasePath(basePath string) *{{classname}} {
|
||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
configuration.BasePath = basePath
|
configuration.BasePath = basePath
|
||||||
|
|
||||||
return &{{classname}} {
|
return &{{classname}}{
|
||||||
Configuration: *configuration,
|
Configuration: *configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
{{#operation}}
|
{{#operation}}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {{summary}}
|
* {{summary}}{{#notes}}
|
||||||
* {{notes}}
|
* {{notes}}{{/notes}}
|
||||||
|
*
|
||||||
{{#allParams}} * @param {{paramName}} {{description}}
|
{{#allParams}} * @param {{paramName}} {{description}}
|
||||||
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||||
*/
|
*/
|
||||||
func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}*{{{returnType}}}, {{/returnType}}*APIResponse, error) {
|
func (a {{classname}}) {{nickname}}({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "{{httpMethod}}"
|
var httpMethod = "{{httpMethod}}"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "{{path}}"
|
path := a.Configuration.BasePath + "{{path}}"{{#pathParams}}
|
||||||
{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1)
|
path = strings.Replace(path, "{"+"{{baseName}}"+"}", fmt.Sprintf("%v", {{paramName}}), -1){{/pathParams}}
|
||||||
{{/pathParams}}
|
{{#allParams}}{{#required}}
|
||||||
|
|
||||||
{{#allParams}}
|
|
||||||
{{#required}}
|
|
||||||
// verify the required parameter '{{paramName}}' is set
|
// verify the required parameter '{{paramName}}' is set
|
||||||
if &{{paramName}} == nil {
|
if &{{paramName}} == nil {
|
||||||
return {{#returnType}}new({{{returnType}}}), {{/returnType}}nil, errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
return {{#returnType}}*new({{{returnType}}}), {{/returnType}}*NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}")
|
||||||
}
|
}{{/required}}{{/allParams}}
|
||||||
{{/required}}
|
|
||||||
{{/allParams}}
|
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
queryParams := make(map[string]string)
|
queryParams := make(map[string]string)
|
||||||
@ -59,92 +55,68 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
{{#authMethods}}
|
||||||
{{#authMethods}}// authentication ({{name}}) required
|
// authentication ({{name}}) required
|
||||||
{{#isApiKey}}{{#isKeyInHeader}}
|
{{#isApiKey}}{{#isKeyInHeader}}
|
||||||
// set key with prefix in header
|
// set key with prefix in header
|
||||||
headerParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
|
headerParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
|
||||||
{{/isKeyInHeader}}{{#isKeyInQuery}}
|
{{/isKeyInHeader}}{{#isKeyInQuery}}
|
||||||
// set key with prefix in querystring
|
// set key with prefix in querystring{{#hasKeyParamName}}
|
||||||
{{#hasKeyParamName}}
|
|
||||||
queryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
|
queryParams["{{keyParamName}}"] = a.Configuration.GetAPIKeyWithPrefix("{{keyParamName}}")
|
||||||
{{/hasKeyParamName}}
|
{{/hasKeyParamName}}{{/isKeyInQuery}}{{/isApiKey}}{{#isBasic}}
|
||||||
{{/isKeyInQuery}}{{/isApiKey}}
|
|
||||||
{{#isBasic}}
|
|
||||||
// http basic authentication required
|
// http basic authentication required
|
||||||
if a.Configuration.Username != "" || a.Configuration.Password != ""{
|
if a.Configuration.Username != "" || a.Configuration.Password != ""{
|
||||||
headerParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString()
|
headerParams["Authorization"] = "Basic " + a.Configuration.GetBasicAuthEncodedString()
|
||||||
}
|
}{{/isBasic}}{{#isOAuth}}
|
||||||
{{/isBasic}}
|
|
||||||
{{#isOAuth}}
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}{{/isOAuth}}{{/authMethods}}
|
||||||
{{/isOAuth}}
|
|
||||||
{{/authMethods}}
|
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}{{#hasQueryParams}}{{#queryParams}}
|
||||||
|
|
||||||
{{#hasQueryParams}}
|
|
||||||
{{#queryParams}}
|
|
||||||
queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}})
|
queryParams["{{paramName}}"] = a.Configuration.APIClient.ParameterToString({{paramName}})
|
||||||
{{/queryParams}}
|
{{/queryParams}}{{/hasQueryParams}}
|
||||||
{{/hasQueryParams}}
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ {{#consumes}}"{{mediaType}}", {{/consumes}} }
|
||||||
{{#consumes}}
|
|
||||||
"{{mediaType}}",
|
// set Content-Type header
|
||||||
{{/consumes}}
|
|
||||||
}
|
|
||||||
//set Content-Type header
|
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
{{#produces}}
|
{{#produces}}"{{mediaType}}",
|
||||||
"{{mediaType}}",
|
{{/produces}} }
|
||||||
{{/produces}}
|
|
||||||
}
|
// set Accept header
|
||||||
//set Accept header
|
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}{{#hasHeaderParams}}
|
||||||
{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}"
|
|
||||||
|
{{#headerParams}} // header params "{{baseName}}"
|
||||||
headerParams["{{baseName}}"] = {{paramName}}
|
headerParams["{{baseName}}"] = {{paramName}}
|
||||||
{{/headerParams}}{{/hasHeaderParams}}
|
{{/headerParams}}{{/hasHeaderParams}}{{#hasFormParams}}
|
||||||
{{#hasFormParams}}
|
{{#formParams}}{{#isFile}}
|
||||||
{{#formParams}}
|
fbs, _ := ioutil.ReadAll(file)
|
||||||
{{#isFile}}fbs, _ := ioutil.ReadAll(file)
|
|
||||||
fileBytes = fbs
|
fileBytes = fbs
|
||||||
fileName = file.Name()
|
fileName = file.Name(){{/isFile}}
|
||||||
{{/isFile}}
|
{{^isFile}} formParams["{{paramName}}"] = {{paramName}}{{/isFile}}{{/formParams}}{{/hasFormParams}}{{#hasBodyParam}}
|
||||||
{{^isFile}}formParams["{{paramName}}"] = {{paramName}}
|
{{#bodyParams}} // body params
|
||||||
{{/isFile}}
|
|
||||||
{{/formParams}}
|
|
||||||
{{/hasFormParams}}{{#hasBodyParam}}{{#bodyParams}} // body params
|
|
||||||
postBody = &{{paramName}}
|
postBody = &{{paramName}}
|
||||||
{{/bodyParams}}{{/hasBodyParam}}
|
{{/bodyParams}}{{/hasBodyParam}}
|
||||||
{{#returnType}} var successPayload = new({{returnType}}){{/returnType}}
|
{{#returnType}} var successPayload = new({{returnType}}){{/returnType}}
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err
|
return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
{{#returnType}}
|
{{#returnType}}
|
||||||
|
err = json.Unmarshal(httpResponse.Body(), &successPayload){{/returnType}}
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
return {{#returnType}}*successPayload, {{/returnType}}*NewAPIResponse(httpResponse.RawResponse), err
|
||||||
{{/returnType}}
|
|
||||||
|
|
||||||
return {{#returnType}}successPayload, {{/returnType}}NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
{{/operation}}
|
{{/operation}}{{/operations}}
|
||||||
{{/operations}}
|
|
||||||
|
@ -1,39 +1,38 @@
|
|||||||
package {{packageName}}
|
package {{packageName}}
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"github.com/go-resty/resty"
|
|
||||||
"fmt"
|
|
||||||
"reflect"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-resty/resty"
|
||||||
)
|
)
|
||||||
|
|
||||||
type APIClient struct {
|
type APIClient struct {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
||||||
if (len(contentTypes) == 0){
|
|
||||||
|
if len(contentTypes) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if contains(contentTypes,"application/json") {
|
if contains(contentTypes, "application/json") {
|
||||||
return "application/json"
|
return "application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) SelectHeaderAccept(accepts []string) string {
|
func (c *APIClient) SelectHeaderAccept(accepts []string) string {
|
||||||
if (len(accepts) == 0){
|
|
||||||
|
if len(accepts) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
if contains(accepts, "application/json") {
|
||||||
if contains(accepts,"application/json"){
|
|
||||||
return "application/json"
|
return "application/json"
|
||||||
}
|
}
|
||||||
|
return strings.Join(accepts, ",")
|
||||||
return strings.Join(accepts,",")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func contains(source []string, containvalue string) bool {
|
func contains(source []string, containvalue string) bool {
|
||||||
@ -45,7 +44,6 @@ func contains(source []string, containvalue string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (c *APIClient) CallAPI(path string, method string,
|
func (c *APIClient) CallAPI(path string, method string,
|
||||||
postBody interface{},
|
postBody interface{},
|
||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
@ -58,7 +56,7 @@ func (c *APIClient) CallAPI(path string, method string,
|
|||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
resty.SetDebug(configuration.GetDebug())
|
resty.SetDebug(configuration.GetDebug())
|
||||||
|
|
||||||
request := prepareRequest(postBody, headerParams, queryParams, formParams,fileName,fileBytes)
|
request := prepareRequest(postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
switch strings.ToUpper(method) {
|
switch strings.ToUpper(method) {
|
||||||
case "GET":
|
case "GET":
|
||||||
@ -97,7 +95,6 @@ func prepareRequest(postBody interface{},
|
|||||||
fileBytes []byte) *resty.Request {
|
fileBytes []byte) *resty.Request {
|
||||||
|
|
||||||
request := resty.R()
|
request := resty.R()
|
||||||
|
|
||||||
request.SetBody(postBody)
|
request.SetBody(postBody)
|
||||||
|
|
||||||
// add header parameter, if any
|
// add header parameter, if any
|
||||||
|
@ -4,21 +4,19 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type APIResponse struct {
|
type APIResponse struct {
|
||||||
*http.Response
|
*http.Response
|
||||||
|
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||||
response := &APIResponse{Response: r}
|
|
||||||
|
|
||||||
|
response := &APIResponse{Response: r}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||||
response := &APIResponse{Message: errorMessage}
|
|
||||||
|
|
||||||
|
response := &APIResponse{Message: errorMessage}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
@ -7,8 +7,8 @@ import (
|
|||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
UserName string `json:"userName,omitempty"`
|
UserName string `json:"userName,omitempty"`
|
||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
APIKeyPrefix map[string] string `json:"APIKeyPrefix,omitempty"`
|
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
|
||||||
APIKey map[string] string `json:"APIKey,omitempty"`
|
APIKey map[string]string `json:"APIKey,omitempty"`
|
||||||
debug bool `json:"debug,omitempty"`
|
debug bool `json:"debug,omitempty"`
|
||||||
DebugFile string `json:"debugFile,omitempty"`
|
DebugFile string `json:"debugFile,omitempty"`
|
||||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||||
@ -43,14 +43,14 @@ func (c *Configuration) AddDefaultHeader(key string, value string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
|
func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
|
||||||
if c.APIKeyPrefix[APIKeyIdentifier] != ""{
|
if c.APIKeyPrefix[APIKeyIdentifier] != "" {
|
||||||
return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier]
|
return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier]
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.APIKey[APIKeyIdentifier]
|
return c.APIKey[APIKeyIdentifier]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) SetDebug(enable bool){
|
func (c *Configuration) SetDebug(enable bool) {
|
||||||
c.debug = enable
|
c.debug = enable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
package {{packageName}}
|
package {{packageName}}
|
||||||
|
{{#models}}{{#imports}}
|
||||||
{{#models}}
|
import ({{/imports}}{{#imports}}
|
||||||
import (
|
"{{import}}"{{/imports}}{{#imports}}
|
||||||
{{#imports}} "{{import}}"
|
|
||||||
{{/imports}}
|
|
||||||
)
|
)
|
||||||
|
{{/imports}}{{#model}}{{#description}}
|
||||||
{{#model}}
|
// {{{description}}}{{/description}}
|
||||||
{{#description}}// {{{description}}}{{/description}}
|
|
||||||
type {{classname}} struct {
|
type {{classname}} struct {
|
||||||
{{#vars}}
|
{{#vars}}{{#description}}
|
||||||
{{#description}}// {{{description}}}{{/description}}
|
// {{{description}}}{{/description}}
|
||||||
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
{{name}} {{{datatype}}} `json:"{{baseName}},omitempty"`
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
}
|
}
|
||||||
{{/model}}
|
{{/model}}{{/models}}
|
||||||
{{/models}}
|
|
@ -69,7 +69,7 @@ class ApiClient
|
|||||||
* Constructor of the class
|
* Constructor of the class
|
||||||
* @param Configuration $config config for this ApiClient
|
* @param Configuration $config config for this ApiClient
|
||||||
*/
|
*/
|
||||||
public function __construct(Configuration $config = null)
|
public function __construct(\{{invokerPackage}}\Configuration $config = null)
|
||||||
{
|
{
|
||||||
if ($config == null) {
|
if ($config == null) {
|
||||||
$config = Configuration::getDefaultConfiguration();
|
$config = Configuration::getDefaultConfiguration();
|
||||||
|
@ -60,7 +60,7 @@ use \{{invokerPackage}}\ObjectSerializer;
|
|||||||
* Constructor
|
* Constructor
|
||||||
* @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use
|
* @param \{{invokerPackage}}\ApiClient|null $apiClient The api client to use
|
||||||
*/
|
*/
|
||||||
function __construct($apiClient = null)
|
function __construct(\{{invokerPackage}}\ApiClient $apiClient = null)
|
||||||
{
|
{
|
||||||
if ($apiClient == null) {
|
if ($apiClient == null) {
|
||||||
$apiClient = new ApiClient();
|
$apiClient = new ApiClient();
|
||||||
@ -84,7 +84,7 @@ use \{{invokerPackage}}\ObjectSerializer;
|
|||||||
* @param \{{invokerPackage}}\ApiClient $apiClient set the API client
|
* @param \{{invokerPackage}}\ApiClient $apiClient set the API client
|
||||||
* @return {{classname}}
|
* @return {{classname}}
|
||||||
*/
|
*/
|
||||||
public function setApiClient(ApiClient $apiClient)
|
public function setApiClient(\{{invokerPackage}}\ApiClient $apiClient)
|
||||||
{
|
{
|
||||||
$this->apiClient = $apiClient;
|
$this->apiClient = $apiClient;
|
||||||
return $this;
|
return $this;
|
||||||
|
@ -106,6 +106,22 @@ class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayA
|
|||||||
return {{#parent}}parent::getters() + {{/parent}}self::$getters;
|
return {{#parent}}parent::getters() + {{/parent}}self::$getters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = {{{value}}};
|
||||||
|
{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}
|
||||||
|
|
||||||
|
{{#vars}}{{#isEnum}}
|
||||||
|
/**
|
||||||
|
* Gets allowable values of the enum
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function {{getter}}AllowableValues() {
|
||||||
|
return [
|
||||||
|
{{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}}
|
||||||
|
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{{/isEnum}}{{/vars}}
|
||||||
|
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
/**
|
/**
|
||||||
* ${{name}} {{#description}}{{{description}}}{{/description}}
|
* ${{name}} {{#description}}{{{description}}}{{/description}}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
class {{classname}} {
|
||||||
|
{{#allowableValues}}{{#enumVars}}const {{{name}}} = {{{value}}};
|
||||||
|
{{/enumVars}}{{/allowableValues}}
|
||||||
|
|
||||||
|
{{#vars}}{{#isEnum}}
|
||||||
|
/**
|
||||||
|
* Gets allowable values of the enum
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function {{getter}}AllowableValues() {
|
||||||
|
return [
|
||||||
|
{{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}}
|
||||||
|
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{{/isEnum}}{{/vars}}
|
||||||
|
}
|
@ -0,0 +1,169 @@
|
|||||||
|
class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}implements ArrayAccess
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Array of property to type mappings. Used for (de)serialization
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $swaggerTypes = array(
|
||||||
|
{{#vars}}'{{name}}' => '{{{datatype}}}'{{#hasMore}},
|
||||||
|
{{/hasMore}}{{/vars}}
|
||||||
|
);
|
||||||
|
|
||||||
|
static function swaggerTypes() {
|
||||||
|
return self::$swaggerTypes{{#parent}} + parent::swaggerTypes(){{/parent}};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes where the key is the local name, and the value is the original name
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $attributeMap = array(
|
||||||
|
{{#vars}}'{{name}}' => '{{baseName}}'{{#hasMore}},
|
||||||
|
{{/hasMore}}{{/vars}}
|
||||||
|
);
|
||||||
|
|
||||||
|
static function attributeMap() {
|
||||||
|
return {{#parent}}parent::attributeMap() + {{/parent}}self::$attributeMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes to setter functions (for deserialization of responses)
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $setters = array(
|
||||||
|
{{#vars}}'{{name}}' => '{{setter}}'{{#hasMore}},
|
||||||
|
{{/hasMore}}{{/vars}}
|
||||||
|
);
|
||||||
|
|
||||||
|
static function setters() {
|
||||||
|
return {{#parent}}parent::setters() + {{/parent}}self::$setters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Array of attributes to getter functions (for serialization of requests)
|
||||||
|
* @var string[]
|
||||||
|
*/
|
||||||
|
static $getters = array(
|
||||||
|
{{#vars}}'{{name}}' => '{{getter}}'{{#hasMore}},
|
||||||
|
{{/hasMore}}{{/vars}}
|
||||||
|
);
|
||||||
|
|
||||||
|
static function getters() {
|
||||||
|
return {{#parent}}parent::getters() + {{/parent}}self::$getters;
|
||||||
|
}
|
||||||
|
|
||||||
|
{{#vars}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}const {{datatypeWithEnum}}_{{{name}}} = {{{value}}};
|
||||||
|
{{/enumVars}}{{/allowableValues}}{{/isEnum}}{{/vars}}
|
||||||
|
|
||||||
|
{{#vars}}{{#isEnum}}
|
||||||
|
/**
|
||||||
|
* Gets allowable values of the enum
|
||||||
|
* @return string[]
|
||||||
|
*/
|
||||||
|
public function {{getter}}AllowableValues() {
|
||||||
|
return [
|
||||||
|
{{#allowableValues}}{{#enumVars}}self::{{datatypeWithEnum}}_{{{name}}},{{^-last}}
|
||||||
|
{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
{{/isEnum}}{{/vars}}
|
||||||
|
|
||||||
|
{{#vars}}
|
||||||
|
/**
|
||||||
|
* ${{name}} {{#description}}{{{description}}}{{/description}}
|
||||||
|
* @var {{datatype}}
|
||||||
|
*/
|
||||||
|
protected ${{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};
|
||||||
|
{{/vars}}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param mixed[] $data Associated array of property value initalizing the model
|
||||||
|
*/
|
||||||
|
public function __construct(array $data = null)
|
||||||
|
{
|
||||||
|
{{#parent}}parent::__construct($data);{{/parent}}
|
||||||
|
if ($data != null) {
|
||||||
|
{{#vars}}$this->{{name}} = $data["{{name}}"];{{#hasMore}}
|
||||||
|
{{/hasMore}}{{/vars}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{{#vars}}
|
||||||
|
/**
|
||||||
|
* Gets {{name}}.
|
||||||
|
* @return {{datatype}}
|
||||||
|
*/
|
||||||
|
public function {{getter}}()
|
||||||
|
{
|
||||||
|
return $this->{{name}};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets {{name}}.
|
||||||
|
* @param {{datatype}} ${{name}} {{#description}}{{{description}}}{{/description}}
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function {{setter}}(${{name}})
|
||||||
|
{
|
||||||
|
{{#isEnum}}$allowed_values = array({{#allowableValues}}{{#values}}"{{{this}}}"{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}});
|
||||||
|
if (!in_array(${{{name}}}, $allowed_values)) {
|
||||||
|
throw new \InvalidArgumentException("Invalid value for '{{name}}', must be one of {{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}");
|
||||||
|
}{{/isEnum}}
|
||||||
|
$this->{{name}} = ${{name}};
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
{{/vars}}
|
||||||
|
/**
|
||||||
|
* Returns true if offset exists. False otherwise.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
public function offsetExists($offset)
|
||||||
|
{
|
||||||
|
return isset($this->$offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function offsetGet($offset)
|
||||||
|
{
|
||||||
|
return $this->$offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets value based on offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @param mixed $value Value to be set
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function offsetSet($offset, $value)
|
||||||
|
{
|
||||||
|
$this->$offset = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsets offset.
|
||||||
|
* @param integer $offset Offset
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function offsetUnset($offset)
|
||||||
|
{
|
||||||
|
unset($this->$offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the string presentation of the object.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function __toString()
|
||||||
|
{
|
||||||
|
if (defined('JSON_PRETTY_PRINT')) {
|
||||||
|
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
|
||||||
|
} else {
|
||||||
|
return json_encode(\{{invokerPackage}}\ObjectSerializer::sanitizeForSerialization($this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -899,6 +899,33 @@ definitions:
|
|||||||
format: password
|
format: password
|
||||||
maxLength: 64
|
maxLength: 64
|
||||||
minLength: 10
|
minLength: 10
|
||||||
|
EnumClass:
|
||||||
|
type: string
|
||||||
|
default: '-efg'
|
||||||
|
enum:
|
||||||
|
- _abc
|
||||||
|
- '-efg'
|
||||||
|
- (xyz)
|
||||||
|
Enum_Test:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
enum_string:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- UPPER
|
||||||
|
- lower
|
||||||
|
enum_integer:
|
||||||
|
type: integer
|
||||||
|
format: int32
|
||||||
|
enum:
|
||||||
|
- 1
|
||||||
|
- -1
|
||||||
|
enum_number:
|
||||||
|
type: number
|
||||||
|
format: double
|
||||||
|
enum:
|
||||||
|
- 1.1
|
||||||
|
- -1.2
|
||||||
externalDocs:
|
externalDocs:
|
||||||
description: Find out more about Swagger
|
description: Find out more about Swagger
|
||||||
url: 'http://swagger.io'
|
url: 'http://swagger.io'
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
{
|
{
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
|
@ -139,6 +139,14 @@ namespace IO.Swagger.Test
|
|||||||
// TODO: unit test for the property 'DateTime'
|
// TODO: unit test for the property 'DateTime'
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Test the property 'Uuid'
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void UuidTest()
|
||||||
|
{
|
||||||
|
// TODO: unit test for the property 'Uuid'
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
/// Test the property 'Password'
|
/// Test the property 'Password'
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -6,7 +6,7 @@ This C# SDK is automatically generated by the [Swagger Codegen](https://github.c
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- SDK version: 1.0.0
|
- SDK version: 1.0.0
|
||||||
- Build date: 2016-04-21T17:22:44.115+08:00
|
- Build date: 2016-04-27T22:04:12.906+08:00
|
||||||
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen
|
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen
|
||||||
|
|
||||||
## Frameworks supported
|
## Frameworks supported
|
||||||
@ -53,20 +53,28 @@ namespace Example
|
|||||||
public void main()
|
public void main()
|
||||||
{
|
{
|
||||||
|
|
||||||
// Configure OAuth2 access token for authorization: petstore_auth
|
var apiInstance = new FakeApi();
|
||||||
Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN';
|
var number = number_example; // string | None
|
||||||
|
var _double = 1.2; // double? | None
|
||||||
var apiInstance = new PetApi();
|
var _string = _string_example; // string | None
|
||||||
var body = new Pet(); // Pet | Pet object that needs to be added to the store
|
var _byte = B; // byte[] | None
|
||||||
|
var integer = 56; // int? | None (optional)
|
||||||
|
var int32 = 56; // int? | None (optional)
|
||||||
|
var int64 = 789; // long? | None (optional)
|
||||||
|
var _float = 3.4; // float? | None (optional)
|
||||||
|
var binary = B; // byte[] | None (optional)
|
||||||
|
var date = 2013-10-20; // DateTime? | None (optional)
|
||||||
|
var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional)
|
||||||
|
var password = password_example; // string | None (optional)
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Add a new pet to the store
|
// Fake endpoint for testing various parameters
|
||||||
apiInstance.AddPet(body);
|
apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Debug.Print("Exception when calling PetApi.AddPet: " + e.Message );
|
Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,6 +87,7 @@ All URIs are relative to *http://petstore.swagger.io/v2*
|
|||||||
|
|
||||||
Class | Method | HTTP request | Description
|
Class | Method | HTTP request | Description
|
||||||
------------ | ------------- | ------------- | -------------
|
------------ | ------------- | ------------- | -------------
|
||||||
|
*FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters
|
||||||
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
*PetApi* | [**AddPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store
|
||||||
*PetApi* | [**DeletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet
|
*PetApi* | [**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* | [**FindPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||||
@ -108,6 +117,8 @@ Class | Method | HTTP request | Description
|
|||||||
- [IO.Swagger.Model.Cat](docs/Cat.md)
|
- [IO.Swagger.Model.Cat](docs/Cat.md)
|
||||||
- [IO.Swagger.Model.Category](docs/Category.md)
|
- [IO.Swagger.Model.Category](docs/Category.md)
|
||||||
- [IO.Swagger.Model.Dog](docs/Dog.md)
|
- [IO.Swagger.Model.Dog](docs/Dog.md)
|
||||||
|
- [IO.Swagger.Model.EnumClass](docs/EnumClass.md)
|
||||||
|
- [IO.Swagger.Model.EnumTest](docs/EnumTest.md)
|
||||||
- [IO.Swagger.Model.FormatTest](docs/FormatTest.md)
|
- [IO.Swagger.Model.FormatTest](docs/FormatTest.md)
|
||||||
- [IO.Swagger.Model.Model200Response](docs/Model200Response.md)
|
- [IO.Swagger.Model.Model200Response](docs/Model200Response.md)
|
||||||
- [IO.Swagger.Model.ModelReturn](docs/ModelReturn.md)
|
- [IO.Swagger.Model.ModelReturn](docs/ModelReturn.md)
|
||||||
|
@ -0,0 +1,91 @@
|
|||||||
|
# IO.Swagger.Api.FakeApi
|
||||||
|
|
||||||
|
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||||
|
|
||||||
|
Method | HTTP request | Description
|
||||||
|
------------- | ------------- | -------------
|
||||||
|
[**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters
|
||||||
|
|
||||||
|
|
||||||
|
# **TestEndpointParameters**
|
||||||
|
> void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null)
|
||||||
|
|
||||||
|
Fake endpoint for testing various parameters
|
||||||
|
|
||||||
|
Fake endpoint for testing various parameters
|
||||||
|
|
||||||
|
### Example
|
||||||
|
```csharp
|
||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using IO.Swagger.Api;
|
||||||
|
using IO.Swagger.Client;
|
||||||
|
using IO.Swagger.Model;
|
||||||
|
|
||||||
|
namespace Example
|
||||||
|
{
|
||||||
|
public class TestEndpointParametersExample
|
||||||
|
{
|
||||||
|
public void main()
|
||||||
|
{
|
||||||
|
|
||||||
|
var apiInstance = new FakeApi();
|
||||||
|
var number = 3.4; // double? | None
|
||||||
|
var _double = 1.2; // double? | None
|
||||||
|
var _string = _string_example; // string | None
|
||||||
|
var _byte = B; // byte[] | None
|
||||||
|
var integer = 56; // int? | None (optional)
|
||||||
|
var int32 = 56; // int? | None (optional)
|
||||||
|
var int64 = 789; // long? | None (optional)
|
||||||
|
var _float = 3.4; // float? | None (optional)
|
||||||
|
var binary = B; // byte[] | None (optional)
|
||||||
|
var date = 2013-10-20; // DateTime? | None (optional)
|
||||||
|
var dateTime = 2013-10-20T19:20:30+01:00; // DateTime? | None (optional)
|
||||||
|
var password = password_example; // string | None (optional)
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Fake endpoint for testing various parameters
|
||||||
|
apiInstance.TestEndpointParameters(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Print("Exception when calling FakeApi.TestEndpointParameters: " + e.Message );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Parameters
|
||||||
|
|
||||||
|
Name | Type | Description | Notes
|
||||||
|
------------- | ------------- | ------------- | -------------
|
||||||
|
**number** | **double?**| None |
|
||||||
|
**_double** | **double?**| None |
|
||||||
|
**_string** | **string**| None |
|
||||||
|
**_byte** | **byte[]**| None |
|
||||||
|
**integer** | **int?**| None | [optional]
|
||||||
|
**int32** | **int?**| None | [optional]
|
||||||
|
**int64** | **long?**| None | [optional]
|
||||||
|
**_float** | **float?**| None | [optional]
|
||||||
|
**binary** | **byte[]**| None | [optional]
|
||||||
|
**date** | **DateTime?**| None | [optional]
|
||||||
|
**dateTime** | **DateTime?**| None | [optional]
|
||||||
|
**password** | **string**| None | [optional]
|
||||||
|
|
||||||
|
### Return type
|
||||||
|
|
||||||
|
void (empty response body)
|
||||||
|
|
||||||
|
### Authorization
|
||||||
|
|
||||||
|
No authorization required
|
||||||
|
|
||||||
|
### HTTP request headers
|
||||||
|
|
||||||
|
- **Content-Type**: Not defined
|
||||||
|
- **Accept**: application/xml, application/json
|
||||||
|
|
||||||
|
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
|
||||||
|
|
@ -10,11 +10,11 @@ Name | Type | Description | Notes
|
|||||||
**_Float** | **float?** | | [optional]
|
**_Float** | **float?** | | [optional]
|
||||||
**_Double** | **double?** | | [optional]
|
**_Double** | **double?** | | [optional]
|
||||||
**_String** | **string** | | [optional]
|
**_String** | **string** | | [optional]
|
||||||
**_Byte** | **byte[]** | | [optional]
|
**_Byte** | **byte[]** | |
|
||||||
**Binary** | **byte[]** | | [optional]
|
**Binary** | **byte[]** | | [optional]
|
||||||
**Date** | **DateTime?** | | [optional]
|
**Date** | **DateTime?** | |
|
||||||
**DateTime** | **DateTime?** | | [optional]
|
**DateTime** | **DateTime?** | | [optional]
|
||||||
**Password** | **string** | | [optional]
|
**Password** | **string** | |
|
||||||
|
|
||||||
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ git_repo_id=$2
|
|||||||
release_note=$3
|
release_note=$3
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="YOUR_GIT_USR_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
if [ "$git_repo_id" = "" ]; then
|
||||||
git_repo_id="YOUR_GIT_REPO_ID"
|
git_repo_id="GIT_REPO_ID"
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -0,0 +1,418 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Linq;
|
||||||
|
using RestSharp;
|
||||||
|
using IO.Swagger.Client;
|
||||||
|
|
||||||
|
namespace IO.Swagger.Api
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a collection of functions to interact with the API endpoints
|
||||||
|
/// </summary>
|
||||||
|
public interface IFakeApi
|
||||||
|
{
|
||||||
|
#region Synchronous Operations
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns>ApiResponse of Object(void)</returns>
|
||||||
|
ApiResponse<Object> TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null);
|
||||||
|
#endregion Synchronous Operations
|
||||||
|
#region Asynchronous Operations
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns>Task of void</returns>
|
||||||
|
System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Fake endpoint for testing various parameters
|
||||||
|
/// </remarks>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns>Task of ApiResponse</returns>
|
||||||
|
System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null);
|
||||||
|
#endregion Asynchronous Operations
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a collection of functions to interact with the API endpoints
|
||||||
|
/// </summary>
|
||||||
|
public class FakeApi : IFakeApi
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="FakeApi"/> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
public FakeApi(String basePath)
|
||||||
|
{
|
||||||
|
this.Configuration = new Configuration(new ApiClient(basePath));
|
||||||
|
|
||||||
|
// ensure API client has configuration ready
|
||||||
|
if (Configuration.ApiClient.Configuration == null)
|
||||||
|
{
|
||||||
|
this.Configuration.ApiClient.Configuration = this.Configuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="FakeApi"/> class
|
||||||
|
/// using Configuration object
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="configuration">An instance of Configuration</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public FakeApi(Configuration configuration = null)
|
||||||
|
{
|
||||||
|
if (configuration == null) // use the default one in Configuration
|
||||||
|
this.Configuration = Configuration.Default;
|
||||||
|
else
|
||||||
|
this.Configuration = configuration;
|
||||||
|
|
||||||
|
// ensure API client has configuration ready
|
||||||
|
if (Configuration.ApiClient.Configuration == null)
|
||||||
|
{
|
||||||
|
this.Configuration.ApiClient.Configuration = this.Configuration;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the base path of the API client.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The base path</value>
|
||||||
|
public String GetBasePath()
|
||||||
|
{
|
||||||
|
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets the base path of the API client.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The base path</value>
|
||||||
|
[Obsolete("SetBasePath is deprecated, please do 'Configuraiton.ApiClient = new ApiClient(\"http://new-path\")' instead.")]
|
||||||
|
public void SetBasePath(String basePath)
|
||||||
|
{
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the configuration object
|
||||||
|
/// </summary>
|
||||||
|
/// <value>An instance of the Configuration</value>
|
||||||
|
public Configuration Configuration {get; set;}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the default header.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Dictionary of HTTP header</returns>
|
||||||
|
[Obsolete("DefaultHeader is deprecated, please use Configuration.DefaultHeader instead.")]
|
||||||
|
public Dictionary<String, String> DefaultHeader()
|
||||||
|
{
|
||||||
|
return this.Configuration.DefaultHeader;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add default header.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key">Header field name.</param>
|
||||||
|
/// <param name="value">Header field value.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Obsolete("AddDefaultHeader is deprecated, please use Configuration.AddDefaultHeader instead.")]
|
||||||
|
public void AddDefaultHeader(string key, string value)
|
||||||
|
{
|
||||||
|
this.Configuration.AddDefaultHeader(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public void TestEndpointParameters (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null)
|
||||||
|
{
|
||||||
|
TestEndpointParametersWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns>ApiResponse of Object(void)</returns>
|
||||||
|
public ApiResponse<Object> TestEndpointParametersWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null)
|
||||||
|
{
|
||||||
|
// verify the required parameter 'number' is set
|
||||||
|
if (number == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters");
|
||||||
|
// verify the required parameter '_double' is set
|
||||||
|
if (_double == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters");
|
||||||
|
// verify the required parameter '_string' is set
|
||||||
|
if (_string == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter '_string' when calling FakeApi->TestEndpointParameters");
|
||||||
|
// verify the required parameter '_byte' is set
|
||||||
|
if (_byte == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters");
|
||||||
|
|
||||||
|
var localVarPath = "/fake";
|
||||||
|
var localVarPathParams = new Dictionary<String, String>();
|
||||||
|
var localVarQueryParams = new Dictionary<String, String>();
|
||||||
|
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||||
|
var localVarFormParams = new Dictionary<String, String>();
|
||||||
|
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
String[] localVarHttpContentTypes = new String[] {
|
||||||
|
};
|
||||||
|
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
String[] localVarHttpHeaderAccepts = new String[] {
|
||||||
|
"application/xml",
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||||
|
if (localVarHttpHeaderAccept != null)
|
||||||
|
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||||
|
|
||||||
|
// set "format" to json by default
|
||||||
|
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||||
|
localVarPathParams.Add("format", "json");
|
||||||
|
if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter
|
||||||
|
if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter
|
||||||
|
if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter
|
||||||
|
if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter
|
||||||
|
if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter
|
||||||
|
if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter
|
||||||
|
if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter
|
||||||
|
if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter
|
||||||
|
if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter
|
||||||
|
if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter
|
||||||
|
if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter
|
||||||
|
if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter
|
||||||
|
|
||||||
|
|
||||||
|
// make the HTTP request
|
||||||
|
IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath,
|
||||||
|
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||||
|
localVarPathParams, localVarHttpContentType);
|
||||||
|
|
||||||
|
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||||
|
|
||||||
|
if (localVarStatusCode >= 400)
|
||||||
|
throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content);
|
||||||
|
else if (localVarStatusCode == 0)
|
||||||
|
throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage);
|
||||||
|
|
||||||
|
|
||||||
|
return new ApiResponse<Object>(localVarStatusCode,
|
||||||
|
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns>Task of void</returns>
|
||||||
|
public async System.Threading.Tasks.Task TestEndpointParametersAsync (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null)
|
||||||
|
{
|
||||||
|
await TestEndpointParametersAsyncWithHttpInfo(number, _double, _string, _byte, integer, int32, int64, _float, binary, date, dateTime, password);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fake endpoint for testing various parameters Fake endpoint for testing various parameters
|
||||||
|
/// </summary>
|
||||||
|
/// <exception cref="IO.Swagger.Client.ApiException">Thrown when fails to make API call</exception>
|
||||||
|
/// <param name="number">None</param>
|
||||||
|
/// <param name="_double">None</param>
|
||||||
|
/// <param name="_string">None</param>
|
||||||
|
/// <param name="_byte">None</param>
|
||||||
|
/// <param name="integer">None (optional)</param>
|
||||||
|
/// <param name="int32">None (optional)</param>
|
||||||
|
/// <param name="int64">None (optional)</param>
|
||||||
|
/// <param name="_float">None (optional)</param>
|
||||||
|
/// <param name="binary">None (optional)</param>
|
||||||
|
/// <param name="date">None (optional)</param>
|
||||||
|
/// <param name="dateTime">None (optional)</param>
|
||||||
|
/// <param name="password">None (optional)</param>
|
||||||
|
/// <returns>Task of ApiResponse</returns>
|
||||||
|
public async System.Threading.Tasks.Task<ApiResponse<Object>> TestEndpointParametersAsyncWithHttpInfo (double? number, double? _double, string _string, byte[] _byte, int? integer = null, int? int32 = null, long? int64 = null, float? _float = null, byte[] binary = null, DateTime? date = null, DateTime? dateTime = null, string password = null)
|
||||||
|
{
|
||||||
|
// verify the required parameter 'number' is set
|
||||||
|
if (number == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter 'number' when calling FakeApi->TestEndpointParameters");
|
||||||
|
// verify the required parameter '_double' is set
|
||||||
|
if (_double == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter '_double' when calling FakeApi->TestEndpointParameters");
|
||||||
|
// verify the required parameter '_string' is set
|
||||||
|
if (_string == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter '_string' when calling FakeApi->TestEndpointParameters");
|
||||||
|
// verify the required parameter '_byte' is set
|
||||||
|
if (_byte == null)
|
||||||
|
throw new ApiException(400, "Missing required parameter '_byte' when calling FakeApi->TestEndpointParameters");
|
||||||
|
|
||||||
|
var localVarPath = "/fake";
|
||||||
|
var localVarPathParams = new Dictionary<String, String>();
|
||||||
|
var localVarQueryParams = new Dictionary<String, String>();
|
||||||
|
var localVarHeaderParams = new Dictionary<String, String>(Configuration.DefaultHeader);
|
||||||
|
var localVarFormParams = new Dictionary<String, String>();
|
||||||
|
var localVarFileParams = new Dictionary<String, FileParameter>();
|
||||||
|
Object localVarPostBody = null;
|
||||||
|
|
||||||
|
// to determine the Content-Type header
|
||||||
|
String[] localVarHttpContentTypes = new String[] {
|
||||||
|
};
|
||||||
|
String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);
|
||||||
|
|
||||||
|
// to determine the Accept header
|
||||||
|
String[] localVarHttpHeaderAccepts = new String[] {
|
||||||
|
"application/xml",
|
||||||
|
"application/json"
|
||||||
|
};
|
||||||
|
String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
|
||||||
|
if (localVarHttpHeaderAccept != null)
|
||||||
|
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
|
||||||
|
|
||||||
|
// set "format" to json by default
|
||||||
|
// e.g. /pet/{petId}.{format} becomes /pet/{petId}.json
|
||||||
|
localVarPathParams.Add("format", "json");
|
||||||
|
if (integer != null) localVarFormParams.Add("integer", Configuration.ApiClient.ParameterToString(integer)); // form parameter
|
||||||
|
if (int32 != null) localVarFormParams.Add("int32", Configuration.ApiClient.ParameterToString(int32)); // form parameter
|
||||||
|
if (int64 != null) localVarFormParams.Add("int64", Configuration.ApiClient.ParameterToString(int64)); // form parameter
|
||||||
|
if (number != null) localVarFormParams.Add("number", Configuration.ApiClient.ParameterToString(number)); // form parameter
|
||||||
|
if (_float != null) localVarFormParams.Add("float", Configuration.ApiClient.ParameterToString(_float)); // form parameter
|
||||||
|
if (_double != null) localVarFormParams.Add("double", Configuration.ApiClient.ParameterToString(_double)); // form parameter
|
||||||
|
if (_string != null) localVarFormParams.Add("string", Configuration.ApiClient.ParameterToString(_string)); // form parameter
|
||||||
|
if (_byte != null) localVarFormParams.Add("byte", Configuration.ApiClient.ParameterToString(_byte)); // form parameter
|
||||||
|
if (binary != null) localVarFormParams.Add("binary", Configuration.ApiClient.ParameterToString(binary)); // form parameter
|
||||||
|
if (date != null) localVarFormParams.Add("date", Configuration.ApiClient.ParameterToString(date)); // form parameter
|
||||||
|
if (dateTime != null) localVarFormParams.Add("dateTime", Configuration.ApiClient.ParameterToString(dateTime)); // form parameter
|
||||||
|
if (password != null) localVarFormParams.Add("password", Configuration.ApiClient.ParameterToString(password)); // form parameter
|
||||||
|
|
||||||
|
|
||||||
|
// make the HTTP request
|
||||||
|
IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath,
|
||||||
|
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
|
||||||
|
localVarPathParams, localVarHttpContentType);
|
||||||
|
|
||||||
|
int localVarStatusCode = (int) localVarResponse.StatusCode;
|
||||||
|
|
||||||
|
if (localVarStatusCode >= 400)
|
||||||
|
throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.Content, localVarResponse.Content);
|
||||||
|
else if (localVarStatusCode == 0)
|
||||||
|
throw new ApiException (localVarStatusCode, "Error calling TestEndpointParameters: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage);
|
||||||
|
|
||||||
|
|
||||||
|
return new ApiResponse<Object>(localVarStatusCode,
|
||||||
|
localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
|
||||||
|
null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,18 +12,15 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Animal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Animal : IEquatable<Animal>
|
public partial class Animal : IEquatable<Animal>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Animal" /> class.
|
/// Initializes a new instance of the <see cref="Animal" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Animal" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ClassName">ClassName (required).</param>
|
/// <param name="ClassName">ClassName (required).</param>
|
||||||
|
|
||||||
public Animal(string ClassName = null)
|
public Animal(string ClassName = null)
|
||||||
{
|
{
|
||||||
// to ensure "ClassName" is required (not null)
|
// to ensure "ClassName" is required (not null)
|
||||||
@ -36,15 +33,14 @@ namespace IO.Swagger.Model
|
|||||||
this.ClassName = ClassName;
|
this.ClassName = ClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets ClassName
|
/// Gets or Sets ClassName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="className", EmitDefaultValue=false)]
|
[DataMember(Name="className", EmitDefaultValue=false)]
|
||||||
public string ClassName { get; set; }
|
public string ClassName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -113,6 +109,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,47 +12,44 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// ApiResponse
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class ApiResponse : IEquatable<ApiResponse>
|
public partial class ApiResponse : IEquatable<ApiResponse>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ApiResponse" /> class.
|
/// Initializes a new instance of the <see cref="ApiResponse" /> class.
|
||||||
/// Initializes a new instance of the <see cref="ApiResponse" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Code">Code.</param>
|
/// <param name="Code">Code.</param>
|
||||||
/// <param name="Type">Type.</param>
|
/// <param name="Type">Type.</param>
|
||||||
/// <param name="Message">Message.</param>
|
/// <param name="Message">Message.</param>
|
||||||
|
|
||||||
public ApiResponse(int? Code = null, string Type = null, string Message = null)
|
public ApiResponse(int? Code = null, string Type = null, string Message = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Code = Code;
|
this.Code = Code;
|
||||||
|
|
||||||
this.Type = Type;
|
this.Type = Type;
|
||||||
|
|
||||||
this.Message = Message;
|
this.Message = Message;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Code
|
/// Gets or Sets Code
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="code", EmitDefaultValue=false)]
|
[DataMember(Name="code", EmitDefaultValue=false)]
|
||||||
public int? Code { get; set; }
|
public int? Code { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Type
|
/// Gets or Sets Type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="type", EmitDefaultValue=false)]
|
[DataMember(Name="type", EmitDefaultValue=false)]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Message
|
/// Gets or Sets Message
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="message", EmitDefaultValue=false)]
|
[DataMember(Name="message", EmitDefaultValue=false)]
|
||||||
public string Message { get; set; }
|
public string Message { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,8 +59,8 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class ApiResponse {\n");
|
sb.Append("class ApiResponse {\n");
|
||||||
sb.Append(" Code: ").Append(Code).Append("\n");
|
sb.Append(" Code: ").Append(Code).Append("\n");
|
||||||
sb.Append(" Type: ").Append(Type).Append("\n");
|
sb.Append(" Type: ").Append(Type).Append("\n");
|
||||||
sb.Append(" Message: ").Append(Message).Append("\n");
|
sb.Append(" Message: ").Append(Message).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -137,6 +134,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,19 +12,16 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Cat
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Cat : Animal, IEquatable<Cat>
|
public partial class Cat : Animal, IEquatable<Cat>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Cat" /> class.
|
/// Initializes a new instance of the <see cref="Cat" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Cat" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ClassName">ClassName (required).</param>
|
/// <param name="ClassName">ClassName (required).</param>
|
||||||
/// <param name="Declawed">Declawed.</param>
|
/// <param name="Declawed">Declawed.</param>
|
||||||
|
|
||||||
public Cat(string ClassName = null, bool? Declawed = null)
|
public Cat(string ClassName = null, bool? Declawed = null)
|
||||||
{
|
{
|
||||||
// to ensure "ClassName" is required (not null)
|
// to ensure "ClassName" is required (not null)
|
||||||
@ -36,23 +33,22 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.ClassName = ClassName;
|
this.ClassName = ClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.Declawed = Declawed;
|
this.Declawed = Declawed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets ClassName
|
/// Gets or Sets ClassName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="className", EmitDefaultValue=false)]
|
[DataMember(Name="className", EmitDefaultValue=false)]
|
||||||
public string ClassName { get; set; }
|
public string ClassName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Declawed
|
/// Gets or Sets Declawed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="declawed", EmitDefaultValue=false)]
|
[DataMember(Name="declawed", EmitDefaultValue=false)]
|
||||||
public bool? Declawed { get; set; }
|
public bool? Declawed { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,7 +58,7 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Cat {\n");
|
sb.Append("class Cat {\n");
|
||||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
||||||
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
|
sb.Append(" Declawed: ").Append(Declawed).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -129,6 +125,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,175 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace IO.Swagger.Model
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[DataContract]
|
||||||
|
public class CatDogTest : Cat, IEquatable<CatDogTest>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="CatDogTest" /> class.
|
||||||
|
/// </summary>
|
||||||
|
public CatDogTest()
|
||||||
|
{
|
||||||
|
this.CatDogInteger = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets CatId
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="cat_id", EmitDefaultValue=false)]
|
||||||
|
public long? CatId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets DogId
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="dog_id", EmitDefaultValue=false)]
|
||||||
|
public long? DogId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// integer property for testing allOf
|
||||||
|
/// </summary>
|
||||||
|
/// <value>integer property for testing allOf</value>
|
||||||
|
[DataMember(Name="CatDogInteger", EmitDefaultValue=false)]
|
||||||
|
public int? CatDogInteger { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets DogName
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="dog_name", EmitDefaultValue=false)]
|
||||||
|
public string DogName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets CatName
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="cat_name", EmitDefaultValue=false)]
|
||||||
|
public string CatName { 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 CatDogTest {\n");
|
||||||
|
sb.Append(" CatId: ").Append(CatId).Append("\n");
|
||||||
|
sb.Append(" DogId: ").Append(DogId).Append("\n");
|
||||||
|
sb.Append(" CatDogInteger: ").Append(CatDogInteger).Append("\n");
|
||||||
|
sb.Append(" DogName: ").Append(DogName).Append("\n");
|
||||||
|
sb.Append(" CatName: ").Append(CatName).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 new 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 CatDogTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if CatDogTest instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">Instance of CatDogTest to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(CatDogTest other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.CatId == other.CatId ||
|
||||||
|
this.CatId != null &&
|
||||||
|
this.CatId.Equals(other.CatId)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.DogId == other.DogId ||
|
||||||
|
this.DogId != null &&
|
||||||
|
this.DogId.Equals(other.DogId)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.CatDogInteger == other.CatDogInteger ||
|
||||||
|
this.CatDogInteger != null &&
|
||||||
|
this.CatDogInteger.Equals(other.CatDogInteger)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.DogName == other.DogName ||
|
||||||
|
this.DogName != null &&
|
||||||
|
this.DogName.Equals(other.DogName)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.CatName == other.CatName ||
|
||||||
|
this.CatName != null &&
|
||||||
|
this.CatName.Equals(other.CatName)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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.CatId != null)
|
||||||
|
hash = hash * 57 + this.CatId.GetHashCode();
|
||||||
|
|
||||||
|
if (this.DogId != null)
|
||||||
|
hash = hash * 57 + this.DogId.GetHashCode();
|
||||||
|
|
||||||
|
if (this.CatDogInteger != null)
|
||||||
|
hash = hash * 57 + this.CatDogInteger.GetHashCode();
|
||||||
|
|
||||||
|
if (this.DogName != null)
|
||||||
|
hash = hash * 57 + this.DogName.GetHashCode();
|
||||||
|
|
||||||
|
if (this.CatName != null)
|
||||||
|
hash = hash * 57 + this.CatName.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,39 +12,36 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Category
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Category : IEquatable<Category>
|
public partial class Category : IEquatable<Category>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Category" /> class.
|
/// Initializes a new instance of the <see cref="Category" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Category" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Id">Id.</param>
|
/// <param name="Id">Id.</param>
|
||||||
/// <param name="Name">Name.</param>
|
/// <param name="Name">Name.</param>
|
||||||
|
|
||||||
public Category(long? Id = null, string Name = null)
|
public Category(long? Id = null, string Name = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -54,7 +51,7 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Category {\n");
|
sb.Append("class Category {\n");
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -121,6 +118,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,19 +12,16 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Dog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Dog : Animal, IEquatable<Dog>
|
public partial class Dog : Animal, IEquatable<Dog>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Dog" /> class.
|
/// Initializes a new instance of the <see cref="Dog" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Dog" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ClassName">ClassName (required).</param>
|
/// <param name="ClassName">ClassName (required).</param>
|
||||||
/// <param name="Breed">Breed.</param>
|
/// <param name="Breed">Breed.</param>
|
||||||
|
|
||||||
public Dog(string ClassName = null, string Breed = null)
|
public Dog(string ClassName = null, string Breed = null)
|
||||||
{
|
{
|
||||||
// to ensure "ClassName" is required (not null)
|
// to ensure "ClassName" is required (not null)
|
||||||
@ -36,23 +33,22 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.ClassName = ClassName;
|
this.ClassName = ClassName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.Breed = Breed;
|
this.Breed = Breed;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets ClassName
|
/// Gets or Sets ClassName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="className", EmitDefaultValue=false)]
|
[DataMember(Name="className", EmitDefaultValue=false)]
|
||||||
public string ClassName { get; set; }
|
public string ClassName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Breed
|
/// Gets or Sets Breed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="breed", EmitDefaultValue=false)]
|
[DataMember(Name="breed", EmitDefaultValue=false)]
|
||||||
public string Breed { get; set; }
|
public string Breed { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,7 +58,7 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Dog {\n");
|
sb.Append("class Dog {\n");
|
||||||
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
sb.Append(" ClassName: ").Append(ClassName).Append("\n");
|
||||||
sb.Append(" Breed: ").Append(Breed).Append("\n");
|
sb.Append(" Breed: ").Append(Breed).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -129,6 +125,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,40 @@
|
|||||||
|
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>
|
||||||
|
/// Gets or Sets EnumClass
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum EnumClass
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Abc for "_abc"
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "_abc")]
|
||||||
|
Abc,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum efg for "-efg"
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "-efg")]
|
||||||
|
efg,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum xyz for "(xyz)"
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "(xyz)")]
|
||||||
|
xyz
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,199 @@
|
|||||||
|
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>
|
||||||
|
/// EnumTest
|
||||||
|
/// </summary>
|
||||||
|
[DataContract]
|
||||||
|
public partial class EnumTest : IEquatable<EnumTest>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets EnumString
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum EnumStringEnum
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Upper for "UPPER"
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "UPPER")]
|
||||||
|
Upper,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Lower for "lower"
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "lower")]
|
||||||
|
Lower
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets EnumInteger
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum EnumIntegerEnum
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum NUMBER_1 for 1
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "1")]
|
||||||
|
NUMBER_1 = 1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum NUMBER_MINUS_1 for -1
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "-1")]
|
||||||
|
NUMBER_MINUS_1 = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets EnumNumber
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
|
public enum EnumNumberEnum
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum NUMBER_1_DOT_1 for 1.1
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "1.1")]
|
||||||
|
NUMBER_1_DOT_1,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum NUMBER_MINUS_1_DOT_2 for -1.2
|
||||||
|
/// </summary>
|
||||||
|
[EnumMember(Value = "-1.2")]
|
||||||
|
NUMBER_MINUS_1_DOT_2
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets EnumString
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="enum_string", EmitDefaultValue=false)]
|
||||||
|
public EnumStringEnum? EnumString { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets EnumInteger
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="enum_integer", EmitDefaultValue=false)]
|
||||||
|
public EnumIntegerEnum? EnumInteger { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets EnumNumber
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="enum_number", EmitDefaultValue=false)]
|
||||||
|
public EnumNumberEnum? EnumNumber { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="EnumTest" /> class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="EnumString">EnumString.</param>
|
||||||
|
/// <param name="EnumInteger">EnumInteger.</param>
|
||||||
|
/// <param name="EnumNumber">EnumNumber.</param>
|
||||||
|
public EnumTest(EnumStringEnum? EnumString = null, EnumIntegerEnum? EnumInteger = null, EnumNumberEnum? EnumNumber = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
this.EnumString = EnumString;
|
||||||
|
|
||||||
|
this.EnumInteger = EnumInteger;
|
||||||
|
|
||||||
|
this.EnumNumber = EnumNumber;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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 EnumTest {\n");
|
||||||
|
sb.Append(" EnumString: ").Append(EnumString).Append("\n");
|
||||||
|
sb.Append(" EnumInteger: ").Append(EnumInteger).Append("\n");
|
||||||
|
sb.Append(" EnumNumber: ").Append(EnumNumber).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 EnumTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if EnumTest instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">Instance of EnumTest to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(EnumTest other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.EnumString == other.EnumString ||
|
||||||
|
this.EnumString != null &&
|
||||||
|
this.EnumString.Equals(other.EnumString)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.EnumInteger == other.EnumInteger ||
|
||||||
|
this.EnumInteger != null &&
|
||||||
|
this.EnumInteger.Equals(other.EnumInteger)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.EnumNumber == other.EnumNumber ||
|
||||||
|
this.EnumNumber != null &&
|
||||||
|
this.EnumNumber.Equals(other.EnumNumber)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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.EnumString != null)
|
||||||
|
hash = hash * 59 + this.EnumString.GetHashCode();
|
||||||
|
if (this.EnumInteger != null)
|
||||||
|
hash = hash * 59 + this.EnumInteger.GetHashCode();
|
||||||
|
if (this.EnumNumber != null)
|
||||||
|
hash = hash * 59 + this.EnumNumber.GetHashCode();
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -12,15 +12,13 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// FormatTest
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class FormatTest : IEquatable<FormatTest>
|
public partial class FormatTest : IEquatable<FormatTest>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="FormatTest" /> class.
|
/// Initializes a new instance of the <see cref="FormatTest" /> class.
|
||||||
/// Initializes a new instance of the <see cref="FormatTest" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Integer">Integer.</param>
|
/// <param name="Integer">Integer.</param>
|
||||||
/// <param name="Int32">Int32.</param>
|
/// <param name="Int32">Int32.</param>
|
||||||
@ -29,12 +27,11 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="_Float">_Float.</param>
|
/// <param name="_Float">_Float.</param>
|
||||||
/// <param name="_Double">_Double.</param>
|
/// <param name="_Double">_Double.</param>
|
||||||
/// <param name="_String">_String.</param>
|
/// <param name="_String">_String.</param>
|
||||||
/// <param name="_Byte">_Byte.</param>
|
/// <param name="_Byte">_Byte (required).</param>
|
||||||
/// <param name="Binary">Binary.</param>
|
/// <param name="Binary">Binary.</param>
|
||||||
/// <param name="Date">Date.</param>
|
/// <param name="Date">Date (required).</param>
|
||||||
/// <param name="DateTime">DateTime.</param>
|
/// <param name="DateTime">DateTime.</param>
|
||||||
/// <param name="Password">Password.</param>
|
/// <param name="Password">Password (required).</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, DateTime? DateTime = null, string Password = null)
|
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, DateTime? DateTime = null, string Password = null)
|
||||||
{
|
{
|
||||||
// to ensure "Number" is required (not null)
|
// to ensure "Number" is required (not null)
|
||||||
@ -46,93 +43,113 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.Number = Number;
|
this.Number = Number;
|
||||||
}
|
}
|
||||||
this.Integer = Integer;
|
// to ensure "_Byte" is required (not null)
|
||||||
this.Int32 = Int32;
|
if (_Byte == null)
|
||||||
this.Int64 = Int64;
|
{
|
||||||
this._Float = _Float;
|
throw new InvalidDataException("_Byte is a required property for FormatTest and cannot be null");
|
||||||
this._Double = _Double;
|
}
|
||||||
this._String = _String;
|
else
|
||||||
|
{
|
||||||
this._Byte = _Byte;
|
this._Byte = _Byte;
|
||||||
this.Binary = Binary;
|
}
|
||||||
|
// to ensure "Date" is required (not null)
|
||||||
|
if (Date == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Date is a required property for FormatTest and cannot be null");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.Date = Date;
|
this.Date = Date;
|
||||||
this.DateTime = DateTime;
|
}
|
||||||
|
// to ensure "Password" is required (not null)
|
||||||
|
if (Password == null)
|
||||||
|
{
|
||||||
|
throw new InvalidDataException("Password is a required property for FormatTest and cannot be null");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
this.Password = Password;
|
this.Password = Password;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.Integer = Integer;
|
||||||
|
|
||||||
|
this.Int32 = Int32;
|
||||||
|
|
||||||
|
this.Int64 = Int64;
|
||||||
|
|
||||||
|
this._Float = _Float;
|
||||||
|
|
||||||
|
this._Double = _Double;
|
||||||
|
|
||||||
|
this._String = _String;
|
||||||
|
|
||||||
|
this.Binary = Binary;
|
||||||
|
|
||||||
|
this.DateTime = DateTime;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Integer
|
/// Gets or Sets Integer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="integer", EmitDefaultValue=false)]
|
[DataMember(Name="integer", EmitDefaultValue=false)]
|
||||||
public int? Integer { get; set; }
|
public int? Integer { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Int32
|
/// Gets or Sets Int32
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="int32", EmitDefaultValue=false)]
|
[DataMember(Name="int32", EmitDefaultValue=false)]
|
||||||
public int? Int32 { get; set; }
|
public int? Int32 { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Int64
|
/// Gets or Sets Int64
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="int64", EmitDefaultValue=false)]
|
[DataMember(Name="int64", EmitDefaultValue=false)]
|
||||||
public long? Int64 { get; set; }
|
public long? Int64 { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Number
|
/// Gets or Sets Number
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="number", EmitDefaultValue=false)]
|
[DataMember(Name="number", EmitDefaultValue=false)]
|
||||||
public double? Number { get; set; }
|
public double? Number { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets _Float
|
/// Gets or Sets _Float
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="float", EmitDefaultValue=false)]
|
[DataMember(Name="float", EmitDefaultValue=false)]
|
||||||
public float? _Float { get; set; }
|
public float? _Float { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets _Double
|
/// Gets or Sets _Double
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="double", EmitDefaultValue=false)]
|
[DataMember(Name="double", EmitDefaultValue=false)]
|
||||||
public double? _Double { get; set; }
|
public double? _Double { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets _String
|
/// Gets or Sets _String
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="string", EmitDefaultValue=false)]
|
[DataMember(Name="string", EmitDefaultValue=false)]
|
||||||
public string _String { get; set; }
|
public string _String { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets _Byte
|
/// Gets or Sets _Byte
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="byte", EmitDefaultValue=false)]
|
[DataMember(Name="byte", EmitDefaultValue=false)]
|
||||||
public byte[] _Byte { get; set; }
|
public byte[] _Byte { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Binary
|
/// Gets or Sets Binary
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="binary", EmitDefaultValue=false)]
|
[DataMember(Name="binary", EmitDefaultValue=false)]
|
||||||
public byte[] Binary { get; set; }
|
public byte[] Binary { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Date
|
/// Gets or Sets Date
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="date", EmitDefaultValue=false)]
|
[DataMember(Name="date", EmitDefaultValue=false)]
|
||||||
public DateTime? Date { get; set; }
|
public DateTime? Date { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets DateTime
|
/// Gets or Sets DateTime
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="dateTime", EmitDefaultValue=false)]
|
[DataMember(Name="dateTime", EmitDefaultValue=false)]
|
||||||
public DateTime? DateTime { get; set; }
|
public DateTime? DateTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Password
|
/// Gets or Sets Password
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="password", EmitDefaultValue=false)]
|
[DataMember(Name="password", EmitDefaultValue=false)]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -142,17 +159,17 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class FormatTest {\n");
|
sb.Append("class FormatTest {\n");
|
||||||
sb.Append(" Integer: ").Append(Integer).Append("\n");
|
sb.Append(" Integer: ").Append(Integer).Append("\n");
|
||||||
sb.Append(" Int32: ").Append(Int32).Append("\n");
|
sb.Append(" Int32: ").Append(Int32).Append("\n");
|
||||||
sb.Append(" Int64: ").Append(Int64).Append("\n");
|
sb.Append(" Int64: ").Append(Int64).Append("\n");
|
||||||
sb.Append(" Number: ").Append(Number).Append("\n");
|
sb.Append(" Number: ").Append(Number).Append("\n");
|
||||||
sb.Append(" _Float: ").Append(_Float).Append("\n");
|
sb.Append(" _Float: ").Append(_Float).Append("\n");
|
||||||
sb.Append(" _Double: ").Append(_Double).Append("\n");
|
sb.Append(" _Double: ").Append(_Double).Append("\n");
|
||||||
sb.Append(" _String: ").Append(_String).Append("\n");
|
sb.Append(" _String: ").Append(_String).Append("\n");
|
||||||
sb.Append(" _Byte: ").Append(_Byte).Append("\n");
|
sb.Append(" _Byte: ").Append(_Byte).Append("\n");
|
||||||
sb.Append(" Binary: ").Append(Binary).Append("\n");
|
sb.Append(" Binary: ").Append(Binary).Append("\n");
|
||||||
sb.Append(" Date: ").Append(Date).Append("\n");
|
sb.Append(" Date: ").Append(Date).Append("\n");
|
||||||
sb.Append(" DateTime: ").Append(DateTime).Append("\n");
|
sb.Append(" DateTime: ").Append(DateTime).Append("\n");
|
||||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -289,6 +306,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Text;
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
using System.Collections.ObjectModel;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
@ -12,25 +13,34 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// InlineResponse200
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class InlineResponse200 : IEquatable<InlineResponse200>
|
public partial class InlineResponse200 : IEquatable<InlineResponse200>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pet status in the store
|
/// pet status in the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>pet status in the store</value>
|
/// <value>pet status in the store</value>
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public enum StatusEnum {
|
public enum StatusEnum
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Available for "available"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "available")]
|
[EnumMember(Value = "available")]
|
||||||
Available,
|
Available,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Pending for "pending"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "pending")]
|
[EnumMember(Value = "pending")]
|
||||||
Pending,
|
Pending,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Sold for "sold"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "sold")]
|
[EnumMember(Value = "sold")]
|
||||||
Sold
|
Sold
|
||||||
}
|
}
|
||||||
@ -47,14 +57,14 @@ namespace IO.Swagger.Model
|
|||||||
/// Initializes a new instance of the <see cref="InlineResponse200" /> class.
|
/// Initializes a new instance of the <see cref="InlineResponse200" /> class.
|
||||||
/// Initializes a new instance of the <see cref="InlineResponse200" />class.
|
/// Initializes a new instance of the <see cref="InlineResponse200" />class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="PhotoUrls">PhotoUrls.</param>
|
/// <param name="Tags">Tags.</param>
|
||||||
/// <param name="Name">Name.</param>
|
|
||||||
/// <param name="Id">Id (required).</param>
|
/// <param name="Id">Id (required).</param>
|
||||||
/// <param name="Category">Category.</param>
|
/// <param name="Category">Category.</param>
|
||||||
/// <param name="Tags">Tags.</param>
|
|
||||||
/// <param name="Status">pet status in the store.</param>
|
/// <param name="Status">pet status in the store.</param>
|
||||||
|
/// <param name="Name">Name.</param>
|
||||||
|
/// <param name="PhotoUrls">PhotoUrls.</param>
|
||||||
|
|
||||||
public InlineResponse200(List<string> PhotoUrls = null, string Name = null, long? Id = null, Object Category = null, List<Tag> Tags = null, StatusEnum? Status = null)
|
public InlineResponse200(List<Tag> Tags = null, long? Id = null, Object Category = null, StatusEnum? Status = null, string Name = null, List<string> PhotoUrls = null)
|
||||||
{
|
{
|
||||||
// to ensure "Id" is required (not null)
|
// to ensure "Id" is required (not null)
|
||||||
if (Id == null)
|
if (Id == null)
|
||||||
@ -65,26 +75,20 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
}
|
}
|
||||||
this.PhotoUrls = PhotoUrls;
|
|
||||||
this.Name = Name;
|
|
||||||
this.Category = Category;
|
|
||||||
this.Tags = Tags;
|
this.Tags = Tags;
|
||||||
|
this.Category = Category;
|
||||||
this.Status = Status;
|
this.Status = Status;
|
||||||
|
this.Name = Name;
|
||||||
|
this.PhotoUrls = PhotoUrls;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PhotoUrls
|
/// Gets or Sets Tags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
[DataMember(Name="tags", EmitDefaultValue=false)]
|
||||||
public List<string> PhotoUrls { get; set; }
|
public List<Tag> Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or Sets Name
|
|
||||||
/// </summary>
|
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
@ -99,10 +103,16 @@ namespace IO.Swagger.Model
|
|||||||
public Object Category { get; set; }
|
public Object Category { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Tags
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public List<Tag> Tags { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets PhotoUrls
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
||||||
|
public List<string> PhotoUrls { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
@ -112,12 +122,13 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class InlineResponse200 {\n");
|
sb.Append("class InlineResponse200 {\n");
|
||||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
|
||||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||||
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||||
|
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||||
|
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -155,14 +166,9 @@ namespace IO.Swagger.Model
|
|||||||
|
|
||||||
return
|
return
|
||||||
(
|
(
|
||||||
this.PhotoUrls == other.PhotoUrls ||
|
this.Tags == other.Tags ||
|
||||||
this.PhotoUrls != null &&
|
this.Tags != null &&
|
||||||
this.PhotoUrls.SequenceEqual(other.PhotoUrls)
|
this.Tags.SequenceEqual(other.Tags)
|
||||||
) &&
|
|
||||||
(
|
|
||||||
this.Name == other.Name ||
|
|
||||||
this.Name != null &&
|
|
||||||
this.Name.Equals(other.Name)
|
|
||||||
) &&
|
) &&
|
||||||
(
|
(
|
||||||
this.Id == other.Id ||
|
this.Id == other.Id ||
|
||||||
@ -174,15 +180,20 @@ namespace IO.Swagger.Model
|
|||||||
this.Category != null &&
|
this.Category != null &&
|
||||||
this.Category.Equals(other.Category)
|
this.Category.Equals(other.Category)
|
||||||
) &&
|
) &&
|
||||||
(
|
|
||||||
this.Tags == other.Tags ||
|
|
||||||
this.Tags != null &&
|
|
||||||
this.Tags.SequenceEqual(other.Tags)
|
|
||||||
) &&
|
|
||||||
(
|
(
|
||||||
this.Status == other.Status ||
|
this.Status == other.Status ||
|
||||||
this.Status != null &&
|
this.Status != null &&
|
||||||
this.Status.Equals(other.Status)
|
this.Status.Equals(other.Status)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Name == other.Name ||
|
||||||
|
this.Name != null &&
|
||||||
|
this.Name.Equals(other.Name)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.PhotoUrls == other.PhotoUrls ||
|
||||||
|
this.PhotoUrls != null &&
|
||||||
|
this.PhotoUrls.SequenceEqual(other.PhotoUrls)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,21 +208,28 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
int hash = 41;
|
int hash = 41;
|
||||||
// Suitable nullity checks etc, of course :)
|
// Suitable nullity checks etc, of course :)
|
||||||
if (this.PhotoUrls != null)
|
|
||||||
hash = hash * 59 + this.PhotoUrls.GetHashCode();
|
|
||||||
if (this.Name != null)
|
|
||||||
hash = hash * 59 + this.Name.GetHashCode();
|
|
||||||
if (this.Id != null)
|
|
||||||
hash = hash * 59 + this.Id.GetHashCode();
|
|
||||||
if (this.Category != null)
|
|
||||||
hash = hash * 59 + this.Category.GetHashCode();
|
|
||||||
if (this.Tags != null)
|
if (this.Tags != null)
|
||||||
hash = hash * 59 + this.Tags.GetHashCode();
|
hash = hash * 59 + this.Tags.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Id != null)
|
||||||
|
hash = hash * 59 + this.Id.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Category != null)
|
||||||
|
hash = hash * 59 + this.Category.GetHashCode();
|
||||||
|
|
||||||
if (this.Status != null)
|
if (this.Status != null)
|
||||||
hash = hash * 59 + this.Status.GetHashCode();
|
hash = hash * 59 + this.Status.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Name != null)
|
||||||
|
hash = hash * 59 + this.Name.GetHashCode();
|
||||||
|
|
||||||
|
if (this.PhotoUrls != null)
|
||||||
|
hash = hash * 59 + this.PhotoUrls.GetHashCode();
|
||||||
|
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,26 +17,23 @@ namespace IO.Swagger.Model
|
|||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Model200Response : IEquatable<Model200Response>
|
public partial class Model200Response : IEquatable<Model200Response>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Model200Response" /> class.
|
/// Initializes a new instance of the <see cref="Model200Response" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Model200Response" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Name">Name.</param>
|
/// <param name="Name">Name.</param>
|
||||||
|
|
||||||
public Model200Response(int? Name = null)
|
public Model200Response(int? Name = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public int? Name { get; set; }
|
public int? Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -105,6 +102,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,26 +17,23 @@ namespace IO.Swagger.Model
|
|||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class ModelReturn : IEquatable<ModelReturn>
|
public partial class ModelReturn : IEquatable<ModelReturn>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ModelReturn" /> class.
|
/// Initializes a new instance of the <see cref="ModelReturn" /> class.
|
||||||
/// Initializes a new instance of the <see cref="ModelReturn" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="_Return">_Return.</param>
|
/// <param name="_Return">_Return.</param>
|
||||||
|
|
||||||
public ModelReturn(int? _Return = null)
|
public ModelReturn(int? _Return = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this._Return = _Return;
|
this._Return = _Return;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets _Return
|
/// Gets or Sets _Return
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="return", EmitDefaultValue=false)]
|
[DataMember(Name="return", EmitDefaultValue=false)]
|
||||||
public int? _Return { get; set; }
|
public int? _Return { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -105,6 +102,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,11 @@ namespace IO.Swagger.Model
|
|||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Name : IEquatable<Name>
|
public partial class Name : IEquatable<Name>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Name" /> class.
|
/// Initializes a new instance of the <see cref="Name" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Name" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="_Name">_Name (required).</param>
|
/// <param name="_Name">_Name (required).</param>
|
||||||
/// <param name="Property">Property.</param>
|
/// <param name="Property">Property.</param>
|
||||||
|
|
||||||
public Name(int? _Name = null, string Property = null)
|
public Name(int? _Name = null, string Property = null)
|
||||||
{
|
{
|
||||||
// to ensure "_Name" is required (not null)
|
// to ensure "_Name" is required (not null)
|
||||||
@ -36,29 +33,27 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this._Name = _Name;
|
this._Name = _Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.Property = Property;
|
this.Property = Property;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets _Name
|
/// Gets or Sets _Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public int? _Name { get; set; }
|
public int? _Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets SnakeCase
|
/// Gets or Sets SnakeCase
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="snake_case", EmitDefaultValue=false)]
|
[DataMember(Name="snake_case", EmitDefaultValue=false)]
|
||||||
public int? SnakeCase { get; private set; }
|
public int? SnakeCase { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Property
|
/// Gets or Sets Property
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="property", EmitDefaultValue=false)]
|
[DataMember(Name="property", EmitDefaultValue=false)]
|
||||||
public string Property { get; set; }
|
public string Property { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -68,8 +63,8 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Name {\n");
|
sb.Append("class Name {\n");
|
||||||
sb.Append(" _Name: ").Append(_Name).Append("\n");
|
sb.Append(" _Name: ").Append(_Name).Append("\n");
|
||||||
sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n");
|
sb.Append(" SnakeCase: ").Append(SnakeCase).Append("\n");
|
||||||
sb.Append(" Property: ").Append(Property).Append("\n");
|
sb.Append(" Property: ").Append(Property).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -143,6 +138,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,40 +12,46 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Order
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Order : IEquatable<Order>
|
public partial class Order : IEquatable<Order>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Order Status
|
/// Order Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>Order Status</value>
|
/// <value>Order Status</value>
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public enum StatusEnum {
|
public enum StatusEnum
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Placed for "placed"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "placed")]
|
[EnumMember(Value = "placed")]
|
||||||
Placed,
|
Placed,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Approved for "approved"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "approved")]
|
[EnumMember(Value = "approved")]
|
||||||
Approved,
|
Approved,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Delivered for "delivered"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "delivered")]
|
[EnumMember(Value = "delivered")]
|
||||||
Delivered
|
Delivered
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Order Status
|
/// Order Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>Order Status</value>
|
/// <value>Order Status</value>
|
||||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
[DataMember(Name="status", EmitDefaultValue=false)]
|
||||||
public StatusEnum? Status { get; set; }
|
public StatusEnum? Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Order" /> class.
|
/// Initializes a new instance of the <see cref="Order" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Order" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Id">Id.</param>
|
/// <param name="Id">Id.</param>
|
||||||
/// <param name="PetId">PetId.</param>
|
/// <param name="PetId">PetId.</param>
|
||||||
@ -53,14 +59,20 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="ShipDate">ShipDate.</param>
|
/// <param name="ShipDate">ShipDate.</param>
|
||||||
/// <param name="Status">Order Status.</param>
|
/// <param name="Status">Order Status.</param>
|
||||||
/// <param name="Complete">Complete (default to false).</param>
|
/// <param name="Complete">Complete (default to false).</param>
|
||||||
|
|
||||||
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null)
|
public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.PetId = PetId;
|
this.PetId = PetId;
|
||||||
|
|
||||||
this.Quantity = Quantity;
|
this.Quantity = Quantity;
|
||||||
|
|
||||||
this.ShipDate = ShipDate;
|
this.ShipDate = ShipDate;
|
||||||
|
|
||||||
this.Status = Status;
|
this.Status = Status;
|
||||||
|
|
||||||
// use default value if no "Complete" provided
|
// use default value if no "Complete" provided
|
||||||
if (Complete == null)
|
if (Complete == null)
|
||||||
{
|
{
|
||||||
@ -73,37 +85,31 @@ namespace IO.Swagger.Model
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PetId
|
/// Gets or Sets PetId
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="petId", EmitDefaultValue=false)]
|
[DataMember(Name="petId", EmitDefaultValue=false)]
|
||||||
public long? PetId { get; set; }
|
public long? PetId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Quantity
|
/// Gets or Sets Quantity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
[DataMember(Name="quantity", EmitDefaultValue=false)]
|
||||||
public int? Quantity { get; set; }
|
public int? Quantity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets ShipDate
|
/// Gets or Sets ShipDate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
[DataMember(Name="shipDate", EmitDefaultValue=false)]
|
||||||
public DateTime? ShipDate { get; set; }
|
public DateTime? ShipDate { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Complete
|
/// Gets or Sets Complete
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="complete", EmitDefaultValue=false)]
|
[DataMember(Name="complete", EmitDefaultValue=false)]
|
||||||
public bool? Complete { get; set; }
|
public bool? Complete { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -113,11 +119,11 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Order {\n");
|
sb.Append("class Order {\n");
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
sb.Append(" PetId: ").Append(PetId).Append("\n");
|
||||||
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
sb.Append(" Quantity: ").Append(Quantity).Append("\n");
|
||||||
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
sb.Append(" ShipDate: ").Append(ShipDate).Append("\n");
|
||||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||||
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
sb.Append(" Complete: ").Append(Complete).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -212,6 +218,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,40 +12,46 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Pet
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Pet : IEquatable<Pet>
|
public partial class Pet : IEquatable<Pet>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pet status in the store
|
/// pet status in the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>pet status in the store</value>
|
/// <value>pet status in the store</value>
|
||||||
[JsonConverter(typeof(StringEnumConverter))]
|
[JsonConverter(typeof(StringEnumConverter))]
|
||||||
public enum StatusEnum {
|
public enum StatusEnum
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Available for "available"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "available")]
|
[EnumMember(Value = "available")]
|
||||||
Available,
|
Available,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Pending for "pending"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "pending")]
|
[EnumMember(Value = "pending")]
|
||||||
Pending,
|
Pending,
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enum Sold for "sold"
|
||||||
|
/// </summary>
|
||||||
[EnumMember(Value = "sold")]
|
[EnumMember(Value = "sold")]
|
||||||
Sold
|
Sold
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// pet status in the store
|
/// pet status in the store
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>pet status in the store</value>
|
/// <value>pet status in the store</value>
|
||||||
[DataMember(Name="status", EmitDefaultValue=false)]
|
[DataMember(Name="status", EmitDefaultValue=false)]
|
||||||
public StatusEnum? Status { get; set; }
|
public StatusEnum? Status { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Pet" /> class.
|
/// Initializes a new instance of the <see cref="Pet" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Pet" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Id">Id.</param>
|
/// <param name="Id">Id.</param>
|
||||||
/// <param name="Category">Category.</param>
|
/// <param name="Category">Category.</param>
|
||||||
@ -53,7 +59,6 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="PhotoUrls">PhotoUrls (required).</param>
|
/// <param name="PhotoUrls">PhotoUrls (required).</param>
|
||||||
/// <param name="Tags">Tags.</param>
|
/// <param name="Tags">Tags.</param>
|
||||||
/// <param name="Status">pet status in the store.</param>
|
/// <param name="Status">pet status in the store.</param>
|
||||||
|
|
||||||
public Pet(long? Id = null, Category Category = null, string Name = null, List<string> PhotoUrls = null, List<Tag> Tags = null, StatusEnum? Status = null)
|
public Pet(long? Id = null, Category Category = null, string Name = null, List<string> PhotoUrls = null, List<Tag> Tags = null, StatusEnum? Status = null)
|
||||||
{
|
{
|
||||||
// to ensure "Name" is required (not null)
|
// to ensure "Name" is required (not null)
|
||||||
@ -74,44 +79,43 @@ namespace IO.Swagger.Model
|
|||||||
{
|
{
|
||||||
this.PhotoUrls = PhotoUrls;
|
this.PhotoUrls = PhotoUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Category = Category;
|
this.Category = Category;
|
||||||
|
|
||||||
this.Tags = Tags;
|
this.Tags = Tags;
|
||||||
|
|
||||||
this.Status = Status;
|
this.Status = Status;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Category
|
/// Gets or Sets Category
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="category", EmitDefaultValue=false)]
|
[DataMember(Name="category", EmitDefaultValue=false)]
|
||||||
public Category Category { get; set; }
|
public Category Category { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets PhotoUrls
|
/// Gets or Sets PhotoUrls
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
[DataMember(Name="photoUrls", EmitDefaultValue=false)]
|
||||||
public List<string> PhotoUrls { get; set; }
|
public List<string> PhotoUrls { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Tags
|
/// Gets or Sets Tags
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="tags", EmitDefaultValue=false)]
|
[DataMember(Name="tags", EmitDefaultValue=false)]
|
||||||
public List<Tag> Tags { get; set; }
|
public List<Tag> Tags { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -121,11 +125,11 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Pet {\n");
|
sb.Append("class Pet {\n");
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
sb.Append(" Category: ").Append(Category).Append("\n");
|
sb.Append(" Category: ").Append(Category).Append("\n");
|
||||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||||
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n");
|
||||||
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
sb.Append(" Tags: ").Append(Tags).Append("\n");
|
||||||
sb.Append(" Status: ").Append(Status).Append("\n");
|
sb.Append(" Status: ").Append(Status).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -220,6 +224,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,31 +12,28 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// SpecialModelName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class SpecialModelName : IEquatable<SpecialModelName>
|
public partial class SpecialModelName : IEquatable<SpecialModelName>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="SpecialModelName" /> class.
|
/// Initializes a new instance of the <see cref="SpecialModelName" /> class.
|
||||||
/// Initializes a new instance of the <see cref="SpecialModelName" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="SpecialPropertyName">SpecialPropertyName.</param>
|
/// <param name="SpecialPropertyName">SpecialPropertyName.</param>
|
||||||
|
|
||||||
public SpecialModelName(long? SpecialPropertyName = null)
|
public SpecialModelName(long? SpecialPropertyName = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.SpecialPropertyName = SpecialPropertyName;
|
this.SpecialPropertyName = SpecialPropertyName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets SpecialPropertyName
|
/// Gets or Sets SpecialPropertyName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="$special[property.name]", EmitDefaultValue=false)]
|
[DataMember(Name="$special[property.name]", EmitDefaultValue=false)]
|
||||||
public long? SpecialPropertyName { get; set; }
|
public long? SpecialPropertyName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -105,6 +102,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,39 +12,36 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Tag
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class Tag : IEquatable<Tag>
|
public partial class Tag : IEquatable<Tag>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="Tag" /> class.
|
/// Initializes a new instance of the <see cref="Tag" /> class.
|
||||||
/// Initializes a new instance of the <see cref="Tag" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Id">Id.</param>
|
/// <param name="Id">Id.</param>
|
||||||
/// <param name="Name">Name.</param>
|
/// <param name="Name">Name.</param>
|
||||||
|
|
||||||
public Tag(long? Id = null, string Name = null)
|
public Tag(long? Id = null, string Name = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Name = Name;
|
this.Name = Name;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Name
|
/// Gets or Sets Name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="name", EmitDefaultValue=false)]
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -54,7 +51,7 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class Tag {\n");
|
sb.Append("class Tag {\n");
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
sb.Append(" Name: ").Append(Name).Append("\n");
|
sb.Append(" Name: ").Append(Name).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -121,6 +118,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,143 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
|
using System.Text;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace IO.Swagger.Model
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
[DataContract]
|
||||||
|
public class TagCategoryTest : Category, IEquatable<TagCategoryTest>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the <see cref="TagCategoryTest" /> class.
|
||||||
|
/// </summary>
|
||||||
|
public TagCategoryTest()
|
||||||
|
{
|
||||||
|
this.TagCategoryInteger = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets Id
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
|
public long? Id { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// integer property for testing allOf
|
||||||
|
/// </summary>
|
||||||
|
/// <value>integer property for testing allOf</value>
|
||||||
|
[DataMember(Name="TagCategoryInteger", EmitDefaultValue=false)]
|
||||||
|
public int? TagCategoryInteger { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or Sets Name
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name="name", EmitDefaultValue=false)]
|
||||||
|
public string Name { 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 TagCategoryTest {\n");
|
||||||
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
|
sb.Append(" TagCategoryInteger: ").Append(TagCategoryInteger).Append("\n");
|
||||||
|
sb.Append(" Name: ").Append(Name).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 new 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 TagCategoryTest);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns true if TagCategoryTest instances are equal
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other">Instance of TagCategoryTest to be compared</param>
|
||||||
|
/// <returns>Boolean</returns>
|
||||||
|
public bool Equals(TagCategoryTest other)
|
||||||
|
{
|
||||||
|
// credit: http://stackoverflow.com/a/10454552/677735
|
||||||
|
if (other == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return
|
||||||
|
(
|
||||||
|
this.Id == other.Id ||
|
||||||
|
this.Id != null &&
|
||||||
|
this.Id.Equals(other.Id)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.TagCategoryInteger == other.TagCategoryInteger ||
|
||||||
|
this.TagCategoryInteger != null &&
|
||||||
|
this.TagCategoryInteger.Equals(other.TagCategoryInteger)
|
||||||
|
) &&
|
||||||
|
(
|
||||||
|
this.Name == other.Name ||
|
||||||
|
this.Name != null &&
|
||||||
|
this.Name.Equals(other.Name)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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.Id != null)
|
||||||
|
hash = hash * 57 + this.Id.GetHashCode();
|
||||||
|
|
||||||
|
if (this.TagCategoryInteger != null)
|
||||||
|
hash = hash * 57 + this.TagCategoryInteger.GetHashCode();
|
||||||
|
|
||||||
|
if (this.Name != null)
|
||||||
|
hash = hash * 57 + this.Name.GetHashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,15 +12,13 @@ using Newtonsoft.Json.Converters;
|
|||||||
namespace IO.Swagger.Model
|
namespace IO.Swagger.Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// User
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataContract]
|
[DataContract]
|
||||||
public partial class User : IEquatable<User>
|
public partial class User : IEquatable<User>
|
||||||
{
|
{
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="User" /> class.
|
/// Initializes a new instance of the <see cref="User" /> class.
|
||||||
/// Initializes a new instance of the <see cref="User" />class.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="Id">Id.</param>
|
/// <param name="Id">Id.</param>
|
||||||
/// <param name="Username">Username.</param>
|
/// <param name="Username">Username.</param>
|
||||||
@ -30,70 +28,69 @@ namespace IO.Swagger.Model
|
|||||||
/// <param name="Password">Password.</param>
|
/// <param name="Password">Password.</param>
|
||||||
/// <param name="Phone">Phone.</param>
|
/// <param name="Phone">Phone.</param>
|
||||||
/// <param name="UserStatus">User Status.</param>
|
/// <param name="UserStatus">User Status.</param>
|
||||||
|
|
||||||
public User(long? Id = null, string Username = null, string FirstName = null, string LastName = null, string Email = null, string Password = null, string Phone = null, int? UserStatus = null)
|
public User(long? Id = null, string Username = null, string FirstName = null, string LastName = null, string Email = null, string Password = null, string Phone = null, int? UserStatus = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
this.Id = Id;
|
this.Id = Id;
|
||||||
|
|
||||||
this.Username = Username;
|
this.Username = Username;
|
||||||
|
|
||||||
this.FirstName = FirstName;
|
this.FirstName = FirstName;
|
||||||
|
|
||||||
this.LastName = LastName;
|
this.LastName = LastName;
|
||||||
|
|
||||||
this.Email = Email;
|
this.Email = Email;
|
||||||
|
|
||||||
this.Password = Password;
|
this.Password = Password;
|
||||||
|
|
||||||
this.Phone = Phone;
|
this.Phone = Phone;
|
||||||
|
|
||||||
this.UserStatus = UserStatus;
|
this.UserStatus = UserStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Id
|
/// Gets or Sets Id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="id", EmitDefaultValue=false)]
|
[DataMember(Name="id", EmitDefaultValue=false)]
|
||||||
public long? Id { get; set; }
|
public long? Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Username
|
/// Gets or Sets Username
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="username", EmitDefaultValue=false)]
|
[DataMember(Name="username", EmitDefaultValue=false)]
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets FirstName
|
/// Gets or Sets FirstName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="firstName", EmitDefaultValue=false)]
|
[DataMember(Name="firstName", EmitDefaultValue=false)]
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets LastName
|
/// Gets or Sets LastName
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="lastName", EmitDefaultValue=false)]
|
[DataMember(Name="lastName", EmitDefaultValue=false)]
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Email
|
/// Gets or Sets Email
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="email", EmitDefaultValue=false)]
|
[DataMember(Name="email", EmitDefaultValue=false)]
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Password
|
/// Gets or Sets Password
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="password", EmitDefaultValue=false)]
|
[DataMember(Name="password", EmitDefaultValue=false)]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or Sets Phone
|
/// Gets or Sets Phone
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name="phone", EmitDefaultValue=false)]
|
[DataMember(Name="phone", EmitDefaultValue=false)]
|
||||||
public string Phone { get; set; }
|
public string Phone { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// User Status
|
/// User Status
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>User Status</value>
|
/// <value>User Status</value>
|
||||||
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
[DataMember(Name="userStatus", EmitDefaultValue=false)]
|
||||||
public int? UserStatus { get; set; }
|
public int? UserStatus { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the string presentation of the object
|
/// Returns the string presentation of the object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -103,13 +100,13 @@ namespace IO.Swagger.Model
|
|||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
sb.Append("class User {\n");
|
sb.Append("class User {\n");
|
||||||
sb.Append(" Id: ").Append(Id).Append("\n");
|
sb.Append(" Id: ").Append(Id).Append("\n");
|
||||||
sb.Append(" Username: ").Append(Username).Append("\n");
|
sb.Append(" Username: ").Append(Username).Append("\n");
|
||||||
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
sb.Append(" FirstName: ").Append(FirstName).Append("\n");
|
||||||
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
sb.Append(" LastName: ").Append(LastName).Append("\n");
|
||||||
sb.Append(" Email: ").Append(Email).Append("\n");
|
sb.Append(" Email: ").Append(Email).Append("\n");
|
||||||
sb.Append(" Password: ").Append(Password).Append("\n");
|
sb.Append(" Password: ").Append(Password).Append("\n");
|
||||||
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
sb.Append(" Phone: ").Append(Phone).Append("\n");
|
||||||
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
sb.Append(" UserStatus: ").Append(UserStatus).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
@ -218,6 +215,6 @@ namespace IO.Swagger.Model
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,11 @@
|
|||||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Animal.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\Cat.cs" />
|
||||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\Dog.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" />
|
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\EnumClass.cs" />
|
||||||
|
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\EnumTest.cs" />
|
||||||
|
<Compile Include="TestEnum.cs" />
|
||||||
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\ApiResponse.cs" />
|
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\ApiResponse.cs" />
|
||||||
|
<Compile Include="Lib\SwaggerClient\src\main\csharp\IO\Swagger\Model\FormatTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,28 +1,12 @@
|
|||||||
<Properties StartupItem="SwaggerClientTest.csproj">
|
<Properties StartupItem="SwaggerClientTest.csproj">
|
||||||
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
|
||||||
<MonoDevelop.Ide.Workbench ActiveDocument="TestPet.cs">
|
<MonoDevelop.Ide.Workbench ActiveDocument="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs">
|
||||||
<Files>
|
<Files>
|
||||||
<File FileName="TestPet.cs" Line="29" Column="39" />
|
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumTest.cs" Line="18" Column="58" />
|
||||||
<File FileName="TestOrder.cs" Line="99" Column="6" />
|
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs" Line="1" Column="1" />
|
||||||
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs" Line="711" Column="1" />
|
<File FileName="TestEnum.cs" Line="28" Column="75" />
|
||||||
|
<File FileName="Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/EnumClass.cs" Line="1" Column="1" />
|
||||||
</Files>
|
</Files>
|
||||||
<Pads>
|
|
||||||
<Pad Id="MonoDevelop.NUnit.TestPad">
|
|
||||||
<State name="__root__">
|
|
||||||
<Node name="SwaggerClientTest" expanded="True">
|
|
||||||
<Node name="SwaggerClientTest" expanded="True">
|
|
||||||
<Node name="SwaggerClientTest" expanded="True">
|
|
||||||
<Node name="TestPet" expanded="True">
|
|
||||||
<Node name="TestPet" expanded="True">
|
|
||||||
<Node name="TestGetPetByIdAsyncWithHttpInfo" selected="True" />
|
|
||||||
</Node>
|
|
||||||
</Node>
|
|
||||||
</Node>
|
|
||||||
</Node>
|
|
||||||
</Node>
|
|
||||||
</State>
|
|
||||||
</Pad>
|
|
||||||
</Pads>
|
|
||||||
</MonoDevelop.Ide.Workbench>
|
</MonoDevelop.Ide.Workbench>
|
||||||
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
<MonoDevelop.Ide.DebuggingService.Breakpoints>
|
||||||
<BreakpointStore />
|
<BreakpointStore />
|
||||||
|
39
samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs
Normal file
39
samples/client/petstore/csharp/SwaggerClientTest/TestEnum.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using NUnit.Framework;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.IO;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using IO.Swagger.Api;
|
||||||
|
using IO.Swagger.Model;
|
||||||
|
using IO.Swagger.Client;
|
||||||
|
using System.Reflection;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace SwaggerClientTest.TestEnum
|
||||||
|
{
|
||||||
|
[TestFixture ()]
|
||||||
|
public class TestEnum
|
||||||
|
{
|
||||||
|
public TestEnum ()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Test EnumClass
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestEnumClass ()
|
||||||
|
{
|
||||||
|
// test serialization for string
|
||||||
|
Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumClass.Abc), "\"_abc\"");
|
||||||
|
|
||||||
|
// test serialization for number
|
||||||
|
Assert.AreEqual (Newtonsoft.Json.JsonConvert.SerializeObject(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1), "\"-1\"");
|
||||||
|
|
||||||
|
// test cast to int
|
||||||
|
Assert.AreEqual ((int)EnumTest.EnumIntegerEnum.NUMBER_MINUS_1, -1);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -73,14 +73,14 @@ namespace SwaggerClientTest.TestOrder
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* comment out the test case as the method is not defined in original petstore spec
|
/*
|
||||||
* we will re-enable this after updating the petstore server
|
* Skip the following test as the fake endpiont has been removed from the swagger spec
|
||||||
*
|
* We'll uncomment below after we update the Petstore server
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Test GetInvetoryInObject
|
/// Test TestGetInventoryInObject
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test ()]
|
[Test ()]
|
||||||
public void TestGetInventoryInObject ()
|
public void TestGetInventoryInObject()
|
||||||
{
|
{
|
||||||
// set timeout to 10 seconds
|
// set timeout to 10 seconds
|
||||||
Configuration c1 = new Configuration (timeout: 10000);
|
Configuration c1 = new Configuration (timeout: 10000);
|
||||||
@ -95,9 +95,18 @@ namespace SwaggerClientTest.TestOrder
|
|||||||
{
|
{
|
||||||
Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value));
|
Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
}*/
|
/// <summary>
|
||||||
|
/// Test Enum
|
||||||
|
/// </summary>
|
||||||
|
[Test ()]
|
||||||
|
public void TestEnum ()
|
||||||
|
{
|
||||||
|
Assert.AreEqual (Order.StatusEnum.Approved.ToString(), "Approved");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll
|
|
||||||
/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll
|
|
@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge
|
|||||||
|
|
||||||
- API version: 1.0.0
|
- API version: 1.0.0
|
||||||
- Package version: 1.0.0
|
- Package version: 1.0.0
|
||||||
- Build date: 2016-04-27T21:14:49.805-07:00
|
- Build date: 2016-05-02T15:51:26.331+01:00
|
||||||
- Build package: class io.swagger.codegen.languages.GoClientCodegen
|
- Build package: class io.swagger.codegen.languages.GoClientCodegen
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
@ -1,39 +1,38 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
"github.com/go-resty/resty"
|
|
||||||
"fmt"
|
|
||||||
"reflect"
|
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"fmt"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"reflect"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/go-resty/resty"
|
||||||
)
|
)
|
||||||
|
|
||||||
type APIClient struct {
|
type APIClient struct {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
func (c *APIClient) SelectHeaderContentType(contentTypes []string) string {
|
||||||
if (len(contentTypes) == 0){
|
|
||||||
|
if len(contentTypes) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
if contains(contentTypes,"application/json") {
|
if contains(contentTypes, "application/json") {
|
||||||
return "application/json"
|
return "application/json"
|
||||||
}
|
}
|
||||||
|
|
||||||
return contentTypes[0] // use the first content type specified in 'consumes'
|
return contentTypes[0] // use the first content type specified in 'consumes'
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIClient) SelectHeaderAccept(accepts []string) string {
|
func (c *APIClient) SelectHeaderAccept(accepts []string) string {
|
||||||
if (len(accepts) == 0){
|
|
||||||
|
if len(accepts) == 0 {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
if contains(accepts, "application/json") {
|
||||||
if contains(accepts,"application/json"){
|
|
||||||
return "application/json"
|
return "application/json"
|
||||||
}
|
}
|
||||||
|
return strings.Join(accepts, ",")
|
||||||
return strings.Join(accepts,",")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func contains(source []string, containvalue string) bool {
|
func contains(source []string, containvalue string) bool {
|
||||||
@ -45,7 +44,6 @@ func contains(source []string, containvalue string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (c *APIClient) CallAPI(path string, method string,
|
func (c *APIClient) CallAPI(path string, method string,
|
||||||
postBody interface{},
|
postBody interface{},
|
||||||
headerParams map[string]string,
|
headerParams map[string]string,
|
||||||
@ -58,7 +56,7 @@ func (c *APIClient) CallAPI(path string, method string,
|
|||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
resty.SetDebug(configuration.GetDebug())
|
resty.SetDebug(configuration.GetDebug())
|
||||||
|
|
||||||
request := prepareRequest(postBody, headerParams, queryParams, formParams,fileName,fileBytes)
|
request := prepareRequest(postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
switch strings.ToUpper(method) {
|
switch strings.ToUpper(method) {
|
||||||
case "GET":
|
case "GET":
|
||||||
@ -97,7 +95,6 @@ func prepareRequest(postBody interface{},
|
|||||||
fileBytes []byte) *resty.Request {
|
fileBytes []byte) *resty.Request {
|
||||||
|
|
||||||
request := resty.R()
|
request := resty.R()
|
||||||
|
|
||||||
request.SetBody(postBody)
|
request.SetBody(postBody)
|
||||||
|
|
||||||
// add header parameter, if any
|
// add header parameter, if any
|
||||||
|
@ -4,21 +4,19 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type APIResponse struct {
|
type APIResponse struct {
|
||||||
*http.Response
|
*http.Response
|
||||||
|
|
||||||
Message string `json:"message,omitempty"`
|
Message string `json:"message,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAPIResponse(r *http.Response) *APIResponse {
|
func NewAPIResponse(r *http.Response) *APIResponse {
|
||||||
response := &APIResponse{Response: r}
|
|
||||||
|
|
||||||
|
response := &APIResponse{Response: r}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
func NewAPIResponseWithError(errorMessage string) *APIResponse {
|
||||||
response := &APIResponse{Message: errorMessage}
|
|
||||||
|
|
||||||
|
response := &APIResponse{Message: errorMessage}
|
||||||
return response
|
return response
|
||||||
}
|
}
|
@ -1,9 +1,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
import (
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
type Category struct {
|
type Category struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
@ -7,8 +7,8 @@ import (
|
|||||||
type Configuration struct {
|
type Configuration struct {
|
||||||
UserName string `json:"userName,omitempty"`
|
UserName string `json:"userName,omitempty"`
|
||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
APIKeyPrefix map[string] string `json:"APIKeyPrefix,omitempty"`
|
APIKeyPrefix map[string]string `json:"APIKeyPrefix,omitempty"`
|
||||||
APIKey map[string] string `json:"APIKey,omitempty"`
|
APIKey map[string]string `json:"APIKey,omitempty"`
|
||||||
debug bool `json:"debug,omitempty"`
|
debug bool `json:"debug,omitempty"`
|
||||||
DebugFile string `json:"debugFile,omitempty"`
|
DebugFile string `json:"debugFile,omitempty"`
|
||||||
OAuthToken string `json:"oAuthToken,omitempty"`
|
OAuthToken string `json:"oAuthToken,omitempty"`
|
||||||
@ -43,14 +43,14 @@ func (c *Configuration) AddDefaultHeader(key string, value string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
|
func (c *Configuration) GetAPIKeyWithPrefix(APIKeyIdentifier string) string {
|
||||||
if c.APIKeyPrefix[APIKeyIdentifier] != ""{
|
if c.APIKeyPrefix[APIKeyIdentifier] != "" {
|
||||||
return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier]
|
return c.APIKeyPrefix[APIKeyIdentifier] + " " + c.APIKey[APIKeyIdentifier]
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.APIKey[APIKeyIdentifier]
|
return c.APIKey[APIKeyIdentifier]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Configuration) SetDebug(enable bool){
|
func (c *Configuration) SetDebug(enable bool) {
|
||||||
c.debug = enable
|
c.debug = enable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ git_repo_id=$2
|
|||||||
release_note=$3
|
release_note=$3
|
||||||
|
|
||||||
if [ "$git_user_id" = "" ]; then
|
if [ "$git_user_id" = "" ]; then
|
||||||
git_user_id="YOUR_GIT_USR_ID"
|
git_user_id="GIT_USER_ID"
|
||||||
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$git_repo_id" = "" ]; then
|
if [ "$git_repo_id" = "" ]; then
|
||||||
git_repo_id="YOUR_GIT_REPO_ID"
|
git_repo_id="GIT_REPO_ID"
|
||||||
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
import (
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
type ModelApiResponse struct {
|
type ModelApiResponse struct {
|
||||||
|
|
||||||
Code int32 `json:"code,omitempty"`
|
Code int32 `json:"code,omitempty"`
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
type Order struct {
|
type Order struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
@ -14,6 +13,7 @@ type Order struct {
|
|||||||
Quantity int32 `json:"quantity,omitempty"`
|
Quantity int32 `json:"quantity,omitempty"`
|
||||||
|
|
||||||
ShipDate time.Time `json:"shipDate,omitempty"`
|
ShipDate time.Time `json:"shipDate,omitempty"`
|
||||||
|
|
||||||
// Order Status
|
// Order Status
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
import (
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
type Pet struct {
|
type Pet struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
@ -15,6 +11,7 @@ type Pet struct {
|
|||||||
PhotoUrls []string `json:"photoUrls,omitempty"`
|
PhotoUrls []string `json:"photoUrls,omitempty"`
|
||||||
|
|
||||||
Tags []Tag `json:"tags,omitempty"`
|
Tags []Tag `json:"tags,omitempty"`
|
||||||
|
|
||||||
// pet status in the store
|
// pet status in the store
|
||||||
Status string `json:"status,omitempty"`
|
Status string `json:"status,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -5,26 +5,26 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
)
|
)
|
||||||
|
|
||||||
type PetApi struct {
|
type PetApi struct {
|
||||||
Configuration Configuration
|
Configuration Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPetApi() *PetApi{
|
func NewPetApi() *PetApi {
|
||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
return &PetApi {
|
return &PetApi{
|
||||||
Configuration: *configuration,
|
Configuration: *configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewPetApiWithBasePath(basePath string) *PetApi{
|
func NewPetApiWithBasePath(basePath string) *PetApi {
|
||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
configuration.BasePath = basePath
|
configuration.BasePath = basePath
|
||||||
|
|
||||||
return &PetApi {
|
return &PetApi{
|
||||||
Configuration: *configuration,
|
Configuration: *configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,10 +32,11 @@ func NewPetApiWithBasePath(basePath string) *PetApi{
|
|||||||
/**
|
/**
|
||||||
* Add a new pet to the store
|
* Add a new pet to the store
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
func (a PetApi) AddPet (body Pet) (*APIResponse, error) {
|
func (a PetApi) AddPet(body Pet) (APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Post"
|
var httpMethod = "Post"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -43,7 +44,7 @@ func (a PetApi) AddPet (body Pet) (*APIResponse, error) {
|
|||||||
|
|
||||||
// verify the required parameter 'body' is set
|
// verify the required parameter 'body' is set
|
||||||
if &body == nil {
|
if &body == nil {
|
||||||
return nil, errors.New("Missing required parameter 'body' when calling PetApi->AddPet")
|
return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->AddPet")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -52,71 +53,66 @@ func (a PetApi) AddPet (body Pet) (*APIResponse, error) {
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
||||||
"application/json",
|
|
||||||
"application/xml",
|
// set Content-Type header
|
||||||
}
|
|
||||||
//set Content-Type header
|
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
postBody = &body
|
postBody = &body
|
||||||
|
|
||||||
|
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a pet
|
* Deletes a pet
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param petId Pet id to delete
|
* @param petId Pet id to delete
|
||||||
* @param apiKey
|
* @param apiKey
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
func (a PetApi) DeletePet (petId int64, apiKey string) (*APIResponse, error) {
|
func (a PetApi) DeletePet(petId int64, apiKey string) (APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Delete"
|
var httpMethod = "Delete"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "/pet/{petId}"
|
path := a.Configuration.BasePath + "/pet/{petId}"
|
||||||
path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1)
|
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
if &petId == nil {
|
if &petId == nil {
|
||||||
return nil, errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet")
|
return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -125,59 +121,57 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (*APIResponse, error) {
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
// header params "api_key"
|
// header params "api_key"
|
||||||
headerParams["api_key"] = apiKey
|
headerParams["api_key"] = apiKey
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds Pets by status
|
* Finds Pets by status
|
||||||
* Multiple status values can be provided with comma separated strings
|
* Multiple status values can be provided with comma separated strings
|
||||||
|
*
|
||||||
* @param status Status values that need to be considered for filter
|
* @param status Status values that need to be considered for filter
|
||||||
* @return []Pet
|
* @return []Pet
|
||||||
*/
|
*/
|
||||||
func (a PetApi) FindPetsByStatus (status []string) (*[]Pet, *APIResponse, error) {
|
func (a PetApi) FindPetsByStatus(status []string) ([]Pet, APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Get"
|
var httpMethod = "Get"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -185,7 +179,7 @@ func (a PetApi) FindPetsByStatus (status []string) (*[]Pet, *APIResponse, error)
|
|||||||
|
|
||||||
// verify the required parameter 'status' is set
|
// verify the required parameter 'status' is set
|
||||||
if &status == nil {
|
if &status == nil {
|
||||||
return new([]Pet), nil, errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus")
|
return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -194,14 +188,12 @@ func (a PetApi) FindPetsByStatus (status []string) (*[]Pet, *APIResponse, error)
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
@ -209,45 +201,43 @@ func (a PetApi) FindPetsByStatus (status []string) (*[]Pet, *APIResponse, error)
|
|||||||
|
|
||||||
queryParams["status"] = a.Configuration.APIClient.ParameterToString(status)
|
queryParams["status"] = a.Configuration.APIClient.ParameterToString(status)
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var successPayload = new([]Pet)
|
var successPayload = new([]Pet)
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||||
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds Pets by tags
|
* Finds Pets by tags
|
||||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||||
|
*
|
||||||
* @param tags Tags to filter by
|
* @param tags Tags to filter by
|
||||||
* @return []Pet
|
* @return []Pet
|
||||||
*/
|
*/
|
||||||
func (a PetApi) FindPetsByTags (tags []string) (*[]Pet, *APIResponse, error) {
|
func (a PetApi) FindPetsByTags(tags []string) ([]Pet, APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Get"
|
var httpMethod = "Get"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -255,7 +245,7 @@ func (a PetApi) FindPetsByTags (tags []string) (*[]Pet, *APIResponse, error) {
|
|||||||
|
|
||||||
// verify the required parameter 'tags' is set
|
// verify the required parameter 'tags' is set
|
||||||
if &tags == nil {
|
if &tags == nil {
|
||||||
return new([]Pet), nil, errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags")
|
return *new([]Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -264,14 +254,12 @@ func (a PetApi) FindPetsByTags (tags []string) (*[]Pet, *APIResponse, error) {
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
@ -279,54 +267,52 @@ func (a PetApi) FindPetsByTags (tags []string) (*[]Pet, *APIResponse, error) {
|
|||||||
|
|
||||||
queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags)
|
queryParams["tags"] = a.Configuration.APIClient.ParameterToString(tags)
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var successPayload = new([]Pet)
|
var successPayload = new([]Pet)
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||||
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find pet by ID
|
* Find pet by ID
|
||||||
* Returns a single pet
|
* Returns a single pet
|
||||||
|
*
|
||||||
* @param petId ID of pet to return
|
* @param petId ID of pet to return
|
||||||
* @return Pet
|
* @return Pet
|
||||||
*/
|
*/
|
||||||
func (a PetApi) GetPetById (petId int64) (*Pet, *APIResponse, error) {
|
func (a PetApi) GetPetById(petId int64) (Pet, APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Get"
|
var httpMethod = "Get"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "/pet/{petId}"
|
path := a.Configuration.BasePath + "/pet/{petId}"
|
||||||
path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1)
|
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
if &petId == nil {
|
if &petId == nil {
|
||||||
return new(Pet), nil, errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById")
|
return *new(Pet), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -335,58 +321,52 @@ func (a PetApi) GetPetById (petId int64) (*Pet, *APIResponse, error) {
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
|
|
||||||
// set key with prefix in header
|
// set key with prefix in header
|
||||||
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
|
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
|
||||||
|
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var successPayload = new(Pet)
|
var successPayload = new(Pet)
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||||
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update an existing pet
|
* Update an existing pet
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param body Pet object that needs to be added to the store
|
* @param body Pet object that needs to be added to the store
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
func (a PetApi) UpdatePet (body Pet) (*APIResponse, error) {
|
func (a PetApi) UpdatePet(body Pet) (APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Put"
|
var httpMethod = "Put"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -394,7 +374,7 @@ func (a PetApi) UpdatePet (body Pet) (*APIResponse, error) {
|
|||||||
|
|
||||||
// verify the required parameter 'body' is set
|
// verify the required parameter 'body' is set
|
||||||
if &body == nil {
|
if &body == nil {
|
||||||
return nil, errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet")
|
return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -403,72 +383,67 @@ func (a PetApi) UpdatePet (body Pet) (*APIResponse, error) {
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ "application/json", "application/xml", }
|
||||||
"application/json",
|
|
||||||
"application/xml",
|
// set Content-Type header
|
||||||
}
|
|
||||||
//set Content-Type header
|
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
postBody = &body
|
postBody = &body
|
||||||
|
|
||||||
|
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates a pet in the store with form data
|
* Updates a pet in the store with form data
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param petId ID of pet that needs to be updated
|
* @param petId ID of pet that needs to be updated
|
||||||
* @param name Updated name of the pet
|
* @param name Updated name of the pet
|
||||||
* @param status Updated status of the pet
|
* @param status Updated status of the pet
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (*APIResponse, error) {
|
func (a PetApi) UpdatePetWithForm(petId int64, name string, status string) (APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Post"
|
var httpMethod = "Post"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "/pet/{petId}"
|
path := a.Configuration.BasePath + "/pet/{petId}"
|
||||||
path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1)
|
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
if &petId == nil {
|
if &petId == nil {
|
||||||
return nil, errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm")
|
return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -477,35 +452,32 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (*AP
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ "application/x-www-form-urlencoded", }
|
||||||
"application/x-www-form-urlencoded",
|
|
||||||
}
|
// set Content-Type header
|
||||||
//set Content-Type header
|
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
@ -514,34 +486,33 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (*AP
|
|||||||
formParams["name"] = name
|
formParams["name"] = name
|
||||||
formParams["status"] = status
|
formParams["status"] = status
|
||||||
|
|
||||||
|
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* uploads an image
|
* uploads an image
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param petId ID of pet to update
|
* @param petId ID of pet to update
|
||||||
* @param additionalMetadata Additional data to pass to server
|
* @param additionalMetadata Additional data to pass to server
|
||||||
* @param file file to upload
|
* @param file file to upload
|
||||||
* @return ModelApiResponse
|
* @return ModelApiResponse
|
||||||
*/
|
*/
|
||||||
func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (*ModelApiResponse, *APIResponse, error) {
|
func (a PetApi) UploadFile(petId int64, additionalMetadata string, file *os.File) (ModelApiResponse, APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Post"
|
var httpMethod = "Post"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "/pet/{petId}/uploadImage"
|
path := a.Configuration.BasePath + "/pet/{petId}/uploadImage"
|
||||||
path = strings.Replace(path, "{" + "petId" + "}", fmt.Sprintf("%v", petId), -1)
|
path = strings.Replace(path, "{"+"petId"+"}", fmt.Sprintf("%v", petId), -1)
|
||||||
|
|
||||||
// verify the required parameter 'petId' is set
|
// verify the required parameter 'petId' is set
|
||||||
if &petId == nil {
|
if &petId == nil {
|
||||||
return new(ModelApiResponse), nil, errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile")
|
return *new(ModelApiResponse), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -550,34 +521,31 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (petstore_auth) required
|
// authentication (petstore_auth) required
|
||||||
|
|
||||||
// oauth required
|
// oauth required
|
||||||
if a.Configuration.AccessToken != ""{
|
if a.Configuration.AccessToken != ""{
|
||||||
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
headerParams["Authorization"] = "Bearer " + a.Configuration.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ "multipart/form-data", }
|
||||||
"multipart/form-data",
|
|
||||||
}
|
// set Content-Type header
|
||||||
//set Content-Type header
|
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
@ -590,13 +558,10 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil
|
|||||||
|
|
||||||
var successPayload = new(ModelApiResponse)
|
var successPayload = new(ModelApiResponse)
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||||
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,18 +11,18 @@ type StoreApi struct {
|
|||||||
Configuration Configuration
|
Configuration Configuration
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStoreApi() *StoreApi{
|
func NewStoreApi() *StoreApi {
|
||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
return &StoreApi {
|
return &StoreApi{
|
||||||
Configuration: *configuration,
|
Configuration: *configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewStoreApiWithBasePath(basePath string) *StoreApi{
|
func NewStoreApiWithBasePath(basePath string) *StoreApi {
|
||||||
configuration := NewConfiguration()
|
configuration := NewConfiguration()
|
||||||
configuration.BasePath = basePath
|
configuration.BasePath = basePath
|
||||||
|
|
||||||
return &StoreApi {
|
return &StoreApi{
|
||||||
Configuration: *configuration,
|
Configuration: *configuration,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,19 +30,20 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi{
|
|||||||
/**
|
/**
|
||||||
* Delete purchase order by ID
|
* Delete purchase order by ID
|
||||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||||
|
*
|
||||||
* @param orderId ID of the order that needs to be deleted
|
* @param orderId ID of the order that needs to be deleted
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
func (a StoreApi) DeleteOrder (orderId string) (*APIResponse, error) {
|
func (a StoreApi) DeleteOrder(orderId string) (APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Delete"
|
var httpMethod = "Delete"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "/store/order/{orderId}"
|
path := a.Configuration.BasePath + "/store/order/{orderId}"
|
||||||
path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1)
|
path = strings.Replace(path, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||||
|
|
||||||
// verify the required parameter 'orderId' is set
|
// verify the required parameter 'orderId' is set
|
||||||
if &orderId == nil {
|
if &orderId == nil {
|
||||||
return nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder")
|
return *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -52,49 +53,46 @@ func (a StoreApi) DeleteOrder (orderId string) (*APIResponse, error) {
|
|||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
return NewAPIResponse(httpResponse.RawResponse), err
|
return *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns pet inventories by status
|
* Returns pet inventories by status
|
||||||
* Returns a map of status codes to quantities
|
* Returns a map of status codes to quantities
|
||||||
|
*
|
||||||
* @return map[string]int32
|
* @return map[string]int32
|
||||||
*/
|
*/
|
||||||
func (a StoreApi) GetInventory () (*map[string]int32, *APIResponse, error) {
|
func (a StoreApi) GetInventory() (map[string]int32, APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Get"
|
var httpMethod = "Get"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -107,66 +105,60 @@ func (a StoreApi) GetInventory () (*map[string]int32, *APIResponse, error) {
|
|||||||
var postBody interface{}
|
var postBody interface{}
|
||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
// authentication (api_key) required
|
// authentication (api_key) required
|
||||||
|
|
||||||
// set key with prefix in header
|
// set key with prefix in header
|
||||||
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
|
headerParams["api_key"] = a.Configuration.GetAPIKeyWithPrefix("api_key")
|
||||||
|
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var successPayload = new(map[string]int32)
|
var successPayload = new(map[string]int32)
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||||
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find purchase order by ID
|
* Find purchase order by ID
|
||||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||||
|
*
|
||||||
* @param orderId ID of pet that needs to be fetched
|
* @param orderId ID of pet that needs to be fetched
|
||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
func (a StoreApi) GetOrderById (orderId int64) (*Order, *APIResponse, error) {
|
func (a StoreApi) GetOrderById(orderId int64) (Order, APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Get"
|
var httpMethod = "Get"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
path := a.Configuration.BasePath + "/store/order/{orderId}"
|
path := a.Configuration.BasePath + "/store/order/{orderId}"
|
||||||
path = strings.Replace(path, "{" + "orderId" + "}", fmt.Sprintf("%v", orderId), -1)
|
path = strings.Replace(path, "{"+"orderId"+"}", fmt.Sprintf("%v", orderId), -1)
|
||||||
|
|
||||||
// verify the required parameter 'orderId' is set
|
// verify the required parameter 'orderId' is set
|
||||||
if &orderId == nil {
|
if &orderId == nil {
|
||||||
return new(Order), nil, errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById")
|
return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -176,52 +168,47 @@ func (a StoreApi) GetOrderById (orderId int64) (*Order, *APIResponse, error) {
|
|||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var successPayload = new(Order)
|
var successPayload = new(Order)
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||||
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Place an order for a pet
|
* Place an order for a pet
|
||||||
*
|
*
|
||||||
|
*
|
||||||
* @param body order placed for purchasing the pet
|
* @param body order placed for purchasing the pet
|
||||||
* @return Order
|
* @return Order
|
||||||
*/
|
*/
|
||||||
func (a StoreApi) PlaceOrder (body Order) (*Order, *APIResponse, error) {
|
func (a StoreApi) PlaceOrder(body Order) (Order, APIResponse, error) {
|
||||||
|
|
||||||
var httpMethod = "Post"
|
var httpMethod = "Post"
|
||||||
// create path and map variables
|
// create path and map variables
|
||||||
@ -229,7 +216,7 @@ func (a StoreApi) PlaceOrder (body Order) (*Order, *APIResponse, error) {
|
|||||||
|
|
||||||
// verify the required parameter 'body' is set
|
// verify the required parameter 'body' is set
|
||||||
if &body == nil {
|
if &body == nil {
|
||||||
return new(Order), nil, errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder")
|
return *new(Order), *NewAPIResponseWithError("400 - Bad Request"), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder")
|
||||||
}
|
}
|
||||||
|
|
||||||
headerParams := make(map[string]string)
|
headerParams := make(map[string]string)
|
||||||
@ -239,44 +226,39 @@ func (a StoreApi) PlaceOrder (body Order) (*Order, *APIResponse, error) {
|
|||||||
var fileName string
|
var fileName string
|
||||||
var fileBytes []byte
|
var fileBytes []byte
|
||||||
|
|
||||||
|
|
||||||
// add default headers if any
|
// add default headers if any
|
||||||
for key := range a.Configuration.DefaultHeader {
|
for key := range a.Configuration.DefaultHeader {
|
||||||
headerParams[key] = a.Configuration.DefaultHeader[key]
|
headerParams[key] = a.Configuration.DefaultHeader[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// to determine the Content-Type header
|
// to determine the Content-Type header
|
||||||
localVarHttpContentTypes := []string {
|
localVarHttpContentTypes := []string{ }
|
||||||
}
|
|
||||||
//set Content-Type header
|
// set Content-Type header
|
||||||
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)
|
||||||
if localVarHttpContentType != "" {
|
if localVarHttpContentType != "" {
|
||||||
headerParams["Content-Type"] = localVarHttpContentType
|
headerParams["Content-Type"] = localVarHttpContentType
|
||||||
}
|
}
|
||||||
// to determine the Accept header
|
// to determine the Accept header
|
||||||
localVarHttpHeaderAccepts := []string {
|
localVarHttpHeaderAccepts := []string{
|
||||||
"application/xml",
|
"application/xml",
|
||||||
"application/json",
|
"application/json",
|
||||||
}
|
}
|
||||||
//set Accept header
|
|
||||||
|
// set Accept header
|
||||||
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)
|
||||||
if localVarHttpHeaderAccept != "" {
|
if localVarHttpHeaderAccept != "" {
|
||||||
headerParams["Accept"] = localVarHttpHeaderAccept
|
headerParams["Accept"] = localVarHttpHeaderAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
// body params
|
// body params
|
||||||
postBody = &body
|
postBody = &body
|
||||||
|
|
||||||
var successPayload = new(Order)
|
var successPayload = new(Order)
|
||||||
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
httpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)
|
||||||
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
err = json.Unmarshal(httpResponse.Body(), &successPayload)
|
||||||
|
return *successPayload, *NewAPIResponse(httpResponse.RawResponse), err
|
||||||
return successPayload, NewAPIResponse(httpResponse.RawResponse), err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
import (
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package petstore
|
package petstore
|
||||||
|
|
||||||
import (
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
|
|
||||||
Id int64 `json:"id,omitempty"`
|
Id int64 `json:"id,omitempty"`
|
||||||
@ -19,6 +15,7 @@ type User struct {
|
|||||||
Password string `json:"password,omitempty"`
|
Password string `json:"password,omitempty"`
|
||||||
|
|
||||||
Phone string `json:"phone,omitempty"`
|
Phone string `json:"phone,omitempty"`
|
||||||
|
|
||||||
// User Status
|
// User Status
|
||||||
UserStatus int32 `json:"userStatus,omitempty"`
|
UserStatus int32 `json:"userStatus,omitempty"`
|
||||||
}
|
}
|
||||||
|
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