forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 6.0.x
This commit is contained in:
@@ -1000,7 +1000,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
|
||||
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
|
||||
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) |
|
||||
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) @Blackclaws (2021/03) |
|
||||
| Clojure | |
|
||||
| Dart | @swipesight (2018/09) @jaumard (2018/09) @josh-burton (2019/12) @amondnet (2019/12) @sbu-WBT (2020/12) @kuhnroyal (2020/12) @agilob (2020/12) |
|
||||
| Eiffel | @jvelilla (2017/09) |
|
||||
|
||||
@@ -10,3 +10,4 @@ additionalProperties:
|
||||
hideGenerationTimestamp: "true"
|
||||
serverPort: "8002"
|
||||
additionalModelTypeAnnotations: '@com.fasterxml.jackson.annotation.JsonFilter(value = "filter-name");@com.fasterxml.jackson.annotation.JsonIgnoreProperties(value = "id")'
|
||||
additionalEnumTypeAnnotations: '@com.fasterxml.jackson.annotation.JsonFormat'
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.controllers|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |com.prokarma.pkmst.controller|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |controllers|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |null|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.vertxweb.server.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.server.api.verticle|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.client.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -8,6 +8,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|addConsumesProducesJson|Add @Consumes/@Produces Json to API interface| |false|
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -8,6 +8,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|addConsumesProducesJson|Add @Consumes/@Produces Json to API interface| |false|
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiPackage|package for generated api classes| |org.openapitools.api|
|
||||
|
||||
@@ -7,6 +7,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
||||
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|additionalEnumTypeAnnotations|Additional annotations for enum type(class level annotations)| |null|
|
||||
|additionalModelTypeAnnotations|Additional annotations for model type(class level annotations)| |null|
|
||||
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
|
||||
|apiFirst|Generate the API from the OAI spec at server compile time (API first approach)| |false|
|
||||
|
||||
@@ -4196,7 +4196,8 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#user-content-parameterexplode
|
||||
codegenParameter.isExplode = parameter.getExplode() == null ? false : parameter.getExplode();
|
||||
|
||||
// TODO revise collectionFormat
|
||||
// TODO revise collectionFormat, default collection format in OAS 3 appears to multi at least for query parameters
|
||||
// https://swagger.io/docs/specification/serialization/
|
||||
String collectionFormat = null;
|
||||
if (ModelUtils.isArraySchema(parameterSchema)) { // for array parameter
|
||||
final ArraySchema arraySchema = (ArraySchema) parameterSchema;
|
||||
@@ -4352,14 +4353,21 @@ public class DefaultCodegen implements CodegenConfig {
|
||||
if (codegenParameter.isQueryParam && codegenParameter.isDeepObject) {
|
||||
Schema schema = ModelUtils.getSchema(openAPI, codegenParameter.dataType);
|
||||
codegenParameter.items = fromProperty(codegenParameter.paramName, schema);
|
||||
Map<String, Schema<?>> properties = schema.getProperties();
|
||||
codegenParameter.items.vars =
|
||||
properties.entrySet().stream()
|
||||
.map(entry -> {
|
||||
CodegenProperty property = fromProperty(entry.getKey(), entry.getValue());
|
||||
property.baseName = codegenParameter.baseName + "[" + entry.getKey() + "]";
|
||||
return property;
|
||||
}).collect(Collectors.toList());
|
||||
// TODO Check why schema is actually null for a schema of type object defined inline
|
||||
// https://swagger.io/docs/specification/serialization/
|
||||
if(schema != null) {
|
||||
Map<String, Schema<?>> properties = schema.getProperties();
|
||||
codegenParameter.items.vars =
|
||||
properties.entrySet().stream()
|
||||
.map(entry -> {
|
||||
CodegenProperty property = fromProperty(entry.getKey(), entry.getValue());
|
||||
property.baseName = codegenParameter.baseName + "[" + entry.getKey() + "]";
|
||||
return property;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
else {
|
||||
LOGGER.warn("No object schema found for deepObject parameter" + codegenParameter + " deepObject won't have specific properties");
|
||||
}
|
||||
}
|
||||
|
||||
// set the parameter example value
|
||||
|
||||
@@ -63,6 +63,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
public static final String BOOLEAN_GETTER_PREFIX = "booleanGetterPrefix";
|
||||
public static final String IGNORE_ANYOF_IN_ENUM = "ignoreAnyOfInEnum";
|
||||
public static final String ADDITIONAL_MODEL_TYPE_ANNOTATIONS = "additionalModelTypeAnnotations";
|
||||
public static final String ADDITIONAL_ENUM_TYPE_ANNOTATIONS = "additionalEnumTypeAnnotations";
|
||||
public static final String DISCRIMINATOR_CASE_SENSITIVE = "discriminatorCaseSensitive";
|
||||
public static final String OPENAPI_NULLABLE = "openApiNullable";
|
||||
|
||||
@@ -106,6 +107,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
protected String parentVersion = "";
|
||||
protected boolean parentOverridden = false;
|
||||
protected List<String> additionalModelTypeAnnotations = new LinkedList<>();
|
||||
protected List<String> additionalEnumTypeAnnotations = new LinkedList<>();
|
||||
protected boolean openApiNullable = true;
|
||||
|
||||
public AbstractJavaCodegen() {
|
||||
@@ -244,6 +246,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix").defaultValue(this.getBooleanGetterPrefix()));
|
||||
cliOptions.add(CliOption.newBoolean(IGNORE_ANYOF_IN_ENUM, "Ignore anyOf keyword in enum", ignoreAnyOfInEnum));
|
||||
cliOptions.add(CliOption.newString(ADDITIONAL_MODEL_TYPE_ANNOTATIONS, "Additional annotations for model type(class level annotations)"));
|
||||
cliOptions.add(CliOption.newString(ADDITIONAL_ENUM_TYPE_ANNOTATIONS, "Additional annotations for enum type(class level annotations)"));
|
||||
cliOptions.add(CliOption.newBoolean(OPENAPI_NULLABLE, "Enable OpenAPI Jackson Nullable library", this.openApiNullable));
|
||||
|
||||
cliOptions.add(CliOption.newString(CodegenConstants.PARENT_GROUP_ID, CodegenConstants.PARENT_GROUP_ID_DESC));
|
||||
@@ -293,6 +296,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.setAdditionalModelTypeAnnotations(Arrays.asList(additionalAnnotationsList.split(";")));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(ADDITIONAL_ENUM_TYPE_ANNOTATIONS)) {
|
||||
String additionalAnnotationsList = additionalProperties.get(ADDITIONAL_ENUM_TYPE_ANNOTATIONS).toString();
|
||||
|
||||
this.setAdditionalEnumTypeAnnotations(Arrays.asList(additionalAnnotationsList.split(";")));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) {
|
||||
this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE));
|
||||
} else if (additionalProperties.containsKey(CodegenConstants.API_PACKAGE)) {
|
||||
@@ -586,6 +595,13 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
}
|
||||
}
|
||||
|
||||
if (!additionalEnumTypeAnnotations.isEmpty()) {
|
||||
for (String modelName : objs.keySet()) {
|
||||
Map<String, Object> models = (Map<String, Object>) objs.get(modelName);
|
||||
models.put(ADDITIONAL_ENUM_TYPE_ANNOTATIONS, additionalEnumTypeAnnotations);
|
||||
}
|
||||
}
|
||||
|
||||
return objs;
|
||||
}
|
||||
|
||||
@@ -1767,6 +1783,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
this.additionalModelTypeAnnotations = additionalModelTypeAnnotations;
|
||||
}
|
||||
|
||||
public void setAdditionalEnumTypeAnnotations(final List<String> additionalEnumTypeAnnotations) {
|
||||
this.additionalEnumTypeAnnotations = additionalEnumTypeAnnotations;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) {
|
||||
if (!supportsAdditionalPropertiesWithComposedSchema) {
|
||||
|
||||
2
modules/openapi-generator/src/main/resources/Java/additionalEnumTypeAnnotations.mustache
vendored
Normal file
2
modules/openapi-generator/src/main/resources/Java/additionalEnumTypeAnnotations.mustache
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -6,7 +6,7 @@
|
||||
@JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class)
|
||||
@JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class)
|
||||
{{/withXml}}
|
||||
public enum {{datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#withXml}}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -20,7 +20,7 @@ import com.google.gson.stream.JsonWriter;
|
||||
@JsonbTypeSerializer({{datatypeWithEnum}}.Serializer.class)
|
||||
@JsonbTypeDeserializer({{datatypeWithEnum}}.Deserializer.class)
|
||||
{{/jsonb}}
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{#enumDescription}}
|
||||
/**
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
@XmlType(name="{{datatypeWithEnum}}")
|
||||
@XmlEnum({{dataType}}.class)
|
||||
{{/withXml}}
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{#enumDescription}}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,6 +1,6 @@
|
||||
@XmlType(name="{{datatypeWithEnum}}")
|
||||
@XmlEnum({{dataType}}.class)
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}@XmlEnumValue({{^isString}}"{{/isString}}{{{value}}}{{^isString}}"{{/isString}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,6 +1,6 @@
|
||||
@XmlType(name="{{datatypeWithEnum}}")
|
||||
@XmlEnum({{dataType}}.class)
|
||||
public enum {{datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) @JsonProperty({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}},
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,6 +1,6 @@
|
||||
@XmlType(name="{{datatypeWithEnum}}")
|
||||
@XmlEnum({{dataType}}.class)
|
||||
public enum {{datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}@XmlEnumValue({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}) {{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{#enumDescription}}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
public enum {{classname}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{classname}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}{{^-last}},{{/-last}}{{#-last}};{{/-last}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
public enum {{classname}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{classname}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}{{^-last}}, {{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,4 +1,4 @@
|
||||
public enum {{datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{datatypeWithEnum}} {
|
||||
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}{{name}}({{dataType}}.valueOf({{{value}}})){{^-last}}, {{/-last}}{{#-last}};{{/-last}}{{/enumVars}}
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
2
modules/openapi-generator/src/main/resources/apex/additionalEnumTypeAnnotations.mustache
vendored
Normal file
2
modules/openapi-generator/src/main/resources/apex/additionalEnumTypeAnnotations.mustache
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{name}}{{^-last}},{{/-last}}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
{{{name}}}{{^-last}},{{/-last}}
|
||||
|
||||
@@ -14,20 +14,20 @@ namespace {{this}} {
|
||||
_manager(nullptr),
|
||||
isResponseCompressionEnabled(false),
|
||||
isRequestCompressionEnabled(false) {
|
||||
initializeServerConfigs();
|
||||
}
|
||||
initializeServerConfigs();
|
||||
}
|
||||
|
||||
{{classname}}::~{{classname}}() {
|
||||
}
|
||||
|
||||
void {{classname}}::initializeServerConfigs(){
|
||||
|
||||
//Default server
|
||||
QList<{{prefix}}ServerConfiguration> defaultConf = QList<{{prefix}}ServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<{{prefix}}ServerConfiguration> serverConf = QList<{{prefix}}ServerConfiguration>();
|
||||
//Default server
|
||||
QList<{{prefix}}ServerConfiguration> defaultConf = QList<{{prefix}}ServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<{{prefix}}ServerConfiguration> serverConf = QList<{{prefix}}ServerConfiguration>();
|
||||
{{#vendorExtensions.x-cpp-global-server-list}}
|
||||
defaultConf.append({{prefix}}ServerConfiguration(
|
||||
defaultConf.append({{prefix}}ServerConfiguration(
|
||||
QUrl("{{{url}}}"),
|
||||
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||
{{#variables}}{{#-first}}QMap<QString, {{prefix}}ServerVariable>{ {{/-first}}
|
||||
@@ -36,32 +36,29 @@ defaultConf.append({{prefix}}ServerConfiguration(
|
||||
{{/variables}}{{^variables}}QMap<QString, {{prefix}}ServerVariable>()));{{/variables}}
|
||||
{{/vendorExtensions.x-cpp-global-server-list}}
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
{{^servers}}
|
||||
_serverConfigs.insert("{{nickname}}",defaultConf);
|
||||
_serverIndices.insert("{{nickname}}",0);
|
||||
|
||||
{{/servers}}
|
||||
{{#servers}}
|
||||
serverConf.append({{prefix}}ServerConfiguration(
|
||||
{{#operation}}
|
||||
{{^servers}}
|
||||
_serverConfigs.insert("{{nickname}}",defaultConf);
|
||||
_serverIndices.insert("{{nickname}}",0);
|
||||
{{/servers}}
|
||||
{{#servers}}
|
||||
serverConf.append({{prefix}}ServerConfiguration(
|
||||
QUrl("{{{url}}}"),
|
||||
"{{{description}}}{{^description}}No description provided{{/description}}",
|
||||
{{#variables}}{{#-first}}QMap<QString, {{prefix}}ServerVariable>{ {{/-first}}
|
||||
{"{{{name}}}", {{prefix}}ServerVariable("{{{description}}}{{^description}}No description provided{{/description}}","{{{defaultValue}}}",
|
||||
QSet<QString>{ {{#enumValues}}{"{{{.}}}"}{{#-last}} })}, {{/-last}}{{^-last}},{{/-last}}{{/enumValues}}{{^enumValues}}{"{{defaultValue}}"} })},{{/enumValues}}{{#-last}} }));{{/-last}}
|
||||
{{/variables}}{{^variables}}QMap<QString, {{prefix}}ServerVariable>()));{{/variables}}
|
||||
{{#-last}}_serverConfigs.insert("{{nickname}}",serverConf);
|
||||
_serverIndices.insert("{{nickname}}",0);{{/-last}}
|
||||
|
||||
{{#-last}}_serverConfigs.insert("{{nickname}}",serverConf);
|
||||
_serverIndices.insert("{{nickname}}",0);{{/-last}}
|
||||
{{/servers}}
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* returns 0 on success and -1, -2 or -3 on failure.
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
*/
|
||||
int {{classname}}::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value){
|
||||
auto it = _serverConfigs.find(operation);
|
||||
@@ -101,17 +98,17 @@ void {{classname}}::setWorkingDirectory(const QString &path) {
|
||||
}
|
||||
|
||||
void {{classname}}::setNetworkAccessManager(QNetworkAccessManager* manager) {
|
||||
_manager = manager;
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
int {{classname}}::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, {{prefix}}ServerVariable> &variables){
|
||||
if(_serverConfigs.contains(operation)){
|
||||
_serverConfigs[operation].append({{prefix}}ServerConfiguration(
|
||||
@@ -124,27 +121,26 @@ int {{classname}}::addServerConfiguration(const QString &operation, const QUrl &
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void {{classname}}::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, {{prefix}}ServerVariable> &variables){
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void {{classname}}::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, {{prefix}}ServerVariable> &variables){
|
||||
|
||||
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
|
||||
|
||||
}
|
||||
|
||||
void {{classname}}::addHeaders(const QString &key, const QString &value) {
|
||||
@@ -164,65 +160,66 @@ void {{classname}}::abortRequests(){
|
||||
}
|
||||
|
||||
QString {{classname}}::getParamStylePrefix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString {{classname}}::getParamStyleSuffix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString {{classname}}::getParamStyleDelimiter(QString style, QString name, bool isExplode){
|
||||
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
|
||||
}else
|
||||
return "none";
|
||||
}else {
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
{{#operations}}
|
||||
@@ -257,8 +254,8 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
||||
QString {{paramName}}PathParam("{");
|
||||
{{paramName}}PathParam.append("{{baseName}}").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "{{style}}";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "{{style}}";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -337,11 +334,11 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
||||
{{^required}}if(!{{paramName}}.isNull()){{/required}}
|
||||
{
|
||||
queryStyle = "{{style}}";
|
||||
if(queryStyle == "")
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
queryPrefix = getParamStylePrefix(queryStyle);
|
||||
querySuffix = getParamStyleSuffix(queryStyle);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "{{baseName}}", {{isExplode}});
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "{{baseName}}", {{isExplode}});
|
||||
{{^collectionFormat}}
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append(queryPrefix);
|
||||
@@ -472,7 +469,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
||||
}
|
||||
fullPath.append(::{{cppNamespace}}::toStringValue(t));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
{{/collectionFormat}}
|
||||
@@ -490,7 +487,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
||||
{{#first}}
|
||||
QString formPrefix,formSuffix, formDelimiter;
|
||||
QString formStyle = "{{style}}";
|
||||
if(formStyle == "")
|
||||
if(formStyle == "")
|
||||
formStyle = "form";
|
||||
formPrefix = getParamStylePrefix(formStyle);
|
||||
formSuffix = getParamStyleSuffix(formStyle);
|
||||
@@ -665,7 +662,7 @@ void {{classname}}::{{nickname}}({{#allParams}}{{#required}}const {{{dataType}}}
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &{{prefix}}HttpRequestWorker::on_execution_finished, this, &{{classname}}::{{nickname}}Callback);
|
||||
connect(this, &{{classname}}::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &{{classname}}::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QJsonValue>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
#include <QVariant>
|
||||
|
||||
#include "{{prefix}}Enum.h"
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace {{clientPackage}}
|
||||
public class ApiClient
|
||||
{
|
||||
private readonly Dictionary<String, String> _defaultHeaderMap = new Dictionary<String, String>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ApiClient" /> class.
|
||||
/// </summary>
|
||||
@@ -29,19 +29,19 @@ namespace {{clientPackage}}
|
||||
BasePath = basePath;
|
||||
RestClient = new RestClient(BasePath);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the base path.
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
public string BasePath { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the RestClient.
|
||||
/// </summary>
|
||||
/// <value>An instance of the RestClient</value>
|
||||
public RestClient RestClient { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default header.
|
||||
/// </summary>
|
||||
@@ -49,7 +49,7 @@ namespace {{clientPackage}}
|
||||
{
|
||||
get { return _defaultHeaderMap; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Makes the HTTP request (Sync).
|
||||
/// </summary>
|
||||
@@ -63,12 +63,12 @@ namespace {{clientPackage}}
|
||||
/// <param name="authSettings">Authentication settings.</param>
|
||||
/// <returns>Object</returns>
|
||||
public Object CallApi(String path, RestSharp.Method method, Dictionary<String, String> queryParams, String postBody,
|
||||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
|
||||
Dictionary<String, String> headerParams, Dictionary<String, String> formParams,
|
||||
Dictionary<String, FileParameter> fileParams, String[] authSettings)
|
||||
{
|
||||
|
||||
var request = new RestRequest(path, method);
|
||||
|
||||
|
||||
UpdateParamsForAuth(queryParams, headerParams, authSettings);
|
||||
|
||||
// add default header, if any
|
||||
@@ -97,7 +97,7 @@ namespace {{clientPackage}}
|
||||
return (Object)RestClient.Execute(request);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add default header.
|
||||
/// </summary>
|
||||
@@ -108,7 +108,7 @@ namespace {{clientPackage}}
|
||||
{
|
||||
_defaultHeaderMap.Add(key, value);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Escape string (url-encoded).
|
||||
/// </summary>
|
||||
@@ -118,7 +118,7 @@ namespace {{clientPackage}}
|
||||
{
|
||||
return RestSharp.Contrib.HttpUtility.UrlEncode(str);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Create FileParameter based on Stream.
|
||||
/// </summary>
|
||||
@@ -132,7 +132,7 @@ namespace {{clientPackage}}
|
||||
else
|
||||
return FileParameter.Create(name, stream.ReadAsBytes(), "no_file_name_provided");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime.
|
||||
/// If parameter is a list of string, join the list with ",".
|
||||
@@ -155,7 +155,7 @@ namespace {{clientPackage}}
|
||||
else
|
||||
return Convert.ToString (obj);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize the JSON string into a proper object.
|
||||
/// </summary>
|
||||
@@ -196,9 +196,9 @@ namespace {{clientPackage}}
|
||||
|
||||
if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type
|
||||
{
|
||||
return ConvertType(content, type);
|
||||
return ConvertType(content, type);
|
||||
}
|
||||
|
||||
|
||||
// at this point, it must be a model (json)
|
||||
try
|
||||
{
|
||||
@@ -209,7 +209,7 @@ namespace {{clientPackage}}
|
||||
throw new ApiException(500, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Serialize an object into JSON string.
|
||||
/// </summary>
|
||||
@@ -226,7 +226,7 @@ namespace {{clientPackage}}
|
||||
throw new ApiException(500, e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the API key with prefix.
|
||||
/// </summary>
|
||||
@@ -242,7 +242,7 @@ namespace {{clientPackage}}
|
||||
else
|
||||
return apiKeyValue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Update parameters based on authentication.
|
||||
/// </summary>
|
||||
@@ -288,7 +288,7 @@ namespace {{clientPackage}}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Encode string in base64 format.
|
||||
/// </summary>
|
||||
@@ -299,7 +299,7 @@ namespace {{clientPackage}}
|
||||
var textByte = System.Text.Encoding.UTF8.GetBytes(text);
|
||||
return System.Convert.ToBase64String(textByte);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Dynamically cast the object into target type.
|
||||
/// </summary>
|
||||
@@ -309,6 +309,6 @@ namespace {{clientPackage}}
|
||||
public static Object ConvertType(Object fromObject, Type toObject) {
|
||||
return Convert.ChangeType(fromObject, toObject);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,31 +12,31 @@ namespace {{clientPackage}}
|
||||
/// </summary>
|
||||
public class Configuration
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Version of the package.
|
||||
/// </summary>
|
||||
/// <value>Version of the package.</value>
|
||||
public const string Version = "{{packageVersion}}";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the default API client for making HTTP calls.
|
||||
/// </summary>
|
||||
/// <value>The API client.</value>
|
||||
public static ApiClient DefaultApiClient = new ApiClient();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the username (HTTP basic authentication).
|
||||
/// </summary>
|
||||
/// <value>The username.</value>
|
||||
public static String Username { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password (HTTP basic authentication).
|
||||
/// </summary>
|
||||
/// <value>The password.</value>
|
||||
public static String Password { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the access token (Bearer/OAuth authentication).
|
||||
/// </summary>
|
||||
@@ -48,15 +48,15 @@ namespace {{clientPackage}}
|
||||
/// </summary>
|
||||
/// <value>The API key.</value>
|
||||
public static Dictionary<String, String> ApiKey = new Dictionary<String, String>();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name.
|
||||
/// </summary>
|
||||
/// <value>The prefix of the API key.</value>
|
||||
public static Dictionary<String, String> ApiKeyPrefix = new Dictionary<String, String>();
|
||||
|
||||
|
||||
private static string _tempFolderPath = Path.GetTempPath();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the temporary folder path to store the files downloaded from the server.
|
||||
/// </summary>
|
||||
@@ -64,19 +64,19 @@ namespace {{clientPackage}}
|
||||
public static String TempFolderPath
|
||||
{
|
||||
get { return _tempFolderPath; }
|
||||
|
||||
set
|
||||
|
||||
set
|
||||
{
|
||||
if (String.IsNullOrEmpty(value))
|
||||
{
|
||||
_tempFolderPath = value;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// create the directory if it does not exist
|
||||
if (!Directory.Exists(value))
|
||||
if (!Directory.Exists(value))
|
||||
Directory.CreateDirectory(value);
|
||||
|
||||
|
||||
// check if the path contains directory separator at the end
|
||||
if (value[value.Length - 1] == Path.DirectorySeparatorChar)
|
||||
_tempFolderPath = value;
|
||||
@@ -131,7 +131,7 @@ namespace {{clientPackage}}
|
||||
.Where(x => x.Name == "System.Core").First().Version.ToString() + "\n";
|
||||
report += " Version of the API: {{version}}\n";
|
||||
report += " SDK Package Version: {{packageVersion}}\n";
|
||||
|
||||
|
||||
return report;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace {{apiPackage}}
|
||||
{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}});
|
||||
{{/operation}}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a collection of functions to interact with the API endpoints
|
||||
/// </summary>
|
||||
@@ -36,11 +36,11 @@ namespace {{apiPackage}}
|
||||
public {{classname}}(ApiClient apiClient = null)
|
||||
{
|
||||
if (apiClient == null) // use the default one in Configuration
|
||||
this.ApiClient = Configuration.DefaultApiClient;
|
||||
this.ApiClient = Configuration.DefaultApiClient;
|
||||
else
|
||||
this.ApiClient = apiClient;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="{{classname}}"/> class.
|
||||
/// </summary>
|
||||
@@ -49,7 +49,7 @@ namespace {{apiPackage}}
|
||||
{
|
||||
this.ApiClient = new ApiClient(basePath);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Sets the base path of the API client.
|
||||
/// </summary>
|
||||
@@ -59,7 +59,7 @@ namespace {{apiPackage}}
|
||||
{
|
||||
this.ApiClient.BasePath = basePath;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the base path of the API client.
|
||||
/// </summary>
|
||||
@@ -69,37 +69,37 @@ namespace {{apiPackage}}
|
||||
{
|
||||
return this.ApiClient.BasePath;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the API client.
|
||||
/// </summary>
|
||||
/// <value>An instance of the ApiClient</value>
|
||||
public ApiClient ApiClient {get; set;}
|
||||
|
||||
|
||||
{{#operation}}
|
||||
/// <summary>
|
||||
/// {{summary}} {{notes}}
|
||||
/// </summary>
|
||||
{{#allParams}}/// <param name="{{paramName}}">{{description}}</param>
|
||||
{{/allParams}}/// <returns>{{#returnType}}{{returnType}}{{/returnType}}</returns>
|
||||
{{#allParams}}/// <param name="{{paramName}}">{{description}}</param>
|
||||
{{/allParams}}/// <returns>{{#returnType}}{{returnType}}{{/returnType}}</returns>
|
||||
public {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{nickname}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^-last}}, {{/-last}}{{/allParams}})
|
||||
{
|
||||
{{#allParams}}{{#required}}
|
||||
// verify the required parameter '{{paramName}}' is set
|
||||
if ({{paramName}} == null) throw new ApiException(400, "Missing required parameter '{{paramName}}' when calling {{nickname}}");
|
||||
{{/required}}{{/allParams}}
|
||||
|
||||
|
||||
var path = "{{{path}}}";
|
||||
path = path.Replace("{format}", "json");
|
||||
{{#pathParams}}path = path.Replace("{" + "{{baseName}}" + "}", ApiClient.ParameterToString({{{paramName}}}));
|
||||
{{/pathParams}}
|
||||
|
||||
|
||||
var queryParams = new Dictionary<String, String>();
|
||||
var headerParams = new Dictionary<String, String>();
|
||||
var formParams = new Dictionary<String, String>();
|
||||
var fileParams = new Dictionary<String, FileParameter>();
|
||||
String postBody = null;
|
||||
|
||||
|
||||
{{#queryParams}} if ({{paramName}} != null) queryParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // query parameter
|
||||
{{/queryParams}}
|
||||
{{#headerParams}} if ({{paramName}} != null) headerParams.Add("{{baseName}}", ApiClient.ParameterToString({{paramName}})); // header parameter
|
||||
@@ -108,21 +108,21 @@ namespace {{apiPackage}}
|
||||
{{/formParams}}
|
||||
{{#bodyParam}}postBody = ApiClient.Serialize({{paramName}}); // http body (model) parameter
|
||||
{{/bodyParam}}
|
||||
|
||||
|
||||
// authentication setting, if any
|
||||
String[] authSettings = new String[] { {{#authMethods}}"{{name}}"{{^-last}}, {{/-last}}{{/authMethods}} };
|
||||
|
||||
|
||||
// make the HTTP request
|
||||
IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.{{httpMethod}}, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
|
||||
|
||||
|
||||
if (((int)response.StatusCode) >= 400)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling {{nickname}}: " + response.Content, response.Content);
|
||||
else if (((int)response.StatusCode) == 0)
|
||||
throw new ApiException ((int)response.StatusCode, "Error calling {{nickname}}: " + response.ErrorMessage, response.ErrorMessage);
|
||||
|
||||
|
||||
{{#returnType}}return ({{{returnType}}}) ApiClient.Deserialize(response.Content, typeof({{{returnType}}}), response.Headers);{{/returnType}}{{^returnType}}return;{{/returnType}}
|
||||
}
|
||||
|
||||
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace {{packageName}}.Client
|
||||
private readonly String _baseUrl;
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
|
||||
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
|
||||
/// These settings can be adjusted to accomodate custom serialization rules.
|
||||
/// </summary>
|
||||
public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings
|
||||
|
||||
@@ -63,6 +63,21 @@ namespace {{packageName}}.Client
|
||||
parameters.Add(name, ParameterToString(item));
|
||||
}
|
||||
}
|
||||
else if (value is IDictionary dictionary)
|
||||
{
|
||||
if(collectionFormat == "deepObject") {
|
||||
foreach (DictionaryEntry entry in dictionary)
|
||||
{
|
||||
parameters.Add(name + "[" + entry.Key + "]", ParameterToString(entry.Value));
|
||||
}
|
||||
}
|
||||
else {
|
||||
foreach (DictionaryEntry entry in dictionary)
|
||||
{
|
||||
parameters.Add(entry.Key.ToString(), ParameterToString(entry.Value));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
parameters.Add(name, ParameterToString(value));
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace {{packageName}}.Client
|
||||
}
|
||||
var uriBuilder = new UriBuilder(string.Concat(basePath, path));
|
||||
uriBuilder.Query = httpValues.ToString().Replace("+", "%20");
|
||||
|
||||
|
||||
var dateTime = DateTime.Now;
|
||||
String Digest = String.Empty;
|
||||
|
||||
|
||||
@@ -28,15 +28,15 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap
|
||||
## Dependencies
|
||||
|
||||
{{#useRestSharp}}
|
||||
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.11.4 or later
|
||||
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 106.11.7 or later
|
||||
{{/useRestSharp}}
|
||||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later
|
||||
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later
|
||||
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
|
||||
{{#useCompareNetObjects}}
|
||||
- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later
|
||||
{{/useCompareNetObjects}}
|
||||
{{#validatable}}
|
||||
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later
|
||||
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
|
||||
{{/validatable}}
|
||||
|
||||
The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
||||
|
||||
@@ -280,7 +280,17 @@ namespace {{packageName}}.{{apiPackage}}
|
||||
{{/pathParams}}
|
||||
{{#queryParams}}
|
||||
{{#required}}
|
||||
{{#isDeepObject}}
|
||||
{{#items.vars}}
|
||||
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}.{{name}}));
|
||||
{{/items.vars}}
|
||||
{{^items}}
|
||||
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("deepObject", "{{baseName}}", {{paramName}}));
|
||||
{{/items}}
|
||||
{{/isDeepObject}}
|
||||
{{^isDeepObject}}
|
||||
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));
|
||||
{{/isDeepObject}}
|
||||
{{/required}}
|
||||
{{^required}}
|
||||
if ({{paramName}} != null)
|
||||
@@ -292,6 +302,9 @@ namespace {{packageName}}.{{apiPackage}}
|
||||
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}.{{name}}));
|
||||
}
|
||||
{{/items.vars}}
|
||||
{{^items}}
|
||||
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("deepObject", "{{baseName}}", {{paramName}}));
|
||||
{{/items}}
|
||||
{{/isDeepObject}}
|
||||
{{^isDeepObject}}
|
||||
localVarRequestOptions.QueryParameters.Add({{packageName}}.Client.ClientUtils.ParameterToMultiMap("{{#collectionFormat}}{{collectionFormat}}{{/collectionFormat}}", "{{baseName}}", {{paramName}}));
|
||||
|
||||
@@ -169,7 +169,7 @@ namespace {{packageName}}.Client
|
||||
{{/reUseHttpClient}}
|
||||
|
||||
/// <summary>
|
||||
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
|
||||
/// Specifies the settings on a <see cref="JsonSerializer" /> object.
|
||||
/// These settings can be adjusted to accomodate custom serialization rules.
|
||||
/// </summary>
|
||||
public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings
|
||||
@@ -339,11 +339,21 @@ namespace {{packageName}}.Client
|
||||
Cookies = new List<Cookie>()
|
||||
};
|
||||
|
||||
// process response headers, e.g. Access-Control-Allow-Methods
|
||||
if (response.Headers != null)
|
||||
{
|
||||
foreach (var responseHeader in response.Headers)
|
||||
{
|
||||
transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value));
|
||||
}
|
||||
}
|
||||
|
||||
// process response content headers, e.g. Content-Type
|
||||
if (response.Content.Headers != null)
|
||||
{
|
||||
foreach (var responseHeader in response.Content.Headers)
|
||||
{
|
||||
transformed.Headers.Add(responseHeader.Key, ClientUtils.ParameterToString(responseHeader.Value));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@
|
||||
{
|
||||
throw new InvalidDataException("The JSON string `" + jsonString + "` incorrectly matches more than one schema (should be exactly one match): " + matchedTypes);
|
||||
}
|
||||
|
||||
|
||||
// deserialization is considered successful at this point if no exception has been thrown.
|
||||
return new{{classname}};
|
||||
}
|
||||
|
||||
@@ -25,16 +25,16 @@
|
||||
{{#useCompareNetObjects}}
|
||||
<PackageReference Include="CompareNETObjects" Version="4.61.0" />
|
||||
{{/useCompareNetObjects}}
|
||||
<PackageReference Include="JsonSubTypes" Version="1.7.0" />
|
||||
<PackageReference Include="JsonSubTypes" Version="1.8.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
{{#useRestSharp}}
|
||||
<PackageReference Include="RestSharp" Version="106.11.4" />
|
||||
<PackageReference Include="RestSharp" Version="106.11.7" />
|
||||
{{/useRestSharp}}
|
||||
{{#supportsRetry}}
|
||||
<PackageReference Include="Polly" Version="7.2.0" />
|
||||
<PackageReference Include="Polly" Version="7.2.1" />
|
||||
{{/supportsRetry}}
|
||||
{{#validatable}}
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
{{/validatable}}
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -31,13 +31,13 @@
|
||||
<dependencies>
|
||||
|
||||
<dependency id="Newtonsoft.Json" version="12.0.3" />
|
||||
<dependency id="RestSharp" version="106.11.4" />
|
||||
<dependency id="RestSharp" version="106.11.7" />
|
||||
{{#useCompareNetObjects}}
|
||||
<dependency id="CompareNETObjects" version="4.61.0" />
|
||||
{{/useCompareNetObjects}}
|
||||
<dependency id="JsonSubTypes" version="1.7.0" />
|
||||
<dependency id="JsonSubTypes" version="1.8.0" />
|
||||
{{#validatable}}
|
||||
<dependency id="System.ComponentModel.Annotations" version="4.7.0" />
|
||||
<dependency id="System.ComponentModel.Annotations" version="5.0.0" />
|
||||
{{/validatable}}
|
||||
|
||||
</dependencies>
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace {{packageName}}.Client
|
||||
{{/netStandard}}
|
||||
|
||||
/// <summary>
|
||||
/// Convert params to key/value pairs.
|
||||
/// Convert params to key/value pairs.
|
||||
/// Use collectionFormat to properly format lists and collections.
|
||||
/// </summary>
|
||||
/// <param name="collectionFormat">Collection format.</param>
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace {{packageName}}.Client
|
||||
/// </summary>
|
||||
/// <value>The base path</value>
|
||||
String GetBasePath();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Provides a factory method hook for the creation of exceptions.
|
||||
/// </summary>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
{
|
||||
this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
}
|
||||
|
||||
|
||||
{{/required}}
|
||||
{{#isNullable}}
|
||||
this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
@@ -100,7 +100,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
{{/isInherited}}
|
||||
{{/vars}}
|
||||
}
|
||||
|
||||
|
||||
{{#vars}}
|
||||
{{^isInherited}}
|
||||
{{^isEnum}}
|
||||
@@ -132,7 +132,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
sb.Append("}\n");
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the JSON string presentation of the object
|
||||
/// </summary>
|
||||
@@ -296,7 +296,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}};
|
||||
}
|
||||
{{/minLength}}
|
||||
{{/isEnum}}
|
||||
|
||||
|
||||
{{#maximum}}
|
||||
// {{{name}}} ({{{dataType}}}) maximum
|
||||
if(this.{{{name}}} > ({{{dataType}}}){{maximum}})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
{{#appName}}
|
||||
* {{{appName}}}
|
||||
*
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,7 +1,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}
|
||||
{{#enumVars}}
|
||||
|
||||
@@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
{{#additionalEnumTypeAnnotations}}{{{.}}}
|
||||
{{/additionalEnumTypeAnnotations}}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
public enum {{{datatypeWithEnum}}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{{datatypeWithEnum}}} {
|
||||
{{#allowableValues}}{{#enumVars}}{{{name}}}({{{value}}}){{^-last}},
|
||||
{{/-last}}{{#-last}};{{/-last}}{{/enumVars}}{{/allowableValues}}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
/**
|
||||
* {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}}
|
||||
*/
|
||||
public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{>additionalEnumTypeAnnotations}}public enum {{#datatypeWithEnum}}{{{.}}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{{classname}}}{{/datatypeWithEnum}} {
|
||||
{{#gson}}
|
||||
{{#allowableValues}}{{#enumVars}}
|
||||
@SerializedName({{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}}{{{value}}}{{#isInteger}}"{{/isInteger}}{{#isDouble}}"{{/isDouble}}{{#isLong}}"{{/isLong}}{{#isFloat}}"{{/isFloat}})
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <QJsonValue>
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
#include <QVariant>
|
||||
|
||||
#include "PFXEnum.h"
|
||||
|
||||
@@ -22,52 +22,43 @@ PFXPetApi::PFXPetApi(const int timeOut)
|
||||
_manager(nullptr),
|
||||
isResponseCompressionEnabled(false),
|
||||
isRequestCompressionEnabled(false) {
|
||||
initializeServerConfigs();
|
||||
}
|
||||
initializeServerConfigs();
|
||||
}
|
||||
|
||||
PFXPetApi::~PFXPetApi() {
|
||||
}
|
||||
|
||||
void PFXPetApi::initializeServerConfigs(){
|
||||
|
||||
//Default server
|
||||
QList<PFXServerConfiguration> defaultConf = QList<PFXServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<PFXServerConfiguration> serverConf = QList<PFXServerConfiguration>();
|
||||
defaultConf.append(PFXServerConfiguration(
|
||||
//Default server
|
||||
QList<PFXServerConfiguration> defaultConf = QList<PFXServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<PFXServerConfiguration> serverConf = QList<PFXServerConfiguration>();
|
||||
defaultConf.append(PFXServerConfiguration(
|
||||
QUrl("http://petstore.swagger.io/v2"),
|
||||
"No description provided",
|
||||
QMap<QString, PFXServerVariable>()));
|
||||
_serverConfigs.insert("addPet",defaultConf);
|
||||
_serverIndices.insert("addPet",0);
|
||||
|
||||
_serverConfigs.insert("deletePet",defaultConf);
|
||||
_serverIndices.insert("deletePet",0);
|
||||
|
||||
_serverConfigs.insert("findPetsByStatus",defaultConf);
|
||||
_serverIndices.insert("findPetsByStatus",0);
|
||||
|
||||
_serverConfigs.insert("findPetsByTags",defaultConf);
|
||||
_serverIndices.insert("findPetsByTags",0);
|
||||
|
||||
_serverConfigs.insert("getPetById",defaultConf);
|
||||
_serverIndices.insert("getPetById",0);
|
||||
|
||||
_serverConfigs.insert("updatePet",defaultConf);
|
||||
_serverIndices.insert("updatePet",0);
|
||||
|
||||
_serverConfigs.insert("updatePetWithForm",defaultConf);
|
||||
_serverIndices.insert("updatePetWithForm",0);
|
||||
|
||||
_serverConfigs.insert("uploadFile",defaultConf);
|
||||
_serverIndices.insert("uploadFile",0);
|
||||
|
||||
|
||||
_serverConfigs.insert("addPet",defaultConf);
|
||||
_serverIndices.insert("addPet",0);
|
||||
_serverConfigs.insert("deletePet",defaultConf);
|
||||
_serverIndices.insert("deletePet",0);
|
||||
_serverConfigs.insert("findPetsByStatus",defaultConf);
|
||||
_serverIndices.insert("findPetsByStatus",0);
|
||||
_serverConfigs.insert("findPetsByTags",defaultConf);
|
||||
_serverIndices.insert("findPetsByTags",0);
|
||||
_serverConfigs.insert("getPetById",defaultConf);
|
||||
_serverIndices.insert("getPetById",0);
|
||||
_serverConfigs.insert("updatePet",defaultConf);
|
||||
_serverIndices.insert("updatePet",0);
|
||||
_serverConfigs.insert("updatePetWithForm",defaultConf);
|
||||
_serverIndices.insert("updatePetWithForm",0);
|
||||
_serverConfigs.insert("uploadFile",defaultConf);
|
||||
_serverIndices.insert("uploadFile",0);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns 0 on success and -1, -2 or -3 on failure.
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
*/
|
||||
int PFXPetApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value){
|
||||
auto it = _serverConfigs.find(operation);
|
||||
@@ -107,17 +98,17 @@ void PFXPetApi::setWorkingDirectory(const QString &path) {
|
||||
}
|
||||
|
||||
void PFXPetApi::setNetworkAccessManager(QNetworkAccessManager* manager) {
|
||||
_manager = manager;
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
int PFXPetApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
if(_serverConfigs.contains(operation)){
|
||||
_serverConfigs[operation].append(PFXServerConfiguration(
|
||||
@@ -130,27 +121,26 @@ int PFXPetApi::addServerConfiguration(const QString &operation, const QUrl &url,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void PFXPetApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void PFXPetApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
|
||||
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
|
||||
|
||||
}
|
||||
|
||||
void PFXPetApi::addHeaders(const QString &key, const QString &value) {
|
||||
@@ -170,65 +160,66 @@ void PFXPetApi::abortRequests(){
|
||||
}
|
||||
|
||||
QString PFXPetApi::getParamStylePrefix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString PFXPetApi::getParamStyleSuffix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString PFXPetApi::getParamStyleDelimiter(QString style, QString name, bool isExplode){
|
||||
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
|
||||
}else
|
||||
return "none";
|
||||
}else {
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
void PFXPetApi::addPet(const PFXPet &body) {
|
||||
@@ -246,7 +237,7 @@ void PFXPetApi::addPet(const PFXPet &body) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::addPetCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -281,8 +272,8 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const QVariant &api_key) {
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -305,7 +296,7 @@ void PFXPetApi::deletePet(const qint64 &pet_id, const QVariant &api_key) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::deletePetCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -339,11 +330,11 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
||||
|
||||
{
|
||||
queryStyle = "form";
|
||||
if(queryStyle == "")
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
queryPrefix = getParamStylePrefix(queryStyle);
|
||||
querySuffix = getParamStyleSuffix(queryStyle);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "status", false);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "status", false);
|
||||
if (status.size() > 0) {
|
||||
if (QString("csv").indexOf("multi") == 0) {
|
||||
foreach (QString t, status) {
|
||||
@@ -417,7 +408,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
||||
}
|
||||
fullPath.append(::test_namespace::toStringValue(t));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -430,7 +421,7 @@ void PFXPetApi::findPetsByStatus(const QList<QString> &status) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByStatusCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -474,11 +465,11 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
||||
|
||||
{
|
||||
queryStyle = "form";
|
||||
if(queryStyle == "")
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
queryPrefix = getParamStylePrefix(queryStyle);
|
||||
querySuffix = getParamStyleSuffix(queryStyle);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "tags", false);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "tags", false);
|
||||
if (tags.size() > 0) {
|
||||
if (QString("csv").indexOf("multi") == 0) {
|
||||
foreach (QString t, tags) {
|
||||
@@ -552,7 +543,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
||||
}
|
||||
fullPath.append(::test_namespace::toStringValue(t));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,7 +556,7 @@ void PFXPetApi::findPetsByTags(const QList<QString> &tags) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::findPetsByTagsCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -614,8 +605,8 @@ void PFXPetApi::getPetById(const qint64 &pet_id) {
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -632,7 +623,7 @@ void PFXPetApi::getPetById(const qint64 &pet_id) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::getPetByIdCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -674,7 +665,7 @@ void PFXPetApi::updatePet(const PFXPet &body) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -709,8 +700,8 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const QVariant &name, co
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -739,7 +730,7 @@ void PFXPetApi::updatePetWithForm(const qint64 &pet_id, const QVariant &name, co
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::updatePetWithFormCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -774,8 +765,8 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const QVariant &additional_meta
|
||||
QString pet_idPathParam("{");
|
||||
pet_idPathParam.append("petId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -804,7 +795,7 @@ void PFXPetApi::uploadFile(const qint64 &pet_id, const QVariant &additional_meta
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXPetApi::uploadFileCallback);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXPetApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,40 +22,35 @@ PFXStoreApi::PFXStoreApi(const int timeOut)
|
||||
_manager(nullptr),
|
||||
isResponseCompressionEnabled(false),
|
||||
isRequestCompressionEnabled(false) {
|
||||
initializeServerConfigs();
|
||||
}
|
||||
initializeServerConfigs();
|
||||
}
|
||||
|
||||
PFXStoreApi::~PFXStoreApi() {
|
||||
}
|
||||
|
||||
void PFXStoreApi::initializeServerConfigs(){
|
||||
|
||||
//Default server
|
||||
QList<PFXServerConfiguration> defaultConf = QList<PFXServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<PFXServerConfiguration> serverConf = QList<PFXServerConfiguration>();
|
||||
defaultConf.append(PFXServerConfiguration(
|
||||
//Default server
|
||||
QList<PFXServerConfiguration> defaultConf = QList<PFXServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<PFXServerConfiguration> serverConf = QList<PFXServerConfiguration>();
|
||||
defaultConf.append(PFXServerConfiguration(
|
||||
QUrl("http://petstore.swagger.io/v2"),
|
||||
"No description provided",
|
||||
QMap<QString, PFXServerVariable>()));
|
||||
_serverConfigs.insert("deleteOrder",defaultConf);
|
||||
_serverIndices.insert("deleteOrder",0);
|
||||
|
||||
_serverConfigs.insert("getInventory",defaultConf);
|
||||
_serverIndices.insert("getInventory",0);
|
||||
|
||||
_serverConfigs.insert("getOrderById",defaultConf);
|
||||
_serverIndices.insert("getOrderById",0);
|
||||
|
||||
_serverConfigs.insert("placeOrder",defaultConf);
|
||||
_serverIndices.insert("placeOrder",0);
|
||||
|
||||
|
||||
_serverConfigs.insert("deleteOrder",defaultConf);
|
||||
_serverIndices.insert("deleteOrder",0);
|
||||
_serverConfigs.insert("getInventory",defaultConf);
|
||||
_serverIndices.insert("getInventory",0);
|
||||
_serverConfigs.insert("getOrderById",defaultConf);
|
||||
_serverIndices.insert("getOrderById",0);
|
||||
_serverConfigs.insert("placeOrder",defaultConf);
|
||||
_serverIndices.insert("placeOrder",0);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns 0 on success and -1, -2 or -3 on failure.
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
*/
|
||||
int PFXStoreApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value){
|
||||
auto it = _serverConfigs.find(operation);
|
||||
@@ -95,17 +90,17 @@ void PFXStoreApi::setWorkingDirectory(const QString &path) {
|
||||
}
|
||||
|
||||
void PFXStoreApi::setNetworkAccessManager(QNetworkAccessManager* manager) {
|
||||
_manager = manager;
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
int PFXStoreApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
if(_serverConfigs.contains(operation)){
|
||||
_serverConfigs[operation].append(PFXServerConfiguration(
|
||||
@@ -118,27 +113,26 @@ int PFXStoreApi::addServerConfiguration(const QString &operation, const QUrl &ur
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void PFXStoreApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void PFXStoreApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
|
||||
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
|
||||
|
||||
}
|
||||
|
||||
void PFXStoreApi::addHeaders(const QString &key, const QString &value) {
|
||||
@@ -158,65 +152,66 @@ void PFXStoreApi::abortRequests(){
|
||||
}
|
||||
|
||||
QString PFXStoreApi::getParamStylePrefix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString PFXStoreApi::getParamStyleSuffix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString PFXStoreApi::getParamStyleDelimiter(QString style, QString name, bool isExplode){
|
||||
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
|
||||
}else
|
||||
return "none";
|
||||
}else {
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
void PFXStoreApi::deleteOrder(const QString &order_id) {
|
||||
@@ -228,8 +223,8 @@ void PFXStoreApi::deleteOrder(const QString &order_id) {
|
||||
QString order_idPathParam("{");
|
||||
order_idPathParam.append("orderId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -246,7 +241,7 @@ void PFXStoreApi::deleteOrder(const QString &order_id) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::deleteOrderCallback);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -288,7 +283,7 @@ void PFXStoreApi::getInventory() {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getInventoryCallback);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -333,8 +328,8 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) {
|
||||
QString order_idPathParam("{");
|
||||
order_idPathParam.append("orderId").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -351,7 +346,7 @@ void PFXStoreApi::getOrderById(const qint64 &order_id) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::getOrderByIdCallback);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -393,7 +388,7 @@ void PFXStoreApi::placeOrder(const PFXOrder &body) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXStoreApi::placeOrderCallback);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXStoreApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,52 +22,43 @@ PFXUserApi::PFXUserApi(const int timeOut)
|
||||
_manager(nullptr),
|
||||
isResponseCompressionEnabled(false),
|
||||
isRequestCompressionEnabled(false) {
|
||||
initializeServerConfigs();
|
||||
}
|
||||
initializeServerConfigs();
|
||||
}
|
||||
|
||||
PFXUserApi::~PFXUserApi() {
|
||||
}
|
||||
|
||||
void PFXUserApi::initializeServerConfigs(){
|
||||
|
||||
//Default server
|
||||
QList<PFXServerConfiguration> defaultConf = QList<PFXServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<PFXServerConfiguration> serverConf = QList<PFXServerConfiguration>();
|
||||
defaultConf.append(PFXServerConfiguration(
|
||||
//Default server
|
||||
QList<PFXServerConfiguration> defaultConf = QList<PFXServerConfiguration>();
|
||||
//varying endpoint server
|
||||
QList<PFXServerConfiguration> serverConf = QList<PFXServerConfiguration>();
|
||||
defaultConf.append(PFXServerConfiguration(
|
||||
QUrl("http://petstore.swagger.io/v2"),
|
||||
"No description provided",
|
||||
QMap<QString, PFXServerVariable>()));
|
||||
_serverConfigs.insert("createUser",defaultConf);
|
||||
_serverIndices.insert("createUser",0);
|
||||
|
||||
_serverConfigs.insert("createUsersWithArrayInput",defaultConf);
|
||||
_serverIndices.insert("createUsersWithArrayInput",0);
|
||||
|
||||
_serverConfigs.insert("createUsersWithListInput",defaultConf);
|
||||
_serverIndices.insert("createUsersWithListInput",0);
|
||||
|
||||
_serverConfigs.insert("deleteUser",defaultConf);
|
||||
_serverIndices.insert("deleteUser",0);
|
||||
|
||||
_serverConfigs.insert("getUserByName",defaultConf);
|
||||
_serverIndices.insert("getUserByName",0);
|
||||
|
||||
_serverConfigs.insert("loginUser",defaultConf);
|
||||
_serverIndices.insert("loginUser",0);
|
||||
|
||||
_serverConfigs.insert("logoutUser",defaultConf);
|
||||
_serverIndices.insert("logoutUser",0);
|
||||
|
||||
_serverConfigs.insert("updateUser",defaultConf);
|
||||
_serverIndices.insert("updateUser",0);
|
||||
|
||||
|
||||
_serverConfigs.insert("createUser",defaultConf);
|
||||
_serverIndices.insert("createUser",0);
|
||||
_serverConfigs.insert("createUsersWithArrayInput",defaultConf);
|
||||
_serverIndices.insert("createUsersWithArrayInput",0);
|
||||
_serverConfigs.insert("createUsersWithListInput",defaultConf);
|
||||
_serverIndices.insert("createUsersWithListInput",0);
|
||||
_serverConfigs.insert("deleteUser",defaultConf);
|
||||
_serverIndices.insert("deleteUser",0);
|
||||
_serverConfigs.insert("getUserByName",defaultConf);
|
||||
_serverIndices.insert("getUserByName",0);
|
||||
_serverConfigs.insert("loginUser",defaultConf);
|
||||
_serverIndices.insert("loginUser",0);
|
||||
_serverConfigs.insert("logoutUser",defaultConf);
|
||||
_serverIndices.insert("logoutUser",0);
|
||||
_serverConfigs.insert("updateUser",defaultConf);
|
||||
_serverIndices.insert("updateUser",0);
|
||||
}
|
||||
|
||||
/**
|
||||
* returns 0 on success and -1, -2 or -3 on failure.
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
* -1 when the variable does not exist and -2 if the value is not defined in the enum and -3 if the operation or server index is not found
|
||||
*/
|
||||
int PFXUserApi::setDefaultServerValue(int serverIndex, const QString &operation, const QString &variable, const QString &value){
|
||||
auto it = _serverConfigs.find(operation);
|
||||
@@ -107,17 +98,17 @@ void PFXUserApi::setWorkingDirectory(const QString &path) {
|
||||
}
|
||||
|
||||
void PFXUserApi::setNetworkAccessManager(QNetworkAccessManager* manager) {
|
||||
_manager = manager;
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a specific operation.
|
||||
* @param operation The id to the target operation.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
* returns the index of the new server config on success and -1 if the operation is not found
|
||||
*/
|
||||
int PFXUserApi::addServerConfiguration(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
if(_serverConfigs.contains(operation)){
|
||||
_serverConfigs[operation].append(PFXServerConfiguration(
|
||||
@@ -130,27 +121,26 @@ int PFXUserApi::addServerConfiguration(const QString &operation, const QUrl &url
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for a all operations and sets the index to that server.
|
||||
* @param url A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void PFXUserApi::setNewServerForAllOperations(const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
for(auto e : _serverIndices.keys()){
|
||||
setServerIndex(e, addServerConfiguration(e, url, description, variables));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends a new ServerConfiguration to the config map for an operations and sets the index to that server.
|
||||
* @param URL A string that contains the URL of the server
|
||||
* @param description A String that describes the server
|
||||
* @param variables A map between a variable name and its value. The value is used for substitution in the server's URL template.
|
||||
*/
|
||||
void PFXUserApi::setNewServer(const QString &operation, const QUrl &url, const QString &description, const QMap<QString, PFXServerVariable> &variables){
|
||||
|
||||
setServerIndex(operation, addServerConfiguration(operation, url, description, variables));
|
||||
|
||||
}
|
||||
|
||||
void PFXUserApi::addHeaders(const QString &key, const QString &value) {
|
||||
@@ -170,65 +160,66 @@ void PFXUserApi::abortRequests(){
|
||||
}
|
||||
|
||||
QString PFXUserApi::getParamStylePrefix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return ";";
|
||||
}else if(style == "label"){
|
||||
return ".";
|
||||
}else if(style == "form"){
|
||||
return "&";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "&";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "&";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString PFXUserApi::getParamStyleSuffix(QString style){
|
||||
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else
|
||||
return "none";
|
||||
if(style == "matrix"){
|
||||
return "=";
|
||||
}else if(style == "label"){
|
||||
return "";
|
||||
}else if(style == "form"){
|
||||
return "=";
|
||||
}else if(style == "simple"){
|
||||
return "";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return "=";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return "=";
|
||||
}else{
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
QString PFXUserApi::getParamStyleDelimiter(QString style, QString name, bool isExplode){
|
||||
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
if(style == "matrix"){
|
||||
return (isExplode) ? ";" + name + "=" : ",";
|
||||
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
}else if(style == "label"){
|
||||
return (isExplode) ? "." : ",";
|
||||
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
}else if(style == "form"){
|
||||
return (isExplode) ? "&" + name + "=" : ",";
|
||||
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
}else if(style == "simple"){
|
||||
return ",";
|
||||
}else if(style == "spaceDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : " ";
|
||||
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
}else if(style == "pipeDelimited"){
|
||||
return (isExplode) ? "&" + name + "=" : "|";
|
||||
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
}else if(style == "deepObject"){
|
||||
return (isExplode) ? "&" : "none";
|
||||
|
||||
}else
|
||||
return "none";
|
||||
}else {
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
void PFXUserApi::createUser(const PFXUser &body) {
|
||||
@@ -246,7 +237,7 @@ void PFXUserApi::createUser(const PFXUser &body) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUserCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -287,7 +278,7 @@ void PFXUserApi::createUsersWithArrayInput(const QList<PFXUser> &body) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithArrayInputCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -328,7 +319,7 @@ void PFXUserApi::createUsersWithListInput(const QList<PFXUser> &body) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::createUsersWithListInputCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -363,8 +354,8 @@ void PFXUserApi::deleteUser(const QString &username) {
|
||||
QString usernamePathParam("{");
|
||||
usernamePathParam.append("username").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -381,7 +372,7 @@ void PFXUserApi::deleteUser(const QString &username) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::deleteUserCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -416,8 +407,8 @@ void PFXUserApi::getUserByName(const QString &username) {
|
||||
QString usernamePathParam("{");
|
||||
usernamePathParam.append("username").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -434,7 +425,7 @@ void PFXUserApi::getUserByName(const QString &username) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::getUserByNameCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -469,11 +460,11 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) {
|
||||
|
||||
{
|
||||
queryStyle = "";
|
||||
if(queryStyle == "")
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
queryPrefix = getParamStylePrefix(queryStyle);
|
||||
querySuffix = getParamStyleSuffix(queryStyle);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "username", false);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "username", false);
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append(queryPrefix);
|
||||
else
|
||||
@@ -485,11 +476,11 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) {
|
||||
|
||||
{
|
||||
queryStyle = "";
|
||||
if(queryStyle == "")
|
||||
if(queryStyle == "")
|
||||
queryStyle = "form";
|
||||
queryPrefix = getParamStylePrefix(queryStyle);
|
||||
querySuffix = getParamStyleSuffix(queryStyle);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "password", false);
|
||||
queryDelimiter = getParamStyleDelimiter(queryStyle, "password", false);
|
||||
if (fullPath.indexOf("?") > 0)
|
||||
fullPath.append(queryPrefix);
|
||||
else
|
||||
@@ -506,7 +497,7 @@ void PFXUserApi::loginUser(const QString &username, const QString &password) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::loginUserCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -546,7 +537,7 @@ void PFXUserApi::logoutUser() {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::logoutUserCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
@@ -581,8 +572,8 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) {
|
||||
QString usernamePathParam("{");
|
||||
usernamePathParam.append("username").append("}");
|
||||
QString pathPrefix, pathSuffix, pathDelimiter;
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
QString pathStyle = "";
|
||||
if(pathStyle == "")
|
||||
pathStyle = "simple";
|
||||
pathPrefix = getParamStylePrefix(pathStyle);
|
||||
pathSuffix = getParamStyleSuffix(pathStyle);
|
||||
@@ -602,7 +593,7 @@ void PFXUserApi::updateUser(const QString &username, const PFXUser &body) {
|
||||
foreach (QString key, this->defaultHeaders.keys()) { input.headers.insert(key, this->defaultHeaders.value(key)); }
|
||||
|
||||
connect(worker, &PFXHttpRequestWorker::on_execution_finished, this, &PFXUserApi::updateUserCallback);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
connect(this, &PFXUserApi::abortRequestsSignal, worker, &QObject::deleteLater);
|
||||
worker->execute(&input);
|
||||
}
|
||||
|
||||
|
||||
@@ -21,3 +21,4 @@
|
||||
#docs/*.md
|
||||
# Then explicitly reverse the ignore rule for a single file:
|
||||
#!docs/README.md
|
||||
src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj
|
||||
|
||||
@@ -84,7 +84,6 @@ docs/UserApi.md
|
||||
docs/Whale.md
|
||||
docs/Zebra.md
|
||||
git_push.sh
|
||||
src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj
|
||||
src/Org.OpenAPITools/Api/AnotherFakeApi.cs
|
||||
src/Org.OpenAPITools/Api/DefaultApi.cs
|
||||
src/Org.OpenAPITools/Api/FakeApi.cs
|
||||
|
||||
@@ -18,9 +18,9 @@ This C# SDK is automatically generated by the [OpenAPI Generator](https://openap
|
||||
## Dependencies
|
||||
|
||||
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 12.0.3 or later
|
||||
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.7.0 or later
|
||||
- [JsonSubTypes](https://www.nuget.org/packages/JsonSubTypes/) - 1.8.0 or later
|
||||
- [CompareNETObjects](https://www.nuget.org/packages/CompareNETObjects) - 4.61.0 or later
|
||||
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 4.7.0 or later
|
||||
- [System.ComponentModel.Annotations](https://www.nuget.org/packages/System.ComponentModel.Annotations) - 5.0.0 or later
|
||||
|
||||
The DLLs included in the package may not be the latest version. We recommend using [NuGet](https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
|
||||
```
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user