diff --git a/bin/csharp-dotnet2-petstore.sh b/bin/csharp-dotnet2-petstore.sh index fdab8bc413b..a63bfa35bfd 100755 --- a/bin/csharp-dotnet2-petstore.sh +++ b/bin/csharp-dotnet2-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/csharp-petstore.sh b/bin/csharp-petstore.sh index c3fe78f0f36..c042dd9c0cd 100755 --- a/bin/csharp-petstore.sh +++ b/bin/csharp-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/perl-petstore.sh b/bin/perl-petstore.sh index b2eb1753d67..f3eb5b17bd9 100755 --- a/bin/perl-petstore.sh +++ b/bin/perl-petstore.sh @@ -27,7 +27,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" # complex module name used for testing -ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l perl -o samples/client/petstore/perl" +ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l perl -o samples/client/petstore/perl" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/php-petstore.sh b/bin/php-petstore.sh index 14b53d65b4f..3b25c1c1cc3 100755 --- a/bin/php-petstore.sh +++ b/bin/php-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l php -o samples/client/petstore/php" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l php -o samples/client/petstore/php" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/python-petstore.sh b/bin/python-petstore.sh index 022629a9e20..ef120089f45 100755 --- a/bin/python-petstore.sh +++ b/bin/python-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l python -o samples/client/petstore/python" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l python -o samples/client/petstore/python" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/ruby-petstore.sh b/bin/ruby-petstore.sh index 05cf1ee995e..f1c87e32028 100755 --- a/bin/ruby-petstore.sh +++ b/bin/ruby-petstore.sh @@ -26,6 +26,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java index 76c0d1277b1..df23c1f2275 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractCSharpCodegen.java @@ -89,7 +89,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co "Int64", "Float", "Guid", - "Stream", // not really a primitive, we include it to avoid model import + "System.IO.Stream", // not really a primitive, we include it to avoid model import "Object") ); @@ -110,7 +110,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co typeMapping.put("number", "double?"); typeMapping.put("datetime", "DateTime?"); typeMapping.put("date", "DateTime?"); - typeMapping.put("file", "Stream"); + typeMapping.put("file", "System.IO.Stream"); typeMapping.put("array", "List"); typeMapping.put("list", "List"); typeMapping.put("map", "Dictionary"); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java index c08ae3456b1..05654eebe5c 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CsharpDotNet2ClientCodegen.java @@ -60,7 +60,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege "Integer", "Long", "Float", - "Stream", // not really a primitive, we include it to avoid model import + "System.IO.Stream", // not really a primitive, we include it to avoid model import "Object") ); instantiationTypes.put("array", "List"); @@ -76,7 +76,7 @@ public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements Codege typeMapping.put("number", "double?"); typeMapping.put("datetime", "DateTime?"); typeMapping.put("date", "DateTime?"); - typeMapping.put("file", "Stream"); + typeMapping.put("file", "System.IO.Stream"); typeMapping.put("array", "List"); typeMapping.put("list", "List"); typeMapping.put("map", "Dictionary"); diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java index b77239a5b4d..5bebf932851 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/GoClientCodegen.java @@ -4,6 +4,7 @@ import io.swagger.codegen.*; import io.swagger.models.properties.ArrayProperty; import io.swagger.models.properties.MapProperty; import io.swagger.models.properties.Property; +import io.swagger.models.parameters.Parameter; import java.io.File; import java.util.*; @@ -132,7 +133,7 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); - supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "Configuration.go")); + supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.go")); } @Override @@ -196,6 +197,13 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toModelName(String name) { + // camelize the model name + // phone_number => PhoneNumber + return camelize(toModelFilename(name)); + } + + @Override + public String toModelFilename(String name) { if (!StringUtils.isEmpty(modelNamePrefix)) { name = modelNamePrefix + "_" + name; } @@ -212,17 +220,48 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { name = "model_" + name; // e.g. return => ModelReturn (after camelize) } - // camelize the model name - // phone_number => PhoneNumber - return camelize(name); + return underscore(name); } @Override - public String toModelFilename(String name) { - // should be the same as the model name - return toModelName(name); + public String toApiFilename(String name) { + // replace - with _ e.g. created-at => created_at + name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + + // e.g. PetApi.go => pet_api.go + return underscore(name) + "_api"; } + + + /** + * Overrides postProcessParameter to add a vendor extension "x-exportParamName". + * This is useful when paramName starts with a lowercase letter, but we need that + * param to be exportable (starts with an Uppercase letter). + * + * @param parameter CodegenParameter object to be processed. + */ + @Override + public void postProcessParameter(CodegenParameter parameter){ + + // Give the base class a chance to process + super.postProcessParameter(parameter); + + char firstChar = parameter.paramName.charAt(0); + + if (Character.isUpperCase(firstChar)) { + // First char is already uppercase, just use paramName. + parameter.vendorExtensions.put("x-exportParamName", parameter.paramName); + + } + + // It's a lowercase first char, let's convert it to uppercase + StringBuilder sb = new StringBuilder(parameter.paramName); + sb.setCharAt(0, Character.toUpperCase(firstChar)); + parameter.vendorExtensions.put("x-exportParamName", sb.toString()); + } + + @Override public String getTypeDeclaration(Property p) { if(p instanceof ArrayProperty) { diff --git a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache index c3fb85acb4f..f1756813ef4 100644 --- a/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache +++ b/modules/swagger-codegen/src/main/resources/CsharpDotNet2/api.mustache @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using {{packageName}}.Client; diff --git a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache index 6e7ef1c19f3..bf6b76d6b41 100644 --- a/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache +++ b/modules/swagger-codegen/src/main/resources/TypeScript-node/api.mustache @@ -190,9 +190,9 @@ export class {{classname}} { let formParams: any = {}; {{#allParams}}{{#required}} - // verify required parameter '{{paramName}}' is set - if (!{{paramName}}) { - throw new Error('Missing required parameter {{paramName}} when calling {{nickname}}'); + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new Error('Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); } {{/required}}{{/allParams}} {{#queryParams}} diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache index af6f859c73d..38c7f00cdaa 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/api.mustache @@ -121,7 +121,10 @@ public class {{classname}} { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { diff --git a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache index fabdd14a6d6..917f9d11eff 100644 --- a/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache +++ b/modules/swagger-codegen/src/main/resources/android/libraries/volley/build.mustache @@ -70,7 +70,7 @@ ext { dependencies { compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "com.google.code.gson:gson:$gson_version" - compile "org.apache.httpcomponents:httpcore:$httpclient_version" + compile "org.apache.httpcomponents:httpcore:$httpcore_version" compile "org.apache.httpcomponents:httpmime:$httpclient_version" compile "com.mcxiaoke.volley:library:${volley_version}@aar" testCompile "junit:junit:$junit_version" diff --git a/modules/swagger-codegen/src/main/resources/csharp/api.mustache b/modules/swagger-codegen/src/main/resources/csharp/api.mustache index 18c675d6350..85af270c213 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api.mustache @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache index 5f5a03aa612..cb345a93cc4 100644 --- a/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache +++ b/modules/swagger-codegen/src/main/resources/csharp/api_test.mustache @@ -61,7 +61,8 @@ namespace {{packageName}}.Test public void {{operationId}}Test() { // TODO: add unit test for the method '{{operationId}}' - {{#allParams}}{{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value + {{#allParams}} + {{{dataType}}} {{paramName}} = null; // TODO: replace null with proper value {{/allParams}} {{#returnType}}var response = {{/returnType}}instance.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); {{#returnType}}Assert.IsInstanceOf<{{{returnType}}}> (response, "response is {{{returnType}}}");{{/returnType}} diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index 6c6ade4379e..233afa8ad89 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -81,10 +81,10 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ } {{#hasQueryParams}} type QueryParams struct { - {{#queryParams}}{{paramName}} {{dataType}} `url:"{{baseName}},omitempty"` + {{#queryParams}}{{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` {{/queryParams}} } - _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{paramName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} }) + _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} }) {{/hasQueryParams}} // accept header accepts := []string { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} } @@ -96,10 +96,10 @@ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{ _sling = _sling.Set("{{baseName}}", {{paramName}}) {{/headerParams}}{{/hasHeaderParams}} {{#hasFormParams}} type FormParams struct { -{{#formParams}} {{paramName}} {{dataType}} `url:"{{baseName}},omitempty"` +{{#formParams}} {{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` {{/formParams}} } - _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{paramName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} }) + _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} }) {{/hasFormParams}} {{#hasBodyParam}}{{#bodyParams}}// body params _sling = _sling.BodyJSON({{paramName}}) diff --git a/modules/swagger-codegen/src/main/resources/go/configuration.mustache b/modules/swagger-codegen/src/main/resources/go/configuration.mustache index ae711d5dd49..301f46d8fd4 100644 --- a/modules/swagger-codegen/src/main/resources/go/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/go/configuration.mustache @@ -18,6 +18,7 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` } func NewConfiguration() *Configuration { @@ -27,7 +28,8 @@ func NewConfiguration() *Configuration { Debug: false, DefaultHeader: make(map[string]string), ApiKey: make(map[string]string), - ApiKeyPrefix: make(map[string]string) , + ApiKeyPrefix: make(map[string]string), + UserAgent: "{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}Swagger-Codegen/{{{packageVersion}}}/go{{/httpUserAgent}}", } } diff --git a/modules/swagger-codegen/src/main/resources/swift/Models.mustache b/modules/swagger-codegen/src/main/resources/swift/Models.mustache index 31cb4a2e219..795fdd3d5e7 100644 --- a/modules/swagger-codegen/src/main/resources/swift/Models.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/Models.mustache @@ -130,11 +130,11 @@ class Decoders { fatalError("formatter failed to parse \(source)") } {{#models}}{{#model}} - // Decoder for [{{{classname}}}] + // Decoder for [{{{classname}}}] Decoders.addDecoder(clazz: [{{{classname}}}].self) { (source: AnyObject) -> [{{{classname}}}] in return Decoders.decode(clazz: [{{{classname}}}].self, source: source) } - // Decoder for {{{classname}}} + // Decoder for {{{classname}}} Decoders.addDecoder(clazz: {{{classname}}}.self) { (source: AnyObject) -> {{{classname}}} in let sourceDictionary = source as! [NSObject:AnyObject] let instance = {{classname}}(){{#vars}}{{#isEnum}} diff --git a/modules/swagger-codegen/src/main/resources/swift/api.mustache b/modules/swagger-codegen/src/main/resources/swift/api.mustache index ada4ec90d36..195fb88aeed 100644 --- a/modules/swagger-codegen/src/main/resources/swift/api.mustache +++ b/modules/swagger-codegen/src/main/resources/swift/api.mustache @@ -23,7 +23,7 @@ public class {{classname}}: APIBase { - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} - parameter completion: completion handler to receive the data and the error objects */ - public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: (({{#returnType}}data: {{{returnType}}}?, {{/returnType}}error: ErrorType?) -> Void)) { + public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#hasParams}}, {{/hasParams}}completion: (({{#returnType}}data: {{{returnType}}}?, {{/returnType}}error: ErrorType?) -> Void)) { {{operationId}}WithRequestBuilder({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}).execute { (response, error) -> Void in completion({{#returnType}}data: response?.body, {{/returnType}}error: error); } @@ -37,7 +37,7 @@ public class {{classname}}: APIBase { - parameter {{paramName}}: ({{#isFormParam}}form{{/isFormParam}}{{#isQueryParam}}query{{/isQueryParam}}{{#isPathParam}}path{{/isPathParam}}{{#isHeaderParam}}header{{/isHeaderParam}}{{#isBodyParam}}body{{/isBodyParam}}) {{description}} {{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{/allParams}} - returns: Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> */ - public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + public class func {{operationId}}({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { let deferred = Promise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}>.pendingPromise() {{operationId}}({{#allParams}}{{paramName}}: {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) { {{#returnType}}data, {{/returnType}}error in if let error = error { @@ -69,7 +69,7 @@ public class {{classname}}: APIBase { - returns: RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> {{description}} */ - public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}?{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { + public class func {{operationId}}WithRequestBuilder({{#allParams}}{{^secondaryParam}}{{paramName}} {{/secondaryParam}}{{paramName}}: {{{dataType}}}{{^required}}? = nil{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> RequestBuilder<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Void{{/returnType}}> { {{^pathParams}}let{{/pathParams}}{{#pathParams}}{{^secondaryParam}}var{{/secondaryParam}}{{/pathParams}} path = "{{path}}"{{#pathParams}} path = path.stringByReplacingOccurrencesOfString("{{=<% %>=}}{<%paramName%>}<%={{ }}=%>", withString: "\({{paramName}})", options: .LiteralSearch, range: nil){{/pathParams}} let URLString = {{projectName}}API.basePath + path diff --git a/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java b/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java index 6f12032460c..83fa8d6437e 100644 --- a/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java +++ b/modules/swagger-codegen/src/test/java/io/swagger/codegen/go/GoModelTest.java @@ -38,8 +38,7 @@ public class GoModelTest { Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.description, "a sample model"); Assert.assertEquals(cm.vars.size(), 3); - // {{imports}} is not used in template - //Assert.assertEquals(cm.imports.size(), 1); + Assert.assertEquals(cm.imports.size(), 1); final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "id"); @@ -199,8 +198,7 @@ public class GoModelTest { Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.description, "a sample model"); Assert.assertEquals(cm.vars.size(), 1); - // {{imports}} is not used in template - //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); final CodegenProperty property1 = cm.vars.get(0); Assert.assertEquals(property1.baseName, "children"); @@ -226,7 +224,7 @@ public class GoModelTest { Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.description, "an array model"); Assert.assertEquals(cm.vars.size(), 0); - // skip import test as import is not used by Go codegen + Assert.assertEquals(cm.imports.size(), 1); } @Test(description = "convert an map model") @@ -241,9 +239,8 @@ public class GoModelTest { Assert.assertEquals(cm.classname, "Sample"); Assert.assertEquals(cm.description, "a map model"); Assert.assertEquals(cm.vars.size(), 0); - // {{imports}} is not used in template - //Assert.assertEquals(cm.imports.size(), 2); - //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + Assert.assertEquals(cm.imports.size(), 1); + Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); } @DataProvider(name = "modelNames") diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml new file mode 100644 index 00000000000..bf84cf9c38c --- /dev/null +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -0,0 +1,792 @@ +swagger: '2.0' +info: + description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose.' + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +host: petstore.swagger.io +basePath: /v2 +tags: + - name: pet + description: Everything about your Pets + externalDocs: + description: Find out more + url: 'http://swagger.io' + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user + externalDocs: + description: Find out more about our store + url: 'http://swagger.io' +schemes: + - http +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: true + schema: + $ref: '#/definitions/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: true + schema: + $ref: '#/definitions/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + produces: + - application/xml + - application/json + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + collectionFormat: csv + responses: + '200': + description: successful operation + schema: + type: array + items: + $ref: '#/definitions/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByTags: + get: + tags: + - pet + summary: Finds Pets by tags + description: 'Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.' + operationId: findPetsByTags + produces: + - application/xml + - application/json + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + type: array + items: + type: string + collectionFormat: csv + responses: + '200': + description: successful operation + schema: + type: array + items: + $ref: '#/definitions/Pet' + '400': + description: Invalid tag value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + type: integer + format: int64 + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Pet' + '400': + description: Invalid ID supplied + '404': + description: Pet not found + security: + - api_key: [] + post: + tags: + - pet + summary: Updates a pet in the store with form data + description: '' + operationId: updatePetWithForm + consumes: + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + type: integer + format: int64 + - name: name + in: formData + description: Updated name of the pet + required: false + type: string + - name: status + in: formData + description: Updated status of the pet + required: false + type: string + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + produces: + - application/xml + - application/json + parameters: + - name: api_key + in: header + required: false + type: string + - name: petId + in: path + description: Pet id to delete + required: true + type: integer + format: int64 + responses: + '400': + description: Invalid pet value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + '/pet/{petId}/uploadImage': + post: + tags: + - pet + summary: uploads an image + description: '' + operationId: uploadFile + consumes: + - multipart/form-data + produces: + - application/json + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + type: integer + format: int64 + - name: additionalMetadata + in: formData + description: Additional data to pass to server + required: false + type: string + - name: file + in: formData + description: file to upload + required: false + type: file + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + produces: + - application/json + parameters: [] + responses: + '200': + description: successful operation + schema: + type: object + additionalProperties: + type: integer + format: int32 + security: + - api_key: [] + /store/order: + post: + tags: + - store + summary: Place an order for a pet + description: '' + operationId: placeOrder + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: order placed for purchasing the pet + required: true + schema: + $ref: '#/definitions/Order' + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Order' + '400': + description: Invalid Order + '/store/order/{orderId}': + get: + tags: + - store + summary: Find purchase order by ID + description: 'For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions' + operationId: getOrderById + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + type: integer + maximum: 5 + minimum: 1 + format: int64 + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Order' + '400': + description: Invalid ID supplied + '404': + description: Order not found + delete: + tags: + - store + summary: Delete purchase order by ID + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + type: string + minimum: 1 + responses: + '400': + description: Invalid ID supplied + '404': + description: Order not found + /user: + post: + tags: + - user + summary: Create user + description: This can only be done by the logged in user. + operationId: createUser + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Created user object + required: true + schema: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: true + schema: + type: array + items: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: true + schema: + type: array + items: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: query + description: The user name for login + required: true + type: string + - name: password + in: query + description: The password for login in clear text + required: true + type: string + responses: + '200': + description: successful operation + schema: + type: string + headers: + X-Rate-Limit: + type: integer + format: int32 + description: calls per hour allowed by the user + X-Expires-After: + type: string + format: date-time + description: date in UTC when toekn expires + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + produces: + - application/xml + - application/json + parameters: [] + responses: + default: + description: successful operation + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: 'The name that needs to be fetched. Use user1 for testing. ' + required: true + type: string + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/User' + '400': + description: Invalid username supplied + '404': + description: User not found + put: + tags: + - user + summary: Updated user + description: This can only be done by the logged in user. + operationId: updateUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + type: string + - in: body + name: body + description: Updated user object + required: true + schema: + $ref: '#/definitions/User' + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found +securityDefinitions: + petstore_auth: + type: oauth2 + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + flow: implicit + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header +definitions: + Order: + type: object + properties: + id: + type: integer + format: int64 + petId: + type: integer + format: int64 + quantity: + type: integer + format: int32 + shipDate: + type: string + format: date-time + status: + type: string + description: Order Status + enum: + - placed + - approved + - delivered + complete: + type: boolean + default: false + xml: + name: Order + Category: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Category + User: + type: object + properties: + id: + type: integer + format: int64 + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + type: integer + format: int32 + description: User Status + xml: + name: User + Tag: + type: object + properties: + id: + type: integer + format: int64 + name: + type: string + xml: + name: Tag + Pet: + type: object + required: + - name + - photoUrls + properties: + id: + type: integer + format: int64 + category: + $ref: '#/definitions/Category' + name: + type: string + example: doggie + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + tags: + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/definitions/Tag' + status: + type: string + description: pet status in the store + enum: + - available + - pending + - sold + xml: + name: Pet + ApiResponse: + type: object + properties: + code: + type: integer + format: int32 + type: + type: string + message: + type: string + '$special[model.name]': + properties: + '$special[property.name]': + type: integer + format: int64 + xml: + name: '$special[model.name]' + Return: + description: Model for testing reserved words + properties: + return: + type: integer + format: int32 + xml: + name: Return + Name: + description: Model for testing model name same as property name + required: + - name + properties: + name: + type: integer + format: int32 + snake_case: + readOnly: true + type: integer + format: int32 + xml: + name: Name + 200_response: + description: Model for testing model name starting with number + properties: + name: + type: integer + format: int32 + xml: + name: Name + Dog: + allOf: + - $ref: '#/definitions/Animal' + - type: object + properties: + breed: + type: string + Cat: + allOf: + - $ref: '#/definitions/Animal' + - type: object + properties: + declawed: + type: boolean + Animal: + type: object + discriminator: className + required: + - className + properties: + className: + type: string + format_test: + type: object + required: + - number + properties: + integer: + type: integer + int32: + type: integer + format: int32 + int64: + type: integer + format: int64 + number: + type: number + float: + type: number + format: float + double: + type: number + format: double + string: + type: string + byte: + type: string + format: byte + binary: + type: string + format: binary + date: + type: string + format: date + dateTime: + type: string + format: date-time + password: + type: string + format: password +externalDocs: + description: Find out more about Swagger + url: 'http://swagger.io' diff --git a/samples/client/petstore/android/default/pom.xml b/samples/client/petstore/android/default/pom.xml index f9c620b7528..afedf8f3027 100644 --- a/samples/client/petstore/android/default/pom.xml +++ b/samples/client/petstore/android/default/pom.xml @@ -110,7 +110,7 @@ io.swagger swagger-annotations - ${swagger-annotations-version} + ${swagger-core-version} com.google.code.gson @@ -145,7 +145,7 @@ - 1.5.4 + 1.5.8 2.3.1 4.8.1 1.0.0 diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java index 49ce07a07ae..17ff327a8aa 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/JsonUtil.java @@ -35,10 +35,22 @@ public class JsonUtil { public static Type getListTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); + if ("Animal".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + + if ("Cat".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + if ("Category".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } + if ("Dog".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + if ("InlineResponse200".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } @@ -81,10 +93,22 @@ public class JsonUtil { public static Type getTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); + if ("Animal".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("Cat".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + if ("Category".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } + if ("Dog".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + if ("InlineResponse200".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java index a28410fd0a9..848f1d2a6cc 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/api/UserApi.java @@ -258,7 +258,7 @@ public class UserApi { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. * @return User */ public User getUserByName (String username) throws ApiException { diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java new file mode 100644 index 00000000000..6f956f69f9e --- /dev/null +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Animal.java @@ -0,0 +1,36 @@ +package io.swagger.client.model; + + +import io.swagger.annotations.*; +import com.google.gson.annotations.SerializedName; + + +@ApiModel(description = "") +public class Animal { + + @SerializedName("className") + private String className = null; + + + /** + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(className).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java new file mode 100644 index 00000000000..b0cd7e96b43 --- /dev/null +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Cat.java @@ -0,0 +1,51 @@ +package io.swagger.client.model; + +import io.swagger.client.model.Animal; + +import io.swagger.annotations.*; +import com.google.gson.annotations.SerializedName; + + +@ApiModel(description = "") +public class Cat extends Animal { + + @SerializedName("className") + private String className = null; + @SerializedName("declawed") + private Boolean declawed = null; + + + /** + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + /** + **/ + @ApiModelProperty(value = "") + public Boolean getDeclawed() { + return declawed; + } + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" " + super.toString()).append("\n"); + sb.append(" className: ").append(className).append("\n"); + sb.append(" declawed: ").append(declawed).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java new file mode 100644 index 00000000000..07b2df5488a --- /dev/null +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Dog.java @@ -0,0 +1,51 @@ +package io.swagger.client.model; + +import io.swagger.client.model.Animal; + +import io.swagger.annotations.*; +import com.google.gson.annotations.SerializedName; + + +@ApiModel(description = "") +public class Dog extends Animal { + + @SerializedName("className") + private String className = null; + @SerializedName("breed") + private String breed = null; + + + /** + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + /** + **/ + @ApiModelProperty(value = "") + public String getBreed() { + return breed; + } + public void setBreed(String breed) { + this.breed = breed; + } + + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" " + super.toString()).append("\n"); + sb.append(" className: ").append(className).append("\n"); + sb.append(" breed: ").append(breed).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java index c4fd8ce357d..303d160d764 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -10,31 +10,42 @@ import com.google.gson.annotations.SerializedName; @ApiModel(description = "") public class InlineResponse200 { - @SerializedName("tags") - private List tags = null; + @SerializedName("photoUrls") + private List photoUrls = null; + @SerializedName("name") + private String name = null; @SerializedName("id") private Long id = null; @SerializedName("category") private Object category = null; + @SerializedName("tags") + private List tags = null; public enum StatusEnum { available, pending, sold, }; @SerializedName("status") private StatusEnum status = null; - @SerializedName("name") - private String name = null; - @SerializedName("photoUrls") - private List photoUrls = null; /** **/ @ApiModelProperty(value = "") - public List getTags() { - return tags; + public List getPhotoUrls() { + return photoUrls; } - public void setTags(List tags) { - this.tags = tags; + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + + /** + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; } @@ -60,6 +71,17 @@ public class InlineResponse200 { } + /** + **/ + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + + /** * pet status in the store **/ @@ -72,40 +94,18 @@ public class InlineResponse200 { } - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" tags: ").append(tags).append("\n"); + sb.append(" photoUrls: ").append(photoUrls).append("\n"); + sb.append(" name: ").append(name).append("\n"); sb.append(" id: ").append(id).append("\n"); sb.append(" category: ").append(category).append("\n"); + sb.append(" tags: ").append(tags).append("\n"); sb.append(" status: ").append(status).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append(" photoUrls: ").append(photoUrls).append("\n"); sb.append("}\n"); return sb.toString(); } diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java index 4a6e58b2a5e..6d3c93d9799 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Model200Response.java @@ -5,7 +5,10 @@ import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") +/** + * Model for testing model name starting with number + **/ +@ApiModel(description = "Model for testing model name starting with number") public class Model200Response { @SerializedName("name") diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java index 24763f3acb4..464b0cca25e 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/ModelReturn.java @@ -5,7 +5,10 @@ import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") +/** + * Model for testing reserved words + **/ +@ApiModel(description = "Model for testing reserved words") public class ModelReturn { @SerializedName("return") diff --git a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java index 9763aca7b34..1b320fb26ea 100644 --- a/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/android/default/src/main/java/io/swagger/client/model/Name.java @@ -5,7 +5,10 @@ import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") +/** + * Model for testing model name same as property name + **/ +@ApiModel(description = "Model for testing model name same as property name") public class Name { @SerializedName("name") diff --git a/samples/client/petstore/android/volley/build.gradle b/samples/client/petstore/android/volley/build.gradle index e678620cb00..f794267c737 100644 --- a/samples/client/petstore/android/volley/build.gradle +++ b/samples/client/petstore/android/volley/build.gradle @@ -6,10 +6,8 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:1.5.0' - + classpath 'com.android.tools.build:gradle:1.5.+' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3' - } } @@ -55,9 +53,10 @@ android { ext { swagger_annotations_version = "1.5.0" gson_version = "2.3.1" - httpclient_version = "4.3.3" + httpclient_version = "4.5.2" + httpcore_version = "4.4.4" volley_version = "1.0.19" - junit_version = "4.8.1" + junit_version = "4.12" robolectric_version = "3.0" concurrent_unit_version = "0.4.2" } @@ -65,7 +64,7 @@ ext { dependencies { compile "io.swagger:swagger-annotations:$swagger_annotations_version" compile "com.google.code.gson:gson:$gson_version" - compile "org.apache.httpcomponents:httpcore:$httpclient_version" + compile "org.apache.httpcomponents:httpcore:$httpcore_version" compile "org.apache.httpcomponents:httpmime:$httpclient_version" compile "com.mcxiaoke.volley:library:${volley_version}@aar" testCompile "junit:junit:$junit_version" diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java index 21ee5f36286..7ef69c6f0ab 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/ApiInvoker.java @@ -189,50 +189,14 @@ public class ApiInvoker { // Setup authentications (key: authentication name, value: authentication). INSTANCE.authentications = new HashMap(); - - - INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); - - - - - - INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - - - - - - - INSTANCE.authentications.put("test_http_basic", new HttpBasicAuth()); - - - - - INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); - - - - - - INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); - - - - - - INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); - - - - - - - // TODO: comment out below as OAuth does not exist //INSTANCE.authentications.put("petstore_auth", new OAuth()); - - + INSTANCE.authentications.put("test_api_client_id", new ApiKeyAuth("header", "x-test_api_client_id")); + INSTANCE.authentications.put("test_api_client_secret", new ApiKeyAuth("header", "x-test_api_client_secret")); + INSTANCE.authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + INSTANCE.authentications.put("test_http_basic", new HttpBasicAuth()); + INSTANCE.authentications.put("test_api_key_query", new ApiKeyAuth("query", "test_api_key_query")); + INSTANCE.authentications.put("test_api_key_header", new ApiKeyAuth("header", "test_api_key_header")); // Prevent the authentications from being modified. INSTANCE.authentications = Collections.unmodifiableMap(INSTANCE.authentications); } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java index 49ce07a07ae..318c23f957d 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/JsonUtil.java @@ -35,10 +35,26 @@ public class JsonUtil { public static Type getListTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); + if ("Animal".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + + if ("Cat".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + if ("Category".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } + if ("Dog".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + + if ("FormatTest".equalsIgnoreCase(className)) { + return new TypeToken>(){}.getType(); + } + if ("InlineResponse200".equalsIgnoreCase(className)) { return new TypeToken>(){}.getType(); } @@ -81,10 +97,26 @@ public class JsonUtil { public static Type getTypeForDeserialization(Class cls) { String className = cls.getSimpleName(); + if ("Animal".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("Cat".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + if ("Category".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } + if ("Dog".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + + if ("FormatTest".equalsIgnoreCase(className)) { + return new TypeToken(){}.getType(); + } + if ("InlineResponse200".equalsIgnoreCase(className)) { return new TypeToken(){}.getType(); } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java index b0a72ab7d8a..2f39cf7cab1 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/PetApi.java @@ -45,7 +45,6 @@ public class PetApi { return basePath; } - /** * Add a new pet to the store * @@ -66,9 +65,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/json","application/xml" @@ -84,8 +81,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -102,7 +98,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -130,9 +129,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/json","application/xml" @@ -148,8 +145,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -158,11 +154,7 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -174,7 +166,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Fake endpoint to test byte array in body parameter for adding a new pet to the store * @@ -186,7 +177,7 @@ public class PetApi { // create path and map variables - String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); + String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); // query params List queryParams = new ArrayList(); @@ -195,9 +186,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/json","application/xml" @@ -213,8 +202,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -231,7 +219,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -250,7 +241,7 @@ public class PetApi { // create path and map variables - String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); + String path = "/pet?testing_byte_array=true".replaceAll("\\{format\\}","json"); // query params List queryParams = new ArrayList(); @@ -259,9 +250,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/json","application/xml" @@ -277,8 +266,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -287,11 +275,7 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -303,7 +287,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Deletes a pet * @@ -331,11 +314,8 @@ public class PetApi { // form params Map formParams = new HashMap(); - - headerParams.put("api_key", ApiInvoker.parameterToString(apiKey)); - String[] contentTypes = { @@ -351,8 +331,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -369,7 +348,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -403,11 +385,8 @@ public class PetApi { // form params Map formParams = new HashMap(); - - headerParams.put("api_key", ApiInvoker.parameterToString(apiKey)); - String[] contentTypes = { @@ -423,8 +402,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -433,11 +411,7 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -449,7 +423,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Finds Pets by status * Multiple status values can be provided with comma separated strings @@ -470,11 +443,8 @@ public class PetApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status)); - - String[] contentTypes = { @@ -490,8 +460,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -508,7 +477,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -536,11 +508,8 @@ public class PetApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("multi", "status", status)); - - String[] contentTypes = { @@ -556,8 +525,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -566,16 +534,11 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -587,7 +550,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Finds Pets by tags * Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. @@ -608,11 +570,8 @@ public class PetApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags)); - - String[] contentTypes = { @@ -628,8 +587,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -646,7 +604,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -674,11 +635,8 @@ public class PetApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("multi", "tags", tags)); - - String[] contentTypes = { @@ -694,8 +652,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -704,16 +661,11 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((List) ApiInvoker.deserialize(localVarResponse, "array", Pet.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -725,7 +677,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Find pet by ID * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -752,9 +703,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -770,10 +719,9 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -788,7 +736,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -822,9 +773,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -840,26 +789,20 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((Pet) ApiInvoker.deserialize(localVarResponse, "", Pet.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -871,7 +814,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -889,7 +831,7 @@ public class PetApi { // create path and map variables - String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); // query params List queryParams = new ArrayList(); @@ -898,9 +840,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -916,10 +856,9 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -934,7 +873,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -959,7 +901,7 @@ public class PetApi { // create path and map variables - String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + String path = "/pet/{petId}?response=inline_arbitrary_object".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); // query params List queryParams = new ArrayList(); @@ -968,9 +910,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -986,26 +926,20 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((InlineResponse200) ApiInvoker.deserialize(localVarResponse, "", InlineResponse200.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -1017,7 +951,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Fake endpoint to test byte array return by 'Find pet by ID' * Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions @@ -1035,7 +968,7 @@ public class PetApi { // create path and map variables - String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); // query params List queryParams = new ArrayList(); @@ -1044,9 +977,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -1062,10 +993,9 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -1080,7 +1010,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -1105,7 +1038,7 @@ public class PetApi { // create path and map variables - String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); + String path = "/pet/{petId}?testing_byte_array=true".replaceAll("\\{format\\}","json").replaceAll("\\{" + "petId" + "\\}", apiInvoker.escapeString(petId.toString())); // query params List queryParams = new ArrayList(); @@ -1114,9 +1047,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -1132,26 +1063,20 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "api_key", "petstore_auth" }; + String[] authNames = new String[] { "petstore_auth", "api_key" }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((byte[]) ApiInvoker.deserialize(localVarResponse, "", byte[].class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -1163,7 +1088,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Update an existing pet * @@ -1184,9 +1108,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/json","application/xml" @@ -1202,8 +1124,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -1220,7 +1141,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -1248,9 +1172,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/json","application/xml" @@ -1266,8 +1188,7 @@ public class PetApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "petstore_auth" }; @@ -1276,11 +1197,7 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -1292,7 +1209,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Updates a pet in the store with form data * @@ -1321,9 +1237,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/x-www-form-urlencoded" @@ -1348,8 +1262,7 @@ public class PetApi { } else { // normal form params formParams.put("name", ApiInvoker.parameterToString(name)); - formParams.put("status", ApiInvoker.parameterToString(status)); - +formParams.put("status", ApiInvoker.parameterToString(status)); } String[] authNames = new String[] { "petstore_auth" }; @@ -1367,7 +1280,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -1401,9 +1317,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "application/x-www-form-urlencoded" @@ -1428,8 +1342,7 @@ public class PetApi { } else { // normal form params formParams.put("name", ApiInvoker.parameterToString(name)); - formParams.put("status", ApiInvoker.parameterToString(status)); - +formParams.put("status", ApiInvoker.parameterToString(status)); } String[] authNames = new String[] { "petstore_auth" }; @@ -1439,11 +1352,7 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -1455,7 +1364,6 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * uploads an image * @@ -1484,9 +1392,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "multipart/form-data" @@ -1511,8 +1417,7 @@ public class PetApi { } else { // normal form params formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata)); - - + } String[] authNames = new String[] { "petstore_auth" }; @@ -1530,7 +1435,10 @@ public class PetApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -1564,9 +1472,7 @@ public class PetApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { "multipart/form-data" @@ -1591,8 +1497,7 @@ public class PetApi { } else { // normal form params formParams.put("additionalMetadata", ApiInvoker.parameterToString(additionalMetadata)); - - + } String[] authNames = new String[] { "petstore_auth" }; @@ -1602,11 +1507,7 @@ public class PetApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -1618,5 +1519,4 @@ public class PetApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java index e0aa403200a..2d7b1e7683f 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/StoreApi.java @@ -44,7 +44,6 @@ public class StoreApi { return basePath; } - /** * Delete purchase order by ID * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors @@ -71,9 +70,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -89,8 +86,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -107,7 +103,10 @@ public class StoreApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -141,9 +140,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -159,8 +156,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -169,11 +165,7 @@ public class StoreApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -185,7 +177,6 @@ public class StoreApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Finds orders by status * A single status value can be provided as a string @@ -206,11 +197,8 @@ public class StoreApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status)); - - String[] contentTypes = { @@ -226,8 +214,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; @@ -244,7 +231,10 @@ public class StoreApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -272,11 +262,8 @@ public class StoreApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("", "status", status)); - - String[] contentTypes = { @@ -292,8 +279,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; @@ -302,16 +288,11 @@ public class StoreApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((List) ApiInvoker.deserialize(localVarResponse, "array", Order.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -323,7 +304,6 @@ public class StoreApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Returns pet inventories by status * Returns a map of status codes to quantities @@ -343,9 +323,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -361,8 +339,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "api_key" }; @@ -379,7 +356,10 @@ public class StoreApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -407,9 +387,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -425,8 +403,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "api_key" }; @@ -435,16 +412,11 @@ public class StoreApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((Map) ApiInvoker.deserialize(localVarResponse, "map", Map.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -456,7 +428,6 @@ public class StoreApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Fake endpoint to test arbitrary object return by 'Get inventory' * Returns an arbitrary object which is actually a map of status codes to quantities @@ -467,7 +438,7 @@ public class StoreApi { // create path and map variables - String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); + String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); // query params List queryParams = new ArrayList(); @@ -476,9 +447,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -494,8 +463,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "api_key" }; @@ -512,7 +480,10 @@ public class StoreApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -531,7 +502,7 @@ public class StoreApi { // create path and map variables - String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); + String path = "/store/inventory?response=arbitrary_object".replaceAll("\\{format\\}","json"); // query params List queryParams = new ArrayList(); @@ -540,9 +511,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -558,8 +527,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "api_key" }; @@ -568,16 +536,11 @@ public class StoreApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((Object) ApiInvoker.deserialize(localVarResponse, "", Object.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -589,10 +552,9 @@ public class StoreApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched * @return Order */ @@ -616,9 +578,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -634,10 +594,9 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" }; + String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" }; try { String localVarResponse = apiInvoker.invokeAPI (basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames); @@ -652,7 +611,10 @@ public class StoreApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -662,7 +624,7 @@ public class StoreApi { /** * Find purchase order by ID - * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions * @param orderId ID of pet that needs to be fetched */ public void getOrderById (String orderId, final Response.Listener responseListener, final Response.ErrorListener errorListener) { @@ -686,9 +648,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -704,26 +664,20 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } - String[] authNames = new String[] { "test_api_key_header", "test_api_key_query" }; + String[] authNames = new String[] { "test_api_key_query", "test_api_key_header" }; try { apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames, new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((Order) ApiInvoker.deserialize(localVarResponse, "", Order.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -735,7 +689,6 @@ public class StoreApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Place an order for a pet * @@ -756,9 +709,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -774,8 +725,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; @@ -792,7 +742,10 @@ public class StoreApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -820,9 +773,7 @@ public class StoreApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -838,8 +789,7 @@ public class StoreApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "test_api_client_id", "test_api_client_secret" }; @@ -848,16 +798,11 @@ public class StoreApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((Order) ApiInvoker.deserialize(localVarResponse, "", Order.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -869,5 +814,4 @@ public class StoreApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java index 0938e600dd2..33575e314b9 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/api/UserApi.java @@ -44,7 +44,6 @@ public class UserApi { return basePath; } - /** * Create user * This can only be done by the logged in user. @@ -65,9 +64,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -83,8 +80,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -101,7 +97,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -129,9 +128,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -147,8 +144,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -157,11 +153,7 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -173,7 +165,6 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Creates list of users with given input array * @@ -194,9 +185,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -212,8 +201,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -230,7 +218,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -258,9 +249,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -276,8 +265,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -286,11 +274,7 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -302,7 +286,6 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Creates list of users with given input array * @@ -323,9 +306,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -341,8 +322,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -359,7 +339,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -387,9 +370,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -405,8 +386,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -415,11 +395,7 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -431,7 +407,6 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Delete user * This can only be done by the logged in user. @@ -458,9 +433,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -476,8 +449,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "test_http_basic" }; @@ -494,7 +466,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -528,9 +503,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -546,8 +519,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { "test_http_basic" }; @@ -556,11 +528,7 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -572,11 +540,10 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. * @return User */ public User getUserByName (String username) throws TimeoutException, ExecutionException, InterruptedException, ApiException { @@ -599,9 +566,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -617,8 +582,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -635,7 +599,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -646,7 +613,7 @@ public class UserApi { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. + * @param username The name that needs to be fetched. Use user1 for testing. */ public void getUserByName (String username, final Response.Listener responseListener, final Response.ErrorListener errorListener) { Object postBody = null; @@ -669,9 +636,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -687,8 +652,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -697,16 +661,11 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((User) ApiInvoker.deserialize(localVarResponse, "", User.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -718,7 +677,6 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Logs user into the system * @@ -740,13 +698,9 @@ public class UserApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("", "username", username)); - queryParams.addAll(ApiInvoker.parameterToPairs("", "password", password)); - - String[] contentTypes = { @@ -762,8 +716,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -780,7 +733,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -808,13 +764,9 @@ public class UserApi { // form params Map formParams = new HashMap(); - queryParams.addAll(ApiInvoker.parameterToPairs("", "username", username)); - queryParams.addAll(ApiInvoker.parameterToPairs("", "password", password)); - - String[] contentTypes = { @@ -830,8 +782,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -840,16 +791,11 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - try { responseListener.onResponse((String) ApiInvoker.deserialize(localVarResponse, "", String.class)); - - - } catch (ApiException exception) { errorListener.onErrorResponse(new VolleyError(exception)); } - } }, new Response.ErrorListener() { @Override @@ -861,7 +807,6 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Logs out current logged in user session * @@ -881,9 +826,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -899,8 +842,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -917,7 +859,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -945,9 +890,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -963,8 +906,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -973,11 +915,7 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -989,7 +927,6 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - /** * Updated user * This can only be done by the logged in user. @@ -1017,9 +954,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -1035,8 +970,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -1053,7 +987,10 @@ public class UserApi { throw ex; } catch (ExecutionException ex) { if(ex.getCause() instanceof VolleyError) { - throw new ApiException(((VolleyError) ex.getCause()).networkResponse.statusCode, ((VolleyError) ex.getCause()).getMessage()); + VolleyError volleyError = (VolleyError)ex.getCause(); + if (volleyError.networkResponse != null) { + throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage()); + } } throw ex; } catch (TimeoutException ex) { @@ -1087,9 +1024,7 @@ public class UserApi { // form params Map formParams = new HashMap(); - - String[] contentTypes = { @@ -1105,8 +1040,7 @@ public class UserApi { postBody = httpEntity; } else { // normal form params - - } + } String[] authNames = new String[] { }; @@ -1115,11 +1049,7 @@ public class UserApi { new Response.Listener() { @Override public void onResponse(String localVarResponse) { - - responseListener.onResponse(localVarResponse); - - } }, new Response.ErrorListener() { @Override @@ -1131,5 +1061,4 @@ public class UserApi { errorListener.onErrorResponse(new VolleyError(ex)); } } - } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java new file mode 100644 index 00000000000..80b84fb850a --- /dev/null +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Animal.java @@ -0,0 +1,34 @@ +package io.swagger.client.model; + + +import io.swagger.annotations.*; +import com.google.gson.annotations.SerializedName; + + +@ApiModel(description = "") +public class Animal { + + @SerializedName("className") + private String className = null; + + /** + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(className).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java new file mode 100644 index 00000000000..449d6bddaa7 --- /dev/null +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Cat.java @@ -0,0 +1,48 @@ +package io.swagger.client.model; + +import io.swagger.client.model.Animal; + +import io.swagger.annotations.*; +import com.google.gson.annotations.SerializedName; + + +@ApiModel(description = "") +public class Cat extends Animal { + + @SerializedName("className") + private String className = null; + @SerializedName("declawed") + private Boolean declawed = null; + + /** + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + @ApiModelProperty(value = "") + public Boolean getDeclawed() { + return declawed; + } + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" " + super.toString()).append("\n"); + sb.append(" className: ").append(className).append("\n"); + sb.append(" declawed: ").append(declawed).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java index 44c71e8a620..b3fa2f93341 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Category.java @@ -13,7 +13,6 @@ public class Category { @SerializedName("name") private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -24,7 +23,6 @@ public class Category { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -35,7 +33,6 @@ public class Category { this.name = name; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java new file mode 100644 index 00000000000..8f35b9b0ea9 --- /dev/null +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Dog.java @@ -0,0 +1,48 @@ +package io.swagger.client.model; + +import io.swagger.client.model.Animal; + +import io.swagger.annotations.*; +import com.google.gson.annotations.SerializedName; + + +@ApiModel(description = "") +public class Dog extends Animal { + + @SerializedName("className") + private String className = null; + @SerializedName("breed") + private String breed = null; + + /** + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getBreed() { + return breed; + } + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" " + super.toString()).append("\n"); + sb.append(" className: ").append(className).append("\n"); + sb.append(" breed: ").append(breed).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java new file mode 100644 index 00000000000..3f362afc925 --- /dev/null +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/FormatTest.java @@ -0,0 +1,179 @@ +package io.swagger.client.model; + +import java.math.BigDecimal; +import java.util.Date; + +import io.swagger.annotations.*; +import com.google.gson.annotations.SerializedName; + + +@ApiModel(description = "") +public class FormatTest { + + @SerializedName("integer") + private Integer integer = null; + @SerializedName("int32") + private Integer int32 = null; + @SerializedName("int64") + private Long int64 = null; + @SerializedName("number") + private BigDecimal number = null; + @SerializedName("float") + private Float _float = null; + @SerializedName("double") + private Double _double = null; + @SerializedName("string") + private String string = null; + @SerializedName("byte") + private byte[] _byte = null; + @SerializedName("binary") + private byte[] binary = null; + @SerializedName("date") + private Date date = null; + @SerializedName("dateTime") + private Date dateTime = null; + @SerializedName("password") + private String password = null; + + /** + **/ + @ApiModelProperty(value = "") + public Integer getInteger() { + return integer; + } + public void setInteger(Integer integer) { + this.integer = integer; + } + + /** + **/ + @ApiModelProperty(value = "") + public Integer getInt32() { + return int32; + } + public void setInt32(Integer int32) { + this.int32 = int32; + } + + /** + **/ + @ApiModelProperty(value = "") + public Long getInt64() { + return int64; + } + public void setInt64(Long int64) { + this.int64 = int64; + } + + /** + **/ + @ApiModelProperty(required = true, value = "") + public BigDecimal getNumber() { + return number; + } + public void setNumber(BigDecimal number) { + this.number = number; + } + + /** + **/ + @ApiModelProperty(value = "") + public Float getFloat() { + return _float; + } + public void setFloat(Float _float) { + this._float = _float; + } + + /** + **/ + @ApiModelProperty(value = "") + public Double getDouble() { + return _double; + } + public void setDouble(Double _double) { + this._double = _double; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getString() { + return string; + } + public void setString(String string) { + this.string = string; + } + + /** + **/ + @ApiModelProperty(value = "") + public byte[] getByte() { + return _byte; + } + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + /** + **/ + @ApiModelProperty(value = "") + public byte[] getBinary() { + return binary; + } + public void setBinary(byte[] binary) { + this.binary = binary; + } + + /** + **/ + @ApiModelProperty(value = "") + public Date getDate() { + return date; + } + public void setDate(Date date) { + this.date = date; + } + + /** + **/ + @ApiModelProperty(value = "") + public Date getDateTime() { + return dateTime; + } + public void setDateTime(Date dateTime) { + this.dateTime = dateTime; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getPassword() { + return password; + } + public void setPassword(String password) { + this.password = password; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(integer).append("\n"); + sb.append(" int32: ").append(int32).append("\n"); + sb.append(" int64: ").append(int64).append("\n"); + sb.append(" number: ").append(number).append("\n"); + sb.append(" _float: ").append(_float).append("\n"); + sb.append(" _double: ").append(_double).append("\n"); + sb.append(" string: ").append(string).append("\n"); + sb.append(" _byte: ").append(_byte).append("\n"); + sb.append(" binary: ").append(binary).append("\n"); + sb.append(" date: ").append(date).append("\n"); + sb.append(" dateTime: ").append(dateTime).append("\n"); + sb.append(" password: ").append(password).append("\n"); + sb.append("}\n"); + return sb.toString(); + } +} diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java index c4fd8ce357d..85b56f0e488 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/InlineResponse200.java @@ -10,34 +10,42 @@ import com.google.gson.annotations.SerializedName; @ApiModel(description = "") public class InlineResponse200 { - @SerializedName("tags") - private List tags = null; + @SerializedName("photoUrls") + private List photoUrls = null; + @SerializedName("name") + private String name = null; @SerializedName("id") private Long id = null; @SerializedName("category") private Object category = null; + @SerializedName("tags") + private List tags = null; public enum StatusEnum { available, pending, sold, }; @SerializedName("status") private StatusEnum status = null; - @SerializedName("name") - private String name = null; - @SerializedName("photoUrls") - private List photoUrls = null; - /** **/ @ApiModelProperty(value = "") - public List getTags() { - return tags; + public List getPhotoUrls() { + return photoUrls; } - public void setTags(List tags) { - this.tags = tags; + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + /** + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + public void setName(String name) { + this.name = name; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -48,7 +56,6 @@ public class InlineResponse200 { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -59,7 +66,16 @@ public class InlineResponse200 { this.category = category; } - + /** + **/ + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + public void setTags(List tags) { + this.tags = tags; + } + /** * pet status in the store **/ @@ -71,41 +87,18 @@ public class InlineResponse200 { this.status = status; } - - /** - **/ - @ApiModelProperty(value = "") - public String getName() { - return name; - } - public void setName(String name) { - this.name = name; - } - - - /** - **/ - @ApiModelProperty(value = "") - public List getPhotoUrls() { - return photoUrls; - } - public void setPhotoUrls(List photoUrls) { - this.photoUrls = photoUrls; - } - - @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class InlineResponse200 {\n"); - sb.append(" tags: ").append(tags).append("\n"); + sb.append(" photoUrls: ").append(photoUrls).append("\n"); + sb.append(" name: ").append(name).append("\n"); sb.append(" id: ").append(id).append("\n"); sb.append(" category: ").append(category).append("\n"); + sb.append(" tags: ").append(tags).append("\n"); sb.append(" status: ").append(status).append("\n"); - sb.append(" name: ").append(name).append("\n"); - sb.append(" photoUrls: ").append(photoUrls).append("\n"); sb.append("}\n"); return sb.toString(); } diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java index 4a6e58b2a5e..31664d1e6cf 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Model200Response.java @@ -5,13 +5,15 @@ import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") +/** + * Model for testing model name starting with number + **/ +@ApiModel(description = "Model for testing model name starting with number") public class Model200Response { @SerializedName("name") private Integer name = null; - /** **/ @ApiModelProperty(value = "") @@ -22,7 +24,6 @@ public class Model200Response { this.name = name; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java index 24763f3acb4..f0b0802096f 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/ModelReturn.java @@ -5,13 +5,15 @@ import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") +/** + * Model for testing reserved words + **/ +@ApiModel(description = "Model for testing reserved words") public class ModelReturn { @SerializedName("return") private Integer _return = null; - /** **/ @ApiModelProperty(value = "") @@ -22,7 +24,6 @@ public class ModelReturn { this._return = _return; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java index 9763aca7b34..d9f6153eb45 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Name.java @@ -5,7 +5,10 @@ import io.swagger.annotations.*; import com.google.gson.annotations.SerializedName; -@ApiModel(description = "") +/** + * Model for testing model name same as property name + **/ +@ApiModel(description = "Model for testing model name same as property name") public class Name { @SerializedName("name") @@ -13,10 +16,9 @@ public class Name { @SerializedName("snake_case") private Integer snakeCase = null; - /** **/ - @ApiModelProperty(value = "") + @ApiModelProperty(required = true, value = "") public Integer getName() { return name; } @@ -24,7 +26,6 @@ public class Name { this.name = name; } - /** **/ @ApiModelProperty(value = "") @@ -35,7 +36,6 @@ public class Name { this.snakeCase = snakeCase; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java index f3f42db615c..be6f1b96db2 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Order.java @@ -25,7 +25,6 @@ public class Order { @SerializedName("complete") private Boolean complete = null; - /** **/ @ApiModelProperty(value = "") @@ -36,7 +35,6 @@ public class Order { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -47,7 +45,6 @@ public class Order { this.petId = petId; } - /** **/ @ApiModelProperty(value = "") @@ -58,7 +55,6 @@ public class Order { this.quantity = quantity; } - /** **/ @ApiModelProperty(value = "") @@ -69,7 +65,6 @@ public class Order { this.shipDate = shipDate; } - /** * Order Status **/ @@ -81,7 +76,6 @@ public class Order { this.status = status; } - /** **/ @ApiModelProperty(value = "") @@ -92,7 +86,6 @@ public class Order { this.complete = complete; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java index 20865ad5434..425b11a6ddc 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Pet.java @@ -27,7 +27,6 @@ public class Pet { @SerializedName("status") private StatusEnum status = null; - /** **/ @ApiModelProperty(value = "") @@ -38,7 +37,6 @@ public class Pet { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -49,7 +47,6 @@ public class Pet { this.category = category; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -60,7 +57,6 @@ public class Pet { this.name = name; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -71,7 +67,6 @@ public class Pet { this.photoUrls = photoUrls; } - /** **/ @ApiModelProperty(value = "") @@ -82,7 +77,6 @@ public class Pet { this.tags = tags; } - /** * pet status in the store **/ @@ -94,7 +88,6 @@ public class Pet { this.status = status; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java index d804bdd8765..78aae71a5c5 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/SpecialModelName.java @@ -11,7 +11,6 @@ public class SpecialModelName { @SerializedName("$special[property.name]") private Long specialPropertyName = null; - /** **/ @ApiModelProperty(value = "") @@ -22,7 +21,6 @@ public class SpecialModelName { this.specialPropertyName = specialPropertyName; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java index 7c9651b1ba8..2d21e6240db 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/Tag.java @@ -13,7 +13,6 @@ public class Tag { @SerializedName("name") private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -24,7 +23,6 @@ public class Tag { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -35,7 +33,6 @@ public class Tag { this.name = name; } - @Override public String toString() { diff --git a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java index dc022697eb0..d2b89faec07 100644 --- a/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java +++ b/samples/client/petstore/android/volley/src/main/java/io/swagger/client/model/User.java @@ -25,7 +25,6 @@ public class User { @SerializedName("userStatus") private Integer userStatus = null; - /** **/ @ApiModelProperty(value = "") @@ -36,7 +35,6 @@ public class User { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -47,7 +45,6 @@ public class User { this.username = username; } - /** **/ @ApiModelProperty(value = "") @@ -58,7 +55,6 @@ public class User { this.firstName = firstName; } - /** **/ @ApiModelProperty(value = "") @@ -69,7 +65,6 @@ public class User { this.lastName = lastName; } - /** **/ @ApiModelProperty(value = "") @@ -80,7 +75,6 @@ public class User { this.email = email; } - /** **/ @ApiModelProperty(value = "") @@ -91,7 +85,6 @@ public class User { this.password = password; } - /** **/ @ApiModelProperty(value = "") @@ -102,7 +95,6 @@ public class User { this.phone = phone; } - /** * User Status **/ @@ -114,7 +106,6 @@ public class User { this.userStatus = userStatus; } - @Override public String toString() { diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs index b09b31264c3..2a513818a31 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/PetApi.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using IO.Swagger.Client; @@ -7,57 +6,17 @@ using IO.Swagger.Model; namespace IO.Swagger.Api { - /// /// Represents a collection of functions to interact with the API endpoints /// public interface IPetApi { - - /// - /// Update an existing pet - /// - /// Pet object that needs to be added to the store - /// - void UpdatePet (Pet body); - /// /// Add a new pet to the store /// /// Pet object that needs to be added to the store /// void AddPet (Pet body); - - /// - /// Finds Pets by status Multiple status values can be provided with comma seperated strings - /// - /// Status values that need to be considered for filter - /// List<Pet> - List FindPetsByStatus (List status); - - /// - /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - /// - /// Tags to filter by - /// List<Pet> - List FindPetsByTags (List tags); - - /// - /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// ID of pet that needs to be fetched - /// Pet - Pet GetPetById (long? petId); - - /// - /// Updates a pet in the store with form data - /// - /// ID of pet that needs to be updated - /// Updated name of the pet - /// Updated status of the pet - /// - void UpdatePetWithForm (string petId, string name, string status); - /// /// Deletes a pet /// @@ -65,16 +24,46 @@ namespace IO.Swagger.Api /// /// void DeletePet (long? petId, string apiKey); - + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// List<Pet> + List FindPetsByStatus (List status); + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// List<Pet> + List FindPetsByTags (List tags); + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Pet + Pet GetPetById (long? petId); + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// + void UpdatePet (Pet body); + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet + /// Updated status of the pet + /// + void UpdatePetWithForm (long? petId, string name, string status); /// /// uploads an image /// /// ID of pet to update /// Additional data to pass to server /// file to upload - /// - void UploadFile (long? petId, string additionalMetadata, Stream file); - + /// ApiResponse + ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file); } /// @@ -130,47 +119,6 @@ namespace IO.Swagger.Api /// An instance of the ApiClient public ApiClient ApiClient {get; set;} - - /// - /// Update an existing pet - /// - /// Pet object that needs to be added to the store - /// - public void UpdatePet (Pet body) - { - - - var path = "/pet"; - path = path.Replace("{format}", "json"); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - postBody = ApiClient.Serialize(body); // http body (model) parameter - - - // authentication setting, if any - String[] authSettings = new String[] { "petstore_auth" }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage); - - return; - } - - /// /// Add a new pet to the store /// @@ -179,22 +127,20 @@ namespace IO.Swagger.Api public void AddPet (Pet body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling AddPet"); + var path = "/pet"; path = path.Replace("{format}", "json"); - - + var queryParams = new Dictionary(); var headerParams = new Dictionary(); var formParams = new Dictionary(); var fileParams = new Dictionary(); String postBody = null; - - - - postBody = ApiClient.Serialize(body); // http body (model) parameter - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { "petstore_auth" }; @@ -210,177 +156,6 @@ namespace IO.Swagger.Api return; } - - /// - /// Finds Pets by status Multiple status values can be provided with comma seperated strings - /// - /// Status values that need to be considered for filter - /// List<Pet> - public List FindPetsByStatus (List status) - { - - - var path = "/pet/findByStatus"; - path = path.Replace("{format}", "json"); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter - - - - - - // authentication setting, if any - String[] authSettings = new String[] { "petstore_auth" }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage); - - return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers); - } - - - /// - /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. - /// - /// Tags to filter by - /// List<Pet> - public List FindPetsByTags (List tags) - { - - - var path = "/pet/findByTags"; - path = path.Replace("{format}", "json"); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter - - - - - - // authentication setting, if any - String[] authSettings = new String[] { "petstore_auth" }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage); - - return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers); - } - - - /// - /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// ID of pet that needs to be fetched - /// Pet - public Pet GetPetById (long? petId) - { - - // verify the required parameter 'petId' is set - if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById"); - - - var path = "/pet/{petId}"; - path = path.Replace("{format}", "json"); - path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - - - // authentication setting, if any - String[] authSettings = new String[] { "api_key" }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage); - - return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers); - } - - - /// - /// Updates a pet in the store with form data - /// - /// ID of pet that needs to be updated - /// Updated name of the pet - /// Updated status of the pet - /// - public void UpdatePetWithForm (string petId, string name, string status) - { - - // verify the required parameter 'petId' is set - if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm"); - - - var path = "/pet/{petId}"; - path = path.Replace("{format}", "json"); - path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter - if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter - - - - // authentication setting, if any - String[] authSettings = new String[] { "petstore_auth" }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage); - - return; - } - - /// /// Deletes a pet /// @@ -397,7 +172,6 @@ namespace IO.Swagger.Api var path = "/pet/{petId}"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); - var queryParams = new Dictionary(); var headerParams = new Dictionary(); @@ -405,12 +179,8 @@ namespace IO.Swagger.Api var fileParams = new Dictionary(); String postBody = null; - - if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter - - - - + if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter + // authentication setting, if any String[] authSettings = new String[] { "petstore_auth" }; @@ -425,15 +195,203 @@ namespace IO.Swagger.Api return; } - + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// List<Pet> + public List FindPetsByStatus (List status) + { + + // verify the required parameter 'status' is set + if (status == null) throw new ApiException(400, "Missing required parameter 'status' when calling FindPetsByStatus"); + + + var path = "/pet/findByStatus"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage); + + return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers); + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// List<Pet> + public List FindPetsByTags (List tags) + { + + // verify the required parameter 'tags' is set + if (tags == null) throw new ApiException(400, "Missing required parameter 'tags' when calling FindPetsByTags"); + + + var path = "/pet/findByTags"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage); + + return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers); + } + + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Pet + public Pet GetPetById (long? petId) + { + + // verify the required parameter 'petId' is set + if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById"); + + + var path = "/pet/{petId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { "api_key" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage); + + return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers); + } + + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// + public void UpdatePet (Pet body) + { + + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling UpdatePet"); + + + var path = "/pet"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(body); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet + /// Updated status of the pet + /// + public void UpdatePetWithForm (long? petId, string name, string status) + { + + // verify the required parameter 'petId' is set + if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm"); + + + var path = "/pet/{petId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter +if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + /// /// uploads an image /// /// ID of pet to update /// Additional data to pass to server /// file to upload - /// - public void UploadFile (long? petId, string additionalMetadata, Stream file) + /// ApiResponse + public ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file) { // verify the required parameter 'petId' is set @@ -443,7 +401,6 @@ namespace IO.Swagger.Api var path = "/pet/{petId}/uploadImage"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); - var queryParams = new Dictionary(); var headerParams = new Dictionary(); @@ -451,13 +408,9 @@ namespace IO.Swagger.Api var fileParams = new Dictionary(); String postBody = null; - - - if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter - if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file)); - - - + if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter +if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file)); + // authentication setting, if any String[] authSettings = new String[] { "petstore_auth" }; @@ -469,10 +422,8 @@ namespace IO.Swagger.Api else if (((int)response.StatusCode) == 0) throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage); - return; + return (ApiResponse) ApiClient.Deserialize(response.Content, typeof(ApiResponse), response.Headers); } - } - } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs index ba269cc2b0c..0f9cb2339be 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/StoreApi.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using IO.Swagger.Client; @@ -7,40 +6,34 @@ using IO.Swagger.Model; namespace IO.Swagger.Api { - /// /// Represents a collection of functions to interact with the API endpoints /// public interface IStoreApi { - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Dictionary<String, int?> - Dictionary GetInventory (); - - /// - /// Place an order for a pet - /// - /// order placed for purchasing the pet - /// Order - Order PlaceOrder (Order body); - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// ID of pet that needs to be fetched - /// Order - Order GetOrderById (string orderId); - /// /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors /// /// ID of the order that needs to be deleted /// void DeleteOrder (string orderId); - + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Dictionary<String, int?> + Dictionary GetInventory (); + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// ID of pet that needs to be fetched + /// Order + Order GetOrderById (long? orderId); + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Order + Order PlaceOrder (Order body); } /// @@ -96,128 +89,6 @@ namespace IO.Swagger.Api /// An instance of the ApiClient public ApiClient ApiClient {get; set;} - - /// - /// Returns pet inventories by status Returns a map of status codes to quantities - /// - /// Dictionary<String, int?> - public Dictionary GetInventory () - { - - - var path = "/store/inventory"; - path = path.Replace("{format}", "json"); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - - - // authentication setting, if any - String[] authSettings = new String[] { "api_key" }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage); - - return (Dictionary) ApiClient.Deserialize(response.Content, typeof(Dictionary), response.Headers); - } - - - /// - /// Place an order for a pet - /// - /// order placed for purchasing the pet - /// Order - public Order PlaceOrder (Order body) - { - - - var path = "/store/order"; - path = path.Replace("{format}", "json"); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - postBody = ApiClient.Serialize(body); // http body (model) parameter - - - // authentication setting, if any - String[] authSettings = new String[] { }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage); - - return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers); - } - - - /// - /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - /// - /// ID of pet that needs to be fetched - /// Order - public Order GetOrderById (string orderId) - { - - // verify the required parameter 'orderId' is set - if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById"); - - - var path = "/store/order/{orderId}"; - path = path.Replace("{format}", "json"); - path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId)); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - - - // authentication setting, if any - String[] authSettings = new String[] { }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage); - - return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers); - } - - /// /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors /// @@ -233,7 +104,6 @@ namespace IO.Swagger.Api var path = "/store/order/{orderId}"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId)); - var queryParams = new Dictionary(); var headerParams = new Dictionary(); @@ -241,11 +111,7 @@ namespace IO.Swagger.Api var fileParams = new Dictionary(); String postBody = null; - - - - - + // authentication setting, if any String[] authSettings = new String[] { }; @@ -260,7 +126,111 @@ namespace IO.Swagger.Api return; } - - } + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Dictionary<String, int?> + public Dictionary GetInventory () + { + + var path = "/store/inventory"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { "api_key" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage); + + return (Dictionary) ApiClient.Deserialize(response.Content, typeof(Dictionary), response.Headers); + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// ID of pet that needs to be fetched + /// Order + public Order GetOrderById (long? orderId) + { + + // verify the required parameter 'orderId' is set + if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById"); + + + var path = "/store/order/{orderId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage); + + return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers); + } + + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Order + public Order PlaceOrder (Order body) + { + + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling PlaceOrder"); + + + var path = "/store/order"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(body); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage); + + return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers); + } + + } } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs index 1374556698e..e57bd2f8873 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Api/UserApi.cs @@ -1,5 +1,4 @@ using System; -using System.IO; using System.Collections.Generic; using RestSharp; using IO.Swagger.Client; @@ -7,34 +6,41 @@ using IO.Swagger.Model; namespace IO.Swagger.Api { - /// /// Represents a collection of functions to interact with the API endpoints /// public interface IUserApi { - /// /// Create user This can only be done by the logged in user. /// /// Created user object /// void CreateUser (User body); - /// /// Creates list of users with given input array /// /// List of user object /// void CreateUsersWithArrayInput (List body); - /// /// Creates list of users with given input array /// /// List of user object /// void CreateUsersWithListInput (List body); - + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// + void DeleteUser (string username); + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// User + User GetUserByName (string username); /// /// Logs user into the system /// @@ -42,20 +48,11 @@ namespace IO.Swagger.Api /// The password for login in clear text /// string string LoginUser (string username, string password); - /// /// Logs out current logged in user session /// /// void LogoutUser (); - - /// - /// Get user by user name - /// - /// The name that needs to be fetched. Use user1 for testing. - /// User - User GetUserByName (string username); - /// /// Updated user This can only be done by the logged in user. /// @@ -63,14 +60,6 @@ namespace IO.Swagger.Api /// Updated user object /// void UpdateUser (string username, User body); - - /// - /// Delete user This can only be done by the logged in user. - /// - /// The name that needs to be deleted - /// - void DeleteUser (string username); - } /// @@ -126,7 +115,6 @@ namespace IO.Swagger.Api /// An instance of the ApiClient public ApiClient ApiClient {get; set;} - /// /// Create user This can only be done by the logged in user. /// @@ -135,22 +123,20 @@ namespace IO.Swagger.Api public void CreateUser (User body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUser"); + var path = "/user"; path = path.Replace("{format}", "json"); - - + var queryParams = new Dictionary(); var headerParams = new Dictionary(); var formParams = new Dictionary(); var fileParams = new Dictionary(); String postBody = null; - - - - postBody = ApiClient.Serialize(body); // http body (model) parameter - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { }; @@ -166,7 +152,6 @@ namespace IO.Swagger.Api return; } - /// /// Creates list of users with given input array /// @@ -175,22 +160,20 @@ namespace IO.Swagger.Api public void CreateUsersWithArrayInput (List body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUsersWithArrayInput"); + var path = "/user/createWithArray"; path = path.Replace("{format}", "json"); - - + var queryParams = new Dictionary(); var headerParams = new Dictionary(); var formParams = new Dictionary(); var fileParams = new Dictionary(); String postBody = null; - - - - postBody = ApiClient.Serialize(body); // http body (model) parameter - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { }; @@ -206,7 +189,6 @@ namespace IO.Swagger.Api return; } - /// /// Creates list of users with given input array /// @@ -215,22 +197,20 @@ namespace IO.Swagger.Api public void CreateUsersWithListInput (List body) { + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling CreateUsersWithListInput"); + var path = "/user/createWithList"; path = path.Replace("{format}", "json"); - - + var queryParams = new Dictionary(); var headerParams = new Dictionary(); var formParams = new Dictionary(); var fileParams = new Dictionary(); String postBody = null; - - - - postBody = ApiClient.Serialize(body); // http body (model) parameter - + postBody = ApiClient.Serialize(body); // http body (model) parameter // authentication setting, if any String[] authSettings = new String[] { }; @@ -246,175 +226,6 @@ namespace IO.Swagger.Api return; } - - /// - /// Logs user into the system - /// - /// The user name for login - /// The password for login in clear text - /// string - public string LoginUser (string username, string password) - { - - - var path = "/user/login"; - path = path.Replace("{format}", "json"); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter - if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter - - - - - - // authentication setting, if any - String[] authSettings = new String[] { }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage); - - return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers); - } - - - /// - /// Logs out current logged in user session - /// - /// - public void LogoutUser () - { - - - var path = "/user/logout"; - path = path.Replace("{format}", "json"); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - - - // authentication setting, if any - String[] authSettings = new String[] { }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage); - - return; - } - - - /// - /// Get user by user name - /// - /// The name that needs to be fetched. Use user1 for testing. - /// User - public User GetUserByName (string username) - { - - // verify the required parameter 'username' is set - if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName"); - - - var path = "/user/{username}"; - path = path.Replace("{format}", "json"); - path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - - - // authentication setting, if any - String[] authSettings = new String[] { }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage); - - return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers); - } - - - /// - /// Updated user This can only be done by the logged in user. - /// - /// name that need to be deleted - /// Updated user object - /// - public void UpdateUser (string username, User body) - { - - // verify the required parameter 'username' is set - if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser"); - - - var path = "/user/{username}"; - path = path.Replace("{format}", "json"); - path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); - - - var queryParams = new Dictionary(); - var headerParams = new Dictionary(); - var formParams = new Dictionary(); - var fileParams = new Dictionary(); - String postBody = null; - - - - - postBody = ApiClient.Serialize(body); // http body (model) parameter - - - // authentication setting, if any - String[] authSettings = new String[] { }; - - // make the HTTP request - IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); - - if (((int)response.StatusCode) >= 400) - throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content); - else if (((int)response.StatusCode) == 0) - throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage); - - return; - } - - /// /// Delete user This can only be done by the logged in user. /// @@ -430,7 +241,6 @@ namespace IO.Swagger.Api var path = "/user/{username}"; path = path.Replace("{format}", "json"); path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); - var queryParams = new Dictionary(); var headerParams = new Dictionary(); @@ -438,11 +248,7 @@ namespace IO.Swagger.Api var fileParams = new Dictionary(); String postBody = null; - - - - - + // authentication setting, if any String[] authSettings = new String[] { }; @@ -457,7 +263,158 @@ namespace IO.Swagger.Api return; } - - } + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// User + public User GetUserByName (string username) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName"); + + var path = "/user/{username}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage); + + return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers); + } + + /// + /// Logs user into the system + /// + /// The user name for login + /// The password for login in clear text + /// string + public string LoginUser (string username, string password) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling LoginUser"); + + // verify the required parameter 'password' is set + if (password == null) throw new ApiException(400, "Missing required parameter 'password' when calling LoginUser"); + + + var path = "/user/login"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter + if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage); + + return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers); + } + + /// + /// Logs out current logged in user session + /// + /// + public void LogoutUser () + { + + + var path = "/user/logout"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// name that need to be deleted + /// Updated user object + /// + public void UpdateUser (string username, User body) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser"); + + // verify the required parameter 'body' is set + if (body == null) throw new ApiException(400, "Missing required parameter 'body' when calling UpdateUser"); + + + var path = "/user/{username}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(body); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + } } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs index 3041cde567e..4f55f130134 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Client/ApiClient.cs @@ -257,17 +257,14 @@ namespace IO.Swagger.Client // determine which one to use switch(auth) { - - case "api_key": - headerParams["api_key"] = GetApiKeyWithPrefix("api_key"); - - break; - case "petstore_auth": //TODO support oauth break; - + case "api_key": + headerParams["api_key"] = GetApiKeyWithPrefix("api_key"); + + break; default: //TODO show warning about security definition not found break; diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/ApiResponse.cs new file mode 100644 index 00000000000..42e259da68a --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/ApiResponse.cs @@ -0,0 +1,60 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace IO.Swagger.Model { + + /// + /// + /// + [DataContract] + public class ApiResponse { + /// + /// Gets or Sets Code + /// + [DataMember(Name="code", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "code")] + public int? Code { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name="type", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or Sets Message + /// + [DataMember(Name="message", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs index a11c0761d2d..3e2508259db 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Category.cs @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Category { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Name /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "name")] public string Name { get; set; } - /// /// Get the string presentation of the object @@ -37,11 +34,8 @@ namespace IO.Swagger.Model { public override string ToString() { var sb = new StringBuilder(); sb.Append("class Category {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Order.cs index 17890990aa6..0f667d9c46d 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Order.cs @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Order { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets PetId /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "petId")] public long? PetId { get; set; } - /// /// Gets or Sets Quantity /// @@ -36,7 +33,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "quantity")] public int? Quantity { get; set; } - /// /// Gets or Sets ShipDate /// @@ -44,7 +40,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "shipDate")] public DateTime? ShipDate { get; set; } - /// /// Order Status /// @@ -53,7 +48,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "status")] public string Status { get; set; } - /// /// Gets or Sets Complete /// @@ -61,7 +55,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "complete")] public bool? Complete { get; set; } - /// /// Get the string presentation of the object @@ -70,19 +63,12 @@ namespace IO.Swagger.Model { public override string ToString() { var sb = new StringBuilder(); sb.Append("class Order {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" PetId: ").Append(PetId).Append("\n"); - sb.Append(" Quantity: ").Append(Quantity).Append("\n"); - sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append(" Complete: ").Append(Complete).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Pet.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Pet.cs index 14f285794ad..27ab53d3767 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Pet.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Pet.cs @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Pet { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Category /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "category")] public Category Category { get; set; } - /// /// Gets or Sets Name /// @@ -36,7 +33,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "name")] public string Name { get; set; } - /// /// Gets or Sets PhotoUrls /// @@ -44,7 +40,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "photoUrls")] public List PhotoUrls { get; set; } - /// /// Gets or Sets Tags /// @@ -52,7 +47,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "tags")] public List Tags { get; set; } - /// /// pet status in the store /// @@ -61,7 +55,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "status")] public string Status { get; set; } - /// /// Get the string presentation of the object @@ -70,19 +63,12 @@ namespace IO.Swagger.Model { public override string ToString() { var sb = new StringBuilder(); sb.Append("class Pet {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Category: ").Append(Category).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); - sb.Append(" Tags: ").Append(Tags).Append("\n"); - sb.Append(" Status: ").Append(Status).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Tag.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Tag.cs index 9a784e07a7e..639e1d79eaf 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Tag.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/Tag.cs @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class Tag { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Name /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "name")] public string Name { get; set; } - /// /// Get the string presentation of the object @@ -37,11 +34,8 @@ namespace IO.Swagger.Model { public override string ToString() { var sb = new StringBuilder(); sb.Append("class Tag {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/User.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/User.cs index ee7d6b035a3..f3367f341b9 100644 --- a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/User.cs +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/IO/Swagger/Model/User.cs @@ -12,7 +12,6 @@ namespace IO.Swagger.Model { /// [DataContract] public class User { - /// /// Gets or Sets Id /// @@ -20,7 +19,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "id")] public long? Id { get; set; } - /// /// Gets or Sets Username /// @@ -28,7 +26,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "username")] public string Username { get; set; } - /// /// Gets or Sets FirstName /// @@ -36,7 +33,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "firstName")] public string FirstName { get; set; } - /// /// Gets or Sets LastName /// @@ -44,7 +40,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "lastName")] public string LastName { get; set; } - /// /// Gets or Sets Email /// @@ -52,7 +47,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "email")] public string Email { get; set; } - /// /// Gets or Sets Password /// @@ -60,7 +54,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "password")] public string Password { get; set; } - /// /// Gets or Sets Phone /// @@ -68,7 +61,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "phone")] public string Phone { get; set; } - /// /// User Status /// @@ -77,7 +69,6 @@ namespace IO.Swagger.Model { [JsonProperty(PropertyName = "userStatus")] public int? UserStatus { get; set; } - /// /// Get the string presentation of the object @@ -86,23 +77,14 @@ namespace IO.Swagger.Model { public override string ToString() { var sb = new StringBuilder(); sb.Append("class User {\n"); - sb.Append(" Id: ").Append(Id).Append("\n"); - sb.Append(" Username: ").Append(Username).Append("\n"); - sb.Append(" FirstName: ").Append(FirstName).Append("\n"); - sb.Append(" LastName: ").Append(LastName).Append("\n"); - sb.Append(" Email: ").Append(Email).Append("\n"); - sb.Append(" Password: ").Append(Password).Append("\n"); - sb.Append(" Phone: ").Append(Phone).Append("\n"); - sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); - sb.Append("}\n"); return sb.ToString(); } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs new file mode 100644 index 00000000000..c2535cdadb3 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/ApiResponseTests.cs @@ -0,0 +1,80 @@ +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing ApiResponse + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class ApiResponseTests + { + private ApiResponse instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + instance = new ApiResponse(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of ApiResponse + /// + [Test] + public void ApiResponseInstanceTest() + { + Assert.IsInstanceOf (instance, "instance is a ApiResponse"); + } + + /// + /// Test the property 'Code' + /// + [Test] + public void CodeTest() + { + // TODO: unit test for the property 'Code' + } + /// + /// Test the property 'Type' + /// + [Test] + public void TypeTest() + { + // TODO: unit test for the property 'Type' + } + /// + /// Test the property 'Message' + /// + [Test] + public void MessageTest() + { + // TODO: unit test for the property 'Message' + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs index 67d8241ee91..0da272b0a9e 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/PetApiTests.cs @@ -65,18 +65,6 @@ namespace IO.Swagger.Test } - /// - /// Test AddPetUsingByteArray - /// - [Test] - public void AddPetUsingByteArrayTest() - { - // TODO: add unit test for the method 'AddPetUsingByteArray' - byte[] body = null; // TODO: replace null with proper value - instance.AddPetUsingByteArray(body); - - } - /// /// Test DeletePet /// @@ -126,30 +114,6 @@ string apiKey = null; // TODO: replace null with proper value Assert.IsInstanceOf (response, "response is Pet"); } - /// - /// Test GetPetByIdInObject - /// - [Test] - public void GetPetByIdInObjectTest() - { - // TODO: add unit test for the method 'GetPetByIdInObject' - long? petId = null; // TODO: replace null with proper value - var response = instance.GetPetByIdInObject(petId); - Assert.IsInstanceOf (response, "response is InlineResponse200"); - } - - /// - /// Test PetPetIdtestingByteArraytrueGet - /// - [Test] - public void PetPetIdtestingByteArraytrueGetTest() - { - // TODO: add unit test for the method 'PetPetIdtestingByteArraytrueGet' - long? petId = null; // TODO: replace null with proper value - var response = instance.PetPetIdtestingByteArraytrueGet(petId); - Assert.IsInstanceOf (response, "response is byte[]"); - } - /// /// Test UpdatePet /// @@ -169,7 +133,7 @@ string apiKey = null; // TODO: replace null with proper value public void UpdatePetWithFormTest() { // TODO: add unit test for the method 'UpdatePetWithForm' - string petId = null; // TODO: replace null with proper value + long? petId = null; // TODO: replace null with proper value string name = null; // TODO: replace null with proper value string status = null; // TODO: replace null with proper value instance.UpdatePetWithForm(petId, name, status); @@ -186,8 +150,8 @@ string status = null; // TODO: replace null with proper value long? petId = null; // TODO: replace null with proper value string additionalMetadata = null; // TODO: replace null with proper value Stream file = null; // TODO: replace null with proper value - instance.UploadFile(petId, additionalMetadata, file); - + var response = instance.UploadFile(petId, additionalMetadata, file); + Assert.IsInstanceOf (response, "response is ApiResponse"); } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs index 1d3e1c53815..d1a0de454d6 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient.Test/StoreApiTests.cs @@ -65,18 +65,6 @@ namespace IO.Swagger.Test } - /// - /// Test FindOrdersByStatus - /// - [Test] - public void FindOrdersByStatusTest() - { - // TODO: add unit test for the method 'FindOrdersByStatus' - string status = null; // TODO: replace null with proper value - var response = instance.FindOrdersByStatus(status); - Assert.IsInstanceOf> (response, "response is List"); - } - /// /// Test GetInventory /// @@ -88,17 +76,6 @@ namespace IO.Swagger.Test Assert.IsInstanceOf> (response, "response is Dictionary"); } - /// - /// Test GetInventoryInObject - /// - [Test] - public void GetInventoryInObjectTest() - { - // TODO: add unit test for the method 'GetInventoryInObject' - var response = instance.GetInventoryInObject(); - Assert.IsInstanceOf (response, "response is Object"); - } - /// /// Test GetOrderById /// @@ -106,7 +83,7 @@ namespace IO.Swagger.Test public void GetOrderByIdTest() { // TODO: add unit test for the method 'GetOrderById' - string orderId = null; // TODO: replace null with proper value + long? orderId = null; // TODO: replace null with proper value var response = instance.GetOrderById(orderId); Assert.IsInstanceOf (response, "response is Order"); } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md index 2e419147658..4e67e8c564c 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -1,12 +1,12 @@ - the C# library for the Swagger Petstore - This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: -- Build date: 2016-04-14T08:16:33.913-04:00 +- Build date: 2016-04-14T08:34:43.608-04:00 - Build package: class io.swagger.codegen.languages.CSharpClientCodegen ## Frameworks supported @@ -69,20 +69,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *::PetApi* | [**AddPet**](docs/PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store -*::PetApi* | [**AddPetUsingByteArray**](docs/PetApi.md#AddPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *::PetApi* | [**DeletePet**](docs/PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet *::PetApi* | [**FindPetsByStatus**](docs/PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status *::PetApi* | [**FindPetsByTags**](docs/PetApi.md#FindPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags *::PetApi* | [**GetPetById**](docs/PetApi.md#GetPetById) | **GET** /pet/{petId} | Find pet by ID -*::PetApi* | [**GetPetByIdInObject**](docs/PetApi.md#GetPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*::PetApi* | [**PetPetIdtestingByteArraytrueGet**](docs/PetApi.md#PetPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *::PetApi* | [**UpdatePet**](docs/PetApi.md#UpdatePet) | **PUT** /pet | Update an existing pet *::PetApi* | [**UpdatePetWithForm**](docs/PetApi.md#UpdatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data *::PetApi* | [**UploadFile**](docs/PetApi.md#UploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image *::StoreApi* | [**DeleteOrder**](docs/StoreApi.md#DeleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*::StoreApi* | [**FindOrdersByStatus**](docs/StoreApi.md#FindOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status *::StoreApi* | [**GetInventory**](docs/StoreApi.md#GetInventory) | **GET** /store/inventory | Returns pet inventories by status -*::StoreApi* | [**GetInventoryInObject**](docs/StoreApi.md#GetInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *::StoreApi* | [**GetOrderById**](docs/StoreApi.md#GetOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID *::StoreApi* | [**PlaceOrder**](docs/StoreApi.md#PlaceOrder) | **POST** /store/order | Place an order for a pet *::UserApi* | [**CreateUser**](docs/UserApi.md#CreateUser) | **POST** /user | Create user @@ -98,11 +93,11 @@ Class | Method | HTTP request | Description ## Documentation for Models - [::Animal](docs/Animal.md) + - [::ApiResponse](docs/ApiResponse.md) - [::Cat](docs/Cat.md) - [::Category](docs/Category.md) - [::Dog](docs/Dog.md) - [::FormatTest](docs/FormatTest.md) - - [::InlineResponse200](docs/InlineResponse200.md) - [::Model200Response](docs/Model200Response.md) - [::ModelReturn](docs/ModelReturn.md) - [::Name](docs/Name.md) @@ -120,43 +115,15 @@ Class | Method | HTTP request | Description - **Type**: OAuth - **Flow**: implicit -- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - write:pets: modify pets in your account - read:pets: read your pets -### test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -### test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - ### api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -### test_http_basic - -- **Type**: HTTP basic authentication - -### test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - -### test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md new file mode 100644 index 00000000000..6862adc1707 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md @@ -0,0 +1,11 @@ +# ApiResponse + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int?** | | [optional] +**Type** | **string** | | [optional] +**Message** | **string** | | [optional] + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md index 4d1ba46f9b6..6fd033dd5e8 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md @@ -9,6 +9,6 @@ Name | Type | Description | Notes **Quantity** | **int?** | | [optional] **ShipDate** | **DateTime?** | | [optional] **Status** | **string** | Order Status | [optional] -**Complete** | **bool?** | | [optional] +**Complete** | **bool?** | | [optional] [default to false] diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md index 6e92b75c537..5e6510cfe59 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md @@ -5,13 +5,10 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**AddPet**](PetApi.md#AddPet) | **POST** /pet | Add a new pet to the store -[**AddPetUsingByteArray**](PetApi.md#AddPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**DeletePet**](PetApi.md#DeletePet) | **DELETE** /pet/{petId} | Deletes a pet [**FindPetsByStatus**](PetApi.md#FindPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status [**FindPetsByTags**](PetApi.md#FindPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags [**GetPetById**](PetApi.md#GetPetById) | **GET** /pet/{petId} | Find pet by ID -[**GetPetByIdInObject**](PetApi.md#GetPetByIdInObject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -[**PetPetIdtestingByteArraytrueGet**](PetApi.md#PetPetIdtestingByteArraytrueGet) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**UpdatePet**](PetApi.md#UpdatePet) | **PUT** /pet | Update an existing pet [**UpdatePetWithForm**](PetApi.md#UpdatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data [**UploadFile**](PetApi.md#UploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -58,7 +55,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -71,63 +68,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml - -# **AddPetUsingByteArray** -> AddPetUsingByteArray(body) - -Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Module; - -namespace Example -{ - public class AddPetUsingByteArrayExample - { - public void main(){ - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; - - var apiInstance = new PetApi(); - var body = BINARY_DATA_HERE; // byte[] | Pet object in the form of byte array - - try { - apiInstance.AddPetUsingByteArray(body); - } catch (Exception e) { - Debug.Print("Exception when calling PetApi.AddPetUsingByteArray: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **body** | **byte[]**| Pet object in the form of byte array | [optional] - -### Return type - -void (empty response body) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **DeletePet** > DeletePet(petId, apiKey) @@ -185,7 +126,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **FindPetsByStatus** > List FindPetsByStatus(status) @@ -212,7 +153,7 @@ namespace Example Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; var apiInstance = new PetApi(); - var status = new List(); // List | Status values that need to be considered for query + var status = new List(); // List | Status values that need to be considered for filter try { List<Pet> result = apiInstance.FindPetsByStatus(status); @@ -229,7 +170,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<string>**](string.md)| Status values that need to be considered for query | [optional] [default to available] + **status** | [**List<string>**](string.md)| Status values that need to be considered for filter | ### Return type @@ -242,14 +183,14 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **FindPetsByTags** > List FindPetsByTags(tags) Finds Pets by tags -Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example ```csharp @@ -286,7 +227,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<string>**](string.md)| Tags to filter by | [optional] + **tags** | [**List<string>**](string.md)| Tags to filter by | ### Return type @@ -299,14 +240,14 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **GetPetById** > Pet GetPetById(petId) Find pet by ID -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions +Returns a single pet ### Example ```csharp @@ -322,15 +263,13 @@ namespace Example { public void main(){ - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; // Configure API key authorization: api_key Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); var apiInstance = new PetApi(); - var petId = 789; // long? | ID of pet that needs to be fetched + var petId = 789; // long? | ID of pet to return try { Pet result = apiInstance.GetPetById(petId); @@ -347,7 +286,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **long?**| ID of pet that needs to be fetched | + **petId** | **long?**| ID of pet to return | ### Return type @@ -355,134 +294,12 @@ Name | Type | Description | Notes ### Authorization -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) +[api_key](../README.md#api_key) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -# **GetPetByIdInObject** -> InlineResponse200 GetPetByIdInObject(petId) - -Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Module; - -namespace Example -{ - public class GetPetByIdInObjectExample - { - public void main(){ - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; - // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); - - var apiInstance = new PetApi(); - var petId = 789; // long? | ID of pet that needs to be fetched - - try { - InlineResponse200 result = apiInstance.GetPetByIdInObject(petId); - Debug.WriteLine(result); - } catch (Exception e) { - Debug.Print("Exception when calling PetApi.GetPetByIdInObject: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **long?**| ID of pet that needs to be fetched | - -### Return type - -[**InlineResponse200**](InlineResponse200.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -# **PetPetIdtestingByteArraytrueGet** -> byte[] PetPetIdtestingByteArraytrueGet(petId) - -Fake endpoint to test byte array return by 'Find pet by ID' - -Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Module; - -namespace Example -{ - public class PetPetIdtestingByteArraytrueGetExample - { - public void main(){ - - // Configure OAuth2 access token for authorization: petstore_auth - Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; - // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); - - var apiInstance = new PetApi(); - var petId = 789; // long? | ID of pet that needs to be fetched - - try { - byte[] result = apiInstance.PetPetIdtestingByteArraytrueGet(petId); - Debug.WriteLine(result); - } catch (Exception e) { - Debug.Print("Exception when calling PetApi.PetPetIdtestingByteArraytrueGet: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **long?**| ID of pet that needs to be fetched | - -### Return type - -**byte[]** - -### Authorization - -[petstore_auth](../README.md#petstore_auth), [api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **UpdatePet** > UpdatePet(body) @@ -525,7 +342,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -538,7 +355,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **UpdatePetWithForm** > UpdatePetWithForm(petId, name, status) @@ -565,7 +382,7 @@ namespace Example Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; var apiInstance = new PetApi(); - var petId = petId_example; // string | ID of pet that needs to be updated + var petId = 789; // long? | ID of pet that needs to be updated var name = name_example; // string | Updated name of the pet var status = status_example; // string | Updated status of the pet @@ -583,7 +400,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **string**| ID of pet that needs to be updated | + **petId** | **long?**| ID of pet that needs to be updated | **name** | **string**| Updated name of the pet | [optional] **status** | **string**| Updated status of the pet | [optional] @@ -598,10 +415,10 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **UploadFile** -> UploadFile(petId, additionalMetadata, file) +> ApiResponse UploadFile(petId, additionalMetadata, file) uploads an image @@ -630,7 +447,8 @@ namespace Example var file = new Stream(); // Stream | file to upload try { - apiInstance.UploadFile(petId, additionalMetadata, file); + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); } catch (Exception e) { Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); } @@ -649,7 +467,7 @@ Name | Type | Description | Notes ### Return type -void (empty response body) +[**ApiResponse**](ApiResponse.md) ### Authorization @@ -658,5 +476,5 @@ void (empty response body) ### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json, application/xml + - **Accept**: application/json diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md index 3b4e6bccb63..78b1b384e71 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md @@ -5,9 +5,7 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**DeleteOrder**](StoreApi.md#DeleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -[**FindOrdersByStatus**](StoreApi.md#FindOrdersByStatus) | **GET** /store/findByStatus | Finds orders by status [**GetInventory**](StoreApi.md#GetInventory) | **GET** /store/inventory | Returns pet inventories by status -[**GetInventoryInObject**](StoreApi.md#GetInventoryInObject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**GetOrderById**](StoreApi.md#GetOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID [**PlaceOrder**](StoreApi.md#PlaceOrder) | **POST** /store/order | Place an order for a pet @@ -63,70 +61,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -# **FindOrdersByStatus** -> List FindOrdersByStatus(status) - -Finds orders by status - -A single status value can be provided as a string - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Module; - -namespace Example -{ - public class FindOrdersByStatusExample - { - public void main(){ - - // Configure API key authorization: test_api_client_id - Configuration.Default.ApiKey.Add('x-test_api_client_id', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_id', 'BEARER'); - // Configure API key authorization: test_api_client_secret - Configuration.Default.ApiKey.Add('x-test_api_client_secret', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_secret', 'BEARER'); - - var apiInstance = new StoreApi(); - var status = status_example; // string | Status value that needs to be considered for query - - try { - List<Order> result = apiInstance.FindOrdersByStatus(status); - Debug.WriteLine(result); - } catch (Exception e) { - Debug.Print("Exception when calling StoreApi.FindOrdersByStatus: " + e.Message ); - } - } - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] - -### Return type - -[**List**](Order.md) - -### Authorization - -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **GetInventory** > Dictionary GetInventory() @@ -181,62 +116,7 @@ This endpoint does not need any parameter. ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml - -# **GetInventoryInObject** -> Object GetInventoryInObject() - -Fake endpoint to test arbitrary object return by 'Get inventory' - -Returns an arbitrary object which is actually a map of status codes to quantities - -### Example -```csharp -using System; -using System.Diagnostics; -using IO.Swagger.Api; -using IO.Swagger.Client; -using IO.Swagger.Module; - -namespace Example -{ - public class GetInventoryInObjectExample - { - public void main(){ - - // Configure API key authorization: api_key - Configuration.Default.ApiKey.Add('api_key', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('api_key', 'BEARER'); - - var apiInstance = new StoreApi(); - - try { - Object result = apiInstance.GetInventoryInObject(); - Debug.WriteLine(result); - } catch (Exception e) { - Debug.Print("Exception when calling StoreApi.GetInventoryInObject: " + e.Message ); - } - } - } -} -``` - -### Parameters -This endpoint does not need any parameter. - -### Return type - -**Object** - -### Authorization - -[api_key](../README.md#api_key) - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/json # **GetOrderById** > Order GetOrderById(orderId) @@ -259,17 +139,8 @@ namespace Example { public void main(){ - // Configure API key authorization: test_api_key_query - Configuration.Default.ApiKey.Add('test_api_key_query', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('test_api_key_query', 'BEARER'); - // Configure API key authorization: test_api_key_header - Configuration.Default.ApiKey.Add('test_api_key_header', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('test_api_key_header', 'BEARER'); - var apiInstance = new StoreApi(); - var orderId = orderId_example; // string | ID of pet that needs to be fetched + var orderId = 789; // long? | ID of pet that needs to be fetched try { Order result = apiInstance.GetOrderById(orderId); @@ -286,7 +157,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **string**| ID of pet that needs to be fetched | + **orderId** | **long?**| ID of pet that needs to be fetched | ### Return type @@ -294,12 +165,12 @@ Name | Type | Description | Notes ### Authorization -[test_api_key_query](../README.md#test_api_key_query), [test_api_key_header](../README.md#test_api_key_header) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **PlaceOrder** > Order PlaceOrder(body) @@ -322,15 +193,6 @@ namespace Example { public void main(){ - // Configure API key authorization: test_api_client_id - Configuration.Default.ApiKey.Add('x-test_api_client_id', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_id', 'BEARER'); - // Configure API key authorization: test_api_client_secret - Configuration.Default.ApiKey.Add('x-test_api_client_secret', 'YOUR_API_KEY'); - // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed - // Configuration.Default.ApiKeyPrefix.Add('x-test_api_client_secret', 'BEARER'); - var apiInstance = new StoreApi(); var body = new Order(); // Order | order placed for purchasing the pet @@ -349,7 +211,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] + **body** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -357,10 +219,10 @@ Name | Type | Description | Notes ### Authorization -[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md index 8b7864ecd6a..be0473107ab 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md @@ -52,7 +52,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -65,7 +65,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **CreateUsersWithArrayInput** > CreateUsersWithArrayInput(body) @@ -105,7 +105,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | [optional] + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -118,7 +118,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **CreateUsersWithListInput** > CreateUsersWithListInput(body) @@ -158,7 +158,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**List<User>**](User.md)| List of user object | [optional] + **body** | [**List<User>**](User.md)| List of user object | ### Return type @@ -171,7 +171,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **DeleteUser** > DeleteUser(username) @@ -194,10 +194,6 @@ namespace Example { public void main(){ - // Configure HTTP basic authorization: test_http_basic - Configuration.Default.Username = 'YOUR_USERNAME'; - Configuration.Default.Password = 'YOUR_PASSWORD'; - var apiInstance = new UserApi(); var username = username_example; // string | The name that needs to be deleted @@ -223,12 +219,12 @@ void (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **GetUserByName** > User GetUserByName(username) @@ -282,7 +278,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **LoginUser** > string LoginUser(username, password) @@ -324,8 +320,8 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **string**| The user name for login | [optional] - **password** | **string**| The password for login in clear text | [optional] + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | ### Return type @@ -338,7 +334,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **LogoutUser** > LogoutUser() @@ -387,7 +383,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **UpdateUser** > UpdateUser(username, body) @@ -429,7 +425,7 @@ namespace Example Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **string**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -442,5 +438,5 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs index 9f76dd12714..5466b39c8bd 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/PetApi.cs @@ -22,9 +22,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// - void AddPet (Pet body = null); + void AddPet (Pet body); /// /// Add a new pet to the store @@ -33,30 +33,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// ApiResponse of Object(void) - ApiResponse AddPetWithHttpInfo (Pet body = null); - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// - void AddPetUsingByteArray (byte[] body = null); - - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// ApiResponse of Object(void) - ApiResponse AddPetUsingByteArrayWithHttpInfo (byte[] body = null); + ApiResponse AddPetWithHttpInfo (Pet body); /// /// Deletes a pet /// @@ -87,9 +66,9 @@ namespace IO.Swagger.Api /// Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// List<Pet> - List FindPetsByStatus (List status = null); + List FindPetsByStatus (List status); /// /// Finds Pets by status @@ -98,38 +77,38 @@ namespace IO.Swagger.Api /// Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// ApiResponse of List<Pet> - ApiResponse> FindPetsByStatusWithHttpInfo (List status = null); + ApiResponse> FindPetsByStatusWithHttpInfo (List status); /// /// Finds Pets by tags /// /// - /// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// List<Pet> - List FindPetsByTags (List tags = null); + List FindPetsByTags (List tags); /// /// Finds Pets by tags /// /// - /// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// ApiResponse of List<Pet> - ApiResponse> FindPetsByTagsWithHttpInfo (List tags = null); + ApiResponse> FindPetsByTagsWithHttpInfo (List tags); /// /// Find pet by ID /// /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// Pet Pet GetPetById (long? petId); @@ -137,64 +116,22 @@ namespace IO.Swagger.Api /// Find pet by ID /// /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// ApiResponse of Pet ApiResponse GetPetByIdWithHttpInfo (long? petId); /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// InlineResponse200 - InlineResponse200 GetPetByIdInObject (long? petId); - - /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// ApiResponse of InlineResponse200 - ApiResponse GetPetByIdInObjectWithHttpInfo (long? petId); - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// byte[] - byte[] PetPetIdtestingByteArraytrueGet (long? petId); - - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// ApiResponse of byte[] - ApiResponse PetPetIdtestingByteArraytrueGetWithHttpInfo (long? petId); - /// /// Update an existing pet /// /// /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// - void UpdatePet (Pet body = null); + void UpdatePet (Pet body); /// /// Update an existing pet @@ -203,9 +140,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// ApiResponse of Object(void) - ApiResponse UpdatePetWithHttpInfo (Pet body = null); + ApiResponse UpdatePetWithHttpInfo (Pet body); /// /// Updates a pet in the store with form data /// @@ -217,7 +154,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// - void UpdatePetWithForm (string petId, string name = null, string status = null); + void UpdatePetWithForm (long? petId, string name = null, string status = null); /// /// Updates a pet in the store with form data @@ -230,7 +167,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// ApiResponse of Object(void) - ApiResponse UpdatePetWithFormWithHttpInfo (string petId, string name = null, string status = null); + ApiResponse UpdatePetWithFormWithHttpInfo (long? petId, string name = null, string status = null); /// /// uploads an image /// @@ -241,8 +178,8 @@ namespace IO.Swagger.Api /// ID of pet to update /// Additional data to pass to server (optional) /// file to upload (optional) - /// - void UploadFile (long? petId, string additionalMetadata = null, Stream file = null); + /// ApiResponse + ApiResponse UploadFile (long? petId, string additionalMetadata = null, Stream file = null); /// /// uploads an image @@ -254,8 +191,8 @@ namespace IO.Swagger.Api /// ID of pet to update /// Additional data to pass to server (optional) /// file to upload (optional) - /// ApiResponse of Object(void) - ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null); + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -265,9 +202,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of void - System.Threading.Tasks.Task AddPetAsync (Pet body = null); + System.Threading.Tasks.Task AddPetAsync (Pet body); /// /// Add a new pet to the store @@ -276,30 +213,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of ApiResponse - System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body = null); - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// Task of void - System.Threading.Tasks.Task AddPetUsingByteArrayAsync (byte[] body = null); - - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// - /// - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// Task of ApiResponse - System.Threading.Tasks.Task> AddPetUsingByteArrayAsyncWithHttpInfo (byte[] body = null); + System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body); /// /// Deletes a pet /// @@ -330,9 +246,9 @@ namespace IO.Swagger.Api /// Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// Task of List<Pet> - System.Threading.Tasks.Task> FindPetsByStatusAsync (List status = null); + System.Threading.Tasks.Task> FindPetsByStatusAsync (List status); /// /// Finds Pets by status @@ -341,38 +257,38 @@ namespace IO.Swagger.Api /// Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// Task of ApiResponse (List<Pet>) - System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status = null); + System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status); /// /// Finds Pets by tags /// /// - /// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// Task of List<Pet> - System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags = null); + System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags); /// /// Finds Pets by tags /// /// - /// Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// Task of ApiResponse (List<Pet>) - System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags = null); + System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags); /// /// Find pet by ID /// /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// Task of Pet System.Threading.Tasks.Task GetPetByIdAsync (long? petId); @@ -380,64 +296,22 @@ namespace IO.Swagger.Api /// Find pet by ID /// /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// Task of ApiResponse (Pet) System.Threading.Tasks.Task> GetPetByIdAsyncWithHttpInfo (long? petId); /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of InlineResponse200 - System.Threading.Tasks.Task GetPetByIdInObjectAsync (long? petId); - - /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of ApiResponse (InlineResponse200) - System.Threading.Tasks.Task> GetPetByIdInObjectAsyncWithHttpInfo (long? petId); - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of byte[] - System.Threading.Tasks.Task PetPetIdtestingByteArraytrueGetAsync (long? petId); - - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' - /// - /// - /// Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of ApiResponse (byte[]) - System.Threading.Tasks.Task> PetPetIdtestingByteArraytrueGetAsyncWithHttpInfo (long? petId); - /// /// Update an existing pet /// /// /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of void - System.Threading.Tasks.Task UpdatePetAsync (Pet body = null); + System.Threading.Tasks.Task UpdatePetAsync (Pet body); /// /// Update an existing pet @@ -446,9 +320,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body = null); + System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body); /// /// Updates a pet in the store with form data /// @@ -460,7 +334,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// Task of void - System.Threading.Tasks.Task UpdatePetWithFormAsync (string petId, string name = null, string status = null); + System.Threading.Tasks.Task UpdatePetWithFormAsync (long? petId, string name = null, string status = null); /// /// Updates a pet in the store with form data @@ -473,20 +347,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// Task of ApiResponse - System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (string petId, string name = null, string status = null); - /// - /// uploads an image - /// - /// - /// - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Task of void - System.Threading.Tasks.Task UploadFileAsync (long? petId, string additionalMetadata = null, Stream file = null); - + System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (long? petId, string name = null, string status = null); /// /// uploads an image /// @@ -498,7 +359,20 @@ namespace IO.Swagger.Api /// Additional data to pass to server (optional) /// file to upload (optional) /// Task of ApiResponse - System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null); + System.Threading.Tasks.Task UploadFileAsync (long? petId, string additionalMetadata = null, Stream file = null); + + /// + /// uploads an image + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null); #endregion Asynchronous Operations } @@ -593,9 +467,9 @@ namespace IO.Swagger.Api /// Add a new pet to the store /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// - public void AddPet (Pet body = null) + public void AddPet (Pet body) { AddPetWithHttpInfo(body); } @@ -604,10 +478,13 @@ namespace IO.Swagger.Api /// Add a new pet to the store /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// ApiResponse of Object(void) - public ApiResponse AddPetWithHttpInfo (Pet body = null) + public ApiResponse AddPetWithHttpInfo (Pet body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->AddPet"); var localVarPath = "/pet"; var localVarPathParams = new Dictionary(); @@ -626,8 +503,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -674,9 +551,9 @@ namespace IO.Swagger.Api /// Add a new pet to the store /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of void - public async System.Threading.Tasks.Task AddPetAsync (Pet body = null) + public async System.Threading.Tasks.Task AddPetAsync (Pet body) { await AddPetAsyncWithHttpInfo(body); @@ -686,10 +563,13 @@ namespace IO.Swagger.Api /// Add a new pet to the store /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of ApiResponse - public async System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body = null) + public async System.Threading.Tasks.Task> AddPetAsyncWithHttpInfo (Pet body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->AddPet"); var localVarPath = "/pet"; var localVarPathParams = new Dictionary(); @@ -708,8 +588,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -752,169 +632,6 @@ namespace IO.Swagger.Api null); } - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// - public void AddPetUsingByteArray (byte[] body = null) - { - AddPetUsingByteArrayWithHttpInfo(body); - } - - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// ApiResponse of Object(void) - public ApiResponse AddPetUsingByteArrayWithHttpInfo (byte[] body = null) - { - - var localVarPath = "/pet?testing_byte_array=true"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling AddPetUsingByteArray: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling AddPetUsingByteArray: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - null); - } - - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// Task of void - public async System.Threading.Tasks.Task AddPetUsingByteArrayAsync (byte[] body = null) - { - await AddPetUsingByteArrayAsyncWithHttpInfo(body); - - } - - /// - /// Fake endpoint to test byte array in body parameter for adding a new pet to the store - /// - /// Thrown when fails to make API call - /// Pet object in the form of byte array (optional) - /// Task of ApiResponse - public async System.Threading.Tasks.Task> AddPetUsingByteArrayAsyncWithHttpInfo (byte[] body = null) - { - - var localVarPath = "/pet?testing_byte_array=true"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (body.GetType() != typeof(byte[])) - { - localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter - } - else - { - localVarPostBody = body; // byte array - } - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling AddPetUsingByteArray: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling AddPetUsingByteArray: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - null); - } - /// /// Deletes a pet /// @@ -955,8 +672,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1034,8 +751,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1076,9 +793,9 @@ namespace IO.Swagger.Api /// Finds Pets by status Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// List<Pet> - public List FindPetsByStatus (List status = null) + public List FindPetsByStatus (List status) { ApiResponse> localVarResponse = FindPetsByStatusWithHttpInfo(status); return localVarResponse.Data; @@ -1088,10 +805,13 @@ namespace IO.Swagger.Api /// Finds Pets by status Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// ApiResponse of List<Pet> - public ApiResponse< List > FindPetsByStatusWithHttpInfo (List status = null) + public ApiResponse< List > FindPetsByStatusWithHttpInfo (List status) { + // verify the required parameter 'status' is set + if (status == null) + throw new ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); var localVarPath = "/pet/findByStatus"; var localVarPathParams = new Dictionary(); @@ -1108,8 +828,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1149,9 +869,9 @@ namespace IO.Swagger.Api /// Finds Pets by status Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// Task of List<Pet> - public async System.Threading.Tasks.Task> FindPetsByStatusAsync (List status = null) + public async System.Threading.Tasks.Task> FindPetsByStatusAsync (List status) { ApiResponse> localVarResponse = await FindPetsByStatusAsyncWithHttpInfo(status); return localVarResponse.Data; @@ -1162,10 +882,13 @@ namespace IO.Swagger.Api /// Finds Pets by status Multiple status values can be provided with comma separated strings /// /// Thrown when fails to make API call - /// Status values that need to be considered for query (optional, default to available) + /// Status values that need to be considered for filter /// Task of ApiResponse (List<Pet>) - public async System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status = null) + public async System.Threading.Tasks.Task>> FindPetsByStatusAsyncWithHttpInfo (List status) { + // verify the required parameter 'status' is set + if (status == null) + throw new ApiException(400, "Missing required parameter 'status' when calling PetApi->FindPetsByStatus"); var localVarPath = "/pet/findByStatus"; var localVarPathParams = new Dictionary(); @@ -1182,8 +905,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1220,25 +943,28 @@ namespace IO.Swagger.Api } /// - /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// List<Pet> - public List FindPetsByTags (List tags = null) + public List FindPetsByTags (List tags) { ApiResponse> localVarResponse = FindPetsByTagsWithHttpInfo(tags); return localVarResponse.Data; } /// - /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// ApiResponse of List<Pet> - public ApiResponse< List > FindPetsByTagsWithHttpInfo (List tags = null) + public ApiResponse< List > FindPetsByTagsWithHttpInfo (List tags) { + // verify the required parameter 'tags' is set + if (tags == null) + throw new ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); var localVarPath = "/pet/findByTags"; var localVarPathParams = new Dictionary(); @@ -1255,8 +981,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1293,12 +1019,12 @@ namespace IO.Swagger.Api } /// - /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// Task of List<Pet> - public async System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags = null) + public async System.Threading.Tasks.Task> FindPetsByTagsAsync (List tags) { ApiResponse> localVarResponse = await FindPetsByTagsAsyncWithHttpInfo(tags); return localVarResponse.Data; @@ -1306,13 +1032,16 @@ namespace IO.Swagger.Api } /// - /// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Thrown when fails to make API call - /// Tags to filter by (optional) + /// Tags to filter by /// Task of ApiResponse (List<Pet>) - public async System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags = null) + public async System.Threading.Tasks.Task>> FindPetsByTagsAsyncWithHttpInfo (List tags) { + // verify the required parameter 'tags' is set + if (tags == null) + throw new ApiException(400, "Missing required parameter 'tags' when calling PetApi->FindPetsByTags"); var localVarPath = "/pet/findByTags"; var localVarPathParams = new Dictionary(); @@ -1329,8 +1058,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1367,10 +1096,10 @@ namespace IO.Swagger.Api } /// - /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Find pet by ID Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// Pet public Pet GetPetById (long? petId) { @@ -1379,10 +1108,10 @@ namespace IO.Swagger.Api } /// - /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Find pet by ID Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// ApiResponse of Pet public ApiResponse< Pet > GetPetByIdWithHttpInfo (long? petId) { @@ -1405,8 +1134,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1417,12 +1146,6 @@ namespace IO.Swagger.Api localVarPathParams.Add("format", "json"); if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } // authentication (api_key) required if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) { @@ -1449,10 +1172,10 @@ namespace IO.Swagger.Api } /// - /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Find pet by ID Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// Task of Pet public async System.Threading.Tasks.Task GetPetByIdAsync (long? petId) { @@ -1462,10 +1185,10 @@ namespace IO.Swagger.Api } /// - /// Find pet by ID Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + /// Find pet by ID Returns a single pet /// /// Thrown when fails to make API call - /// ID of pet that needs to be fetched + /// ID of pet to return /// Task of ApiResponse (Pet) public async System.Threading.Tasks.Task> GetPetByIdAsyncWithHttpInfo (long? petId) { @@ -1488,8 +1211,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1500,12 +1223,6 @@ namespace IO.Swagger.Api localVarPathParams.Add("format", "json"); if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } // authentication (api_key) required if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) { @@ -1530,341 +1247,13 @@ namespace IO.Swagger.Api } - /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// InlineResponse200 - public InlineResponse200 GetPetByIdInObject (long? petId) - { - ApiResponse localVarResponse = GetPetByIdInObjectWithHttpInfo(petId); - return localVarResponse.Data; - } - - /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// ApiResponse of InlineResponse200 - public ApiResponse< InlineResponse200 > GetPetByIdInObjectWithHttpInfo (long? petId) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetByIdInObject"); - - var localVarPath = "/pet/{petId}?response=inline_arbitrary_object"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (InlineResponse200) Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse200))); - - } - - /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of InlineResponse200 - public async System.Threading.Tasks.Task GetPetByIdInObjectAsync (long? petId) - { - ApiResponse localVarResponse = await GetPetByIdInObjectAsyncWithHttpInfo(petId); - return localVarResponse.Data; - - } - - /// - /// Fake endpoint to test inline arbitrary object return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of ApiResponse (InlineResponse200) - public async System.Threading.Tasks.Task> GetPetByIdInObjectAsyncWithHttpInfo (long? petId) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->GetPetByIdInObject"); - - var localVarPath = "/pet/{petId}?response=inline_arbitrary_object"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetPetByIdInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (InlineResponse200) Configuration.ApiClient.Deserialize(localVarResponse, typeof(InlineResponse200))); - - } - - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// byte[] - public byte[] PetPetIdtestingByteArraytrueGet (long? petId) - { - ApiResponse localVarResponse = PetPetIdtestingByteArraytrueGetWithHttpInfo(petId); - return localVarResponse.Data; - } - - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// ApiResponse of byte[] - public ApiResponse< byte[] > PetPetIdtestingByteArraytrueGetWithHttpInfo (long? petId) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->PetPetIdtestingByteArraytrueGet"); - - var localVarPath = "/pet/{petId}?testing_byte_array=true"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (byte[]) Configuration.ApiClient.Deserialize(localVarResponse, typeof(byte[]))); - - } - - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of byte[] - public async System.Threading.Tasks.Task PetPetIdtestingByteArraytrueGetAsync (long? petId) - { - ApiResponse localVarResponse = await PetPetIdtestingByteArraytrueGetAsyncWithHttpInfo(petId); - return localVarResponse.Data; - - } - - /// - /// Fake endpoint to test byte array return by 'Find pet by ID' Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - /// - /// Thrown when fails to make API call - /// ID of pet that needs to be fetched - /// Task of ApiResponse (byte[]) - public async System.Threading.Tasks.Task> PetPetIdtestingByteArraytrueGetAsyncWithHttpInfo (long? petId) - { - // verify the required parameter 'petId' is set - if (petId == null) - throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->PetPetIdtestingByteArraytrueGet"); - - var localVarPath = "/pet/{petId}?testing_byte_array=true"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (petId != null) localVarPathParams.Add("petId", Configuration.ApiClient.ParameterToString(petId)); // path parameter - - // authentication (petstore_auth) required - // oauth required - if (!String.IsNullOrEmpty(Configuration.AccessToken)) - { - localVarHeaderParams["Authorization"] = "Bearer " + Configuration.AccessToken; - } - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling PetPetIdtestingByteArraytrueGet: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (byte[]) Configuration.ApiClient.Deserialize(localVarResponse, typeof(byte[]))); - - } - /// /// Update an existing pet /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// - public void UpdatePet (Pet body = null) + public void UpdatePet (Pet body) { UpdatePetWithHttpInfo(body); } @@ -1873,10 +1262,13 @@ namespace IO.Swagger.Api /// Update an existing pet /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// ApiResponse of Object(void) - public ApiResponse UpdatePetWithHttpInfo (Pet body = null) + public ApiResponse UpdatePetWithHttpInfo (Pet body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->UpdatePet"); var localVarPath = "/pet"; var localVarPathParams = new Dictionary(); @@ -1895,8 +1287,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1943,9 +1335,9 @@ namespace IO.Swagger.Api /// Update an existing pet /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of void - public async System.Threading.Tasks.Task UpdatePetAsync (Pet body = null) + public async System.Threading.Tasks.Task UpdatePetAsync (Pet body) { await UpdatePetAsyncWithHttpInfo(body); @@ -1955,10 +1347,13 @@ namespace IO.Swagger.Api /// Update an existing pet /// /// Thrown when fails to make API call - /// Pet object that needs to be added to the store (optional) + /// Pet object that needs to be added to the store /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body = null) + public async System.Threading.Tasks.Task> UpdatePetAsyncWithHttpInfo (Pet body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling PetApi->UpdatePet"); var localVarPath = "/pet"; var localVarPathParams = new Dictionary(); @@ -1977,8 +1372,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -2029,7 +1424,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// - public void UpdatePetWithForm (string petId, string name = null, string status = null) + public void UpdatePetWithForm (long? petId, string name = null, string status = null) { UpdatePetWithFormWithHttpInfo(petId, name, status); } @@ -2042,7 +1437,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// ApiResponse of Object(void) - public ApiResponse UpdatePetWithFormWithHttpInfo (string petId, string name = null, string status = null) + public ApiResponse UpdatePetWithFormWithHttpInfo (long? petId, string name = null, string status = null) { // verify the required parameter 'petId' is set if (petId == null) @@ -2064,8 +1459,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -2111,7 +1506,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// Task of void - public async System.Threading.Tasks.Task UpdatePetWithFormAsync (string petId, string name = null, string status = null) + public async System.Threading.Tasks.Task UpdatePetWithFormAsync (long? petId, string name = null, string status = null) { await UpdatePetWithFormAsyncWithHttpInfo(petId, name, status); @@ -2125,7 +1520,7 @@ namespace IO.Swagger.Api /// Updated name of the pet (optional) /// Updated status of the pet (optional) /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (string petId, string name = null, string status = null) + public async System.Threading.Tasks.Task> UpdatePetWithFormAsyncWithHttpInfo (long? petId, string name = null, string status = null) { // verify the required parameter 'petId' is set if (petId == null) @@ -2147,8 +1542,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -2193,10 +1588,11 @@ namespace IO.Swagger.Api /// ID of pet to update /// Additional data to pass to server (optional) /// file to upload (optional) - /// - public void UploadFile (long? petId, string additionalMetadata = null, Stream file = null) + /// ApiResponse + public ApiResponse UploadFile (long? petId, string additionalMetadata = null, Stream file = null) { - UploadFileWithHttpInfo(petId, additionalMetadata, file); + ApiResponse localVarResponse = UploadFileWithHttpInfo(petId, additionalMetadata, file); + return localVarResponse.Data; } /// @@ -2206,8 +1602,8 @@ namespace IO.Swagger.Api /// ID of pet to update /// Additional data to pass to server (optional) /// file to upload (optional) - /// ApiResponse of Object(void) - public ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null) { // verify the required parameter 'petId' is set if (petId == null) @@ -2229,8 +1625,7 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -2262,24 +1657,10 @@ namespace IO.Swagger.Api else if (localVarStatusCode == 0) throw new ApiException (localVarStatusCode, "Error calling UploadFile: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, + return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - null); - } - - /// - /// uploads an image - /// - /// Thrown when fails to make API call - /// ID of pet to update - /// Additional data to pass to server (optional) - /// file to upload (optional) - /// Task of void - public async System.Threading.Tasks.Task UploadFileAsync (long? petId, string additionalMetadata = null, Stream file = null) - { - await UploadFileAsyncWithHttpInfo(petId, additionalMetadata, file); - + (ApiResponse) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } /// @@ -2290,7 +1671,22 @@ namespace IO.Swagger.Api /// Additional data to pass to server (optional) /// file to upload (optional) /// Task of ApiResponse - public async System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null) + public async System.Threading.Tasks.Task UploadFileAsync (long? petId, string additionalMetadata = null, Stream file = null) + { + ApiResponse localVarResponse = await UploadFileAsyncWithHttpInfo(petId, additionalMetadata, file); + return localVarResponse.Data; + + } + + /// + /// uploads an image + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// Additional data to pass to server (optional) + /// file to upload (optional) + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, Stream file = null) { // verify the required parameter 'petId' is set if (petId == null) @@ -2312,8 +1708,7 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -2345,10 +1740,10 @@ namespace IO.Swagger.Api else if (localVarStatusCode == 0) throw new ApiException (localVarStatusCode, "Error calling UploadFile: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, + return new ApiResponse(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - null); + (ApiResponse) Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs index 13de1c99bbf..3598f17a9fb 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/StoreApi.cs @@ -37,27 +37,6 @@ namespace IO.Swagger.Api /// ApiResponse of Object(void) ApiResponse DeleteOrderWithHttpInfo (string orderId); /// - /// Finds orders by status - /// - /// - /// A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// List<Order> - List FindOrdersByStatus (string status = null); - - /// - /// Finds orders by status - /// - /// - /// A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// ApiResponse of List<Order> - ApiResponse> FindOrdersByStatusWithHttpInfo (string status = null); - /// /// Returns pet inventories by status /// /// @@ -77,25 +56,6 @@ namespace IO.Swagger.Api /// ApiResponse of Dictionary<string, int?> ApiResponse> GetInventoryWithHttpInfo (); /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' - /// - /// - /// Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Object - Object GetInventoryInObject (); - - /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' - /// - /// - /// Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// ApiResponse of Object - ApiResponse GetInventoryInObjectWithHttpInfo (); - /// /// Find purchase order by ID /// /// @@ -104,7 +64,7 @@ namespace IO.Swagger.Api /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// Order - Order GetOrderById (string orderId); + Order GetOrderById (long? orderId); /// /// Find purchase order by ID @@ -115,7 +75,7 @@ namespace IO.Swagger.Api /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// ApiResponse of Order - ApiResponse GetOrderByIdWithHttpInfo (string orderId); + ApiResponse GetOrderByIdWithHttpInfo (long? orderId); /// /// Place an order for a pet /// @@ -123,9 +83,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// Order - Order PlaceOrder (Order body = null); + Order PlaceOrder (Order body); /// /// Place an order for a pet @@ -134,9 +94,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// ApiResponse of Order - ApiResponse PlaceOrderWithHttpInfo (Order body = null); + ApiResponse PlaceOrderWithHttpInfo (Order body); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -161,27 +121,6 @@ namespace IO.Swagger.Api /// Task of ApiResponse System.Threading.Tasks.Task> DeleteOrderAsyncWithHttpInfo (string orderId); /// - /// Finds orders by status - /// - /// - /// A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// Task of List<Order> - System.Threading.Tasks.Task> FindOrdersByStatusAsync (string status = null); - - /// - /// Finds orders by status - /// - /// - /// A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// Task of ApiResponse (List<Order>) - System.Threading.Tasks.Task>> FindOrdersByStatusAsyncWithHttpInfo (string status = null); - /// /// Returns pet inventories by status /// /// @@ -201,25 +140,6 @@ namespace IO.Swagger.Api /// Task of ApiResponse (Dictionary<string, int?>) System.Threading.Tasks.Task>> GetInventoryAsyncWithHttpInfo (); /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' - /// - /// - /// Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of Object - System.Threading.Tasks.Task GetInventoryInObjectAsync (); - - /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' - /// - /// - /// Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of ApiResponse (Object) - System.Threading.Tasks.Task> GetInventoryInObjectAsyncWithHttpInfo (); - /// /// Find purchase order by ID /// /// @@ -228,7 +148,7 @@ namespace IO.Swagger.Api /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// Task of Order - System.Threading.Tasks.Task GetOrderByIdAsync (string orderId); + System.Threading.Tasks.Task GetOrderByIdAsync (long? orderId); /// /// Find purchase order by ID @@ -239,7 +159,7 @@ namespace IO.Swagger.Api /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (string orderId); + System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (long? orderId); /// /// Place an order for a pet /// @@ -247,9 +167,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// Task of Order - System.Threading.Tasks.Task PlaceOrderAsync (Order body = null); + System.Threading.Tasks.Task PlaceOrderAsync (Order body); /// /// Place an order for a pet @@ -258,9 +178,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// Task of ApiResponse (Order) - System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body = null); + System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body); #endregion Asynchronous Operations } @@ -389,8 +309,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -459,8 +379,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -490,163 +410,6 @@ namespace IO.Swagger.Api null); } - /// - /// Finds orders by status A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// List<Order> - public List FindOrdersByStatus (string status = null) - { - ApiResponse> localVarResponse = FindOrdersByStatusWithHttpInfo(status); - return localVarResponse.Data; - } - - /// - /// Finds orders by status A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// ApiResponse of List<Order> - public ApiResponse< List > FindOrdersByStatusWithHttpInfo (string status = null) - { - - var localVarPath = "/store/findByStatus"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (status != null) localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter - - // authentication (test_api_client_id) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_id"))) - { - localVarHeaderParams["x-test_api_client_id"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_id"); - } - - // authentication (test_api_client_secret) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"))) - { - localVarHeaderParams["x-test_api_client_secret"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"); - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling FindOrdersByStatus: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling FindOrdersByStatus: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (List) Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); - - } - - /// - /// Finds orders by status A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// Task of List<Order> - public async System.Threading.Tasks.Task> FindOrdersByStatusAsync (string status = null) - { - ApiResponse> localVarResponse = await FindOrdersByStatusAsyncWithHttpInfo(status); - return localVarResponse.Data; - - } - - /// - /// Finds orders by status A single status value can be provided as a string - /// - /// Thrown when fails to make API call - /// Status value that needs to be considered for query (optional, default to placed) - /// Task of ApiResponse (List<Order>) - public async System.Threading.Tasks.Task>> FindOrdersByStatusAsyncWithHttpInfo (string status = null) - { - - var localVarPath = "/store/findByStatus"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - if (status != null) localVarQueryParams.Add("status", Configuration.ApiClient.ParameterToString(status)); // query parameter - - // authentication (test_api_client_id) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_id"))) - { - localVarHeaderParams["x-test_api_client_id"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_id"); - } - // authentication (test_api_client_secret) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"))) - { - localVarHeaderParams["x-test_api_client_secret"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling FindOrdersByStatus: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling FindOrdersByStatus: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse>(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (List) Configuration.ApiClient.Deserialize(localVarResponse, typeof(List))); - - } - /// /// Returns pet inventories by status Returns a map of status codes to quantities /// @@ -681,8 +444,7 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -752,8 +514,7 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -787,153 +548,13 @@ namespace IO.Swagger.Api } - /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Object - public Object GetInventoryInObject () - { - ApiResponse localVarResponse = GetInventoryInObjectWithHttpInfo(); - return localVarResponse.Data; - } - - /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// ApiResponse of Object - public ApiResponse< Object > GetInventoryInObjectWithHttpInfo () - { - - var localVarPath = "/store/inventory?response=arbitrary_object"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (Object) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); - - } - - /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of Object - public async System.Threading.Tasks.Task GetInventoryInObjectAsync () - { - ApiResponse localVarResponse = await GetInventoryInObjectAsyncWithHttpInfo(); - return localVarResponse.Data; - - } - - /// - /// Fake endpoint to test arbitrary object return by 'Get inventory' Returns an arbitrary object which is actually a map of status codes to quantities - /// - /// Thrown when fails to make API call - /// Task of ApiResponse (Object) - public async System.Threading.Tasks.Task> GetInventoryInObjectAsyncWithHttpInfo () - { - - var localVarPath = "/store/inventory?response=arbitrary_object"; - var localVarPathParams = new Dictionary(); - var localVarQueryParams = new Dictionary(); - var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); - var localVarFormParams = new Dictionary(); - var localVarFileParams = new Dictionary(); - Object localVarPostBody = null; - - // to determine the Content-Type header - String[] localVarHttpContentTypes = new String[] { - }; - String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); - - // to determine the Accept header - String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" - }; - String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); - if (localVarHttpHeaderAccept != null) - localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); - - // set "format" to json by default - // e.g. /pet/{petId}.{format} becomes /pet/{petId}.json - localVarPathParams.Add("format", "json"); - - // authentication (api_key) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("api_key"))) - { - localVarHeaderParams["api_key"] = Configuration.GetApiKeyWithPrefix("api_key"); - } - - // make the HTTP request - IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, - Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, - localVarPathParams, localVarHttpContentType); - - int localVarStatusCode = (int) localVarResponse.StatusCode; - - if (localVarStatusCode >= 400) - throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.Content, localVarResponse.Content); - else if (localVarStatusCode == 0) - throw new ApiException (localVarStatusCode, "Error calling GetInventoryInObject: " + localVarResponse.ErrorMessage, localVarResponse.ErrorMessage); - - return new ApiResponse(localVarStatusCode, - localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), - (Object) Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object))); - - } - /// /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions /// /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// Order - public Order GetOrderById (string orderId) + public Order GetOrderById (long? orderId) { ApiResponse localVarResponse = GetOrderByIdWithHttpInfo(orderId); return localVarResponse.Data; @@ -945,7 +566,7 @@ namespace IO.Swagger.Api /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// ApiResponse of Order - public ApiResponse< Order > GetOrderByIdWithHttpInfo (string orderId) + public ApiResponse< Order > GetOrderByIdWithHttpInfo (long? orderId) { // verify the required parameter 'orderId' is set if (orderId == null) @@ -966,8 +587,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -978,18 +599,6 @@ namespace IO.Swagger.Api localVarPathParams.Add("format", "json"); if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter - // authentication (test_api_key_query) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_query"))) - { - localVarQueryParams["test_api_key_query"] = Configuration.GetApiKeyWithPrefix("test_api_key_query"); - } - - // authentication (test_api_key_header) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_header"))) - { - localVarHeaderParams["test_api_key_header"] = Configuration.GetApiKeyWithPrefix("test_api_key_header"); - } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1015,7 +624,7 @@ namespace IO.Swagger.Api /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// Task of Order - public async System.Threading.Tasks.Task GetOrderByIdAsync (string orderId) + public async System.Threading.Tasks.Task GetOrderByIdAsync (long? orderId) { ApiResponse localVarResponse = await GetOrderByIdAsyncWithHttpInfo(orderId); return localVarResponse.Data; @@ -1028,7 +637,7 @@ namespace IO.Swagger.Api /// Thrown when fails to make API call /// ID of pet that needs to be fetched /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (string orderId) + public async System.Threading.Tasks.Task> GetOrderByIdAsyncWithHttpInfo (long? orderId) { // verify the required parameter 'orderId' is set if (orderId == null) @@ -1049,8 +658,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1061,16 +670,6 @@ namespace IO.Swagger.Api localVarPathParams.Add("format", "json"); if (orderId != null) localVarPathParams.Add("orderId", Configuration.ApiClient.ParameterToString(orderId)); // path parameter - // authentication (test_api_key_query) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_query"))) - { - localVarQueryParams["test_api_key_query"] = Configuration.GetApiKeyWithPrefix("test_api_key_query"); - } - // authentication (test_api_key_header) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("test_api_key_header"))) - { - localVarHeaderParams["test_api_key_header"] = Configuration.GetApiKeyWithPrefix("test_api_key_header"); - } // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1094,9 +693,9 @@ namespace IO.Swagger.Api /// Place an order for a pet /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// Order - public Order PlaceOrder (Order body = null) + public Order PlaceOrder (Order body) { ApiResponse localVarResponse = PlaceOrderWithHttpInfo(body); return localVarResponse.Data; @@ -1106,10 +705,13 @@ namespace IO.Swagger.Api /// Place an order for a pet /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// ApiResponse of Order - public ApiResponse< Order > PlaceOrderWithHttpInfo (Order body = null) + public ApiResponse< Order > PlaceOrderWithHttpInfo (Order body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling StoreApi->PlaceOrder"); var localVarPath = "/store/order"; var localVarPathParams = new Dictionary(); @@ -1126,8 +728,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1145,18 +747,6 @@ namespace IO.Swagger.Api localVarPostBody = body; // byte array } - // authentication (test_api_client_id) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_id"))) - { - localVarHeaderParams["x-test_api_client_id"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_id"); - } - - // authentication (test_api_client_secret) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"))) - { - localVarHeaderParams["x-test_api_client_secret"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"); - } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1180,9 +770,9 @@ namespace IO.Swagger.Api /// Place an order for a pet /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// Task of Order - public async System.Threading.Tasks.Task PlaceOrderAsync (Order body = null) + public async System.Threading.Tasks.Task PlaceOrderAsync (Order body) { ApiResponse localVarResponse = await PlaceOrderAsyncWithHttpInfo(body); return localVarResponse.Data; @@ -1193,10 +783,13 @@ namespace IO.Swagger.Api /// Place an order for a pet /// /// Thrown when fails to make API call - /// order placed for purchasing the pet (optional) + /// order placed for purchasing the pet /// Task of ApiResponse (Order) - public async System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body = null) + public async System.Threading.Tasks.Task> PlaceOrderAsyncWithHttpInfo (Order body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling StoreApi->PlaceOrder"); var localVarPath = "/store/order"; var localVarPathParams = new Dictionary(); @@ -1213,8 +806,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1232,16 +825,6 @@ namespace IO.Swagger.Api localVarPostBody = body; // byte array } - // authentication (test_api_client_id) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_id"))) - { - localVarHeaderParams["x-test_api_client_id"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_id"); - } - // authentication (test_api_client_secret) required - if (!String.IsNullOrEmpty(Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"))) - { - localVarHeaderParams["x-test_api_client_secret"] = Configuration.GetApiKeyWithPrefix("x-test_api_client_secret"); - } // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs index 1426f315ea2..06d994b5eca 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Api/UserApi.cs @@ -22,9 +22,9 @@ namespace IO.Swagger.Api /// This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// - void CreateUser (User body = null); + void CreateUser (User body); /// /// Create user @@ -33,9 +33,9 @@ namespace IO.Swagger.Api /// This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// ApiResponse of Object(void) - ApiResponse CreateUserWithHttpInfo (User body = null); + ApiResponse CreateUserWithHttpInfo (User body); /// /// Creates list of users with given input array /// @@ -43,9 +43,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// - void CreateUsersWithArrayInput (List body = null); + void CreateUsersWithArrayInput (List body); /// /// Creates list of users with given input array @@ -54,9 +54,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// ApiResponse of Object(void) - ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body = null); + ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body); /// /// Creates list of users with given input array /// @@ -64,9 +64,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// - void CreateUsersWithListInput (List body = null); + void CreateUsersWithListInput (List body); /// /// Creates list of users with given input array @@ -75,9 +75,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// ApiResponse of Object(void) - ApiResponse CreateUsersWithListInputWithHttpInfo (List body = null); + ApiResponse CreateUsersWithListInputWithHttpInfo (List body); /// /// Delete user /// @@ -127,10 +127,10 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// string - string LoginUser (string username = null, string password = null); + string LoginUser (string username, string password); /// /// Logs user into the system @@ -139,10 +139,10 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// ApiResponse of string - ApiResponse LoginUserWithHttpInfo (string username = null, string password = null); + ApiResponse LoginUserWithHttpInfo (string username, string password); /// /// Logs out current logged in user session /// @@ -170,9 +170,9 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// - void UpdateUser (string username, User body = null); + void UpdateUser (string username, User body); /// /// Updated user @@ -182,9 +182,9 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// ApiResponse of Object(void) - ApiResponse UpdateUserWithHttpInfo (string username, User body = null); + ApiResponse UpdateUserWithHttpInfo (string username, User body); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -194,9 +194,9 @@ namespace IO.Swagger.Api /// This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// Task of void - System.Threading.Tasks.Task CreateUserAsync (User body = null); + System.Threading.Tasks.Task CreateUserAsync (User body); /// /// Create user @@ -205,9 +205,9 @@ namespace IO.Swagger.Api /// This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body = null); + System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body); /// /// Creates list of users with given input array /// @@ -215,9 +215,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of void - System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body = null); + System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body); /// /// Creates list of users with given input array @@ -226,9 +226,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body = null); + System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body); /// /// Creates list of users with given input array /// @@ -236,9 +236,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of void - System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body = null); + System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body); /// /// Creates list of users with given input array @@ -247,9 +247,9 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of ApiResponse - System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body = null); + System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body); /// /// Delete user /// @@ -299,10 +299,10 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// Task of string - System.Threading.Tasks.Task LoginUserAsync (string username = null, string password = null); + System.Threading.Tasks.Task LoginUserAsync (string username, string password); /// /// Logs user into the system @@ -311,10 +311,10 @@ namespace IO.Swagger.Api /// /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// Task of ApiResponse (string) - System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username = null, string password = null); + System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username, string password); /// /// Logs out current logged in user session /// @@ -342,9 +342,9 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// Task of void - System.Threading.Tasks.Task UpdateUserAsync (string username, User body = null); + System.Threading.Tasks.Task UpdateUserAsync (string username, User body); /// /// Updated user @@ -354,9 +354,9 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// Task of ApiResponse - System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body = null); + System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body); #endregion Asynchronous Operations } @@ -451,9 +451,9 @@ namespace IO.Swagger.Api /// Create user This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// - public void CreateUser (User body = null) + public void CreateUser (User body) { CreateUserWithHttpInfo(body); } @@ -462,10 +462,13 @@ namespace IO.Swagger.Api /// Create user This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// ApiResponse of Object(void) - public ApiResponse CreateUserWithHttpInfo (User body = null) + public ApiResponse CreateUserWithHttpInfo (User body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUser"); var localVarPath = "/user"; var localVarPathParams = new Dictionary(); @@ -482,8 +485,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -524,9 +527,9 @@ namespace IO.Swagger.Api /// Create user This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// Task of void - public async System.Threading.Tasks.Task CreateUserAsync (User body = null) + public async System.Threading.Tasks.Task CreateUserAsync (User body) { await CreateUserAsyncWithHttpInfo(body); @@ -536,10 +539,13 @@ namespace IO.Swagger.Api /// Create user This can only be done by the logged in user. /// /// Thrown when fails to make API call - /// Created user object (optional) + /// Created user object /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body = null) + public async System.Threading.Tasks.Task> CreateUserAsyncWithHttpInfo (User body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUser"); var localVarPath = "/user"; var localVarPathParams = new Dictionary(); @@ -556,8 +562,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -598,9 +604,9 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// - public void CreateUsersWithArrayInput (List body = null) + public void CreateUsersWithArrayInput (List body) { CreateUsersWithArrayInputWithHttpInfo(body); } @@ -609,10 +615,13 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// ApiResponse of Object(void) - public ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body = null) + public ApiResponse CreateUsersWithArrayInputWithHttpInfo (List body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput"); var localVarPath = "/user/createWithArray"; var localVarPathParams = new Dictionary(); @@ -629,8 +638,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -671,9 +680,9 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body = null) + public async System.Threading.Tasks.Task CreateUsersWithArrayInputAsync (List body) { await CreateUsersWithArrayInputAsyncWithHttpInfo(body); @@ -683,10 +692,13 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body = null) + public async System.Threading.Tasks.Task> CreateUsersWithArrayInputAsyncWithHttpInfo (List body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput"); var localVarPath = "/user/createWithArray"; var localVarPathParams = new Dictionary(); @@ -703,8 +715,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -745,9 +757,9 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// - public void CreateUsersWithListInput (List body = null) + public void CreateUsersWithListInput (List body) { CreateUsersWithListInputWithHttpInfo(body); } @@ -756,10 +768,13 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// ApiResponse of Object(void) - public ApiResponse CreateUsersWithListInputWithHttpInfo (List body = null) + public ApiResponse CreateUsersWithListInputWithHttpInfo (List body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput"); var localVarPath = "/user/createWithList"; var localVarPathParams = new Dictionary(); @@ -776,8 +791,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -818,9 +833,9 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of void - public async System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body = null) + public async System.Threading.Tasks.Task CreateUsersWithListInputAsync (List body) { await CreateUsersWithListInputAsyncWithHttpInfo(body); @@ -830,10 +845,13 @@ namespace IO.Swagger.Api /// Creates list of users with given input array /// /// Thrown when fails to make API call - /// List of user object (optional) + /// List of user object /// Task of ApiResponse - public async System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body = null) + public async System.Threading.Tasks.Task> CreateUsersWithListInputAsyncWithHttpInfo (List body) { + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput"); var localVarPath = "/user/createWithList"; var localVarPathParams = new Dictionary(); @@ -850,8 +868,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -926,8 +944,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -938,13 +956,6 @@ namespace IO.Swagger.Api localVarPathParams.Add("format", "json"); if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - // authentication (test_http_basic) required - // http basic authentication required - if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) - { - localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password); - } - // make the HTTP request IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, @@ -1003,8 +1014,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1015,12 +1026,6 @@ namespace IO.Swagger.Api localVarPathParams.Add("format", "json"); if (username != null) localVarPathParams.Add("username", Configuration.ApiClient.ParameterToString(username)); // path parameter - // authentication (test_http_basic) required - // http basic authentication required - if (!String.IsNullOrEmpty(Configuration.Username) || !String.IsNullOrEmpty(Configuration.Password)) - { - localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(Configuration.Username + ":" + Configuration.Password); - } // make the HTTP request IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, @@ -1079,8 +1084,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1150,8 +1155,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1185,10 +1190,10 @@ namespace IO.Swagger.Api /// Logs user into the system /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// string - public string LoginUser (string username = null, string password = null) + public string LoginUser (string username, string password) { ApiResponse localVarResponse = LoginUserWithHttpInfo(username, password); return localVarResponse.Data; @@ -1198,11 +1203,17 @@ namespace IO.Swagger.Api /// Logs user into the system /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// ApiResponse of string - public ApiResponse< string > LoginUserWithHttpInfo (string username = null, string password = null) + public ApiResponse< string > LoginUserWithHttpInfo (string username, string password) { + // verify the required parameter 'username' is set + if (username == null) + throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + // verify the required parameter 'password' is set + if (password == null) + throw new ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); var localVarPath = "/user/login"; var localVarPathParams = new Dictionary(); @@ -1219,8 +1230,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1255,10 +1266,10 @@ namespace IO.Swagger.Api /// Logs user into the system /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// Task of string - public async System.Threading.Tasks.Task LoginUserAsync (string username = null, string password = null) + public async System.Threading.Tasks.Task LoginUserAsync (string username, string password) { ApiResponse localVarResponse = await LoginUserAsyncWithHttpInfo(username, password); return localVarResponse.Data; @@ -1269,11 +1280,17 @@ namespace IO.Swagger.Api /// Logs user into the system /// /// Thrown when fails to make API call - /// The user name for login (optional) - /// The password for login in clear text (optional) + /// The user name for login + /// The password for login in clear text /// Task of ApiResponse (string) - public async System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username = null, string password = null) + public async System.Threading.Tasks.Task> LoginUserAsyncWithHttpInfo (string username, string password) { + // verify the required parameter 'username' is set + if (username == null) + throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->LoginUser"); + // verify the required parameter 'password' is set + if (password == null) + throw new ApiException(400, "Missing required parameter 'password' when calling UserApi->LoginUser"); var localVarPath = "/user/login"; var localVarPathParams = new Dictionary(); @@ -1290,8 +1307,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1355,8 +1372,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1419,8 +1436,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1454,9 +1471,9 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// - public void UpdateUser (string username, User body = null) + public void UpdateUser (string username, User body) { UpdateUserWithHttpInfo(username, body); } @@ -1466,13 +1483,16 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// ApiResponse of Object(void) - public ApiResponse UpdateUserWithHttpInfo (string username, User body = null) + public ApiResponse UpdateUserWithHttpInfo (string username, User body) { // verify the required parameter 'username' is set if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->UpdateUser"); var localVarPath = "/user/{username}"; var localVarPathParams = new Dictionary(); @@ -1489,8 +1509,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) @@ -1533,9 +1553,9 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// Task of void - public async System.Threading.Tasks.Task UpdateUserAsync (string username, User body = null) + public async System.Threading.Tasks.Task UpdateUserAsync (string username, User body) { await UpdateUserAsyncWithHttpInfo(username, body); @@ -1546,13 +1566,16 @@ namespace IO.Swagger.Api /// /// Thrown when fails to make API call /// name that need to be deleted - /// Updated user object (optional) + /// Updated user object /// Task of ApiResponse - public async System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body = null) + public async System.Threading.Tasks.Task> UpdateUserAsyncWithHttpInfo (string username, User body) { // verify the required parameter 'username' is set if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UserApi->UpdateUser"); + // verify the required parameter 'body' is set + if (body == null) + throw new ApiException(400, "Missing required parameter 'body' when calling UserApi->UpdateUser"); var localVarPath = "/user/{username}"; var localVarPathParams = new Dictionary(); @@ -1569,8 +1592,8 @@ namespace IO.Swagger.Api // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { - "application/json", - "application/xml" + "application/xml", + "application/json" }; String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs new file mode 100644 index 00000000000..de8b24e69e9 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/ApiResponse.cs @@ -0,0 +1,142 @@ +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// + /// + [DataContract] + public partial class ApiResponse : IEquatable + { + + /// + /// Initializes a new instance of the class. + /// Initializes a new instance of the class. + /// + /// Code. + /// Type. + /// Message. + + public ApiResponse(int? Code = null, string Type = null, string Message = null) + { + this.Code = Code; + this.Type = Type; + this.Message = Message; + + } + + + /// + /// Gets or Sets Code + /// + [DataMember(Name="code", EmitDefaultValue=false)] + public int? Code { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name="type", EmitDefaultValue=false)] + public string Type { get; set; } + + /// + /// Gets or Sets Message + /// + [DataMember(Name="message", EmitDefaultValue=false)] + public string Message { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as ApiResponse); + } + + /// + /// Returns true if ApiResponse instances are equal + /// + /// Instance of ApiResponse to be compared + /// Boolean + public bool Equals(ApiResponse other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.Code == other.Code || + this.Code != null && + this.Code.Equals(other.Code) + ) && + ( + this.Type == other.Type || + this.Type != null && + this.Type.Equals(other.Type) + ) && + ( + this.Message == other.Message || + this.Message != null && + this.Message.Equals(other.Message) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.Code != null) + hash = hash * 59 + this.Code.GetHashCode(); + if (this.Type != null) + hash = hash * 59 + this.Type.GetHashCode(); + if (this.Message != null) + hash = hash * 59 + this.Message.GetHashCode(); + return hash; + } + } + + } +} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs index b5ce3f55c4c..78276f0e313 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/src/main/csharp/IO/Swagger/Model/Order.cs @@ -47,19 +47,29 @@ namespace IO.Swagger.Model /// Initializes a new instance of the class. /// Initializes a new instance of the class. /// + /// Id. /// PetId. /// Quantity. /// ShipDate. /// Order Status. - /// Complete. + /// Complete (default to false). - public Order(long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) + public Order(long? Id = null, long? PetId = null, int? Quantity = null, DateTime? ShipDate = null, StatusEnum? Status = null, bool? Complete = null) { + this.Id = Id; this.PetId = PetId; this.Quantity = Quantity; this.ShipDate = ShipDate; this.Status = Status; - this.Complete = Complete; + // use default value if no "Complete" provided + if (Complete == null) + { + this.Complete = false; + } + else + { + this.Complete = Complete; + } } @@ -68,7 +78,7 @@ namespace IO.Swagger.Model /// Gets or Sets Id /// [DataMember(Name="id", EmitDefaultValue=false)] - public long? Id { get; private set; } + public long? Id { get; set; } /// /// Gets or Sets PetId diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj index 67c8e73b6e5..7b777ba6a27 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.csproj @@ -70,6 +70,7 @@ + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs index f234ffdb0cf..0b91bb4ae32 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs +++ b/samples/client/petstore/csharp/SwaggerClientTest/SwaggerClientTest.userprefs @@ -2,9 +2,27 @@ - - + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs index f66e34a5e9e..6af386ff2ba 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestOrder.cs @@ -73,6 +73,9 @@ namespace SwaggerClientTest.TestOrder } + /* comment out the test case as the method is not defined in original petstore spec + * we will re-enable this after updating the petstore server + * /// /// Test GetInvetoryInObject /// @@ -93,7 +96,7 @@ namespace SwaggerClientTest.TestOrder Assert.IsInstanceOf (typeof(int?), Int32.Parse(entry.Value)); } - } + }*/ } } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs index 0b04ca72b05..25d2255542a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs +++ b/samples/client/petstore/csharp/SwaggerClientTest/TestPet.cs @@ -158,6 +158,9 @@ namespace SwaggerClientTest.TestPet } + /* comment out the test case as the method is not defined in original petstore spec + * we will re-enable this after updating the petstore server + * /// /// Test GetPetByIdInObject /// @@ -187,8 +190,11 @@ namespace SwaggerClientTest.TestPet Assert.AreEqual (56, (int)category ["id"]); Assert.AreEqual ("sample category name2", (string) category["name"]); - } + }*/ + /* comment out the test case as the method is not defined in original petstore spec + * we will re-enable this after updating the petstore server + * /// /// Test GetPetByIdWithByteArray /// @@ -201,8 +207,11 @@ namespace SwaggerClientTest.TestPet PetApi petApi = new PetApi (c1); byte[] response = petApi.PetPetIdtestingByteArraytrueGet (petId); Assert.IsInstanceOf (response, "Response is byte array"); - } + }*/ + /* comment out the test case as the method is not defined in original petstore spec + * we will re-enable this after updating the petstore server + * /// /// Test AddPetUsingByteArray /// @@ -216,7 +225,7 @@ namespace SwaggerClientTest.TestPet Pet p = createPet (); byte[] petByteArray = GetBytes ((string)petApi.Configuration.ApiClient.Serialize (p)); petApi.AddPetUsingByteArray (petByteArray); - } + }*/ /// /// Test UpdatePetWithForm @@ -225,7 +234,7 @@ namespace SwaggerClientTest.TestPet public void TestUpdatePetWithForm () { PetApi petApi = new PetApi (); - petApi.UpdatePetWithForm (petId.ToString(), "new form name", "pending"); + petApi.UpdatePetWithForm (petId, "new form name", "pending"); Pet response = petApi.GetPetById (petId); Assert.IsInstanceOf (response, "Response is a Pet"); @@ -239,7 +248,7 @@ namespace SwaggerClientTest.TestPet Assert.AreEqual (56, response.Category.Id); // test optional parameter - petApi.UpdatePetWithForm (petId.ToString(), "new form name2"); + petApi.UpdatePetWithForm (petId, "new form name2"); Pet response2 = petApi.GetPetById (petId); Assert.AreEqual ("new form name2", response2.Name); } diff --git a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt index 323cad108c6..0991d15f118 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt +++ b/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.csproj.FilesWrittenAbsolute.txt @@ -1,9 +1,9 @@ /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/.NETFramework,Version=v4.5.AssemblyAttribute.cs /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.swagger-logo.png +/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll +/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll +/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll.mdb /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/SwaggerClientTest.dll /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll /Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/obj/Debug/SwaggerClientTest.dll.mdb -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/Newtonsoft.Json.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/nunit.framework.dll -/Users/williamcheng/Code/swagger-codegen/samples/client/petstore/csharp/SwaggerClientTest/bin/Debug/RestSharp.dll diff --git a/samples/client/petstore/go/petApi_test.go b/samples/client/petstore/go/pet_api_test.go similarity index 100% rename from samples/client/petstore/go/petApi_test.go rename to samples/client/petstore/go/pet_api_test.go diff --git a/samples/client/petstore/go/swagger/ModelReturn.go b/samples/client/petstore/go/swagger/ModelReturn.go deleted file mode 100644 index 8195d536e30..00000000000 --- a/samples/client/petstore/go/swagger/ModelReturn.go +++ /dev/null @@ -1,8 +0,0 @@ -package swagger - -import ( -) - -type ModelReturn struct { - Return_ int32 `json:"return,omitempty"` -} diff --git a/samples/client/petstore/go/swagger/Name.go b/samples/client/petstore/go/swagger/Name.go deleted file mode 100644 index bf106c0681a..00000000000 --- a/samples/client/petstore/go/swagger/Name.go +++ /dev/null @@ -1,9 +0,0 @@ -package swagger - -import ( -) - -type Name struct { - Name int32 `json:"name,omitempty"` - SnakeCase int32 `json:"snake_case,omitempty"` -} diff --git a/samples/client/petstore/go/swagger/ApiResponse.go b/samples/client/petstore/go/swagger/api_response.go similarity index 100% rename from samples/client/petstore/go/swagger/ApiResponse.go rename to samples/client/petstore/go/swagger/api_response.go diff --git a/samples/client/petstore/go/swagger/Category.go b/samples/client/petstore/go/swagger/category.go similarity index 100% rename from samples/client/petstore/go/swagger/Category.go rename to samples/client/petstore/go/swagger/category.go diff --git a/samples/client/petstore/go/swagger/Configuration.go b/samples/client/petstore/go/swagger/configuration.go similarity index 91% rename from samples/client/petstore/go/swagger/Configuration.go rename to samples/client/petstore/go/swagger/configuration.go index 83f3bd13ef7..b231bd8aa48 100644 --- a/samples/client/petstore/go/swagger/Configuration.go +++ b/samples/client/petstore/go/swagger/configuration.go @@ -18,6 +18,7 @@ type Configuration struct { Scheme string `json:"scheme,omitempty"` AccessToken string `json:"accessToken,omitempty"` DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` } func NewConfiguration() *Configuration { @@ -27,7 +28,8 @@ func NewConfiguration() *Configuration { Debug: false, DefaultHeader: make(map[string]string), ApiKey: make(map[string]string), - ApiKeyPrefix: make(map[string]string) , + ApiKeyPrefix: make(map[string]string), + UserAgent: "Swagger-Codegen/1.0.0/go", } } diff --git a/samples/client/petstore/go/swagger/Order.go b/samples/client/petstore/go/swagger/order.go similarity index 100% rename from samples/client/petstore/go/swagger/Order.go rename to samples/client/petstore/go/swagger/order.go diff --git a/samples/client/petstore/go/swagger/Pet.go b/samples/client/petstore/go/swagger/pet.go similarity index 100% rename from samples/client/petstore/go/swagger/Pet.go rename to samples/client/petstore/go/swagger/pet.go diff --git a/samples/client/petstore/go/swagger/PetApi.go b/samples/client/petstore/go/swagger/pet_api.go similarity index 97% rename from samples/client/petstore/go/swagger/PetApi.go rename to samples/client/petstore/go/swagger/pet_api.go index e7f2b25464f..2b73357eb06 100644 --- a/samples/client/petstore/go/swagger/PetApi.go +++ b/samples/client/petstore/go/swagger/pet_api.go @@ -201,9 +201,9 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) { } type QueryParams struct { - status []string `url:"status,omitempty"` + Status []string `url:"status,omitempty"` } - _sling = _sling.QueryStruct(&QueryParams{ status: status }) + _sling = _sling.QueryStruct(&QueryParams{ Status: status }) // accept header accepts := []string { "application/xml", "application/json" } for key := range accepts { @@ -274,9 +274,9 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) { } type QueryParams struct { - tags []string `url:"tags,omitempty"` + Tags []string `url:"tags,omitempty"` } - _sling = _sling.QueryStruct(&QueryParams{ tags: tags }) + _sling = _sling.QueryStruct(&QueryParams{ Tags: tags }) // accept header accepts := []string { "application/xml", "application/json" } for key := range accepts { @@ -497,10 +497,10 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err } type FormParams struct { - name string `url:"name,omitempty"` - status string `url:"status,omitempty"` + Name string `url:"name,omitempty"` + Status string `url:"status,omitempty"` } - _sling = _sling.BodyForm(&FormParams{ name: name,status: status }) + _sling = _sling.BodyForm(&FormParams{ Name: name,Status: status }) @@ -574,10 +574,10 @@ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.Fil } type FormParams struct { - additionalMetadata string `url:"additionalMetadata,omitempty"` - file *os.File `url:"file,omitempty"` + AdditionalMetadata string `url:"additionalMetadata,omitempty"` + File *os.File `url:"file,omitempty"` } - _sling = _sling.BodyForm(&FormParams{ additionalMetadata: additionalMetadata,file: file }) + _sling = _sling.BodyForm(&FormParams{ AdditionalMetadata: additionalMetadata,File: file }) var successPayload = new(ApiResponse) diff --git a/samples/client/petstore/go/swagger/StoreApi.go b/samples/client/petstore/go/swagger/store_api.go similarity index 100% rename from samples/client/petstore/go/swagger/StoreApi.go rename to samples/client/petstore/go/swagger/store_api.go diff --git a/samples/client/petstore/go/swagger/Tag.go b/samples/client/petstore/go/swagger/tag.go similarity index 100% rename from samples/client/petstore/go/swagger/Tag.go rename to samples/client/petstore/go/swagger/tag.go diff --git a/samples/client/petstore/go/swagger/User.go b/samples/client/petstore/go/swagger/user.go similarity index 100% rename from samples/client/petstore/go/swagger/User.go rename to samples/client/petstore/go/swagger/user.go diff --git a/samples/client/petstore/go/swagger/UserApi.go b/samples/client/petstore/go/swagger/user_api.go similarity index 98% rename from samples/client/petstore/go/swagger/UserApi.go rename to samples/client/petstore/go/swagger/user_api.go index a6ed7c5d264..655e8b46fe9 100644 --- a/samples/client/petstore/go/swagger/UserApi.go +++ b/samples/client/petstore/go/swagger/user_api.go @@ -374,10 +374,10 @@ func (a UserApi) LoginUser (username string, password string) (string, error) { } type QueryParams struct { - username string `url:"username,omitempty"` -password string `url:"password,omitempty"` + Username string `url:"username,omitempty"` +Password string `url:"password,omitempty"` } - _sling = _sling.QueryStruct(&QueryParams{ username: username,password: password }) + _sling = _sling.QueryStruct(&QueryParams{ Username: username,Password: password }) // accept header accepts := []string { "application/xml", "application/json" } for key := range accepts { diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 18db67296f2..a4c5c47558a 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -2,7 +2,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. # VERSION @@ -10,7 +10,7 @@ Automatically generated by the [Swagger Codegen](https://github.com/swagger-api/ - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-12T12:54:53.924+08:00 +- Build date: 2016-04-13T22:41:41.133+08:00 - Build package: class io.swagger.codegen.languages.PerlClientCodegen ## A note on Moose @@ -232,11 +232,11 @@ use WWW::SwaggerClient::UserApi; To load the models: ```perl use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::ApiResponse; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::FormatTest; -use WWW::SwaggerClient::Object::InlineResponse200; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; @@ -262,11 +262,11 @@ use WWW::SwaggerClient::UserApi; # load the models use WWW::SwaggerClient::Object::Animal; +use WWW::SwaggerClient::Object::ApiResponse; use WWW::SwaggerClient::Object::Cat; use WWW::SwaggerClient::Object::Category; use WWW::SwaggerClient::Object::Dog; use WWW::SwaggerClient::Object::FormatTest; -use WWW::SwaggerClient::Object::InlineResponse200; use WWW::SwaggerClient::Object::Model200Response; use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; @@ -301,20 +301,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image *StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet *UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user @@ -329,11 +324,11 @@ Class | Method | HTTP request | Description # DOCUMENTATION FOR MODELS - [WWW::SwaggerClient::Object::Animal](docs/Animal.md) + - [WWW::SwaggerClient::Object::ApiResponse](docs/ApiResponse.md) - [WWW::SwaggerClient::Object::Cat](docs/Cat.md) - [WWW::SwaggerClient::Object::Category](docs/Category.md) - [WWW::SwaggerClient::Object::Dog](docs/Dog.md) - [WWW::SwaggerClient::Object::FormatTest](docs/FormatTest.md) - - [WWW::SwaggerClient::Object::InlineResponse200](docs/InlineResponse200.md) - [WWW::SwaggerClient::Object::Model200Response](docs/Model200Response.md) - [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md) - [WWW::SwaggerClient::Object::Name](docs/Name.md) @@ -346,40 +341,12 @@ Class | Method | HTTP request | Description # DOCUMENTATION FOR AUTHORIATION -## test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - ## api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -## test_http_basic - -- **Type**: HTTP basic authentication - -## test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -## test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -## test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - ## petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/perl/docs/Order.md b/samples/client/petstore/perl/docs/Order.md index 542a3a91240..cffb6a6af23 100644 --- a/samples/client/petstore/perl/docs/Order.md +++ b/samples/client/petstore/perl/docs/Order.md @@ -13,7 +13,7 @@ Name | Type | Description | Notes **quantity** | **int** | | [optional] **ship_date** | **DateTime** | | [optional] **status** | **string** | Order Status | [optional] -**complete** | **boolean** | | [optional] +**complete** | **boolean** | | [optional] [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index d3082b8ad59..faa4c799739 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -45,7 +45,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -58,7 +58,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -88,7 +88,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](User.md)| List of user object | [optional] + **body** | [**ARRAY[User]**](User.md)| List of user object | ### Return type @@ -101,7 +101,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -131,7 +131,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**ARRAY[User]**](User.md)| List of user object | [optional] + **body** | [**ARRAY[User]**](User.md)| List of user object | ### Return type @@ -144,7 +144,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -159,10 +159,6 @@ This can only be done by the logged in user. ```perl use Data::Dumper; -# Configure HTTP basic authorization: test_http_basic -$WWW::SwaggerClient::Configuration::username = 'YOUR_USERNAME'; -$WWW::SwaggerClient::Configuration::password = 'YOUR_PASSWORD'; - my $api_instance = WWW::SwaggerClient::UserApi->new(); my $username = 'username_example'; # string | The name that needs to be deleted @@ -186,12 +182,12 @@ void (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -235,7 +231,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -267,8 +263,8 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **string**| The user name for login | [optional] - **password** | **string**| The password for login in clear text | [optional] + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | ### Return type @@ -281,7 +277,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -320,7 +316,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -352,7 +348,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **string**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -365,7 +361,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm index b5fd24c2b1b..3dfa6633ee5 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/ApiClient.pm @@ -319,47 +319,13 @@ sub update_params_for_auth { if (!defined($auth)) { # TODO show warning about auth setting not defined } - elsif ($auth eq 'test_api_key_header') { - - my $api_key = $self->get_api_key_with_prefix('test_api_key_header'); - if ($api_key) { - $header_params->{'test_api_key_header'} = $api_key; - } - } -elsif ($auth eq 'api_key') { + elsif ($auth eq 'api_key') { my $api_key = $self->get_api_key_with_prefix('api_key'); if ($api_key) { $header_params->{'api_key'} = $api_key; } } -elsif ($auth eq 'test_http_basic') { - - if ($WWW::SwaggerClient::Configuration::username || $WWW::SwaggerClient::Configuration::password) { - $header_params->{'Authorization'} = 'Basic ' . encode_base64($WWW::SwaggerClient::Configuration::username . ":" . $WWW::SwaggerClient::Configuration::password); - } - } -elsif ($auth eq 'test_api_client_secret') { - - my $api_key = $self->get_api_key_with_prefix('x-test_api_client_secret'); - if ($api_key) { - $header_params->{'x-test_api_client_secret'} = $api_key; - } - } -elsif ($auth eq 'test_api_client_id') { - - my $api_key = $self->get_api_key_with_prefix('x-test_api_client_id'); - if ($api_key) { - $header_params->{'x-test_api_client_id'} = $api_key; - } - } -elsif ($auth eq 'test_api_key_query') { - - my $api_key = $self->get_api_key_with_prefix('test_api_key_query'); - if ($api_key) { - $query_params->{'test_api_key_query'} = $api_key; - } - } elsif ($auth eq 'petstore_auth') { if ($WWW::SwaggerClient::Configuration::access_token) { diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm index 53222949718..fd1b4092302 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/PetApi.pm @@ -56,13 +56,13 @@ sub new { # # Add a new pet to the store # -# @param Pet $body Pet object that needs to be added to the store (optional) +# @param Pet $body Pet object that needs to be added to the store (required) { my $params = { 'body' => { data_type => 'Pet', description => 'Pet object that needs to be added to the store', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ add_pet } = { @@ -76,6 +76,11 @@ sub new { sub add_pet { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling add_pet"); + } + # parse inputs my $_resource_path = '/pet'; $_resource_path =~ s/{format}/json/; # default format to json @@ -86,64 +91,7 @@ sub add_pet { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', 'application/xml'); - - my $_body_data; - # body params - if ( exists $args{'body'}) { - $_body_data = $args{'body'}; - } - - # authentication setting, if any - my $auth_settings = [qw(petstore_auth )]; - - # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - return; -} - -# -# add_pet_using_byte_array -# -# Fake endpoint to test byte array in body parameter for adding a new pet to the store -# -# @param string $body Pet object in the form of byte array (optional) -{ - my $params = { - 'body' => { - data_type => 'string', - description => 'Pet object in the form of byte array', - required => '0', - }, - }; - __PACKAGE__->method_documentation->{ add_pet_using_byte_array } = { - summary => 'Fake endpoint to test byte array in body parameter for adding a new pet to the store', - params => $params, - returns => undef, - }; -} -# @return void -# -sub add_pet_using_byte_array { - my ($self, %args) = @_; - - # parse inputs - my $_resource_path = '/pet?testing_byte_array=true'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'POST'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -211,7 +159,7 @@ sub delete_pet { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -245,13 +193,13 @@ sub delete_pet { # # Finds Pets by status # -# @param ARRAY[string] $status Status values that need to be considered for query (optional, default to available) +# @param ARRAY[string] $status Status values that need to be considered for filter (required) { my $params = { 'status' => { data_type => 'ARRAY[string]', - description => 'Status values that need to be considered for query', - required => '0', + description => 'Status values that need to be considered for filter', + required => '1', }, }; __PACKAGE__->method_documentation->{ find_pets_by_status } = { @@ -265,6 +213,11 @@ sub delete_pet { sub find_pets_by_status { my ($self, %args) = @_; + # verify the required parameter 'status' is set + unless (exists $args{'status'}) { + croak("Missing the required parameter 'status' when calling find_pets_by_status"); + } + # parse inputs my $_resource_path = '/pet/findByStatus'; $_resource_path =~ s/{format}/json/; # default format to json @@ -275,7 +228,7 @@ sub find_pets_by_status { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -306,13 +259,13 @@ sub find_pets_by_status { # # Finds Pets by tags # -# @param ARRAY[string] $tags Tags to filter by (optional) +# @param ARRAY[string] $tags Tags to filter by (required) { my $params = { 'tags' => { data_type => 'ARRAY[string]', description => 'Tags to filter by', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ find_pets_by_tags } = { @@ -326,6 +279,11 @@ sub find_pets_by_status { sub find_pets_by_tags { my ($self, %args) = @_; + # verify the required parameter 'tags' is set + unless (exists $args{'tags'}) { + croak("Missing the required parameter 'tags' when calling find_pets_by_tags"); + } + # parse inputs my $_resource_path = '/pet/findByTags'; $_resource_path =~ s/{format}/json/; # default format to json @@ -336,7 +294,7 @@ sub find_pets_by_tags { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -367,12 +325,12 @@ sub find_pets_by_tags { # # Find pet by ID # -# @param int $pet_id ID of pet that needs to be fetched (required) +# @param int $pet_id ID of pet to return (required) { my $params = { 'pet_id' => { data_type => 'int', - description => 'ID of pet that needs to be fetched', + description => 'ID of pet to return', required => '1', }, }; @@ -402,7 +360,7 @@ sub get_pet_by_id { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -417,7 +375,7 @@ sub get_pet_by_id { my $_body_data; # authentication setting, if any - my $auth_settings = [qw(api_key petstore_auth )]; + my $auth_settings = [qw(api_key )]; # make the API Call my $response = $self->{api_client}->call_api($_resource_path, $_method, @@ -430,154 +388,18 @@ sub get_pet_by_id { return $_response_object; } -# -# get_pet_by_id_in_object -# -# Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -# -# @param int $pet_id ID of pet that needs to be fetched (required) -{ - my $params = { - 'pet_id' => { - data_type => 'int', - description => 'ID of pet that needs to be fetched', - required => '1', - }, - }; - __PACKAGE__->method_documentation->{ get_pet_by_id_in_object } = { - summary => 'Fake endpoint to test inline arbitrary object return by 'Find pet by ID'', - params => $params, - returns => 'InlineResponse200', - }; -} -# @return InlineResponse200 -# -sub get_pet_by_id_in_object { - my ($self, %args) = @_; - - # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling get_pet_by_id_in_object"); - } - - # parse inputs - my $_resource_path = '/pet/{petId}?response=inline_arbitrary_object'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - # path params - if ( exists $args{'pet_id'}) { - my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); - $_resource_path =~ s/$_base_variable/$_base_value/g; - } - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(api_key petstore_auth )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('InlineResponse200', $response); - return $_response_object; -} - -# -# pet_pet_idtesting_byte_arraytrue_get -# -# Fake endpoint to test byte array return by 'Find pet by ID' -# -# @param int $pet_id ID of pet that needs to be fetched (required) -{ - my $params = { - 'pet_id' => { - data_type => 'int', - description => 'ID of pet that needs to be fetched', - required => '1', - }, - }; - __PACKAGE__->method_documentation->{ pet_pet_idtesting_byte_arraytrue_get } = { - summary => 'Fake endpoint to test byte array return by 'Find pet by ID'', - params => $params, - returns => 'string', - }; -} -# @return string -# -sub pet_pet_idtesting_byte_arraytrue_get { - my ($self, %args) = @_; - - # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling pet_pet_idtesting_byte_arraytrue_get"); - } - - # parse inputs - my $_resource_path = '/pet/{petId}?testing_byte_array=true'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - # path params - if ( exists $args{'pet_id'}) { - my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); - $_resource_path =~ s/$_base_variable/$_base_value/g; - } - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(api_key petstore_auth )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('string', $response); - return $_response_object; -} - # # update_pet # # Update an existing pet # -# @param Pet $body Pet object that needs to be added to the store (optional) +# @param Pet $body Pet object that needs to be added to the store (required) { my $params = { 'body' => { data_type => 'Pet', description => 'Pet object that needs to be added to the store', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ update_pet } = { @@ -591,6 +413,11 @@ sub pet_pet_idtesting_byte_arraytrue_get { sub update_pet { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling update_pet"); + } + # parse inputs my $_resource_path = '/pet'; $_resource_path =~ s/{format}/json/; # default format to json @@ -601,7 +428,7 @@ sub update_pet { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -628,13 +455,13 @@ sub update_pet { # # Updates a pet in the store with form data # -# @param string $pet_id ID of pet that needs to be updated (required) +# @param int $pet_id ID of pet that needs to be updated (required) # @param string $name Updated name of the pet (optional) # @param string $status Updated status of the pet (optional) { my $params = { 'pet_id' => { - data_type => 'string', + data_type => 'int', description => 'ID of pet that needs to be updated', required => '1', }, @@ -675,7 +502,7 @@ sub update_pet_with_form { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -738,10 +565,10 @@ sub update_pet_with_form { __PACKAGE__->method_documentation->{ upload_file } = { summary => 'uploads an image', params => $params, - returns => undef, + returns => 'ApiResponse', }; } -# @return void +# @return ApiResponse # sub upload_file { my ($self, %args) = @_; @@ -761,7 +588,7 @@ sub upload_file { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -790,10 +617,14 @@ sub upload_file { my $auth_settings = [qw(petstore_auth )]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, + my $response = $self->{api_client}->call_api($_resource_path, $_method, $query_params, $form_params, $header_params, $_body_data, $auth_settings); - return; + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('ApiResponse', $response); + return $_response_object; } 1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm index 77b2c79e112..e72b12a22b8 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Role.pm @@ -37,7 +37,7 @@ has version_info => ( is => 'ro', default => sub { { app_name => 'Swagger Petstore', app_version => '1.0.0', - generated_date => '2016-04-12T12:54:53.924+08:00', + generated_date => '2016-04-13T22:41:41.133+08:00', generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen', } }, documentation => 'Information about the application version and the codegen codebase version' @@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project: =over 4 -=item Build date: 2016-04-12T12:54:53.924+08:00 +=item Build date: 2016-04-13T22:41:41.133+08:00 =item Build package: class io.swagger.codegen.languages.PerlClientCodegen diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm index 69b31f5e4ad..16a4f13cb1e 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/StoreApi.pm @@ -91,7 +91,7 @@ sub delete_order { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -115,67 +115,6 @@ sub delete_order { return; } -# -# find_orders_by_status -# -# Finds orders by status -# -# @param string $status Status value that needs to be considered for query (optional, default to placed) -{ - my $params = { - 'status' => { - data_type => 'string', - description => 'Status value that needs to be considered for query', - required => '0', - }, - }; - __PACKAGE__->method_documentation->{ find_orders_by_status } = { - summary => 'Finds orders by status', - params => $params, - returns => 'ARRAY[Order]', - }; -} -# @return ARRAY[Order] -# -sub find_orders_by_status { - my ($self, %args) = @_; - - # parse inputs - my $_resource_path = '/store/findByStatus'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - # query params - if ( exists $args{'status'}) { - $query_params->{'status'} = $self->{api_client}->to_query_value($args{'status'}); - } - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(test_api_client_id test_api_client_secret )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('ARRAY[Order]', $response); - return $_response_object; -} - # # get_inventory # @@ -205,7 +144,7 @@ sub get_inventory { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -226,66 +165,16 @@ sub get_inventory { return $_response_object; } -# -# get_inventory_in_object -# -# Fake endpoint to test arbitrary object return by 'Get inventory' -# -{ - my $params = { - }; - __PACKAGE__->method_documentation->{ get_inventory_in_object } = { - summary => 'Fake endpoint to test arbitrary object return by 'Get inventory'', - params => $params, - returns => 'object', - }; -} -# @return object -# -sub get_inventory_in_object { - my ($self, %args) = @_; - - # parse inputs - my $_resource_path = '/store/inventory?response=arbitrary_object'; - $_resource_path =~ s/{format}/json/; # default format to json - - my $_method = 'GET'; - my $query_params = {}; - my $header_params = {}; - my $form_params = {}; - - # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); - if ($_header_accept) { - $header_params->{'Accept'} = $_header_accept; - } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); - - my $_body_data; - # authentication setting, if any - my $auth_settings = [qw(api_key )]; - - # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { - return; - } - my $_response_object = $self->{api_client}->deserialize('object', $response); - return $_response_object; -} - # # get_order_by_id # # Find purchase order by ID # -# @param string $order_id ID of pet that needs to be fetched (required) +# @param int $order_id ID of pet that needs to be fetched (required) { my $params = { 'order_id' => { - data_type => 'string', + data_type => 'int', description => 'ID of pet that needs to be fetched', required => '1', }, @@ -316,7 +205,7 @@ sub get_order_by_id { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -331,7 +220,7 @@ sub get_order_by_id { my $_body_data; # authentication setting, if any - my $auth_settings = [qw(test_api_key_header test_api_key_query )]; + my $auth_settings = [qw()]; # make the API Call my $response = $self->{api_client}->call_api($_resource_path, $_method, @@ -349,13 +238,13 @@ sub get_order_by_id { # # Place an order for a pet # -# @param Order $body order placed for purchasing the pet (optional) +# @param Order $body order placed for purchasing the pet (required) { my $params = { 'body' => { data_type => 'Order', description => 'order placed for purchasing the pet', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ place_order } = { @@ -369,6 +258,11 @@ sub get_order_by_id { sub place_order { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling place_order"); + } + # parse inputs my $_resource_path = '/store/order'; $_resource_path =~ s/{format}/json/; # default format to json @@ -379,7 +273,7 @@ sub place_order { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -392,7 +286,7 @@ sub place_order { } # authentication setting, if any - my $auth_settings = [qw(test_api_client_id test_api_client_secret )]; + my $auth_settings = [qw()]; # make the API Call my $response = $self->{api_client}->call_api($_resource_path, $_method, diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm index 20e2a1644dc..75f56f56293 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/UserApi.pm @@ -56,13 +56,13 @@ sub new { # # Create user # -# @param User $body Created user object (optional) +# @param User $body Created user object (required) { my $params = { 'body' => { data_type => 'User', description => 'Created user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ create_user } = { @@ -76,6 +76,11 @@ sub new { sub create_user { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling create_user"); + } + # parse inputs my $_resource_path = '/user'; $_resource_path =~ s/{format}/json/; # default format to json @@ -86,7 +91,7 @@ sub create_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -113,13 +118,13 @@ sub create_user { # # Creates list of users with given input array # -# @param ARRAY[User] $body List of user object (optional) +# @param ARRAY[User] $body List of user object (required) { my $params = { 'body' => { data_type => 'ARRAY[User]', description => 'List of user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ create_users_with_array_input } = { @@ -133,6 +138,11 @@ sub create_user { sub create_users_with_array_input { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling create_users_with_array_input"); + } + # parse inputs my $_resource_path = '/user/createWithArray'; $_resource_path =~ s/{format}/json/; # default format to json @@ -143,7 +153,7 @@ sub create_users_with_array_input { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -170,13 +180,13 @@ sub create_users_with_array_input { # # Creates list of users with given input array # -# @param ARRAY[User] $body List of user object (optional) +# @param ARRAY[User] $body List of user object (required) { my $params = { 'body' => { data_type => 'ARRAY[User]', description => 'List of user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ create_users_with_list_input } = { @@ -190,6 +200,11 @@ sub create_users_with_array_input { sub create_users_with_list_input { my ($self, %args) = @_; + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling create_users_with_list_input"); + } + # parse inputs my $_resource_path = '/user/createWithList'; $_resource_path =~ s/{format}/json/; # default format to json @@ -200,7 +215,7 @@ sub create_users_with_list_input { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -262,7 +277,7 @@ sub delete_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -277,7 +292,7 @@ sub delete_user { my $_body_data; # authentication setting, if any - my $auth_settings = [qw(test_http_basic )]; + my $auth_settings = [qw()]; # make the API Call $self->{api_client}->call_api($_resource_path, $_method, @@ -326,7 +341,7 @@ sub get_user_by_name { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -359,19 +374,19 @@ sub get_user_by_name { # # Logs user into the system # -# @param string $username The user name for login (optional) -# @param string $password The password for login in clear text (optional) +# @param string $username The user name for login (required) +# @param string $password The password for login in clear text (required) { my $params = { 'username' => { data_type => 'string', description => 'The user name for login', - required => '0', + required => '1', }, 'password' => { data_type => 'string', description => 'The password for login in clear text', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ login_user } = { @@ -385,6 +400,16 @@ sub get_user_by_name { sub login_user { my ($self, %args) = @_; + # verify the required parameter 'username' is set + unless (exists $args{'username'}) { + croak("Missing the required parameter 'username' when calling login_user"); + } + + # verify the required parameter 'password' is set + unless (exists $args{'password'}) { + croak("Missing the required parameter 'password' when calling login_user"); + } + # parse inputs my $_resource_path = '/user/login'; $_resource_path =~ s/{format}/json/; # default format to json @@ -395,7 +420,7 @@ sub login_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -455,7 +480,7 @@ sub logout_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } @@ -478,7 +503,7 @@ sub logout_user { # Updated user # # @param string $username name that need to be deleted (required) -# @param User $body Updated user object (optional) +# @param User $body Updated user object (required) { my $params = { 'username' => { @@ -489,7 +514,7 @@ sub logout_user { 'body' => { data_type => 'User', description => 'Updated user object', - required => '0', + required => '1', }, }; __PACKAGE__->method_documentation->{ update_user } = { @@ -508,6 +533,11 @@ sub update_user { croak("Missing the required parameter 'username' when calling update_user"); } + # verify the required parameter 'body' is set + unless (exists $args{'body'}) { + croak("Missing the required parameter 'body' when calling update_user"); + } + # parse inputs my $_resource_path = '/user/{username}'; $_resource_path =~ s/{format}/json/; # default format to json @@ -518,7 +548,7 @@ sub update_user { my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json', 'application/xml'); + my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } diff --git a/samples/client/petstore/perl/t/PetApiTest.t b/samples/client/petstore/perl/t/PetApiTest.t index 91f87e56f24..8d0a0c84a9c 100644 --- a/samples/client/petstore/perl/t/PetApiTest.t +++ b/samples/client/petstore/perl/t/PetApiTest.t @@ -37,14 +37,6 @@ isa_ok($api, 'WWW::SwaggerClient::PetApi'); my $result = $api->add_pet(body => $body); } -# -# add_pet_using_byte_array test -# -{ - my $body = undef; # replace NULL with a proper value - my $result = $api->add_pet_using_byte_array(body => $body); -} - # # delete_pet test # @@ -78,22 +70,6 @@ isa_ok($api, 'WWW::SwaggerClient::PetApi'); my $result = $api->get_pet_by_id(pet_id => $pet_id); } -# -# get_pet_by_id_in_object test -# -{ - my $pet_id = undef; # replace NULL with a proper value - my $result = $api->get_pet_by_id_in_object(pet_id => $pet_id); -} - -# -# pet_pet_idtesting_byte_arraytrue_get test -# -{ - my $pet_id = undef; # replace NULL with a proper value - my $result = $api->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id); -} - # # update_pet test # diff --git a/samples/client/petstore/perl/t/StoreApiTest.t b/samples/client/petstore/perl/t/StoreApiTest.t index a9bc3b3a4f3..3bb0ed753d3 100644 --- a/samples/client/petstore/perl/t/StoreApiTest.t +++ b/samples/client/petstore/perl/t/StoreApiTest.t @@ -37,14 +37,6 @@ isa_ok($api, 'WWW::SwaggerClient::StoreApi'); my $result = $api->delete_order(order_id => $order_id); } -# -# find_orders_by_status test -# -{ - my $status = undef; # replace NULL with a proper value - my $result = $api->find_orders_by_status(status => $status); -} - # # get_inventory test # @@ -52,13 +44,6 @@ isa_ok($api, 'WWW::SwaggerClient::StoreApi'); my $result = $api->get_inventory(); } -# -# get_inventory_in_object test -# -{ - my $result = $api->get_inventory_in_object(); -} - # # get_order_by_id test # diff --git a/samples/client/petstore/perl/tests/01_pet_api.t b/samples/client/petstore/perl/tests/01_pet_api.t index c7bcdf98a0a..e63a645e38a 100644 --- a/samples/client/petstore/perl/tests/01_pet_api.t +++ b/samples/client/petstore/perl/tests/01_pet_api.t @@ -76,7 +76,7 @@ my $get_pet_after_update = $api->get_pet_by_id(pet_id => $pet_id); is $get_pet_after_update->{status}, 'sold', 'get the updated status after update_pet_with_form'; my $upload_pet = $api->upload_file(pet_id => $pet_id, additional_metadata => 'testabc', file => 'test.pl'); -is $upload_pet, undef, 'get the null response from upload_pet'; +isa_ok($upload_pet, 'WWW::SwaggerClient::Object::ApiResponse'); my $delete_pet = $api->delete_pet(pet_id => $pet_id); is $delete_pet, undef, 'get the null response from delete_pet'; diff --git a/samples/client/petstore/perl/tests/04_role.t b/samples/client/petstore/perl/tests/04_role.t index 8836c35546c..7570dfa703a 100644 --- a/samples/client/petstore/perl/tests/04_role.t +++ b/samples/client/petstore/perl/tests/04_role.t @@ -50,10 +50,10 @@ is $get_pet->tags->[0]->id, '11', 'stored and retrieved: got the proper tag id'; # API method docs is_deeply( [sort keys %{$api->pet_api->method_documentation}], - [ 'add_pet', 'add_pet_using_byte_array', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'get_pet_by_id_in_object', 'pet_pet_idtesting_byte_arraytrue_get', 'update_pet', 'update_pet_with_form', 'upload_file'], + [ 'add_pet', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'update_pet', 'update_pet_with_form', 'upload_file'], "Pet API method_documentation has the correct keys"); is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{description}, - 'ID of pet that needs to be fetched', 'get_pet_by_id parameter pet_id description is correct'; + 'ID of pet to return', 'get_pet_by_id parameter pet_id description is correct'; is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{required}, 1, 'get_pet_by_id parameter pet_id is required'; is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{data_type}, diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index bdee1670248..d7a43368cac 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -1,11 +1,11 @@ # SwaggerClient-php -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This PHP package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T16:59:06.544+08:00 +- Build date: 2016-04-12T20:01:35.068+08:00 - Build package: class io.swagger.codegen.languages.PhpClientCodegen ## Requirements @@ -80,20 +80,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *PetApi* | [**addPet**](docs/PetApi.md#addpet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**addPetUsingByteArray**](docs/PetApi.md#addpetusingbytearray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *PetApi* | [**deletePet**](docs/PetApi.md#deletepet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**findPetsByStatus**](docs/PetApi.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**findPetsByTags**](docs/PetApi.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**getPetById**](docs/PetApi.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**getPetByIdInObject**](docs/PetApi.md#getpetbyidinobject) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*PetApi* | [**petPetIdtestingByteArraytrueGet**](docs/PetApi.md#petpetidtestingbytearraytrueget) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *PetApi* | [**updatePet**](docs/PetApi.md#updatepet) | **PUT** /pet | Update an existing pet *PetApi* | [**updatePetWithForm**](docs/PetApi.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**uploadFile**](docs/PetApi.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image *StoreApi* | [**deleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**findOrdersByStatus**](docs/StoreApi.md#findordersbystatus) | **GET** /store/findByStatus | Finds orders by status *StoreApi* | [**getInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**getInventoryInObject**](docs/StoreApi.md#getinventoryinobject) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *StoreApi* | [**getOrderById**](docs/StoreApi.md#getorderbyid) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**placeOrder**](docs/StoreApi.md#placeorder) | **POST** /store/order | Place an order for a pet *UserApi* | [**createUser**](docs/UserApi.md#createuser) | **POST** /user | Create user @@ -109,11 +104,11 @@ Class | Method | HTTP request | Description ## Documentation For Models - [Animal](docs/Animal.md) + - [ApiResponse](docs/ApiResponse.md) - [Cat](docs/Cat.md) - [Category](docs/Category.md) - [Dog](docs/Dog.md) - [FormatTest](docs/FormatTest.md) - - [InlineResponse200](docs/InlineResponse200.md) - [Model200Response](docs/Model200Response.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) @@ -127,40 +122,12 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - ## api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -## test_http_basic - -- **Type**: HTTP basic authentication - -## test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -## test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -## test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - ## petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md index 7ea1a17404f..e0598317f5e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/FormatTest.md @@ -13,7 +13,8 @@ Name | Type | Description | Notes **byte** | **string** | | [optional] **binary** | **string** | | [optional] **date** | [**\DateTime**](Date.md) | | [optional] -**date_time** | **string** | | [optional] +**date_time** | [**\DateTime**](\DateTime.md) | | [optional] +**password** | **string** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md index 8932478b022..ddae5cc2b57 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Order.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Order.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **quantity** | **int** | | [optional] **ship_date** | [**\DateTime**](\DateTime.md) | | [optional] **status** | **string** | Order Status | [optional] -**complete** | **bool** | | [optional] +**complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md index a6ecedea83e..7f048a429e3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md @@ -41,7 +41,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Created user object | [optional] + **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Created user object | ### Return type @@ -54,7 +54,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -85,7 +85,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | [optional] + **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | ### Return type @@ -98,7 +98,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -129,7 +129,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | [optional] + **body** | [**\Swagger\Client\Model\User[]**](User.md)| List of user object | ### Return type @@ -142,7 +142,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -158,10 +158,6 @@ This can only be done by the logged in user. setUsername('YOUR_USERNAME'); -Swagger\Client\Configuration::getDefaultConfiguration()->setPassword('YOUR_PASSWORD'); - $api_instance = new Swagger\Client\Api\UserApi(); $username = "username_example"; // string | The name that needs to be deleted @@ -185,12 +181,12 @@ void (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -235,7 +231,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -268,8 +264,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **string**| The user name for login | [optional] - **password** | **string**| The password for login in clear text | [optional] + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | ### Return type @@ -282,7 +278,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -322,7 +318,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -355,7 +351,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **string**| name that need to be deleted | - **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Updated user object | [optional] + **body** | [**\Swagger\Client\Model\User**](\Swagger\Client\Model\User.md)| Updated user object | ### Return type @@ -368,7 +364,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php index 4661a5b3bd8..1154b72929c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/PetApi.php @@ -95,11 +95,11 @@ class PetApi * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function addPet($body = null) + public function addPet($body) { list($response) = $this->addPetWithHttpInfo ($body); return $response; @@ -111,13 +111,17 @@ class PetApi * * Add a new pet to the store * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function addPetWithHttpInfo($body = null) + public function addPetWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling addPet'); + } // parse inputs $resourcePath = "/pet"; @@ -125,88 +129,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array('application/json','application/xml')); - - - - - // default format to json - $resourcePath = str_replace("{format}", "json", $resourcePath); - - - // body params - $_tempBody = null; - if (isset($body)) { - $_tempBody = $body; - } - - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, 'POST', - $queryParams, $httpBody, - $headerParams - ); - - return array(null, $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - } - - throw $e; - } - } - /** - * addPetUsingByteArray - * - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param string $body Pet object in the form of byte array (optional) - * @return void - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function addPetUsingByteArray($body = null) - { - list($response) = $this->addPetUsingByteArrayWithHttpInfo ($body); - return $response; - } - - - /** - * addPetUsingByteArrayWithHttpInfo - * - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - * @param string $body Pet object in the form of byte array (optional) - * @return Array of null, HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function addPetUsingByteArrayWithHttpInfo($body = null) - { - - - // parse inputs - $resourcePath = "/pet?testing_byte_array=true"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -293,7 +216,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -350,11 +273,11 @@ class PetApi * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for query (optional, default to available) + * @param string[] $status Status values that need to be considered for filter (required) * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByStatus($status = null) + public function findPetsByStatus($status) { list($response) = $this->findPetsByStatusWithHttpInfo ($status); return $response; @@ -366,13 +289,17 @@ class PetApi * * Finds Pets by status * - * @param string[] $status Status values that need to be considered for query (optional, default to available) + * @param string[] $status Status values that need to be considered for filter (required) * @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByStatusWithHttpInfo($status = null) + public function findPetsByStatusWithHttpInfo($status) { + // verify the required parameter 'status' is set + if ($status === null) { + throw new \InvalidArgumentException('Missing the required parameter $status when calling findPetsByStatus'); + } // parse inputs $resourcePath = "/pet/findByStatus"; @@ -380,7 +307,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -388,7 +315,7 @@ class PetApi // query params if (is_array($status)) { - $status = $this->apiClient->getSerializer()->serializeCollection($status, 'multi', true); + $status = $this->apiClient->getSerializer()->serializeCollection($status, 'csv', true); } if ($status !== null) { $queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status); @@ -440,11 +367,11 @@ class PetApi * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (optional) + * @param string[] $tags Tags to filter by (required) * @return \Swagger\Client\Model\Pet[] * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByTags($tags = null) + public function findPetsByTags($tags) { list($response) = $this->findPetsByTagsWithHttpInfo ($tags); return $response; @@ -456,13 +383,17 @@ class PetApi * * Finds Pets by tags * - * @param string[] $tags Tags to filter by (optional) + * @param string[] $tags Tags to filter by (required) * @return Array of \Swagger\Client\Model\Pet[], HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function findPetsByTagsWithHttpInfo($tags = null) + public function findPetsByTagsWithHttpInfo($tags) { + // verify the required parameter 'tags' is set + if ($tags === null) { + throw new \InvalidArgumentException('Missing the required parameter $tags when calling findPetsByTags'); + } // parse inputs $resourcePath = "/pet/findByTags"; @@ -470,7 +401,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -478,7 +409,7 @@ class PetApi // query params if (is_array($tags)) { - $tags = $this->apiClient->getSerializer()->serializeCollection($tags, 'multi', true); + $tags = $this->apiClient->getSerializer()->serializeCollection($tags, 'csv', true); } if ($tags !== null) { $queryParams['tags'] = $this->apiClient->getSerializer()->toQueryValue($tags); @@ -530,7 +461,7 @@ class PetApi * * Find pet by ID * - * @param int $pet_id ID of pet that needs to be fetched (required) + * @param int $pet_id ID of pet to return (required) * @return \Swagger\Client\Model\Pet * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -546,7 +477,7 @@ class PetApi * * Find pet by ID * - * @param int $pet_id ID of pet that needs to be fetched (required) + * @param int $pet_id ID of pet to return (required) * @return Array of \Swagger\Client\Model\Pet, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -564,7 +495,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -599,11 +530,6 @@ class PetApi $headerParams['api_key'] = $apiKey; } - - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( @@ -627,220 +553,16 @@ class PetApi throw $e; } } - /** - * getPetByIdInObject - * - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return \Swagger\Client\Model\InlineResponse200 - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function getPetByIdInObject($pet_id) - { - list($response) = $this->getPetByIdInObjectWithHttpInfo ($pet_id); - return $response; - } - - - /** - * getPetByIdInObjectWithHttpInfo - * - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return Array of \Swagger\Client\Model\InlineResponse200, HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function getPetByIdInObjectWithHttpInfo($pet_id) - { - - // verify the required parameter 'pet_id' is set - if ($pet_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling getPetByIdInObject'); - } - - // parse inputs - $resourcePath = "/pet/{petId}?response=inline_arbitrary_object"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); - - - - // path params - if ($pet_id !== null) { - $resourcePath = str_replace( - "{" . "petId" . "}", - $this->apiClient->getSerializer()->toPathValue($pet_id), - $resourcePath - ); - } - // default format to json - $resourcePath = str_replace("{format}", "json", $resourcePath); - - - - - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); - if (strlen($apiKey) !== 0) { - $headerParams['api_key'] = $apiKey; - } - - - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, 'GET', - $queryParams, $httpBody, - $headerParams, '\Swagger\Client\Model\InlineResponse200' - ); - if (!$response) { - return array(null, $statusCode, $httpHeader); - } - - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\InlineResponse200', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\InlineResponse200', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } - /** - * petPetIdtestingByteArraytrueGet - * - * Fake endpoint to test byte array return by 'Find pet by ID' - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return string - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function petPetIdtestingByteArraytrueGet($pet_id) - { - list($response) = $this->petPetIdtestingByteArraytrueGetWithHttpInfo ($pet_id); - return $response; - } - - - /** - * petPetIdtestingByteArraytrueGetWithHttpInfo - * - * Fake endpoint to test byte array return by 'Find pet by ID' - * - * @param int $pet_id ID of pet that needs to be fetched (required) - * @return Array of string, HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function petPetIdtestingByteArraytrueGetWithHttpInfo($pet_id) - { - - // verify the required parameter 'pet_id' is set - if ($pet_id === null) { - throw new \InvalidArgumentException('Missing the required parameter $pet_id when calling petPetIdtestingByteArraytrueGet'); - } - - // parse inputs - $resourcePath = "/pet/{petId}?testing_byte_array=true"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); - - - - // path params - if ($pet_id !== null) { - $resourcePath = str_replace( - "{" . "petId" . "}", - $this->apiClient->getSerializer()->toPathValue($pet_id), - $resourcePath - ); - } - // default format to json - $resourcePath = str_replace("{format}", "json", $resourcePath); - - - - - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); - if (strlen($apiKey) !== 0) { - $headerParams['api_key'] = $apiKey; - } - - - // this endpoint requires OAuth (access token) - if (strlen($this->apiClient->getConfig()->getAccessToken()) !== 0) { - $headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken(); - } - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, 'GET', - $queryParams, $httpBody, - $headerParams, 'string' - ); - if (!$response) { - return array(null, $statusCode, $httpHeader); - } - - return array($this->apiClient->getSerializer()->deserialize($response, 'string', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'string', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } /** * updatePet * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updatePet($body = null) + public function updatePet($body) { list($response) = $this->updatePetWithHttpInfo ($body); return $response; @@ -852,13 +574,17 @@ class PetApi * * Update an existing pet * - * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (optional) + * @param \Swagger\Client\Model\Pet $body Pet object that needs to be added to the store (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updatePetWithHttpInfo($body = null) + public function updatePetWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling updatePet'); + } // parse inputs $resourcePath = "/pet"; @@ -866,7 +592,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -917,7 +643,7 @@ class PetApi * * Updates a pet in the store with form data * - * @param string $pet_id ID of pet that needs to be updated (required) + * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) * @return void @@ -935,7 +661,7 @@ class PetApi * * Updates a pet in the store with form data * - * @param string $pet_id ID of pet that needs to be updated (required) + * @param int $pet_id ID of pet that needs to be updated (required) * @param string $name Updated name of the pet (optional) * @param string $status Updated status of the pet (optional) * @return Array of null, HTTP status code, HTTP response headers (array of strings) @@ -955,7 +681,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -1018,7 +744,7 @@ class PetApi * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) - * @return void + * @return \Swagger\Client\Model\ApiResponse * @throws \Swagger\Client\ApiException on non-2xx response */ public function uploadFile($pet_id, $additional_metadata = null, $file = null) @@ -1036,7 +762,7 @@ class PetApi * @param int $pet_id ID of pet to update (required) * @param string $additional_metadata Additional data to pass to server (optional) * @param \SplFileObject $file file to upload (optional) - * @return Array of null, HTTP status code, HTTP response headers (array of strings) + * @return Array of \Swagger\Client\Model\ApiResponse, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ public function uploadFileWithHttpInfo($pet_id, $additional_metadata = null, $file = null) @@ -1053,7 +779,7 @@ class PetApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -1103,12 +829,19 @@ class PetApi list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'POST', $queryParams, $httpBody, - $headerParams + $headerParams, '\Swagger\Client\Model\ApiResponse' ); + if (!$response) { + return array(null, $statusCode, $httpHeader); + } - return array(null, $statusCode, $httpHeader); - } catch (ApiException $e) { + return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\ApiResponse', $httpHeader), $statusCode, $httpHeader); + } catch (ApiException $e) { switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\ApiResponse', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; } throw $e; diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php index 387cd476c55..e5bf83b4463 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/StoreApi.php @@ -129,7 +129,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -173,102 +173,6 @@ class StoreApi throw $e; } } - /** - * findOrdersByStatus - * - * Finds orders by status - * - * @param string $status Status value that needs to be considered for query (optional, default to placed) - * @return \Swagger\Client\Model\Order[] - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function findOrdersByStatus($status = null) - { - list($response) = $this->findOrdersByStatusWithHttpInfo ($status); - return $response; - } - - - /** - * findOrdersByStatusWithHttpInfo - * - * Finds orders by status - * - * @param string $status Status value that needs to be considered for query (optional, default to placed) - * @return Array of \Swagger\Client\Model\Order[], HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function findOrdersByStatusWithHttpInfo($status = null) - { - - - // parse inputs - $resourcePath = "/store/findByStatus"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); - - // query params - if ($status !== null) { - $queryParams['status'] = $this->apiClient->getSerializer()->toQueryValue($status); - } - - - // default format to json - $resourcePath = str_replace("{format}", "json", $resourcePath); - - - - - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_id'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_id'] = $apiKey; - } - - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_secret'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_secret'] = $apiKey; - } - - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, 'GET', - $queryParams, $httpBody, - $headerParams, '\Swagger\Client\Model\Order[]' - ); - if (!$response) { - return array(null, $statusCode, $httpHeader); - } - - return array($this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\Order[]', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\Order[]', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } /** * getInventory * @@ -302,7 +206,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -353,96 +257,12 @@ class StoreApi throw $e; } } - /** - * getInventoryInObject - * - * Fake endpoint to test arbitrary object return by 'Get inventory' - * - * @return object - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function getInventoryInObject() - { - list($response) = $this->getInventoryInObjectWithHttpInfo (); - return $response; - } - - - /** - * getInventoryInObjectWithHttpInfo - * - * Fake endpoint to test arbitrary object return by 'Get inventory' - * - * @return Array of object, HTTP status code, HTTP response headers (array of strings) - * @throws \Swagger\Client\ApiException on non-2xx response - */ - public function getInventoryInObjectWithHttpInfo() - { - - - // parse inputs - $resourcePath = "/store/inventory?response=arbitrary_object"; - $httpBody = ''; - $queryParams = array(); - $headerParams = array(); - $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); - if (!is_null($_header_accept)) { - $headerParams['Accept'] = $_header_accept; - } - $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType(array()); - - - - - // default format to json - $resourcePath = str_replace("{format}", "json", $resourcePath); - - - - - // for model (json/xml) - if (isset($_tempBody)) { - $httpBody = $_tempBody; // $_tempBody is the method argument, if present - } elseif (count($formParams) > 0) { - $httpBody = $formParams; // for HTTP post (form) - } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('api_key'); - if (strlen($apiKey) !== 0) { - $headerParams['api_key'] = $apiKey; - } - - // make the API Call - try { - list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( - $resourcePath, 'GET', - $queryParams, $httpBody, - $headerParams, 'object' - ); - if (!$response) { - return array(null, $statusCode, $httpHeader); - } - - return array($this->apiClient->getSerializer()->deserialize($response, 'object', $httpHeader), $statusCode, $httpHeader); - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), 'object', $e->getResponseHeaders()); - $e->setResponseObject($data); - break; - } - - throw $e; - } - } /** * getOrderById * * Find purchase order by ID * - * @param string $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -458,7 +278,7 @@ class StoreApi * * Find purchase order by ID * - * @param string $order_id ID of pet that needs to be fetched (required) + * @param int $order_id ID of pet that needs to be fetched (required) * @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ @@ -476,7 +296,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -504,21 +324,7 @@ class StoreApi } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_header'); - if (strlen($apiKey) !== 0) { - $headerParams['test_api_key_header'] = $apiKey; - } - - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('test_api_key_query'); - if (strlen($apiKey) !== 0) { - $queryParams['test_api_key_query'] = $apiKey; - } - - // make the API Call + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'GET', @@ -546,11 +352,11 @@ class StoreApi * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (optional) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @return \Swagger\Client\Model\Order * @throws \Swagger\Client\ApiException on non-2xx response */ - public function placeOrder($body = null) + public function placeOrder($body) { list($response) = $this->placeOrderWithHttpInfo ($body); return $response; @@ -562,13 +368,17 @@ class StoreApi * * Place an order for a pet * - * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (optional) + * @param \Swagger\Client\Model\Order $body order placed for purchasing the pet (required) * @return Array of \Swagger\Client\Model\Order, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function placeOrderWithHttpInfo($body = null) + public function placeOrderWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling placeOrder'); + } // parse inputs $resourcePath = "/store/order"; @@ -576,7 +386,7 @@ class StoreApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -601,21 +411,7 @@ class StoreApi } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_id'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_id'] = $apiKey; - } - - - // this endpoint requires API key authentication - $apiKey = $this->apiClient->getApiKeyWithPrefix('x-test_api_client_secret'); - if (strlen($apiKey) !== 0) { - $headerParams['x-test_api_client_secret'] = $apiKey; - } - - // make the API Call + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'POST', diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php index 23f682e4943..4882ccd9764 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/UserApi.php @@ -95,11 +95,11 @@ class UserApi * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (optional) + * @param \Swagger\Client\Model\User $body Created user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUser($body = null) + public function createUser($body) { list($response) = $this->createUserWithHttpInfo ($body); return $response; @@ -111,13 +111,17 @@ class UserApi * * Create user * - * @param \Swagger\Client\Model\User $body Created user object (optional) + * @param \Swagger\Client\Model\User $body Created user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUserWithHttpInfo($body = null) + public function createUserWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling createUser'); + } // parse inputs $resourcePath = "/user"; @@ -125,7 +129,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -171,11 +175,11 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithArrayInput($body = null) + public function createUsersWithArrayInput($body) { list($response) = $this->createUsersWithArrayInputWithHttpInfo ($body); return $response; @@ -187,13 +191,17 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithArrayInputWithHttpInfo($body = null) + public function createUsersWithArrayInputWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithArrayInput'); + } // parse inputs $resourcePath = "/user/createWithArray"; @@ -201,7 +209,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -247,11 +255,11 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithListInput($body = null) + public function createUsersWithListInput($body) { list($response) = $this->createUsersWithListInputWithHttpInfo ($body); return $response; @@ -263,13 +271,17 @@ class UserApi * * Creates list of users with given input array * - * @param \Swagger\Client\Model\User[] $body List of user object (optional) + * @param \Swagger\Client\Model\User[] $body List of user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function createUsersWithListInputWithHttpInfo($body = null) + public function createUsersWithListInputWithHttpInfo($body) { + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling createUsersWithListInput'); + } // parse inputs $resourcePath = "/user/createWithList"; @@ -277,7 +289,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -357,7 +369,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -385,12 +397,7 @@ class UserApi } elseif (count($formParams) > 0) { $httpBody = $formParams; // for HTTP post (form) } - - // this endpoint requires HTTP basic authentication - if (strlen($this->apiClient->getConfig()->getUsername()) !== 0 or strlen($this->apiClient->getConfig()->getPassword()) !== 0) { - $headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword()); - } - // make the API Call + // make the API Call try { list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( $resourcePath, 'DELETE', @@ -445,7 +452,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -501,12 +508,12 @@ class UserApi * * Logs user into the system * - * @param string $username The user name for login (optional) - * @param string $password The password for login in clear text (optional) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @return string * @throws \Swagger\Client\ApiException on non-2xx response */ - public function loginUser($username = null, $password = null) + public function loginUser($username, $password) { list($response) = $this->loginUserWithHttpInfo ($username, $password); return $response; @@ -518,14 +525,22 @@ class UserApi * * Logs user into the system * - * @param string $username The user name for login (optional) - * @param string $password The password for login in clear text (optional) + * @param string $username The user name for login (required) + * @param string $password The password for login in clear text (required) * @return Array of string, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function loginUserWithHttpInfo($username = null, $password = null) + public function loginUserWithHttpInfo($username, $password) { + // verify the required parameter 'username' is set + if ($username === null) { + throw new \InvalidArgumentException('Missing the required parameter $username when calling loginUser'); + } + // verify the required parameter 'password' is set + if ($password === null) { + throw new \InvalidArgumentException('Missing the required parameter $password when calling loginUser'); + } // parse inputs $resourcePath = "/user/login"; @@ -533,7 +548,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -616,7 +631,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } @@ -659,11 +674,11 @@ class UserApi * Updated user * * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (optional) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @return void * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updateUser($username, $body = null) + public function updateUser($username, $body) { list($response) = $this->updateUserWithHttpInfo ($username, $body); return $response; @@ -676,17 +691,21 @@ class UserApi * Updated user * * @param string $username name that need to be deleted (required) - * @param \Swagger\Client\Model\User $body Updated user object (optional) + * @param \Swagger\Client\Model\User $body Updated user object (required) * @return Array of null, HTTP status code, HTTP response headers (array of strings) * @throws \Swagger\Client\ApiException on non-2xx response */ - public function updateUserWithHttpInfo($username, $body = null) + public function updateUserWithHttpInfo($username, $body) { // verify the required parameter 'username' is set if ($username === null) { throw new \InvalidArgumentException('Missing the required parameter $username when calling updateUser'); } + // verify the required parameter 'body' is set + if ($body === null) { + throw new \InvalidArgumentException('Missing the required parameter $body when calling updateUser'); + } // parse inputs $resourcePath = "/user/{username}"; @@ -694,7 +713,7 @@ class UserApi $queryParams = array(); $headerParams = array(); $formParams = array(); - $_header_accept = $this->apiClient->selectHeaderAccept(array('application/json', 'application/xml')); + $_header_accept = $this->apiClient->selectHeaderAccept(array('application/xml', 'application/json')); if (!is_null($_header_accept)) { $headerParams['Accept'] = $_header_accept; } diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php index 949603d7d0a..7bfe30c0ef7 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/FormatTest.php @@ -67,7 +67,8 @@ class FormatTest implements ArrayAccess 'byte' => 'string', 'binary' => 'string', 'date' => '\DateTime', - 'date_time' => 'string' + 'date_time' => '\DateTime', + 'password' => 'string' ); static function swaggerTypes() { @@ -89,7 +90,8 @@ class FormatTest implements ArrayAccess 'byte' => 'byte', 'binary' => 'binary', 'date' => 'date', - 'date_time' => 'dateTime' + 'date_time' => 'dateTime', + 'password' => 'password' ); static function attributeMap() { @@ -111,7 +113,8 @@ class FormatTest implements ArrayAccess 'byte' => 'setByte', 'binary' => 'setBinary', 'date' => 'setDate', - 'date_time' => 'setDateTime' + 'date_time' => 'setDateTime', + 'password' => 'setPassword' ); static function setters() { @@ -133,7 +136,8 @@ class FormatTest implements ArrayAccess 'byte' => 'getByte', 'binary' => 'getBinary', 'date' => 'getDate', - 'date_time' => 'getDateTime' + 'date_time' => 'getDateTime', + 'password' => 'getPassword' ); static function getters() { @@ -192,9 +196,14 @@ class FormatTest implements ArrayAccess protected $date; /** * $date_time - * @var string + * @var \DateTime */ protected $date_time; + /** + * $password + * @var string + */ + protected $password; /** * Constructor @@ -216,6 +225,7 @@ class FormatTest implements ArrayAccess $this->binary = $data["binary"]; $this->date = $data["date"]; $this->date_time = $data["date_time"]; + $this->password = $data["password"]; } } /** @@ -420,7 +430,7 @@ class FormatTest implements ArrayAccess } /** * Gets date_time - * @return string + * @return \DateTime */ public function getDateTime() { @@ -429,7 +439,7 @@ class FormatTest implements ArrayAccess /** * Sets date_time - * @param string $date_time + * @param \DateTime $date_time * @return $this */ public function setDateTime($date_time) @@ -438,6 +448,26 @@ class FormatTest implements ArrayAccess $this->date_time = $date_time; return $this; } + /** + * Gets password + * @return string + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets password + * @param string $password + * @return $this + */ + public function setPassword($password) + { + + $this->password = $password; + return $this; + } /** * Returns true if offset exists. False otherwise. * @param integer $offset Offset diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php index a2dfe600950..7ee5c124d2c 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/Order.php @@ -149,7 +149,7 @@ class Order implements ArrayAccess * $complete * @var bool */ - protected $complete; + protected $complete = false; /** * Constructor diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php index f70ddf00107..af6b1018332 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/PetApiTest.php @@ -72,15 +72,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase */ public function test_addPet() { - } - /** - * Test case for addPetUsingByteArray - * - * Fake endpoint to test byte array in body parameter for adding a new pet to the store - * - */ - public function test_addPetUsingByteArray() { - } /** * Test case for deletePet @@ -117,24 +108,6 @@ class PetApiTest extends \PHPUnit_Framework_TestCase */ public function test_getPetById() { - } - /** - * Test case for getPetByIdInObject - * - * Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - * - */ - public function test_getPetByIdInObject() { - - } - /** - * Test case for petPetIdtestingByteArraytrueGet - * - * Fake endpoint to test byte array return by 'Find pet by ID' - * - */ - public function test_petPetIdtestingByteArraytrueGet() { - } /** * Test case for updatePet diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php index 2eaf5f5dd11..25fa53169f2 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Tests/StoreApiTest.php @@ -72,15 +72,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase */ public function test_deleteOrder() { - } - /** - * Test case for findOrdersByStatus - * - * Finds orders by status - * - */ - public function test_findOrdersByStatus() { - } /** * Test case for getInventory @@ -90,15 +81,6 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase */ public function test_getInventory() { - } - /** - * Test case for getInventoryInObject - * - * Fake endpoint to test arbitrary object return by 'Get inventory' - * - */ - public function test_getInventoryInObject() { - } /** * Test case for getOrderById diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php index 240f32eca4f..ea6c307decd 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/PetApiTest.php @@ -111,6 +111,10 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getTags()[0]->getName(), 'test php tag'); } + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test getPetById with a Pet object (id 10005) public function testGetPetByIdInObject() { @@ -133,6 +137,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getTags()[0]->getId(), $pet_id); $this->assertSame($response->getTags()[0]->getName(), 'test php tag'); } + */ // test getPetByIdWithHttpInfo with a Pet object (id 10005) public function testGetPetByIdWithHttpInfo() @@ -274,7 +279,11 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getId(), $new_pet_id); $this->assertSame($response->getName(), 'PHP Unit Test 2'); } - + + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test addPetUsingByteArray and verify by the "id" and "name" of the response public function testAddPetUsingByteArray() { @@ -310,8 +319,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($response->getId(), $new_pet_id); $this->assertSame($response->getName(), 'PHP Unit Test 3'); } - - + */ // test upload file public function testUploadFile() @@ -322,9 +330,10 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $pet_api = new Swagger\Client\Api\PetApi($api_client); // upload file $pet_id = 10001; - $add_response = $pet_api->uploadFile($pet_id, "test meta", "./composer.json"); - // return nothing (void) - $this->assertSame($add_response, NULL); + $response = $pet_api->uploadFile($pet_id, "test meta", "./composer.json"); + // return ApiResponse + $this->assertInstanceOf('Swagger\Client\Model\ApiResponse', $response); + } // test get inventory @@ -341,7 +350,11 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertInternalType("int", $get_response['sold']); $this->assertInternalType("int", $get_response['pending']); } - + + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test byte array response public function testGetPetByIdWithByteArray() { @@ -365,6 +378,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase $this->assertSame($json['tags'][0]['id'], $pet_id); $this->assertSame($json['tags'][0]['name'], 'test php tag'); } + */ // test empty object serialization public function testEmptyPetSerialization() diff --git a/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php b/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php index b54416f28a9..378fa5e7e19 100644 --- a/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php +++ b/samples/client/petstore/php/SwaggerClient-php/tests/StoreApiTest.php @@ -47,6 +47,10 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase $this->assertInternalType("int", $get_response['available']); } + /* + * comment out as we've removed invalid endpoints from the spec, we'll introduce something + * similar in the future when we've time to update the petstore server + * // test get inventory public function testGetInventoryInObject() { @@ -60,6 +64,7 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase $this->assertInternalType("array", $get_response); $this->assertInternalType("int", $get_response['available']); } + */ } diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 612b03d7347..85da3806f31 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -1,11 +1,11 @@ # swagger_client -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T16:56:24.045+08:00 +- Build date: 2016-04-14T17:57:34.564+08:00 - Build package: class io.swagger.codegen.languages.PythonClientCodegen ## Requirements. @@ -55,11 +55,11 @@ from pprint import pprint swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = swagger_client.PetApi -body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional) +body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store try: # Add a new pet to the store - api_instance.add_pet(body=body) + api_instance.add_pet(body) except ApiException as e: print "Exception when calling PetApi->add_pet: %s\n" % e @@ -72,20 +72,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -*PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -*PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image *StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -*StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet *UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user @@ -101,11 +96,11 @@ Class | Method | HTTP request | Description ## Documentation For Models - [Animal](docs/Animal.md) + - [ApiResponse](docs/ApiResponse.md) - [Cat](docs/Cat.md) - [Category](docs/Category.md) - [Dog](docs/Dog.md) - [FormatTest](docs/FormatTest.md) - - [InlineResponse200](docs/InlineResponse200.md) - [Model200Response](docs/Model200Response.md) - [ModelReturn](docs/ModelReturn.md) - [Name](docs/Name.md) @@ -119,40 +114,12 @@ Class | Method | HTTP request | Description ## Documentation For Authorization -## test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - ## api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -## test_http_basic - -- **Type**: HTTP basic authentication - -## test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -## test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -## test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - ## petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/python/docs/FormatTest.md b/samples/client/petstore/python/docs/FormatTest.md index 00244bcbeaf..4182a447086 100644 --- a/samples/client/petstore/python/docs/FormatTest.md +++ b/samples/client/petstore/python/docs/FormatTest.md @@ -13,7 +13,8 @@ Name | Type | Description | Notes **byte** | **str** | | [optional] **binary** | **str** | | [optional] **date** | **date** | | [optional] -**date_time** | **str** | | [optional] +**date_time** | **datetime** | | [optional] +**password** | **str** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/Order.md b/samples/client/petstore/python/docs/Order.md index 4499eaa976d..b5f7b22d34c 100644 --- a/samples/client/petstore/python/docs/Order.md +++ b/samples/client/petstore/python/docs/Order.md @@ -8,7 +8,7 @@ Name | Type | Description | Notes **quantity** | **int** | | [optional] **ship_date** | **datetime** | | [optional] **status** | **str** | Order Status | [optional] -**complete** | **bool** | | [optional] +**complete** | **bool** | | [optional] [default to False] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/UserApi.md b/samples/client/petstore/python/docs/UserApi.md index 580efeeb6a8..1975c1fe7f3 100644 --- a/samples/client/petstore/python/docs/UserApi.md +++ b/samples/client/petstore/python/docs/UserApi.md @@ -15,7 +15,7 @@ Method | HTTP request | Description # **create_user** -> create_user(body=body) +> create_user(body) Create user @@ -30,11 +30,11 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.UserApi() -body = swagger_client.User() # User | Created user object (optional) +body = swagger_client.User() # User | Created user object try: # Create user - api_instance.create_user(body=body) + api_instance.create_user(body) except ApiException as e: print "Exception when calling UserApi->create_user: %s\n" % e ``` @@ -43,7 +43,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -56,12 +56,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_users_with_array_input** -> create_users_with_array_input(body=body) +> create_users_with_array_input(body) Creates list of users with given input array @@ -76,11 +76,11 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.UserApi() -body = [swagger_client.User()] # list[User] | List of user object (optional) +body = [swagger_client.User()] # list[User] | List of user object try: # Creates list of users with given input array - api_instance.create_users_with_array_input(body=body) + api_instance.create_users_with_array_input(body) except ApiException as e: print "Exception when calling UserApi->create_users_with_array_input: %s\n" % e ``` @@ -89,7 +89,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](User.md)| List of user object | [optional] + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -102,12 +102,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_users_with_list_input** -> create_users_with_list_input(body=body) +> create_users_with_list_input(body) Creates list of users with given input array @@ -122,11 +122,11 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.UserApi() -body = [swagger_client.User()] # list[User] | List of user object (optional) +body = [swagger_client.User()] # list[User] | List of user object try: # Creates list of users with given input array - api_instance.create_users_with_list_input(body=body) + api_instance.create_users_with_list_input(body) except ApiException as e: print "Exception when calling UserApi->create_users_with_list_input: %s\n" % e ``` @@ -135,7 +135,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**list[User]**](User.md)| List of user object | [optional] + **body** | [**list[User]**](User.md)| List of user object | ### Return type @@ -148,7 +148,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -166,10 +166,6 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint -# Configure HTTP basic authorization: test_http_basic -swagger_client.configuration.username = 'YOUR_USERNAME' -swagger_client.configuration.password = 'YOUR_PASSWORD' - # create an instance of the API class api_instance = swagger_client.UserApi() username = 'username_example' # str | The name that needs to be deleted @@ -193,12 +189,12 @@ void (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -245,12 +241,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **login_user** -> str login_user(username=username, password=password) +> str login_user(username, password) Logs user into the system @@ -265,12 +261,12 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.UserApi() -username = 'username_example' # str | The user name for login (optional) -password = 'password_example' # str | The password for login in clear text (optional) +username = 'username_example' # str | The user name for login +password = 'password_example' # str | The password for login in clear text try: # Logs user into the system - api_response = api_instance.login_user(username=username, password=password) + api_response = api_instance.login_user(username, password) pprint(api_response) except ApiException as e: print "Exception when calling UserApi->login_user: %s\n" % e @@ -280,8 +276,8 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **str**| The user name for login | [optional] - **password** | **str**| The password for login in clear text | [optional] + **username** | **str**| The user name for login | + **password** | **str**| The password for login in clear text | ### Return type @@ -294,7 +290,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -336,12 +332,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_user** -> update_user(username, body=body) +> update_user(username, body) Updated user @@ -357,11 +353,11 @@ from pprint import pprint # create an instance of the API class api_instance = swagger_client.UserApi() username = 'username_example' # str | name that need to be deleted -body = swagger_client.User() # User | Updated user object (optional) +body = swagger_client.User() # User | Updated user object try: # Updated user - api_instance.update_user(username, body=body) + api_instance.update_user(username, body) except ApiException as e: print "Exception when calling UserApi->update_user: %s\n" % e ``` @@ -371,7 +367,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **str**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -384,7 +380,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/setup.py b/samples/client/petstore/python/setup.py index 725510e4a01..ef25bcba63b 100644 --- a/samples/client/petstore/python/setup.py +++ b/samples/client/petstore/python/setup.py @@ -28,7 +28,7 @@ setup( packages=find_packages(), include_package_data=True, long_description="""\ - This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. """ ) diff --git a/samples/client/petstore/python/swagger_client.egg-info/PKG-INFO b/samples/client/petstore/python/swagger_client.egg-info/PKG-INFO index da21dbff75f..a4852b36ea4 100644 --- a/samples/client/petstore/python/swagger_client.egg-info/PKG-INFO +++ b/samples/client/petstore/python/swagger_client.egg-info/PKG-INFO @@ -6,7 +6,7 @@ Home-page: UNKNOWN Author: UNKNOWN Author-email: apiteam@swagger.io License: UNKNOWN -Description: This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +Description: This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Keywords: Swagger,Swagger Petstore Platform: UNKNOWN diff --git a/samples/client/petstore/python/swagger_client/__init__.py b/samples/client/petstore/python/swagger_client/__init__.py index 9d8452e6151..2169ecd37e7 100644 --- a/samples/client/petstore/python/swagger_client/__init__.py +++ b/samples/client/petstore/python/swagger_client/__init__.py @@ -2,11 +2,11 @@ from __future__ import absolute_import # import models into sdk package from .models.animal import Animal +from .models.api_response import ApiResponse from .models.cat import Cat from .models.category import Category from .models.dog import Dog from .models.format_test import FormatTest -from .models.inline_response_200 import InlineResponse200 from .models.model_200_response import Model200Response from .models.model_return import ModelReturn from .models.name import Name diff --git a/samples/client/petstore/python/swagger_client/apis/pet_api.py b/samples/client/petstore/python/swagger_client/apis/pet_api.py index 2948960fa29..cab854e3019 100644 --- a/samples/client/petstore/python/swagger_client/apis/pet_api.py +++ b/samples/client/petstore/python/swagger_client/apis/pet_api.py @@ -45,7 +45,7 @@ class PetApi(object): config.api_client = ApiClient() self.api_client = config.api_client - def add_pet(self, **kwargs): + def add_pet(self, body, **kwargs): """ Add a new pet to the store @@ -56,11 +56,11 @@ class PetApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.add_pet(callback=callback_function) + >>> thread = api.add_pet(body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param Pet body: Pet object that needs to be added to the store + :param Pet body: Pet object that needs to be added to the store (required) :return: None If the method is called asynchronously, returns the request thread. @@ -79,6 +79,9 @@ class PetApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `add_pet`") resource_path = '/pet'.replace('{format}', 'json') path_params = {} @@ -96,81 +99,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type(['application/json', 'application/xml']) - - # Authentication setting - auth_settings = ['petstore_auth'] - - response = self.api_client.call_api(resource_path, 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type=None, - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def add_pet_using_byte_array(self, **kwargs): - """ - Fake endpoint to test byte array in body parameter for adding a new pet to the store - - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please define a `callback` function - to be invoked when receiving the response. - >>> def callback_function(response): - >>> pprint(response) - >>> - >>> thread = api.add_pet_using_byte_array(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str body: Pet object in the form of byte array - :return: None - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] - all_params.append('callback') - - params = locals() - for key, val in iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method add_pet_using_byte_array" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/pet?testing_byte_array=true'.replace('{format}', 'json') - path_params = {} - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -250,7 +179,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -273,7 +202,7 @@ class PetApi(object): callback=params.get('callback')) return response - def find_pets_by_status(self, **kwargs): + def find_pets_by_status(self, status, **kwargs): """ Finds Pets by status Multiple status values can be provided with comma separated strings @@ -284,11 +213,11 @@ class PetApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.find_pets_by_status(callback=callback_function) + >>> thread = api.find_pets_by_status(status, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param list[str] status: Status values that need to be considered for query + :param list[str] status: Status values that need to be considered for filter (required) :return: list[Pet] If the method is called asynchronously, returns the request thread. @@ -307,6 +236,9 @@ class PetApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'status' is set + if ('status' not in params) or (params['status'] is None): + raise ValueError("Missing the required parameter `status` when calling `find_pets_by_status`") resource_path = '/pet/findByStatus'.replace('{format}', 'json') path_params = {} @@ -324,7 +256,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -347,10 +279,10 @@ class PetApi(object): callback=params.get('callback')) return response - def find_pets_by_tags(self, **kwargs): + def find_pets_by_tags(self, tags, **kwargs): """ Finds Pets by tags - Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -358,11 +290,11 @@ class PetApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.find_pets_by_tags(callback=callback_function) + >>> thread = api.find_pets_by_tags(tags, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param list[str] tags: Tags to filter by + :param list[str] tags: Tags to filter by (required) :return: list[Pet] If the method is called asynchronously, returns the request thread. @@ -381,6 +313,9 @@ class PetApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'tags' is set + if ('tags' not in params) or (params['tags'] is None): + raise ValueError("Missing the required parameter `tags` when calling `find_pets_by_tags`") resource_path = '/pet/findByTags'.replace('{format}', 'json') path_params = {} @@ -398,7 +333,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -424,7 +359,7 @@ class PetApi(object): def get_pet_by_id(self, pet_id, **kwargs): """ Find pet by ID - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + Returns a single pet This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please define a `callback` function @@ -436,7 +371,7 @@ class PetApi(object): :param callback function: The callback function for asynchronous request. (optional) - :param int pet_id: ID of pet that needs to be fetched (required) + :param int pet_id: ID of pet to return (required) :return: Pet If the method is called asynchronously, returns the request thread. @@ -475,7 +410,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -484,7 +419,7 @@ class PetApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['api_key', 'petstore_auth'] + auth_settings = ['api_key'] response = self.api_client.call_api(resource_path, 'GET', path_params, @@ -498,161 +433,7 @@ class PetApi(object): callback=params.get('callback')) return response - def get_pet_by_id_in_object(self, pet_id, **kwargs): - """ - Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please define a `callback` function - to be invoked when receiving the response. - >>> def callback_function(response): - >>> pprint(response) - >>> - >>> thread = api.get_pet_by_id_in_object(pet_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param int pet_id: ID of pet that needs to be fetched (required) - :return: InlineResponse200 - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['pet_id'] - all_params.append('callback') - - params = locals() - for key, val in iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_pet_by_id_in_object" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'pet_id' is set - if ('pet_id' not in params) or (params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id_in_object`") - - resource_path = '/pet/{petId}?response=inline_arbitrary_object'.replace('{format}', 'json') - path_params = {} - if 'pet_id' in params: - path_params['petId'] = params['pet_id'] - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['api_key', 'petstore_auth'] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='InlineResponse200', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def pet_pet_idtesting_byte_arraytrue_get(self, pet_id, **kwargs): - """ - Fake endpoint to test byte array return by 'Find pet by ID' - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please define a `callback` function - to be invoked when receiving the response. - >>> def callback_function(response): - >>> pprint(response) - >>> - >>> thread = api.pet_pet_idtesting_byte_arraytrue_get(pet_id, callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param int pet_id: ID of pet that needs to be fetched (required) - :return: str - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['pet_id'] - all_params.append('callback') - - params = locals() - for key, val in iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method pet_pet_idtesting_byte_arraytrue_get" % key - ) - params[key] = val - del params['kwargs'] - - # verify the required parameter 'pet_id' is set - if ('pet_id' not in params) or (params['pet_id'] is None): - raise ValueError("Missing the required parameter `pet_id` when calling `pet_pet_idtesting_byte_arraytrue_get`") - - resource_path = '/pet/{petId}?testing_byte_array=true'.replace('{format}', 'json') - path_params = {} - if 'pet_id' in params: - path_params['petId'] = params['pet_id'] - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['api_key', 'petstore_auth'] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='str', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - - def update_pet(self, **kwargs): + def update_pet(self, body, **kwargs): """ Update an existing pet @@ -663,11 +444,11 @@ class PetApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.update_pet(callback=callback_function) + >>> thread = api.update_pet(body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param Pet body: Pet object that needs to be added to the store + :param Pet body: Pet object that needs to be added to the store (required) :return: None If the method is called asynchronously, returns the request thread. @@ -686,6 +467,9 @@ class PetApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `update_pet`") resource_path = '/pet'.replace('{format}', 'json') path_params = {} @@ -703,7 +487,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -741,7 +525,7 @@ class PetApi(object): :param callback function: The callback function for asynchronous request. (optional) - :param str pet_id: ID of pet that needs to be updated (required) + :param int pet_id: ID of pet that needs to be updated (required) :param str name: Updated name of the pet :param str status: Updated status of the pet :return: None @@ -786,7 +570,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -827,7 +611,7 @@ class PetApi(object): :param int pet_id: ID of pet to update (required) :param str additional_metadata: Additional data to pass to server :param file file: file to upload - :return: None + :return: ApiResponse If the method is called asynchronously, returns the request thread. """ @@ -869,7 +653,7 @@ class PetApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -887,7 +671,7 @@ class PetApi(object): body=body_params, post_params=form_params, files=local_var_files, - response_type=None, + response_type='ApiResponse', auth_settings=auth_settings, callback=params.get('callback')) return response diff --git a/samples/client/petstore/python/swagger_client/apis/store_api.py b/samples/client/petstore/python/swagger_client/apis/store_api.py index 4fb03ad471b..9391a6a6096 100644 --- a/samples/client/petstore/python/swagger_client/apis/store_api.py +++ b/samples/client/petstore/python/swagger_client/apis/store_api.py @@ -99,7 +99,7 @@ class StoreApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -122,80 +122,6 @@ class StoreApi(object): callback=params.get('callback')) return response - def find_orders_by_status(self, **kwargs): - """ - Finds orders by status - A single status value can be provided as a string - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please define a `callback` function - to be invoked when receiving the response. - >>> def callback_function(response): - >>> pprint(response) - >>> - >>> thread = api.find_orders_by_status(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :param str status: Status value that needs to be considered for query - :return: list[Order] - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['status'] - all_params.append('callback') - - params = locals() - for key, val in iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method find_orders_by_status" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/store/findByStatus'.replace('{format}', 'json') - path_params = {} - - query_params = {} - if 'status' in params: - query_params['status'] = params['status'] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['test_api_client_id', 'test_api_client_secret'] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='list[Order]', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - def get_inventory(self, **kwargs): """ Returns pet inventories by status @@ -244,7 +170,7 @@ class StoreApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -267,77 +193,6 @@ class StoreApi(object): callback=params.get('callback')) return response - def get_inventory_in_object(self, **kwargs): - """ - Fake endpoint to test arbitrary object return by 'Get inventory' - Returns an arbitrary object which is actually a map of status codes to quantities - - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please define a `callback` function - to be invoked when receiving the response. - >>> def callback_function(response): - >>> pprint(response) - >>> - >>> thread = api.get_inventory_in_object(callback=callback_function) - - :param callback function: The callback function - for asynchronous request. (optional) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - - all_params = [] - all_params.append('callback') - - params = locals() - for key, val in iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_inventory_in_object" % key - ) - params[key] = val - del params['kwargs'] - - - resource_path = '/store/inventory?response=arbitrary_object'.replace('{format}', 'json') - path_params = {} - - query_params = {} - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - - # HTTP header `Accept` - header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) - if not header_params['Accept']: - del header_params['Accept'] - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.\ - select_header_content_type([]) - - # Authentication setting - auth_settings = ['api_key'] - - response = self.api_client.call_api(resource_path, 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='object', - auth_settings=auth_settings, - callback=params.get('callback')) - return response - def get_order_by_id(self, order_id, **kwargs): """ Find purchase order by ID @@ -353,7 +208,7 @@ class StoreApi(object): :param callback function: The callback function for asynchronous request. (optional) - :param str order_id: ID of pet that needs to be fetched (required) + :param int order_id: ID of pet that needs to be fetched (required) :return: Order If the method is called asynchronously, returns the request thread. @@ -392,7 +247,7 @@ class StoreApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -401,7 +256,7 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['test_api_key_header', 'test_api_key_query'] + auth_settings = [] response = self.api_client.call_api(resource_path, 'GET', path_params, @@ -415,7 +270,7 @@ class StoreApi(object): callback=params.get('callback')) return response - def place_order(self, **kwargs): + def place_order(self, body, **kwargs): """ Place an order for a pet @@ -426,11 +281,11 @@ class StoreApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.place_order(callback=callback_function) + >>> thread = api.place_order(body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param Order body: order placed for purchasing the pet + :param Order body: order placed for purchasing the pet (required) :return: Order If the method is called asynchronously, returns the request thread. @@ -449,6 +304,9 @@ class StoreApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `place_order`") resource_path = '/store/order'.replace('{format}', 'json') path_params = {} @@ -466,7 +324,7 @@ class StoreApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -475,7 +333,7 @@ class StoreApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['test_api_client_id', 'test_api_client_secret'] + auth_settings = [] response = self.api_client.call_api(resource_path, 'POST', path_params, diff --git a/samples/client/petstore/python/swagger_client/apis/user_api.py b/samples/client/petstore/python/swagger_client/apis/user_api.py index 774c99334f5..733a950f393 100644 --- a/samples/client/petstore/python/swagger_client/apis/user_api.py +++ b/samples/client/petstore/python/swagger_client/apis/user_api.py @@ -45,7 +45,7 @@ class UserApi(object): config.api_client = ApiClient() self.api_client = config.api_client - def create_user(self, **kwargs): + def create_user(self, body, **kwargs): """ Create user This can only be done by the logged in user. @@ -56,11 +56,11 @@ class UserApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.create_user(callback=callback_function) + >>> thread = api.create_user(body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param User body: Created user object + :param User body: Created user object (required) :return: None If the method is called asynchronously, returns the request thread. @@ -79,6 +79,9 @@ class UserApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_user`") resource_path = '/user'.replace('{format}', 'json') path_params = {} @@ -96,7 +99,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -119,7 +122,7 @@ class UserApi(object): callback=params.get('callback')) return response - def create_users_with_array_input(self, **kwargs): + def create_users_with_array_input(self, body, **kwargs): """ Creates list of users with given input array @@ -130,11 +133,11 @@ class UserApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.create_users_with_array_input(callback=callback_function) + >>> thread = api.create_users_with_array_input(body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param list[User] body: List of user object + :param list[User] body: List of user object (required) :return: None If the method is called asynchronously, returns the request thread. @@ -153,6 +156,9 @@ class UserApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_users_with_array_input`") resource_path = '/user/createWithArray'.replace('{format}', 'json') path_params = {} @@ -170,7 +176,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -193,7 +199,7 @@ class UserApi(object): callback=params.get('callback')) return response - def create_users_with_list_input(self, **kwargs): + def create_users_with_list_input(self, body, **kwargs): """ Creates list of users with given input array @@ -204,11 +210,11 @@ class UserApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.create_users_with_list_input(callback=callback_function) + >>> thread = api.create_users_with_list_input(body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param list[User] body: List of user object + :param list[User] body: List of user object (required) :return: None If the method is called asynchronously, returns the request thread. @@ -227,6 +233,9 @@ class UserApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `create_users_with_list_input`") resource_path = '/user/createWithList'.replace('{format}', 'json') path_params = {} @@ -244,7 +253,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -321,7 +330,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -330,7 +339,7 @@ class UserApi(object): select_header_content_type([]) # Authentication setting - auth_settings = ['test_http_basic'] + auth_settings = [] response = self.api_client.call_api(resource_path, 'DELETE', path_params, @@ -398,7 +407,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -421,7 +430,7 @@ class UserApi(object): callback=params.get('callback')) return response - def login_user(self, **kwargs): + def login_user(self, username, password, **kwargs): """ Logs user into the system @@ -432,12 +441,12 @@ class UserApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.login_user(callback=callback_function) + >>> thread = api.login_user(username, password, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) - :param str username: The user name for login - :param str password: The password for login in clear text + :param str username: The user name for login (required) + :param str password: The password for login in clear text (required) :return: str If the method is called asynchronously, returns the request thread. @@ -456,6 +465,12 @@ class UserApi(object): params[key] = val del params['kwargs'] + # verify the required parameter 'username' is set + if ('username' not in params) or (params['username'] is None): + raise ValueError("Missing the required parameter `username` when calling `login_user`") + # verify the required parameter 'password' is set + if ('password' not in params) or (params['password'] is None): + raise ValueError("Missing the required parameter `password` when calling `login_user`") resource_path = '/user/login'.replace('{format}', 'json') path_params = {} @@ -475,7 +490,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -546,7 +561,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] @@ -569,7 +584,7 @@ class UserApi(object): callback=params.get('callback')) return response - def update_user(self, username, **kwargs): + def update_user(self, username, body, **kwargs): """ Updated user This can only be done by the logged in user. @@ -580,12 +595,12 @@ class UserApi(object): >>> def callback_function(response): >>> pprint(response) >>> - >>> thread = api.update_user(username, callback=callback_function) + >>> thread = api.update_user(username, body, callback=callback_function) :param callback function: The callback function for asynchronous request. (optional) :param str username: name that need to be deleted (required) - :param User body: Updated user object + :param User body: Updated user object (required) :return: None If the method is called asynchronously, returns the request thread. @@ -607,6 +622,9 @@ class UserApi(object): # verify the required parameter 'username' is set if ('username' not in params) or (params['username'] is None): raise ValueError("Missing the required parameter `username` when calling `update_user`") + # verify the required parameter 'body' is set + if ('body' not in params) or (params['body'] is None): + raise ValueError("Missing the required parameter `body` when calling `update_user`") resource_path = '/user/{username}'.replace('{format}', 'json') path_params = {} @@ -626,7 +644,7 @@ class UserApi(object): # HTTP header `Accept` header_params['Accept'] = self.api_client.\ - select_header_accept(['application/json', 'application/xml']) + select_header_accept(['application/xml', 'application/json']) if not header_params['Accept']: del header_params['Accept'] diff --git a/samples/client/petstore/python/swagger_client/configuration.py b/samples/client/petstore/python/swagger_client/configuration.py index 8f66e4428c5..fe38630927e 100644 --- a/samples/client/petstore/python/swagger_client/configuration.py +++ b/samples/client/petstore/python/swagger_client/configuration.py @@ -217,13 +217,6 @@ class Configuration(object): :return: The Auth Settings information dict. """ return { - 'test_api_key_header': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'test_api_key_header', - 'value': self.get_api_key_with_prefix('test_api_key_header') - }, 'api_key': { 'type': 'api_key', @@ -231,34 +224,6 @@ class Configuration(object): 'key': 'api_key', 'value': self.get_api_key_with_prefix('api_key') }, - 'test_http_basic': - { - 'type': 'basic', - 'in': 'header', - 'key': 'Authorization', - 'value': self.get_basic_auth_token() - }, - 'test_api_client_secret': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'x-test_api_client_secret', - 'value': self.get_api_key_with_prefix('x-test_api_client_secret') - }, - 'test_api_client_id': - { - 'type': 'api_key', - 'in': 'header', - 'key': 'x-test_api_client_id', - 'value': self.get_api_key_with_prefix('x-test_api_client_id') - }, - 'test_api_key_query': - { - 'type': 'api_key', - 'in': 'query', - 'key': 'test_api_key_query', - 'value': self.get_api_key_with_prefix('test_api_key_query') - }, } diff --git a/samples/client/petstore/python/swagger_client/models/__init__.py b/samples/client/petstore/python/swagger_client/models/__init__.py index 86feb9e52ba..1d0e82f2295 100644 --- a/samples/client/petstore/python/swagger_client/models/__init__.py +++ b/samples/client/petstore/python/swagger_client/models/__init__.py @@ -2,11 +2,11 @@ from __future__ import absolute_import # import models into model package from .animal import Animal +from .api_response import ApiResponse from .cat import Cat from .category import Category from .dog import Dog from .format_test import FormatTest -from .inline_response_200 import InlineResponse200 from .model_200_response import Model200Response from .model_return import ModelReturn from .name import Name diff --git a/samples/client/petstore/python/swagger_client/models/format_test.py b/samples/client/petstore/python/swagger_client/models/format_test.py index 891b8fd0991..8654d79bc3c 100644 --- a/samples/client/petstore/python/swagger_client/models/format_test.py +++ b/samples/client/petstore/python/swagger_client/models/format_test.py @@ -47,7 +47,8 @@ class FormatTest(object): 'byte': 'str', 'binary': 'str', 'date': 'date', - 'date_time': 'str' + 'date_time': 'datetime', + 'password': 'str' } self.attribute_map = { @@ -61,7 +62,8 @@ class FormatTest(object): 'byte': 'byte', 'binary': 'binary', 'date': 'date', - 'date_time': 'dateTime' + 'date_time': 'dateTime', + 'password': 'password' } self._integer = None @@ -75,6 +77,7 @@ class FormatTest(object): self._binary = None self._date = None self._date_time = None + self._password = None @property def integer(self): @@ -303,7 +306,7 @@ class FormatTest(object): :return: The date_time of this FormatTest. - :rtype: str + :rtype: datetime """ return self._date_time @@ -314,10 +317,32 @@ class FormatTest(object): :param date_time: The date_time of this FormatTest. - :type: str + :type: datetime """ self._date_time = date_time + @property + def password(self): + """ + Gets the password of this FormatTest. + + + :return: The password of this FormatTest. + :rtype: str + """ + return self._password + + @password.setter + def password(self, password): + """ + Sets the password of this FormatTest. + + + :param password: The password of this FormatTest. + :type: str + """ + self._password = password + def to_dict(self): """ Returns the model properties as a dict diff --git a/samples/client/petstore/python/swagger_client/models/order.py b/samples/client/petstore/python/swagger_client/models/order.py index 4c8911f267b..8fe90765e03 100644 --- a/samples/client/petstore/python/swagger_client/models/order.py +++ b/samples/client/petstore/python/swagger_client/models/order.py @@ -59,7 +59,7 @@ class Order(object): self._quantity = None self._ship_date = None self._status = None - self._complete = None + self._complete = False @property def id(self): diff --git a/samples/client/petstore/python/test.sh b/samples/client/petstore/python/test_python2.sh similarity index 100% rename from samples/client/petstore/python/test.sh rename to samples/client/petstore/python/test_python2.sh diff --git a/samples/client/petstore/python/test-all.sh b/samples/client/petstore/python/test_python2_and_3.sh similarity index 100% rename from samples/client/petstore/python/test-all.sh rename to samples/client/petstore/python/test_python2_and_3.sh diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index a3a02dd1169..90622ef668a 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -2,13 +2,13 @@ Petstore - the Ruby gem for the Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. This SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: - API version: 1.0.0 - Package version: 1.0.0 -- Build date: 2016-04-11T17:03:41.311+08:00 +- Build date: 2016-04-13T17:44:36.129+08:00 - Build package: class io.swagger.codegen.languages.RubyClientCodegen ## Installation @@ -62,13 +62,12 @@ end api_instance = Petstore::PetApi.new -opts = { - body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store -} +body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store + begin #Add a new pet to the store - api_instance.add_pet(opts) + api_instance.add_pet(body) rescue Petstore::ApiError => e puts "Exception when calling PetApi->add_pet: #{e}" end @@ -82,20 +81,15 @@ All URIs are relative to *http://petstore.swagger.io/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *Petstore::PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store -*Petstore::PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store *Petstore::PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet *Petstore::PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status *Petstore::PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags *Petstore::PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID -*Petstore::PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' -*Petstore::PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' *Petstore::PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *Petstore::PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *Petstore::PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image *Petstore::StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID -*Petstore::StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status *Petstore::StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status -*Petstore::StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' *Petstore::StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID *Petstore::StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet *Petstore::UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user @@ -111,11 +105,11 @@ Class | Method | HTTP request | Description ## Documentation for Models - [Petstore::Animal](docs/Animal.md) + - [Petstore::ApiResponse](docs/ApiResponse.md) - [Petstore::Cat](docs/Cat.md) - [Petstore::Category](docs/Category.md) - [Petstore::Dog](docs/Dog.md) - [Petstore::FormatTest](docs/FormatTest.md) - - [Petstore::InlineResponse200](docs/InlineResponse200.md) - [Petstore::Model200Response](docs/Model200Response.md) - [Petstore::ModelReturn](docs/ModelReturn.md) - [Petstore::Name](docs/Name.md) @@ -129,40 +123,12 @@ Class | Method | HTTP request | Description ## Documentation for Authorization -### test_api_key_header - -- **Type**: API key -- **API key parameter name**: test_api_key_header -- **Location**: HTTP header - ### api_key - **Type**: API key - **API key parameter name**: api_key - **Location**: HTTP header -### test_http_basic - -- **Type**: HTTP basic authentication - -### test_api_client_secret - -- **Type**: API key -- **API key parameter name**: x-test_api_client_secret -- **Location**: HTTP header - -### test_api_client_id - -- **Type**: API key -- **API key parameter name**: x-test_api_client_id -- **Location**: HTTP header - -### test_api_key_query - -- **Type**: API key -- **API key parameter name**: test_api_key_query -- **Location**: URL query string - ### petstore_auth - **Type**: OAuth diff --git a/samples/client/petstore/ruby/docs/ApiResponse.md b/samples/client/petstore/ruby/docs/ApiResponse.md new file mode 100644 index 00000000000..843f9cc525b --- /dev/null +++ b/samples/client/petstore/ruby/docs/ApiResponse.md @@ -0,0 +1,10 @@ +# Petstore::ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/FormatTest.md b/samples/client/petstore/ruby/docs/FormatTest.md index 02c44df9b66..2b64ed317b2 100644 --- a/samples/client/petstore/ruby/docs/FormatTest.md +++ b/samples/client/petstore/ruby/docs/FormatTest.md @@ -13,6 +13,7 @@ Name | Type | Description | Notes **byte** | **String** | | [optional] **binary** | **String** | | [optional] **date** | **Date** | | [optional] -**date_time** | **String** | | [optional] +**date_time** | **DateTime** | | [optional] +**password** | **String** | | [optional] diff --git a/samples/client/petstore/ruby/docs/Order.md b/samples/client/petstore/ruby/docs/Order.md index ed1b69874ee..52a832c5106 100644 --- a/samples/client/petstore/ruby/docs/Order.md +++ b/samples/client/petstore/ruby/docs/Order.md @@ -8,6 +8,6 @@ Name | Type | Description | Notes **quantity** | **Integer** | | [optional] **ship_date** | **DateTime** | | [optional] **status** | **String** | Order Status | [optional] -**complete** | **BOOLEAN** | | [optional] +**complete** | **BOOLEAN** | | [optional] [default to false] diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 7fe1d8380f8..87a63e19584 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -15,7 +15,7 @@ Method | HTTP request | Description # **create_user** -> create_user(opts) +> create_user(body) Create user @@ -28,13 +28,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - body: Petstore::User.new # User | Created user object -} +body = Petstore::User.new # User | Created user object + begin #Create user - api_instance.create_user(opts) + api_instance.create_user(body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_user: #{e}" end @@ -44,7 +43,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | [optional] + **body** | [**User**](User.md)| Created user object | ### Return type @@ -57,12 +56,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **create_users_with_array_input** -> create_users_with_array_input(opts) +> create_users_with_array_input(body) Creates list of users with given input array @@ -75,13 +74,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - body: [Petstore::User.new] # Array | List of user object -} +body = [Petstore::User.new] # Array | List of user object + begin #Creates list of users with given input array - api_instance.create_users_with_array_input(opts) + api_instance.create_users_with_array_input(body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_users_with_array_input: #{e}" end @@ -91,7 +89,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](User.md)| List of user object | [optional] + **body** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -104,12 +102,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **create_users_with_list_input** -> create_users_with_list_input(opts) +> create_users_with_list_input(body) Creates list of users with given input array @@ -122,13 +120,12 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - body: [Petstore::User.new] # Array | List of user object -} +body = [Petstore::User.new] # Array | List of user object + begin #Creates list of users with given input array - api_instance.create_users_with_list_input(opts) + api_instance.create_users_with_list_input(body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->create_users_with_list_input: #{e}" end @@ -138,7 +135,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Array<User>**](User.md)| List of user object | [optional] + **body** | [**Array<User>**](User.md)| List of user object | ### Return type @@ -151,7 +148,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -166,12 +163,6 @@ This can only be done by the logged in user. ```ruby # load the gem require 'petstore' -# setup authorization -Petstore.configure do |config| - # Configure HTTP basic authorization: test_http_basic - config.username = 'YOUR USERNAME' - config.password = 'YOUR PASSWORD' -end api_instance = Petstore::UserApi.new @@ -198,12 +189,12 @@ nil (empty response body) ### Authorization -[test_http_basic](../README.md#test_http_basic) +No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -250,12 +241,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **login_user** -> String login_user(opts) +> String login_user(username, password) Logs user into the system @@ -268,14 +259,14 @@ require 'petstore' api_instance = Petstore::UserApi.new -opts = { - username: "username_example", # String | The user name for login - password: "password_example" # String | The password for login in clear text -} +username = "username_example" # String | The user name for login + +password = "password_example" # String | The password for login in clear text + begin #Logs user into the system - result = api_instance.login_user(opts) + result = api_instance.login_user(username, password) p result rescue Petstore::ApiError => e puts "Exception when calling UserApi->login_user: #{e}" @@ -286,8 +277,8 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | [optional] - **password** | **String**| The password for login in clear text | [optional] + **username** | **String**| The user name for login | + **password** | **String**| The password for login in clear text | ### Return type @@ -300,7 +291,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json @@ -340,12 +331,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json # **update_user** -> update_user(username, opts) +> update_user(username, body) Updated user @@ -360,13 +351,12 @@ api_instance = Petstore::UserApi.new username = "username_example" # String | name that need to be deleted -opts = { - body: Petstore::User.new # User | Updated user object -} +body = Petstore::User.new # User | Updated user object + begin #Updated user - api_instance.update_user(username, opts) + api_instance.update_user(username, body) rescue Petstore::ApiError => e puts "Exception when calling UserApi->update_user: #{e}" end @@ -377,7 +367,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | [optional] + **body** | [**User**](User.md)| Updated user object | ### Return type @@ -390,7 +380,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json, application/xml + - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index 2232f05e8ba..5964a522d9f 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -22,11 +22,11 @@ require 'petstore/configuration' # Models require 'petstore/models/animal' +require 'petstore/models/api_response' require 'petstore/models/cat' require 'petstore/models/category' require 'petstore/models/dog' require 'petstore/models/format_test' -require 'petstore/models/inline_response_200' require 'petstore/models/model_200_response' require 'petstore/models/model_return' require 'petstore/models/name' diff --git a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb index 3bff1eda69a..4355642fc58 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/pet_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -26,24 +26,27 @@ module Petstore # Add a new pet to the store # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] - def add_pet(opts = {}) - add_pet_with_http_info(opts) + def add_pet(body, opts = {}) + add_pet_with_http_info(body, opts) return nil end # Add a new pet to the store # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def add_pet_with_http_info(opts = {}) + def add_pet_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#add_pet ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling add_pet" if body.nil? + # resource path local_var_path = "/pet".sub('{format}','json') @@ -54,7 +57,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -65,7 +68,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = ['petstore_auth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -79,61 +82,6 @@ module Petstore return data, status_code, headers end - # Fake endpoint to test byte array in body parameter for adding a new pet to the store - # - # @param [Hash] opts the optional parameters - # @option opts [String] :body Pet object in the form of byte array - # @return [nil] - def add_pet_using_byte_array(opts = {}) - add_pet_using_byte_array_with_http_info(opts) - return nil - end - - # Fake endpoint to test byte array in body parameter for adding a new pet to the store - # - # @param [Hash] opts the optional parameters - # @option opts [String] :body Pet object in the form of byte array - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def add_pet_using_byte_array_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PetApi#add_pet_using_byte_array ..." - end - - # resource path - local_var_path = "/pet?testing_byte_array=true".sub('{format}','json') - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = ['application/json', 'application/xml'] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) - auth_names = ['petstore_auth'] - data, status_code, headers = @api_client.call_api(:POST, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names) - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#add_pet_using_byte_array\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Deletes a pet # # @param pet_id Pet id to delete @@ -169,7 +117,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -197,36 +145,39 @@ module Petstore # Finds Pets by status # Multiple status values can be provided with comma separated strings + # @param status Status values that need to be considered for filter # @param [Hash] opts the optional parameters - # @option opts [Array] :status Status values that need to be considered for query (default to available) # @return [Array] - def find_pets_by_status(opts = {}) - data, _status_code, _headers = find_pets_by_status_with_http_info(opts) + def find_pets_by_status(status, opts = {}) + data, _status_code, _headers = find_pets_by_status_with_http_info(status, opts) return data end # Finds Pets by status # Multiple status values can be provided with comma separated strings + # @param status Status values that need to be considered for filter # @param [Hash] opts the optional parameters - # @option opts [Array] :status Status values that need to be considered for query # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers - def find_pets_by_status_with_http_info(opts = {}) + def find_pets_by_status_with_http_info(status, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#find_pets_by_status ..." end + # verify the required parameter 'status' is set + fail "Missing the required parameter 'status' when calling find_pets_by_status" if status.nil? + # resource path local_var_path = "/pet/findByStatus".sub('{format}','json') # query parameters query_params = {} - query_params[:'status'] = @api_client.build_collection_param(opts[:'status'], :multi) if opts[:'status'] + query_params[:'status'] = @api_client.build_collection_param(status, :csv) # header parameters header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -253,37 +204,40 @@ module Petstore end # Finds Pets by tags - # Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + # @param tags Tags to filter by # @param [Hash] opts the optional parameters - # @option opts [Array] :tags Tags to filter by # @return [Array] - def find_pets_by_tags(opts = {}) - data, _status_code, _headers = find_pets_by_tags_with_http_info(opts) + def find_pets_by_tags(tags, opts = {}) + data, _status_code, _headers = find_pets_by_tags_with_http_info(tags, opts) return data end # Finds Pets by tags - # Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + # @param tags Tags to filter by # @param [Hash] opts the optional parameters - # @option opts [Array] :tags Tags to filter by # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers - def find_pets_by_tags_with_http_info(opts = {}) + def find_pets_by_tags_with_http_info(tags, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#find_pets_by_tags ..." end + # verify the required parameter 'tags' is set + fail "Missing the required parameter 'tags' when calling find_pets_by_tags" if tags.nil? + # resource path local_var_path = "/pet/findByTags".sub('{format}','json') # query parameters query_params = {} - query_params[:'tags'] = @api_client.build_collection_param(opts[:'tags'], :multi) if opts[:'tags'] + query_params[:'tags'] = @api_client.build_collection_param(tags, :csv) # header parameters header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -310,8 +264,8 @@ module Petstore end # Find pet by ID - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched + # Returns a single pet + # @param pet_id ID of pet to return # @param [Hash] opts the optional parameters # @return [Pet] def get_pet_by_id(pet_id, opts = {}) @@ -320,8 +274,8 @@ module Petstore end # Find pet by ID - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched + # Returns a single pet + # @param pet_id ID of pet to return # @param [Hash] opts the optional parameters # @return [Array<(Pet, Fixnum, Hash)>] Pet data, response status code and response headers def get_pet_by_id_with_http_info(pet_id, opts = {}) @@ -342,7 +296,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -354,7 +308,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['api_key', 'petstore_auth'] + auth_names = ['api_key'] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -368,144 +322,29 @@ module Petstore return data, status_code, headers end - # Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [InlineResponse200] - def get_pet_by_id_in_object(pet_id, opts = {}) - data, _status_code, _headers = get_pet_by_id_in_object_with_http_info(pet_id, opts) - return data - end - - # Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [Array<(InlineResponse200, Fixnum, Hash)>] InlineResponse200 data, response status code and response headers - def get_pet_by_id_in_object_with_http_info(pet_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PetApi#get_pet_by_id_in_object ..." - end - - # verify the required parameter 'pet_id' is set - fail "Missing the required parameter 'pet_id' when calling get_pet_by_id_in_object" if pet_id.nil? - - # resource path - local_var_path = "/pet/{petId}?response=inline_arbitrary_object".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['api_key', 'petstore_auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'InlineResponse200') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#get_pet_by_id_in_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - - # Fake endpoint to test byte array return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [String] - def pet_pet_idtesting_byte_arraytrue_get(pet_id, opts = {}) - data, _status_code, _headers = pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, opts) - return data - end - - # Fake endpoint to test byte array return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers - def pet_pet_idtesting_byte_arraytrue_get_with_http_info(pet_id, opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: PetApi#pet_pet_idtesting_byte_arraytrue_get ..." - end - - # verify the required parameter 'pet_id' is set - fail "Missing the required parameter 'pet_id' when calling pet_pet_idtesting_byte_arraytrue_get" if pet_id.nil? - - # resource path - local_var_path = "/pet/{petId}?testing_byte_array=true".sub('{format}','json').sub('{' + 'petId' + '}', pet_id.to_s) - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['api_key', 'petstore_auth'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'String') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: PetApi#pet_pet_idtesting_byte_arraytrue_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Update an existing pet # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] - def update_pet(opts = {}) - update_pet_with_http_info(opts) + def update_pet(body, opts = {}) + update_pet_with_http_info(body, opts) return nil end # Update an existing pet # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def update_pet_with_http_info(opts = {}) + def update_pet_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#update_pet ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling update_pet" if body.nil? + # resource path local_var_path = "/pet".sub('{format}','json') @@ -516,7 +355,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -527,7 +366,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = ['petstore_auth'] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, @@ -578,7 +417,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -611,10 +450,10 @@ module Petstore # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server # @option opts [File] :file file to upload - # @return [nil] + # @return [ApiResponse] def upload_file(pet_id, opts = {}) - upload_file_with_http_info(pet_id, opts) - return nil + data, _status_code, _headers = upload_file_with_http_info(pet_id, opts) + return data end # uploads an image @@ -623,7 +462,7 @@ module Petstore # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server # @option opts [File] :file file to upload - # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers + # @return [Array<(ApiResponse, Fixnum, Hash)>] ApiResponse data, response status code and response headers def upload_file_with_http_info(pet_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: PetApi#upload_file ..." @@ -642,7 +481,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -662,7 +501,8 @@ module Petstore :query_params => query_params, :form_params => form_params, :body => post_body, - :auth_names => auth_names) + :auth_names => auth_names, + :return_type => 'ApiResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: PetApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end diff --git a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb index 548b5a355e0..5a3c8efeb82 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/store_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/store_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -57,7 +57,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -82,67 +82,6 @@ module Petstore return data, status_code, headers end - # Finds orders by status - # A single status value can be provided as a string - # @param [Hash] opts the optional parameters - # @option opts [String] :status Status value that needs to be considered for query (default to placed) - # @return [Array] - def find_orders_by_status(opts = {}) - data, _status_code, _headers = find_orders_by_status_with_http_info(opts) - return data - end - - # Finds orders by status - # A single status value can be provided as a string - # @param [Hash] opts the optional parameters - # @option opts [String] :status Status value that needs to be considered for query - # @return [Array<(Array, Fixnum, Hash)>] Array data, response status code and response headers - def find_orders_by_status_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: StoreApi#find_orders_by_status ..." - end - - if opts[:'status'] && !['placed', 'approved', 'delivered'].include?(opts[:'status']) - fail 'invalid value for "status", must be one of placed, approved, delivered' - end - - # resource path - local_var_path = "/store/findByStatus".sub('{format}','json') - - # query parameters - query_params = {} - query_params[:'status'] = opts[:'status'] if opts[:'status'] - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['test_api_client_id', 'test_api_client_secret'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Array') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: StoreApi#find_orders_by_status\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Returns pet inventories by status # Returns a map of status codes to quantities # @param [Hash] opts the optional parameters @@ -171,7 +110,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -197,60 +136,6 @@ module Petstore return data, status_code, headers end - # Fake endpoint to test arbitrary object return by 'Get inventory' - # Returns an arbitrary object which is actually a map of status codes to quantities - # @param [Hash] opts the optional parameters - # @return [Object] - def get_inventory_in_object(opts = {}) - data, _status_code, _headers = get_inventory_in_object_with_http_info(opts) - return data - end - - # Fake endpoint to test arbitrary object return by 'Get inventory' - # Returns an arbitrary object which is actually a map of status codes to quantities - # @param [Hash] opts the optional parameters - # @return [Array<(Object, Fixnum, Hash)>] Object data, response status code and response headers - def get_inventory_in_object_with_http_info(opts = {}) - if @api_client.config.debugging - @api_client.config.logger.debug "Calling API: StoreApi#get_inventory_in_object ..." - end - - # resource path - local_var_path = "/store/inventory?response=arbitrary_object".sub('{format}','json') - - # query parameters - query_params = {} - - # header parameters - header_params = {} - - # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] - local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result - - # HTTP header 'Content-Type' - local_header_content_type = [] - header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type) - - # form parameters - form_params = {} - - # http body (model) - post_body = nil - auth_names = ['api_key'] - data, status_code, headers = @api_client.call_api(:GET, local_var_path, - :header_params => header_params, - :query_params => query_params, - :form_params => form_params, - :body => post_body, - :auth_names => auth_names, - :return_type => 'Object') - if @api_client.config.debugging - @api_client.config.logger.debug "API called: StoreApi#get_inventory_in_object\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" - end - return data, status_code, headers - end - # Find purchase order by ID # For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions # @param order_id ID of pet that needs to be fetched @@ -284,7 +169,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -296,7 +181,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['test_api_key_header', 'test_api_key_query'] + auth_names = [] data, status_code, headers = @api_client.call_api(:GET, local_var_path, :header_params => header_params, :query_params => query_params, @@ -312,24 +197,27 @@ module Petstore # Place an order for a pet # + # @param body order placed for purchasing the pet # @param [Hash] opts the optional parameters - # @option opts [Order] :body order placed for purchasing the pet # @return [Order] - def place_order(opts = {}) - data, _status_code, _headers = place_order_with_http_info(opts) + def place_order(body, opts = {}) + data, _status_code, _headers = place_order_with_http_info(body, opts) return data end # Place an order for a pet # + # @param body order placed for purchasing the pet # @param [Hash] opts the optional parameters - # @option opts [Order] :body order placed for purchasing the pet # @return [Array<(Order, Fixnum, Hash)>] Order data, response status code and response headers - def place_order_with_http_info(opts = {}) + def place_order_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: StoreApi#place_order ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling place_order" if body.nil? + # resource path local_var_path = "/store/order".sub('{format}','json') @@ -340,7 +228,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -351,8 +239,8 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) - auth_names = ['test_api_client_id', 'test_api_client_secret'] + post_body = @api_client.object_to_http_body(body) + auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, diff --git a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb index 0f9af5bb7f0..d5535aac583 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/user_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/user_api.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -26,24 +26,27 @@ module Petstore # Create user # This can only be done by the logged in user. + # @param body Created user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Created user object # @return [nil] - def create_user(opts = {}) - create_user_with_http_info(opts) + def create_user(body, opts = {}) + create_user_with_http_info(body, opts) return nil end # Create user # This can only be done by the logged in user. + # @param body Created user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Created user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_user_with_http_info(opts = {}) + def create_user_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#create_user ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling create_user" if body.nil? + # resource path local_var_path = "/user".sub('{format}','json') @@ -54,7 +57,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -65,7 +68,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -81,24 +84,27 @@ module Petstore # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] - def create_users_with_array_input(opts = {}) - create_users_with_array_input_with_http_info(opts) + def create_users_with_array_input(body, opts = {}) + create_users_with_array_input_with_http_info(body, opts) return nil end # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_users_with_array_input_with_http_info(opts = {}) + def create_users_with_array_input_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#create_users_with_array_input ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling create_users_with_array_input" if body.nil? + # resource path local_var_path = "/user/createWithArray".sub('{format}','json') @@ -109,7 +115,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -120,7 +126,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -136,24 +142,27 @@ module Petstore # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] - def create_users_with_list_input(opts = {}) - create_users_with_list_input_with_http_info(opts) + def create_users_with_list_input(body, opts = {}) + create_users_with_list_input_with_http_info(body, opts) return nil end # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def create_users_with_list_input_with_http_info(opts = {}) + def create_users_with_list_input_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#create_users_with_list_input ..." end + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling create_users_with_list_input" if body.nil? + # resource path local_var_path = "/user/createWithList".sub('{format}','json') @@ -164,7 +173,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -175,7 +184,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, @@ -222,7 +231,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -234,7 +243,7 @@ module Petstore # http body (model) post_body = nil - auth_names = ['test_http_basic'] + auth_names = [] data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, :header_params => header_params, :query_params => query_params, @@ -280,7 +289,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -308,39 +317,45 @@ module Petstore # Logs user into the system # + # @param username The user name for login + # @param password The password for login in clear text # @param [Hash] opts the optional parameters - # @option opts [String] :username The user name for login - # @option opts [String] :password The password for login in clear text # @return [String] - def login_user(opts = {}) - data, _status_code, _headers = login_user_with_http_info(opts) + def login_user(username, password, opts = {}) + data, _status_code, _headers = login_user_with_http_info(username, password, opts) return data end # Logs user into the system # + # @param username The user name for login + # @param password The password for login in clear text # @param [Hash] opts the optional parameters - # @option opts [String] :username The user name for login - # @option opts [String] :password The password for login in clear text # @return [Array<(String, Fixnum, Hash)>] String data, response status code and response headers - def login_user_with_http_info(opts = {}) + def login_user_with_http_info(username, password, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#login_user ..." end + # verify the required parameter 'username' is set + fail "Missing the required parameter 'username' when calling login_user" if username.nil? + + # verify the required parameter 'password' is set + fail "Missing the required parameter 'password' when calling login_user" if password.nil? + # resource path local_var_path = "/user/login".sub('{format}','json') # query parameters query_params = {} - query_params[:'username'] = opts[:'username'] if opts[:'username'] - query_params[:'password'] = opts[:'password'] if opts[:'password'] + query_params[:'username'] = username + query_params[:'password'] = password # header parameters header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -394,7 +409,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -422,21 +437,21 @@ module Petstore # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted + # @param body Updated user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Updated user object # @return [nil] - def update_user(username, opts = {}) - update_user_with_http_info(username, opts) + def update_user(username, body, opts = {}) + update_user_with_http_info(username, body, opts) return nil end # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted + # @param body Updated user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Updated user object # @return [Array<(nil, Fixnum, Hash)>] nil, response status code and response headers - def update_user_with_http_info(username, opts = {}) + def update_user_with_http_info(username, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UserApi#update_user ..." end @@ -444,6 +459,9 @@ module Petstore # verify the required parameter 'username' is set fail "Missing the required parameter 'username' when calling update_user" if username.nil? + # verify the required parameter 'body' is set + fail "Missing the required parameter 'body' when calling update_user" if body.nil? + # resource path local_var_path = "/user/{username}".sub('{format}','json').sub('{' + 'username' + '}', username.to_s) @@ -454,7 +472,7 @@ module Petstore header_params = {} # HTTP header 'Accept' (if needed) - local_header_accept = ['application/json', 'application/xml'] + local_header_accept = ['application/xml', 'application/json'] local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result # HTTP header 'Content-Type' @@ -465,7 +483,7 @@ module Petstore form_params = {} # http body (model) - post_body = @api_client.object_to_http_body(opts[:'body']) + post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:PUT, local_var_path, :header_params => header_params, diff --git a/samples/client/petstore/ruby/lib/petstore/api_client.rb b/samples/client/petstore/ruby/lib/petstore/api_client.rb index 70111d07438..ed1c501d71a 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_client.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_client.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/api_error.rb b/samples/client/petstore/ruby/lib/petstore/api_error.rb index b05ca2fdaf6..e4c233b2e98 100644 --- a/samples/client/petstore/ruby/lib/petstore/api_error.rb +++ b/samples/client/petstore/ruby/lib/petstore/api_error.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/configuration.rb b/samples/client/petstore/ruby/lib/petstore/configuration.rb index 5125ebe5960..05973753287 100644 --- a/samples/client/petstore/ruby/lib/petstore/configuration.rb +++ b/samples/client/petstore/ruby/lib/petstore/configuration.rb @@ -157,13 +157,6 @@ module Petstore # Returns Auth Settings hash for api client. def auth_settings { - 'test_api_key_header' => - { - type: 'api_key', - in: 'header', - key: 'test_api_key_header', - value: api_key_with_prefix('test_api_key_header') - }, 'api_key' => { type: 'api_key', @@ -171,34 +164,6 @@ module Petstore key: 'api_key', value: api_key_with_prefix('api_key') }, - 'test_http_basic' => - { - type: 'basic', - in: 'header', - key: 'Authorization', - value: basic_auth_token - }, - 'test_api_client_secret' => - { - type: 'api_key', - in: 'header', - key: 'x-test_api_client_secret', - value: api_key_with_prefix('x-test_api_client_secret') - }, - 'test_api_client_id' => - { - type: 'api_key', - in: 'header', - key: 'x-test_api_client_id', - value: api_key_with_prefix('x-test_api_client_id') - }, - 'test_api_key_query' => - { - type: 'api_key', - in: 'query', - key: 'test_api_key_query', - value: api_key_with_prefix('test_api_key_query') - }, 'petstore_auth' => { type: 'oauth2', diff --git a/samples/client/petstore/ruby/lib/petstore/models/animal.rb b/samples/client/petstore/ruby/lib/petstore/models/animal.rb index 325898c5676..342d3b2464d 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/animal.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/animal.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/api_response.rb b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb new file mode 100644 index 00000000000..683083be4b2 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/api_response.rb @@ -0,0 +1,191 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'date' + +module Petstore + class ApiResponse + attr_accessor :code + + attr_accessor :type + + attr_accessor :message + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'code' => :'code', + :'type' => :'type', + :'message' => :'message' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'code' => :'Integer', + :'type' => :'String', + :'message' => :'String' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes[:'code'] + self.code = attributes[:'code'] + end + if attributes[:'type'] + self.type = attributes[:'type'] + end + if attributes[:'message'] + self.message = attributes[:'message'] + end + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + code == o.code && + type == o.type && + message == o.message + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [code, type, message].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /^Array<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /^(true|t|yes|y|1)$/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/cat.rb b/samples/client/petstore/ruby/lib/petstore/models/cat.rb index abd167dfb6c..4489e6abb85 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/cat.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/cat.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/category.rb b/samples/client/petstore/ruby/lib/petstore/models/category.rb index 69f4b039475..0f6d61d83af 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/category.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/category.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/dog.rb b/samples/client/petstore/ruby/lib/petstore/models/dog.rb index 04c88b9d768..5173f9a01ec 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/dog.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/dog.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb index c688c1f7841..87b6d4e4695 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/format_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/format_test.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -40,6 +40,8 @@ module Petstore attr_accessor :date_time + attr_accessor :password + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { @@ -53,7 +55,8 @@ module Petstore :'byte' => :'byte', :'binary' => :'binary', :'date' => :'date', - :'date_time' => :'dateTime' + :'date_time' => :'dateTime', + :'password' => :'password' } end @@ -70,7 +73,8 @@ module Petstore :'byte' => :'String', :'binary' => :'String', :'date' => :'Date', - :'date_time' => :'String' + :'date_time' => :'DateTime', + :'password' => :'String' } end @@ -115,6 +119,9 @@ module Petstore if attributes[:'dateTime'] self.date_time = attributes[:'dateTime'] end + if attributes[:'password'] + self.password = attributes[:'password'] + end end # Checks equality by comparing each attribute. @@ -132,7 +139,8 @@ module Petstore byte == o.byte && binary == o.binary && date == o.date && - date_time == o.date_time + date_time == o.date_time && + password == o.password end # @see the `==` method @@ -144,7 +152,7 @@ module Petstore # Calculates hash code according to all attributes. # @return [Fixnum] Hash code def hash - [integer, int32, int64, number, float, double, string, byte, binary, date, date_time].hash + [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, password].hash end # Builds the object from hash diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb index 4e198a489b3..9cacbdb1298 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_200_response.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb index f016ff32fe9..31adf497fa2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/model_return.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/model_return.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/name.rb b/samples/client/petstore/ruby/lib/petstore/models/name.rb index c0ebf37971b..9818aa41cc4 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/name.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/order.rb b/samples/client/petstore/ruby/lib/petstore/models/order.rb index 86bc4f16197..81f2601e9d9 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/order.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/order.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -80,6 +80,8 @@ module Petstore end if attributes[:'complete'] self.complete = attributes[:'complete'] + else + self.complete = false end end diff --git a/samples/client/petstore/ruby/lib/petstore/models/pet.rb b/samples/client/petstore/ruby/lib/petstore/models/pet.rb index 13c0291bb35..095f91ca7c3 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/pet.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/pet.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb index b0509903ef2..4c859270d1b 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/special_model_name.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/tag.rb b/samples/client/petstore/ruby/lib/petstore/models/tag.rb index 3a7bc3b53a7..e5c80ee2228 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/tag.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/tag.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/models/user.rb b/samples/client/petstore/ruby/lib/petstore/models/user.rb index 2ef984493e9..e7ce160dfa2 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/user.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/user.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/lib/petstore/version.rb b/samples/client/petstore/ruby/lib/petstore/version.rb index 2c3d31c3399..e28b737d97c 100644 --- a/samples/client/petstore/ruby/lib/petstore/version.rb +++ b/samples/client/petstore/ruby/lib/petstore/version.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/api/pet_api_spec.rb b/samples/client/petstore/ruby/spec/api/pet_api_spec.rb index 12cdc70dc57..e903362291b 100644 --- a/samples/client/petstore/ruby/spec/api/pet_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/pet_api_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -39,8 +39,8 @@ describe 'PetApi' do # unit tests for add_pet # Add a new pet to the store # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] describe 'add_pet test' do it "should work" do @@ -52,22 +52,6 @@ describe 'PetApi' do end end - # unit tests for add_pet_using_byte_array - # Fake endpoint to test byte array in body parameter for adding a new pet to the store - # - # @param [Hash] opts the optional parameters - # @option opts [String] :body Pet object in the form of byte array - # @return [nil] - describe 'add_pet_using_byte_array test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for delete_pet # Deletes a pet # @@ -88,8 +72,8 @@ describe 'PetApi' do # unit tests for find_pets_by_status # Finds Pets by status # Multiple status values can be provided with comma separated strings + # @param status Status values that need to be considered for filter # @param [Hash] opts the optional parameters - # @option opts [Array] :status Status values that need to be considered for query # @return [Array] describe 'find_pets_by_status test' do it "should work" do @@ -103,9 +87,9 @@ describe 'PetApi' do # unit tests for find_pets_by_tags # Finds Pets by tags - # Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. + # Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + # @param tags Tags to filter by # @param [Hash] opts the optional parameters - # @option opts [Array] :tags Tags to filter by # @return [Array] describe 'find_pets_by_tags test' do it "should work" do @@ -119,8 +103,8 @@ describe 'PetApi' do # unit tests for get_pet_by_id # Find pet by ID - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched + # Returns a single pet + # @param pet_id ID of pet to return # @param [Hash] opts the optional parameters # @return [Pet] describe 'get_pet_by_id test' do @@ -133,43 +117,11 @@ describe 'PetApi' do end end - # unit tests for get_pet_by_id_in_object - # Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [InlineResponse200] - describe 'get_pet_by_id_in_object test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - - # unit tests for pet_pet_idtesting_byte_arraytrue_get - # Fake endpoint to test byte array return by 'Find pet by ID' - # Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - # @param pet_id ID of pet that needs to be fetched - # @param [Hash] opts the optional parameters - # @return [String] - describe 'pet_pet_idtesting_byte_arraytrue_get test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for update_pet # Update an existing pet # + # @param body Pet object that needs to be added to the store # @param [Hash] opts the optional parameters - # @option opts [Pet] :body Pet object that needs to be added to the store # @return [nil] describe 'update_pet test' do it "should work" do @@ -206,7 +158,7 @@ describe 'PetApi' do # @param [Hash] opts the optional parameters # @option opts [String] :additional_metadata Additional data to pass to server # @option opts [File] :file file to upload - # @return [nil] + # @return [ApiResponse] describe 'upload_file test' do it "should work" do # assertion here diff --git a/samples/client/petstore/ruby/spec/api/store_api_spec.rb b/samples/client/petstore/ruby/spec/api/store_api_spec.rb index 0952b075bf4..479891e9308 100644 --- a/samples/client/petstore/ruby/spec/api/store_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/store_api_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -52,22 +52,6 @@ describe 'StoreApi' do end end - # unit tests for find_orders_by_status - # Finds orders by status - # A single status value can be provided as a string - # @param [Hash] opts the optional parameters - # @option opts [String] :status Status value that needs to be considered for query - # @return [Array] - describe 'find_orders_by_status test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for get_inventory # Returns pet inventories by status # Returns a map of status codes to quantities @@ -83,21 +67,6 @@ describe 'StoreApi' do end end - # unit tests for get_inventory_in_object - # Fake endpoint to test arbitrary object return by 'Get inventory' - # Returns an arbitrary object which is actually a map of status codes to quantities - # @param [Hash] opts the optional parameters - # @return [Object] - describe 'get_inventory_in_object test' do - it "should work" do - # assertion here - # should be_a() - # should be_nil - # should == - # should_not == - end - end - # unit tests for get_order_by_id # Find purchase order by ID # For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -117,8 +86,8 @@ describe 'StoreApi' do # unit tests for place_order # Place an order for a pet # + # @param body order placed for purchasing the pet # @param [Hash] opts the optional parameters - # @option opts [Order] :body order placed for purchasing the pet # @return [Order] describe 'place_order test' do it "should work" do diff --git a/samples/client/petstore/ruby/spec/api/user_api_spec.rb b/samples/client/petstore/ruby/spec/api/user_api_spec.rb index 60f1dcda16f..4564491d507 100644 --- a/samples/client/petstore/ruby/spec/api/user_api_spec.rb +++ b/samples/client/petstore/ruby/spec/api/user_api_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -39,8 +39,8 @@ describe 'UserApi' do # unit tests for create_user # Create user # This can only be done by the logged in user. + # @param body Created user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Created user object # @return [nil] describe 'create_user test' do it "should work" do @@ -55,8 +55,8 @@ describe 'UserApi' do # unit tests for create_users_with_array_input # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] describe 'create_users_with_array_input test' do it "should work" do @@ -71,8 +71,8 @@ describe 'UserApi' do # unit tests for create_users_with_list_input # Creates list of users with given input array # + # @param body List of user object # @param [Hash] opts the optional parameters - # @option opts [Array] :body List of user object # @return [nil] describe 'create_users_with_list_input test' do it "should work" do @@ -119,9 +119,9 @@ describe 'UserApi' do # unit tests for login_user # Logs user into the system # + # @param username The user name for login + # @param password The password for login in clear text # @param [Hash] opts the optional parameters - # @option opts [String] :username The user name for login - # @option opts [String] :password The password for login in clear text # @return [String] describe 'login_user test' do it "should work" do @@ -152,8 +152,8 @@ describe 'UserApi' do # Updated user # This can only be done by the logged in user. # @param username name that need to be deleted + # @param body Updated user object # @param [Hash] opts the optional parameters - # @option opts [User] :body Updated user object # @return [nil] describe 'update_user test' do it "should work" do diff --git a/samples/client/petstore/ruby/spec/models/animal_spec.rb b/samples/client/petstore/ruby/spec/models/animal_spec.rb index ddbfeca85f9..e35b12411be 100644 --- a/samples/client/petstore/ruby/spec/models/animal_spec.rb +++ b/samples/client/petstore/ruby/spec/models/animal_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/api_response_spec.rb b/samples/client/petstore/ruby/spec/models/api_response_spec.rb new file mode 100644 index 00000000000..279d8cb0aa5 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/api_response_spec.rb @@ -0,0 +1,70 @@ +=begin +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +License: Apache 2.0 +http://www.apache.org/licenses/LICENSE-2.0.html + +Terms of Service: http://swagger.io/terms/ + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::ApiResponse +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'ApiResponse' do + before do + # run before each test + @instance = Petstore::ApiResponse.new + end + + after do + # run after each test + end + + describe 'test an instance of ApiResponse' do + it 'should create an instact of ApiResponse' do + @instance.should be_a(Petstore::ApiResponse) + end + end + describe 'test attribute "code"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "type"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + + describe 'test attribute "message"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + +end + diff --git a/samples/client/petstore/ruby/spec/models/cat_spec.rb b/samples/client/petstore/ruby/spec/models/cat_spec.rb index 220a37dfebe..e9b20d57eb0 100644 --- a/samples/client/petstore/ruby/spec/models/cat_spec.rb +++ b/samples/client/petstore/ruby/spec/models/cat_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/category_spec.rb b/samples/client/petstore/ruby/spec/models/category_spec.rb index 745974cbabd..0e7001053f7 100644 --- a/samples/client/petstore/ruby/spec/models/category_spec.rb +++ b/samples/client/petstore/ruby/spec/models/category_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/dog_spec.rb b/samples/client/petstore/ruby/spec/models/dog_spec.rb index 23b1b9a83f7..20375338c7e 100644 --- a/samples/client/petstore/ruby/spec/models/dog_spec.rb +++ b/samples/client/petstore/ruby/spec/models/dog_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/format_test_spec.rb b/samples/client/petstore/ruby/spec/models/format_test_spec.rb index e59d956fd37..e44131192a3 100644 --- a/samples/client/petstore/ruby/spec/models/format_test_spec.rb +++ b/samples/client/petstore/ruby/spec/models/format_test_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io @@ -146,5 +146,15 @@ describe 'FormatTest' do end end + describe 'test attribute "password"' do + it 'should work' do + # assertion here + # should be_a() + # should be_nil + # should == + # should_not == + end + end + end diff --git a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb index 858b6504908..36a4da3baaa 100644 --- a/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb +++ b/samples/client/petstore/ruby/spec/models/inline_response_200_spec.rb @@ -21,7 +21,7 @@ require 'date' # Unit tests for Petstore::InlineResponse200 # Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) # Please update as you see appropriate -describe 'InlineResponse200' do +describe 'InlineResponse200', pending: "Original spec does not have InlineResponse200 and we'll renable this after updating Petstore server" do before do # run before each test @instance = Petstore::InlineResponse200.new diff --git a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb index 4e2f92c5212..88045611d9c 100644 --- a/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_200_response_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/model_return_spec.rb b/samples/client/petstore/ruby/spec/models/model_return_spec.rb index 018798b47e3..7b6f3a571c4 100644 --- a/samples/client/petstore/ruby/spec/models/model_return_spec.rb +++ b/samples/client/petstore/ruby/spec/models/model_return_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/name_spec.rb b/samples/client/petstore/ruby/spec/models/name_spec.rb index 5d66fd078f3..9eef65de2fa 100644 --- a/samples/client/petstore/ruby/spec/models/name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/name_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/order_spec.rb b/samples/client/petstore/ruby/spec/models/order_spec.rb index 698f3af9268..420cfea059c 100644 --- a/samples/client/petstore/ruby/spec/models/order_spec.rb +++ b/samples/client/petstore/ruby/spec/models/order_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/pet_spec.rb b/samples/client/petstore/ruby/spec/models/pet_spec.rb index cf18e1a5f3a..96ced2cd366 100644 --- a/samples/client/petstore/ruby/spec/models/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/models/pet_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb index e3201cb2e31..aa32e3fc7b2 100644 --- a/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb +++ b/samples/client/petstore/ruby/spec/models/special_model_name_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/tag_spec.rb b/samples/client/petstore/ruby/spec/models/tag_spec.rb index 4b3ff7ac611..55778d8fd67 100644 --- a/samples/client/petstore/ruby/spec/models/tag_spec.rb +++ b/samples/client/petstore/ruby/spec/models/tag_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/models/user_spec.rb b/samples/client/petstore/ruby/spec/models/user_spec.rb index 2c289705417..a6b872e834c 100644 --- a/samples/client/petstore/ruby/spec/models/user_spec.rb +++ b/samples/client/petstore/ruby/spec/models/user_spec.rb @@ -1,7 +1,7 @@ =begin Swagger Petstore -This is a sample server Petstore server. You can find out more about Swagger at http://swagger.io or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. OpenAPI spec version: 1.0.0 Contact: apiteam@swagger.io diff --git a/samples/client/petstore/ruby/spec/pet_spec.rb b/samples/client/petstore/ruby/spec/pet_spec.rb index fc1f3087678..b05b2163353 100644 --- a/samples/client/petstore/ruby/spec/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/pet_spec.rb @@ -94,7 +94,9 @@ describe "Pet" do end end - it "should create and get pet with byte array (binary, string)" do + # skip the following as original petstore spec does not have endpoints for testing byte array + # we will re-enable this after updating the petstore server + xit "should create and get pet with byte array (binary, string)" do pet = @pet_api.get_pet_by_id(@pet_id) pet.id = @pet_id + 1 str = serialize_json(pet) @@ -111,7 +113,9 @@ describe "Pet" do @pet_api.delete_pet(pet.id) end - it "should get pet in bject" do + # skip the following as original petstore spec does not have endpoints for testing byte array + # we will re-enable this after updating the petstore server + xit "should get pet in object" do pet = @pet_api.get_pet_by_id_in_object(@pet_id) pet.should be_a(Petstore::InlineResponse200) pet.id.should == @pet_id @@ -136,7 +140,7 @@ describe "Pet" do end it "should find pets by status" do - pets = @pet_api.find_pets_by_status(:status => 'available') + pets = @pet_api.find_pets_by_status(['available']) pets.length.should >= 3 pets.each do |pet| pet.should be_a(Petstore::Pet) @@ -145,12 +149,12 @@ describe "Pet" do end it "should not find a pet with invalid status" do - pets = @pet_api.find_pets_by_status(:status => 'invalid-status') + pets = @pet_api.find_pets_by_status(['invalid-status']) pets.length.should == 0 end it "should find a pet by status" do - pets = @pet_api.find_pets_by_status(:status => "available,sold") + pets = @pet_api.find_pets_by_status(["available", "sold"]) pets.each do |pet| if pet.status != 'available' && pet.status != 'sold' raise "pet status wasn't right" @@ -162,7 +166,7 @@ describe "Pet" do id = @pet_id + 1 pet = Petstore::Pet.new('id' => id, 'name' => "RUBY UNIT TESTING") - result = @pet_api.add_pet(:body => pet) + result = @pet_api.add_pet(pet) # nothing is returned result.should be_nil @@ -175,13 +179,14 @@ describe "Pet" do it "should upload a file to a pet" do result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt')) - # nothing is returned - result.should be_nil + # ApiResponse is returned + result.should be_a(Petstore::ApiResponse) end it "should upload a file with form parameter to a pet" do result = @pet_api.upload_file(@pet_id, file: File.new('hello.txt'), additional_metadata: 'metadata') - result.should be_nil + # ApiResponse is returned + result.should be_a(Petstore::ApiResponse) end it "should implement eql? and hash" do diff --git a/samples/client/petstore/ruby/spec/spec_helper.rb b/samples/client/petstore/ruby/spec/spec_helper.rb index 5382a3879ef..68147e76b72 100644 --- a/samples/client/petstore/ruby/spec/spec_helper.rb +++ b/samples/client/petstore/ruby/spec/spec_helper.rb @@ -49,7 +49,7 @@ def prepare_pet(pet_api) tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test') pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url', 'category' => category, 'tags' => [tag], 'status' => 'pending') - pet_api.add_pet(:'body'=> pet) + pet_api.add_pet(pet) return pet_id end @@ -62,7 +62,7 @@ def prepare_store(store_api) "shipDate" => "2015-04-06T23:42:01.678Z", "status" => "placed", "complete" => false) - store_api.place_order(:body => order) + store_api.place_order(order) return order_id end diff --git a/samples/client/petstore/ruby/spec/store_spec.rb b/samples/client/petstore/ruby/spec/store_spec.rb index 67b678575d0..229a9dfd40a 100644 --- a/samples/client/petstore/ruby/spec/store_spec.rb +++ b/samples/client/petstore/ruby/spec/store_spec.rb @@ -24,7 +24,9 @@ describe "Store" do end end - it "should featch the inventory in object" do + # mark as pending since original petstore does not return object + # will re-enable this after updating the petstore server + xit "should featch the inventory in object" do result = @api.get_inventory_in_object result.should be_a(Hash) result.should_not be_empty diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift index 347ccf23554..1d39c7885d3 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/PetAPI.swift @@ -17,7 +17,7 @@ public class PetAPI: APIBase { - parameter body: (body) Pet object that needs to be added to the store (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func addPet(body body: Pet?, completion: ((error: ErrorType?) -> Void)) { + public class func addPet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) { addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in completion(error: error); } @@ -29,7 +29,7 @@ public class PetAPI: APIBase { - parameter body: (body) Pet object that needs to be added to the store (optional) - returns: Promise */ - public class func addPet(body body: Pet?) -> Promise { + public class func addPet(body body: Pet? = nil) -> Promise { let deferred = Promise.pendingPromise() addPet(body: body) { error in if let error = error { @@ -53,7 +53,7 @@ public class PetAPI: APIBase { - returns: RequestBuilder */ - public class func addPetWithRequestBuilder(body body: Pet?) -> RequestBuilder { + public class func addPetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder { let path = "/pet" let URLString = PetstoreClientAPI.basePath + path let parameters = body?.encodeToJSON() as? [String:AnyObject] @@ -69,7 +69,7 @@ public class PetAPI: APIBase { - parameter body: (body) Pet object in the form of byte array (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func addPetUsingByteArray(body body: String?, completion: ((error: ErrorType?) -> Void)) { + public class func addPetUsingByteArray(body body: String? = nil, completion: ((error: ErrorType?) -> Void)) { addPetUsingByteArrayWithRequestBuilder(body: body).execute { (response, error) -> Void in completion(error: error); } @@ -81,7 +81,7 @@ public class PetAPI: APIBase { - parameter body: (body) Pet object in the form of byte array (optional) - returns: Promise */ - public class func addPetUsingByteArray(body body: String?) -> Promise { + public class func addPetUsingByteArray(body body: String? = nil) -> Promise { let deferred = Promise.pendingPromise() addPetUsingByteArray(body: body) { error in if let error = error { @@ -105,7 +105,7 @@ public class PetAPI: APIBase { - returns: RequestBuilder */ - public class func addPetUsingByteArrayWithRequestBuilder(body body: String?) -> RequestBuilder { + public class func addPetUsingByteArrayWithRequestBuilder(body body: String? = nil) -> RequestBuilder { let path = "/pet?testing_byte_array=true" let URLString = PetstoreClientAPI.basePath + path let parameters = body?.encodeToJSON() as? [String:AnyObject] @@ -176,7 +176,7 @@ public class PetAPI: APIBase { - parameter status: (query) Status values that need to be considered for query (optional, default to available) - parameter completion: completion handler to receive the data and the error objects */ - public class func findPetsByStatus(status status: [String]?, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) { + public class func findPetsByStatus(status status: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) { findPetsByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in completion(data: response?.body, error: error); } @@ -188,7 +188,7 @@ public class PetAPI: APIBase { - parameter status: (query) Status values that need to be considered for query (optional, default to available) - returns: Promise<[Pet]> */ - public class func findPetsByStatus(status status: [String]?) -> Promise<[Pet]> { + public class func findPetsByStatus(status status: [String]? = nil) -> Promise<[Pet]> { let deferred = Promise<[Pet]>.pendingPromise() findPetsByStatus(status: status) { data, error in if let error = error { @@ -207,20 +207,20 @@ public class PetAPI: APIBase { - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -229,21 +229,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -252,13 +252,13 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter status: (query) Status values that need to be considered for query (optional, default to available) - returns: RequestBuilder<[Pet]> */ - public class func findPetsByStatusWithRequestBuilder(status status: [String]?) -> RequestBuilder<[Pet]> { + public class func findPetsByStatusWithRequestBuilder(status status: [String]? = nil) -> RequestBuilder<[Pet]> { let path = "/pet/findByStatus" let URLString = PetstoreClientAPI.basePath + path @@ -278,7 +278,7 @@ public class PetAPI: APIBase { - parameter tags: (query) Tags to filter by (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func findPetsByTags(tags tags: [String]?, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) { + public class func findPetsByTags(tags tags: [String]? = nil, completion: ((data: [Pet]?, error: ErrorType?) -> Void)) { findPetsByTagsWithRequestBuilder(tags: tags).execute { (response, error) -> Void in completion(data: response?.body, error: error); } @@ -290,7 +290,7 @@ public class PetAPI: APIBase { - parameter tags: (query) Tags to filter by (optional) - returns: Promise<[Pet]> */ - public class func findPetsByTags(tags tags: [String]?) -> Promise<[Pet]> { + public class func findPetsByTags(tags tags: [String]? = nil) -> Promise<[Pet]> { let deferred = Promise<[Pet]>.pendingPromise() findPetsByTags(tags: tags) { data, error in if let error = error { @@ -309,20 +309,20 @@ public class PetAPI: APIBase { - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -331,21 +331,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example=[ { - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example=[ { + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -} ], contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 doggie @@ -354,13 +354,13 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter tags: (query) Tags to filter by (optional) - returns: RequestBuilder<[Pet]> */ - public class func findPetsByTagsWithRequestBuilder(tags tags: [String]?) -> RequestBuilder<[Pet]> { + public class func findPetsByTagsWithRequestBuilder(tags tags: [String]? = nil) -> RequestBuilder<[Pet]> { let path = "/pet/findByTags" let URLString = PetstoreClientAPI.basePath + path @@ -408,26 +408,26 @@ public class PetAPI: APIBase { Find pet by ID - GET /pet/{petId} - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example={ - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 doggie @@ -436,21 +436,21 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] - - examples: [{example={ - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], +}] + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], + "name" : "doggie", "id" : 123456789, "category" : { - "id" : 123456789, - "name" : "aeiou" + "name" : "aeiou", + "id" : 123456789 }, - "status" : "aeiou", - "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 doggie @@ -459,7 +459,7 @@ public class PetAPI: APIBase { string -, contentType=application/xml}] +}] - parameter petId: (path) ID of pet that needs to be fetched @@ -512,46 +512,46 @@ public class PetAPI: APIBase { Fake endpoint to test inline arbitrary object return by 'Find pet by ID' - GET /pet/{petId}?response=inline_arbitrary_object - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example={ - "id" : 123456789, - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], - "category" : "{}", - "status" : "aeiou", + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "id" : 123456789, + "category" : "{}", + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= + string + doggie 123456 not implemented io.swagger.models.properties.ObjectProperty@37ff6855 string - doggie - string -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, - "tags" : [ { - "id" : 123456789, - "name" : "aeiou" - } ], - "category" : "{}", - "status" : "aeiou", +}] + - examples: [{contentType=application/json, example={ + "photoUrls" : [ "aeiou" ], "name" : "doggie", - "photoUrls" : [ "aeiou" ] -}, contentType=application/json}, {example= + "id" : 123456789, + "category" : "{}", + "tags" : [ { + "name" : "aeiou", + "id" : 123456789 + } ], + "status" : "aeiou" +}}, {contentType=application/xml, example= + string + doggie 123456 not implemented io.swagger.models.properties.ObjectProperty@37ff6855 string - doggie - string -, contentType=application/xml}] +}] - parameter petId: (path) ID of pet that needs to be fetched @@ -604,14 +604,14 @@ public class PetAPI: APIBase { Fake endpoint to test byte array return by 'Find pet by ID' - GET /pet/{petId}?testing_byte_array=true - Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions - - API Key: - - type: apiKey api_key - - name: api_key - OAuth: - type: oauth2 - name: petstore_auth - - examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] - - examples: [{example="", contentType=application/json}, {example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e, contentType=application/xml}] + - API Key: + - type: apiKey api_key + - name: api_key + - examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}] + - examples: [{contentType=application/json, example=""}, {contentType=application/xml, example=not implemented io.swagger.models.properties.BinaryProperty@55e6ae9e}] - parameter petId: (path) ID of pet that needs to be fetched @@ -636,7 +636,7 @@ public class PetAPI: APIBase { - parameter body: (body) Pet object that needs to be added to the store (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func updatePet(body body: Pet?, completion: ((error: ErrorType?) -> Void)) { + public class func updatePet(body body: Pet? = nil, completion: ((error: ErrorType?) -> Void)) { updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in completion(error: error); } @@ -648,7 +648,7 @@ public class PetAPI: APIBase { - parameter body: (body) Pet object that needs to be added to the store (optional) - returns: Promise */ - public class func updatePet(body body: Pet?) -> Promise { + public class func updatePet(body body: Pet? = nil) -> Promise { let deferred = Promise.pendingPromise() updatePet(body: body) { error in if let error = error { @@ -672,7 +672,7 @@ public class PetAPI: APIBase { - returns: RequestBuilder */ - public class func updatePetWithRequestBuilder(body body: Pet?) -> RequestBuilder { + public class func updatePetWithRequestBuilder(body body: Pet? = nil) -> RequestBuilder { let path = "/pet" let URLString = PetstoreClientAPI.basePath + path let parameters = body?.encodeToJSON() as? [String:AnyObject] @@ -690,7 +690,7 @@ public class PetAPI: APIBase { - parameter status: (form) Updated status of the pet (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func updatePetWithForm(petId petId: String, name: String?, status: String?, completion: ((error: ErrorType?) -> Void)) { + public class func updatePetWithForm(petId petId: String, name: String? = nil, status: String? = nil, completion: ((error: ErrorType?) -> Void)) { updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute { (response, error) -> Void in completion(error: error); } @@ -704,7 +704,7 @@ public class PetAPI: APIBase { - parameter status: (form) Updated status of the pet (optional) - returns: Promise */ - public class func updatePetWithForm(petId petId: String, name: String?, status: String?) -> Promise { + public class func updatePetWithForm(petId petId: String, name: String? = nil, status: String? = nil) -> Promise { let deferred = Promise.pendingPromise() updatePetWithForm(petId: petId, name: name, status: status) { error in if let error = error { @@ -730,7 +730,7 @@ public class PetAPI: APIBase { - returns: RequestBuilder */ - public class func updatePetWithFormWithRequestBuilder(petId petId: String, name: String?, status: String?) -> RequestBuilder { + public class func updatePetWithFormWithRequestBuilder(petId petId: String, name: String? = nil, status: String? = nil) -> RequestBuilder { var path = "/pet/{petId}" path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) let URLString = PetstoreClientAPI.basePath + path @@ -754,7 +754,7 @@ public class PetAPI: APIBase { - parameter _file: (form) file to upload (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func uploadFile(petId petId: Int64, additionalMetadata: String?, _file: NSURL?, completion: ((error: ErrorType?) -> Void)) { + public class func uploadFile(petId petId: Int64, additionalMetadata: String? = nil, _file: NSURL? = nil, completion: ((error: ErrorType?) -> Void)) { uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, _file: _file).execute { (response, error) -> Void in completion(error: error); } @@ -768,7 +768,7 @@ public class PetAPI: APIBase { - parameter _file: (form) file to upload (optional) - returns: Promise */ - public class func uploadFile(petId petId: Int64, additionalMetadata: String?, _file: NSURL?) -> Promise { + public class func uploadFile(petId petId: Int64, additionalMetadata: String? = nil, _file: NSURL? = nil) -> Promise { let deferred = Promise.pendingPromise() uploadFile(petId: petId, additionalMetadata: additionalMetadata, _file: _file) { error in if let error = error { @@ -794,7 +794,7 @@ public class PetAPI: APIBase { - returns: RequestBuilder */ - public class func uploadFileWithRequestBuilder(petId petId: Int64, additionalMetadata: String?, _file: NSURL?) -> RequestBuilder { + public class func uploadFileWithRequestBuilder(petId petId: Int64, additionalMetadata: String? = nil, _file: NSURL? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" path = path.stringByReplacingOccurrencesOfString("{petId}", withString: "\(petId)", options: .LiteralSearch, range: nil) let URLString = PetstoreClientAPI.basePath + path diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift index 94c311f1a44..f4f0cea288b 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/StoreAPI.swift @@ -69,7 +69,7 @@ public class StoreAPI: APIBase { - parameter status: (query) Status value that needs to be considered for query (optional, default to placed) - parameter completion: completion handler to receive the data and the error objects */ - public class func findOrdersByStatus(status status: String?, completion: ((data: [Order]?, error: ErrorType?) -> Void)) { + public class func findOrdersByStatus(status status: String? = nil, completion: ((data: [Order]?, error: ErrorType?) -> Void)) { findOrdersByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in completion(data: response?.body, error: error); } @@ -81,7 +81,7 @@ public class StoreAPI: APIBase { - parameter status: (query) Status value that needs to be considered for query (optional, default to placed) - returns: Promise<[Order]> */ - public class func findOrdersByStatus(status status: String?) -> Promise<[Order]> { + public class func findOrdersByStatus(status status: String? = nil) -> Promise<[Order]> { let deferred = Promise<[Order]>.pendingPromise() findOrdersByStatus(status: status) { data, error in if let error = error { @@ -103,42 +103,42 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey x-test_api_client_secret - name: test_api_client_secret - - examples: [{example=[ { - "id" : 123456789, + - examples: [{contentType=application/json, example=[ { "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -} ], contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example=[ { - "id" : 123456789, +}] + - examples: [{contentType=application/json, example=[ { "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -} ], contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +} ]}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter status: (query) Status value that needs to be considered for query (optional, default to placed) - returns: RequestBuilder<[Order]> */ - public class func findOrdersByStatusWithRequestBuilder(status status: String?) -> RequestBuilder<[Order]> { + public class func findOrdersByStatusWithRequestBuilder(status status: String? = nil) -> RequestBuilder<[Order]> { let path = "/store/findByStatus" let URLString = PetstoreClientAPI.basePath + path @@ -187,12 +187,12 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey api_key - name: api_key - - examples: [{example={ + - examples: [{contentType=application/json, example={ "key" : 123 -}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}] - - examples: [{example={ +}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}] + - examples: [{contentType=application/json, example={ "key" : 123 -}, contentType=application/json}, {example=not implemented io.swagger.models.properties.MapProperty@d1e580af, contentType=application/xml}] +}}, {contentType=application/xml, example=not implemented io.swagger.models.properties.MapProperty@d1e580af}] - returns: RequestBuilder<[String:Int32]> */ @@ -243,8 +243,8 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey api_key - name: api_key - - examples: [{example="{}", contentType=application/json}, {example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f, contentType=application/xml}] - - examples: [{example="{}", contentType=application/json}, {example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f, contentType=application/xml}] + - examples: [{contentType=application/json, example="{}"}, {contentType=application/xml, example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f}] + - examples: [{contentType=application/json, example="{}"}, {contentType=application/xml, example=not implemented io.swagger.models.properties.ObjectProperty@37aadb4f}] - returns: RequestBuilder */ @@ -294,42 +294,42 @@ public class StoreAPI: APIBase { Find purchase order by ID - GET /store/order/{orderId} - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions - - API Key: - - type: apiKey test_api_key_header - - name: test_api_key_header - API Key: - type: apiKey test_api_key_query (QUERY) - name: test_api_key_query - - examples: [{example={ - "id" : 123456789, + - API Key: + - type: apiKey test_api_key_header + - name: test_api_key_header + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, +}] + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter orderId: (path) ID of pet that needs to be fetched @@ -354,7 +354,7 @@ public class StoreAPI: APIBase { - parameter body: (body) order placed for purchasing the pet (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func placeOrder(body body: Order?, completion: ((data: Order?, error: ErrorType?) -> Void)) { + public class func placeOrder(body body: Order? = nil, completion: ((data: Order?, error: ErrorType?) -> Void)) { placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in completion(data: response?.body, error: error); } @@ -366,7 +366,7 @@ public class StoreAPI: APIBase { - parameter body: (body) order placed for purchasing the pet (optional) - returns: Promise */ - public class func placeOrder(body body: Order?) -> Promise { + public class func placeOrder(body body: Order? = nil) -> Promise { let deferred = Promise.pendingPromise() placeOrder(body: body) { data, error in if let error = error { @@ -388,42 +388,42 @@ public class StoreAPI: APIBase { - API Key: - type: apiKey x-test_api_client_secret - name: test_api_client_secret - - examples: [{example={ - "id" : 123456789, + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] - - examples: [{example={ - "id" : 123456789, +}] + - examples: [{contentType=application/json, example={ "petId" : 123456789, - "complete" : true, - "status" : "aeiou", "quantity" : 123, - "shipDate" : "2000-01-23T04:56:07.000+0000" -}, contentType=application/json}, {example= + "id" : 123456789, + "shipDate" : "2000-01-23T04:56:07.000+0000", + "complete" : true, + "status" : "aeiou" +}}, {contentType=application/xml, example= 123456 123456 0 2000-01-23T04:56:07.000Z string true -, contentType=application/xml}] +}] - parameter body: (body) order placed for purchasing the pet (optional) - returns: RequestBuilder */ - public class func placeOrderWithRequestBuilder(body body: Order?) -> RequestBuilder { + public class func placeOrderWithRequestBuilder(body body: Order? = nil) -> RequestBuilder { let path = "/store/order" let URLString = PetstoreClientAPI.basePath + path let parameters = body?.encodeToJSON() as? [String:AnyObject] diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift index 4f1f36754c6..6a522eb8813 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/APIs/UserAPI.swift @@ -17,7 +17,7 @@ public class UserAPI: APIBase { - parameter body: (body) Created user object (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func createUser(body body: User?, completion: ((error: ErrorType?) -> Void)) { + public class func createUser(body body: User? = nil, completion: ((error: ErrorType?) -> Void)) { createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in completion(error: error); } @@ -29,7 +29,7 @@ public class UserAPI: APIBase { - parameter body: (body) Created user object (optional) - returns: Promise */ - public class func createUser(body body: User?) -> Promise { + public class func createUser(body body: User? = nil) -> Promise { let deferred = Promise.pendingPromise() createUser(body: body) { error in if let error = error { @@ -50,7 +50,7 @@ public class UserAPI: APIBase { - returns: RequestBuilder */ - public class func createUserWithRequestBuilder(body body: User?) -> RequestBuilder { + public class func createUserWithRequestBuilder(body body: User? = nil) -> RequestBuilder { let path = "/user" let URLString = PetstoreClientAPI.basePath + path let parameters = body?.encodeToJSON() as? [String:AnyObject] @@ -66,7 +66,7 @@ public class UserAPI: APIBase { - parameter body: (body) List of user object (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func createUsersWithArrayInput(body body: [User]?, completion: ((error: ErrorType?) -> Void)) { + public class func createUsersWithArrayInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) { createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in completion(error: error); } @@ -78,7 +78,7 @@ public class UserAPI: APIBase { - parameter body: (body) List of user object (optional) - returns: Promise */ - public class func createUsersWithArrayInput(body body: [User]?) -> Promise { + public class func createUsersWithArrayInput(body body: [User]? = nil) -> Promise { let deferred = Promise.pendingPromise() createUsersWithArrayInput(body: body) { error in if let error = error { @@ -99,7 +99,7 @@ public class UserAPI: APIBase { - returns: RequestBuilder */ - public class func createUsersWithArrayInputWithRequestBuilder(body body: [User]?) -> RequestBuilder { + public class func createUsersWithArrayInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder { let path = "/user/createWithArray" let URLString = PetstoreClientAPI.basePath + path let parameters = body?.encodeToJSON() as? [String:AnyObject] @@ -115,7 +115,7 @@ public class UserAPI: APIBase { - parameter body: (body) List of user object (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func createUsersWithListInput(body body: [User]?, completion: ((error: ErrorType?) -> Void)) { + public class func createUsersWithListInput(body body: [User]? = nil, completion: ((error: ErrorType?) -> Void)) { createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in completion(error: error); } @@ -127,7 +127,7 @@ public class UserAPI: APIBase { - parameter body: (body) List of user object (optional) - returns: Promise */ - public class func createUsersWithListInput(body body: [User]?) -> Promise { + public class func createUsersWithListInput(body body: [User]? = nil) -> Promise { let deferred = Promise.pendingPromise() createUsersWithListInput(body: body) { error in if let error = error { @@ -148,7 +148,7 @@ public class UserAPI: APIBase { - returns: RequestBuilder */ - public class func createUsersWithListInputWithRequestBuilder(body body: [User]?) -> RequestBuilder { + public class func createUsersWithListInputWithRequestBuilder(body body: [User]? = nil) -> RequestBuilder { let path = "/user/createWithList" let URLString = PetstoreClientAPI.basePath + path let parameters = body?.encodeToJSON() as? [String:AnyObject] @@ -247,7 +247,7 @@ public class UserAPI: APIBase { Get user by user name - GET /user/{username} - - - examples: [{example={ + - examples: [{contentType=application/json, example={ "id" : 1, "username" : "johnp", "firstName" : "John", @@ -256,7 +256,7 @@ public class UserAPI: APIBase { "password" : "-secret-", "phone" : "0123456789", "userStatus" : 0 -}, contentType=application/json}] +}}] - parameter username: (path) The name that needs to be fetched. Use user1 for testing. @@ -282,7 +282,7 @@ public class UserAPI: APIBase { - parameter password: (query) The password for login in clear text (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func loginUser(username username: String?, password: String?, completion: ((data: String?, error: ErrorType?) -> Void)) { + public class func loginUser(username username: String? = nil, password: String? = nil, completion: ((data: String?, error: ErrorType?) -> Void)) { loginUserWithRequestBuilder(username: username, password: password).execute { (response, error) -> Void in completion(data: response?.body, error: error); } @@ -295,7 +295,7 @@ public class UserAPI: APIBase { - parameter password: (query) The password for login in clear text (optional) - returns: Promise */ - public class func loginUser(username username: String?, password: String?) -> Promise { + public class func loginUser(username username: String? = nil, password: String? = nil) -> Promise { let deferred = Promise.pendingPromise() loginUser(username: username, password: password) { data, error in if let error = error { @@ -311,15 +311,15 @@ public class UserAPI: APIBase { Logs user into the system - GET /user/login - - - examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] - - examples: [{example="aeiou", contentType=application/json}, {example=string, contentType=application/xml}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] + - examples: [{contentType=application/json, example="aeiou"}, {contentType=application/xml, example=string}] - parameter username: (query) The user name for login (optional) - parameter password: (query) The password for login in clear text (optional) - returns: RequestBuilder */ - public class func loginUserWithRequestBuilder(username username: String?, password: String?) -> RequestBuilder { + public class func loginUserWithRequestBuilder(username username: String? = nil, password: String? = nil) -> RequestBuilder { let path = "/user/login" let URLString = PetstoreClientAPI.basePath + path @@ -388,7 +388,7 @@ public class UserAPI: APIBase { - parameter body: (body) Updated user object (optional) - parameter completion: completion handler to receive the data and the error objects */ - public class func updateUser(username username: String, body: User?, completion: ((error: ErrorType?) -> Void)) { + public class func updateUser(username username: String, body: User? = nil, completion: ((error: ErrorType?) -> Void)) { updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in completion(error: error); } @@ -401,7 +401,7 @@ public class UserAPI: APIBase { - parameter body: (body) Updated user object (optional) - returns: Promise */ - public class func updateUser(username username: String, body: User?) -> Promise { + public class func updateUser(username username: String, body: User? = nil) -> Promise { let deferred = Promise.pendingPromise() updateUser(username: username, body: body) { error in if let error = error { @@ -423,7 +423,7 @@ public class UserAPI: APIBase { - returns: RequestBuilder */ - public class func updateUserWithRequestBuilder(username username: String, body: User?) -> RequestBuilder { + public class func updateUserWithRequestBuilder(username username: String, body: User? = nil) -> RequestBuilder { var path = "/user/{username}" path = path.stringByReplacingOccurrencesOfString("{username}", withString: "\(username)", options: .LiteralSearch, range: nil) let URLString = PetstoreClientAPI.basePath + path diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift index bb8e7a7be4c..3d3710ea223 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models.swift @@ -130,11 +130,11 @@ class Decoders { fatalError("formatter failed to parse \(source)") } - // Decoder for [Animal] + // Decoder for [Animal] Decoders.addDecoder(clazz: [Animal].self) { (source: AnyObject) -> [Animal] in return Decoders.decode(clazz: [Animal].self, source: source) } - // Decoder for Animal + // Decoder for Animal Decoders.addDecoder(clazz: Animal.self) { (source: AnyObject) -> Animal in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Animal() @@ -143,11 +143,11 @@ class Decoders { } - // Decoder for [Cat] + // Decoder for [Cat] Decoders.addDecoder(clazz: [Cat].self) { (source: AnyObject) -> [Cat] in return Decoders.decode(clazz: [Cat].self, source: source) } - // Decoder for Cat + // Decoder for Cat Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject) -> Cat in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Cat() @@ -157,11 +157,11 @@ class Decoders { } - // Decoder for [Category] + // Decoder for [Category] Decoders.addDecoder(clazz: [Category].self) { (source: AnyObject) -> [Category] in return Decoders.decode(clazz: [Category].self, source: source) } - // Decoder for Category + // Decoder for Category Decoders.addDecoder(clazz: Category.self) { (source: AnyObject) -> Category in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Category() @@ -171,11 +171,11 @@ class Decoders { } - // Decoder for [Dog] + // Decoder for [Dog] Decoders.addDecoder(clazz: [Dog].self) { (source: AnyObject) -> [Dog] in return Decoders.decode(clazz: [Dog].self, source: source) } - // Decoder for Dog + // Decoder for Dog Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject) -> Dog in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Dog() @@ -185,11 +185,11 @@ class Decoders { } - // Decoder for [FormatTest] + // Decoder for [FormatTest] Decoders.addDecoder(clazz: [FormatTest].self) { (source: AnyObject) -> [FormatTest] in return Decoders.decode(clazz: [FormatTest].self, source: source) } - // Decoder for FormatTest + // Decoder for FormatTest Decoders.addDecoder(clazz: FormatTest.self) { (source: AnyObject) -> FormatTest in let sourceDictionary = source as! [NSObject:AnyObject] let instance = FormatTest() @@ -203,34 +203,35 @@ class Decoders { instance.byte = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["byte"]) instance.binary = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["binary"]) instance.date = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["date"]) - instance.dateTime = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["dateTime"]) + instance.dateTime = Decoders.decodeOptional(clazz: NSDate.self, source: sourceDictionary["dateTime"]) + instance.password = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["password"]) return instance } - // Decoder for [InlineResponse200] + // Decoder for [InlineResponse200] Decoders.addDecoder(clazz: [InlineResponse200].self) { (source: AnyObject) -> [InlineResponse200] in return Decoders.decode(clazz: [InlineResponse200].self, source: source) } - // Decoder for InlineResponse200 + // Decoder for InlineResponse200 Decoders.addDecoder(clazz: InlineResponse200.self) { (source: AnyObject) -> InlineResponse200 in let sourceDictionary = source as! [NSObject:AnyObject] let instance = InlineResponse200() - instance.tags = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["tags"]) + instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"]) + instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) instance.id = Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"]) instance.category = Decoders.decodeOptional(clazz: AnyObject.self, source: sourceDictionary["category"]) + instance.tags = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["tags"]) instance.status = InlineResponse200.Status(rawValue: (sourceDictionary["status"] as? String) ?? "") - instance.name = Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"]) - instance.photoUrls = Decoders.decodeOptional(clazz: Array.self, source: sourceDictionary["photoUrls"]) return instance } - // Decoder for [Model200Response] + // Decoder for [Model200Response] Decoders.addDecoder(clazz: [Model200Response].self) { (source: AnyObject) -> [Model200Response] in return Decoders.decode(clazz: [Model200Response].self, source: source) } - // Decoder for Model200Response + // Decoder for Model200Response Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject) -> Model200Response in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Model200Response() @@ -239,11 +240,11 @@ class Decoders { } - // Decoder for [ModelReturn] + // Decoder for [ModelReturn] Decoders.addDecoder(clazz: [ModelReturn].self) { (source: AnyObject) -> [ModelReturn] in return Decoders.decode(clazz: [ModelReturn].self, source: source) } - // Decoder for ModelReturn + // Decoder for ModelReturn Decoders.addDecoder(clazz: ModelReturn.self) { (source: AnyObject) -> ModelReturn in let sourceDictionary = source as! [NSObject:AnyObject] let instance = ModelReturn() @@ -252,11 +253,11 @@ class Decoders { } - // Decoder for [Name] + // Decoder for [Name] Decoders.addDecoder(clazz: [Name].self) { (source: AnyObject) -> [Name] in return Decoders.decode(clazz: [Name].self, source: source) } - // Decoder for Name + // Decoder for Name Decoders.addDecoder(clazz: Name.self) { (source: AnyObject) -> Name in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Name() @@ -266,11 +267,11 @@ class Decoders { } - // Decoder for [Order] + // Decoder for [Order] Decoders.addDecoder(clazz: [Order].self) { (source: AnyObject) -> [Order] in return Decoders.decode(clazz: [Order].self, source: source) } - // Decoder for Order + // Decoder for Order Decoders.addDecoder(clazz: Order.self) { (source: AnyObject) -> Order in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Order() @@ -284,11 +285,11 @@ class Decoders { } - // Decoder for [Pet] + // Decoder for [Pet] Decoders.addDecoder(clazz: [Pet].self) { (source: AnyObject) -> [Pet] in return Decoders.decode(clazz: [Pet].self, source: source) } - // Decoder for Pet + // Decoder for Pet Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject) -> Pet in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Pet() @@ -302,11 +303,11 @@ class Decoders { } - // Decoder for [SpecialModelName] + // Decoder for [SpecialModelName] Decoders.addDecoder(clazz: [SpecialModelName].self) { (source: AnyObject) -> [SpecialModelName] in return Decoders.decode(clazz: [SpecialModelName].self, source: source) } - // Decoder for SpecialModelName + // Decoder for SpecialModelName Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject) -> SpecialModelName in let sourceDictionary = source as! [NSObject:AnyObject] let instance = SpecialModelName() @@ -315,11 +316,11 @@ class Decoders { } - // Decoder for [Tag] + // Decoder for [Tag] Decoders.addDecoder(clazz: [Tag].self) { (source: AnyObject) -> [Tag] in return Decoders.decode(clazz: [Tag].self, source: source) } - // Decoder for Tag + // Decoder for Tag Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject) -> Tag in let sourceDictionary = source as! [NSObject:AnyObject] let instance = Tag() @@ -329,11 +330,11 @@ class Decoders { } - // Decoder for [User] + // Decoder for [User] Decoders.addDecoder(clazz: [User].self) { (source: AnyObject) -> [User] in return Decoders.decode(clazz: [User].self, source: source) } - // Decoder for User + // Decoder for User Decoders.addDecoder(clazz: User.self) { (source: AnyObject) -> User in let sourceDictionary = source as! [NSObject:AnyObject] let instance = User() diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift index ee2547d3e89..b84000125e3 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/FormatTest.swift @@ -19,7 +19,8 @@ public class FormatTest: JSONEncodable { public var byte: String? public var binary: String? public var date: NSDate? - public var dateTime: String? + public var dateTime: NSDate? + public var password: String? public init() {} @@ -37,7 +38,8 @@ public class FormatTest: JSONEncodable { nillableDictionary["byte"] = self.byte nillableDictionary["binary"] = self.binary nillableDictionary["date"] = self.date?.encodeToJSON() - nillableDictionary["dateTime"] = self.dateTime + nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() + nillableDictionary["password"] = self.password let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift index 6e3ce5aeaba..a9397e868ba 100644 --- a/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift +++ b/samples/client/petstore/swift/PetstoreClient/Classes/Swaggers/Models/InlineResponse200.swift @@ -14,26 +14,26 @@ public class InlineResponse200: JSONEncodable { case Pending = "pending" case Sold = "sold" } - public var tags: [Tag]? + public var photoUrls: [String]? + public var name: String? public var id: Int64? public var category: AnyObject? + public var tags: [Tag]? /** pet status in the store */ public var status: Status? - public var name: String? - public var photoUrls: [String]? public init() {} // MARK: JSONEncodable func encodeToJSON() -> AnyObject { var nillableDictionary = [String:AnyObject?]() - nillableDictionary["tags"] = self.tags?.encodeToJSON() + nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() + nillableDictionary["name"] = self.name nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["id"] = self.id?.encodeToJSON() nillableDictionary["category"] = self.category + nillableDictionary["tags"] = self.tags?.encodeToJSON() nillableDictionary["status"] = self.status?.rawValue - nillableDictionary["name"] = self.name - nillableDictionary["photoUrls"] = self.photoUrls?.encodeToJSON() let dictionary: [String:AnyObject] = APIHelper.rejectNil(nillableDictionary) ?? [:] return dictionary } diff --git a/samples/client/petstore/typescript-node/api.ts b/samples/client/petstore/typescript-node/api.ts index c7449aeb5ec..1e314a3fc64 100644 --- a/samples/client/petstore/typescript-node/api.ts +++ b/samples/client/petstore/typescript-node/api.ts @@ -368,9 +368,9 @@ export class PetApi { let formParams: any = {}; - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling deletePet'); + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling deletePet.'); } headerParams['api_key'] = apiKey; @@ -534,9 +534,9 @@ export class PetApi { let formParams: any = {}; - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling getPetById'); + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetById.'); } let useFormData = false; @@ -592,9 +592,9 @@ export class PetApi { let formParams: any = {}; - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling getPetByIdInObject'); + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling getPetByIdInObject.'); } let useFormData = false; @@ -650,9 +650,9 @@ export class PetApi { let formParams: any = {}; - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling petPetIdtestingByteArraytrueGet'); + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling petPetIdtestingByteArraytrueGet.'); } let useFormData = false; @@ -761,9 +761,9 @@ export class PetApi { let formParams: any = {}; - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling updatePetWithForm'); + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling updatePetWithForm.'); } let useFormData = false; @@ -827,9 +827,9 @@ export class PetApi { let formParams: any = {}; - // verify required parameter 'petId' is set - if (!petId) { - throw new Error('Missing required parameter petId when calling uploadFile'); + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new Error('Required parameter petId was null or undefined when calling uploadFile.'); } let useFormData = false; @@ -955,9 +955,9 @@ export class StoreApi { let formParams: any = {}; - // verify required parameter 'orderId' is set - if (!orderId) { - throw new Error('Missing required parameter orderId when calling deleteOrder'); + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling deleteOrder.'); } let useFormData = false; @@ -1163,9 +1163,9 @@ export class StoreApi { let formParams: any = {}; - // verify required parameter 'orderId' is set - if (!orderId) { - throw new Error('Missing required parameter orderId when calling getOrderById'); + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new Error('Required parameter orderId was null or undefined when calling getOrderById.'); } let useFormData = false; @@ -1484,9 +1484,9 @@ export class UserApi { let formParams: any = {}; - // verify required parameter 'username' is set - if (!username) { - throw new Error('Missing required parameter username when calling deleteUser'); + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling deleteUser.'); } let useFormData = false; @@ -1540,9 +1540,9 @@ export class UserApi { let formParams: any = {}; - // verify required parameter 'username' is set - if (!username) { - throw new Error('Missing required parameter username when calling getUserByName'); + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling getUserByName.'); } let useFormData = false; @@ -1699,9 +1699,9 @@ export class UserApi { let formParams: any = {}; - // verify required parameter 'username' is set - if (!username) { - throw new Error('Missing required parameter username when calling updateUser'); + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new Error('Required parameter username was null or undefined when calling updateUser.'); } let useFormData = false;