diff --git a/bin/go-petstore.sh b/bin/go-petstore.sh index 9f192d22234..35c5c0e6064 100755 --- a/bin/go-petstore.sh +++ b/bin/go-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/go -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go -o samples/client/petstore/go" +ags="$@ generate -t modules/swagger-codegen/src/main/resources/go -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l go -o samples/client/petstore/go/go-petstore" java $JAVA_OPTS -jar $executable $ags diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java index d386b4c4dca..e74b95cf2c1 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenParameter.java @@ -9,7 +9,7 @@ public class CodegenParameter { public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam, isCookieParam, isBodyParam, hasMore, isContainer, secondaryParam, isCollectionFormatMulti, isPrimitiveType; - public String baseName, paramName, dataType, datatypeWithEnum, collectionFormat, description, baseType, defaultValue; + public String baseName, paramName, dataType, datatypeWithEnum, collectionFormat, description, unescapedDescription, baseType, defaultValue; public String example; // example value (x-example) public String jsonSchema; public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index cce70f4ce39..9ce8ce09735 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -1706,6 +1706,7 @@ public class DefaultCodegen { CodegenParameter p = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER); p.baseName = param.getName(); p.description = escapeText(param.getDescription()); + p.unescapedDescription = param.getDescription(); if (param.getRequired()) { p.required = param.getRequired(); } diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java index 3e4daa01fcb..b8f2b187a6a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/CSharpClientCodegen.java @@ -11,6 +11,7 @@ import io.swagger.codegen.SupportingFile; import io.swagger.codegen.CodegenProperty; import io.swagger.codegen.CodegenModel; import io.swagger.codegen.CodegenOperation; +import io.swagger.codegen.CodegenParameter; import io.swagger.models.properties.*; import io.swagger.codegen.CliOption; import io.swagger.models.Model; @@ -45,6 +46,8 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { protected String packageCopyright = "No Copyright"; protected String clientPackage = "IO.Swagger.Client"; protected String localVariablePrefix = ""; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; protected String targetFramework = NET45; protected String targetFrameworkNuget = "net45"; @@ -62,6 +65,9 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { modelTestTemplateFiles.put("model_test.mustache", ".cs"); apiTestTemplateFiles.put("api_test.mustache", ".cs"); + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + // C# client default setSourceFolder("src" + File.separator + "main" + File.separator + "csharp"); @@ -219,17 +225,19 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat")); supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh")); supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor" + java.io.File.separator, "packages.config")); - supportingFiles.add(new SupportingFile("README.md", "", "README.md")); + 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")); - if (optionalAssemblyInfoFlag) { supportingFiles.add(new SupportingFile("AssemblyInfo.mustache", packageFolder + File.separator + "Properties", "AssemblyInfo.cs")); } if (optionalProjectFileFlag) { supportingFiles.add(new SupportingFile("Project.mustache", packageFolder, clientPackage + ".csproj")); } + + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); } @Override @@ -300,20 +308,20 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { @Override public Map postProcessModels(Map objMap) { - Map objs = super.postProcessModels(objMap); - + Map objs = super.postProcessModels(objMap); + List models = (List) objs.get("models"); for (Object _mo : models) { Map mo = (Map) _mo; CodegenModel cm = (CodegenModel) mo.get("model"); for (CodegenProperty var : cm.vars) { Map allowableValues = var.allowableValues; - + // handle ArrayProperty if (var.items != null) { allowableValues = var.items.allowableValues; } - + if (allowableValues == null) { continue; } @@ -349,12 +357,12 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { if (var.datatypeWithEnum != null) { var.vendorExtensions.put(DATA_TYPE_WITH_ENUM_EXTENSION, var.datatypeWithEnum.substring(0, var.datatypeWithEnum.length() - 1)); } - + if (var.defaultValue != null) { String enumName = null; - + for (Map enumVar : enumVars) { - + if (var.defaultValue.replace("\"", "").equals(enumVar.get("value"))) { enumName = enumVar.get("name"); break; @@ -413,7 +421,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { } } } - + if(removedChildEnum) { // If we removed an entry from this model's vars, we need to ensure hasMore is updated int count = 0, numVars = codegenProperties.size(); @@ -467,4 +475,20 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { public void setSupportsUWP(Boolean supportsUWP){ this.supportsUWP = supportsUWP; } + + @Override + public String toModelDocFilename(String name) { + return toModelFilename(name); + } + + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + } 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 8b7c3d7252a..93144cf7afc 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 @@ -19,6 +19,8 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { protected String packageName = "swagger"; protected String packageVersion = "1.0.0"; + protected String apiDocPath = "docs/"; + protected String modelDocPath = "docs/"; public CodegenType getTag() { return CodegenType.CLIENT; @@ -37,6 +39,10 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { outputFolder = "generated-code/go"; modelTemplateFiles.put("model.mustache", ".go"); apiTemplateFiles.put("api.mustache", ".go"); + + modelDocTemplateFiles.put("model_doc.mustache", ".md"); + apiDocTemplateFiles.put("api_doc.mustache", ".md"); + templateDir = "go"; setReservedWordsLowerCase( @@ -126,6 +132,9 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); additionalProperties.put(CodegenConstants.PACKAGE_VERSION, packageVersion); + + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); modelPackage = packageName; apiPackage = packageName; @@ -133,8 +142,9 @@ 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("api_client.mustache", packageName, "api_client.go")); + supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.go")); + supportingFiles.add(new SupportingFile("api_client.mustache", "", "api_client.go")); + supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); } @Override @@ -158,11 +168,11 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String apiFileFolder() { - return outputFolder + File.separator + packageName; + return outputFolder + File.separator; } public String modelFileFolder() { - return outputFolder + File.separator + packageName; + return outputFolder + File.separator; } @Override @@ -263,6 +273,26 @@ public class GoClientCodegen extends DefaultCodegen implements CodegenConfig { } + @Override + public String apiDocFileFolder() { + return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar); + } + + @Override + public String modelDocFileFolder() { + return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar); + } + + @Override + public String toModelDocFilename(String name) { + return toModelName(name); + } + + @Override + public String toApiDocFilename(String name) { + return toApiName(name); + } + @Override public String getTypeDeclaration(Property p) { if(p instanceof ArrayProperty) { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java index 848b6f4caea..1dd66c6400d 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/SpringMVCServerCodegen.java @@ -32,18 +32,6 @@ public class SpringMVCServerCodegen extends JavaClientCodegen { additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage); additionalProperties.put(CONFIG_PACKAGE, configPackage); - languageSpecificPrimitives = new HashSet( - Arrays.asList( - "byte[]", - "String", - "boolean", - "Boolean", - "Double", - "Integer", - "Long", - "Float") - ); - cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code")); supportedLibraries.clear(); diff --git a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache index 7560d5c0830..ee02339909e 100644 --- a/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache +++ b/modules/swagger-codegen/src/main/resources/JavaSpringMVC/api.mustache @@ -29,8 +29,8 @@ import java.util.List; import static org.springframework.http.MediaType.*; @Controller -@RequestMapping(value = "/{{baseName}}", produces = {APPLICATION_JSON_VALUE}) -@Api(value = "/{{baseName}}", description = "the {{baseName}} API") +@RequestMapping(value = "/{{{baseName}}}", produces = {APPLICATION_JSON_VALUE}) +@Api(value = "/{{{baseName}}}", description = "the {{{baseName}}} API") {{>generatedAnnotation}} {{#operations}} public class {{classname}} { @@ -44,8 +44,8 @@ public class {{classname}} { {{/hasMore}}{{/authMethods}} }{{/hasAuthMethods}}) @io.swagger.annotations.ApiResponses(value = { {{#responses}} - @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},{{/hasMore}}{{/responses}} }) - @RequestMapping(value = "{{path}}", + @io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}", response = {{{returnType}}}.class){{#hasMore}},{{/hasMore}}{{/responses}} }) + @RequestMapping(value = "{{{path}}}", {{#hasProduces}}produces = { {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }, {{/hasProduces}} {{#hasConsumes}}consumes = { {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} },{{/hasConsumes}} method = RequestMethod.{{httpMethod}}) diff --git a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache index 633f2f0aebb..37282d5a24c 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/README.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/README.mustache @@ -129,7 +129,7 @@ Class | Method | HTTP request | Description {{/isBasic}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{flow}} -- **Authorizatoin URL**: {{authorizationUrl}} +- **Authorization URL**: {{authorizationUrl}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#scopes}} - {{scope}}: {{description}} {{/scopes}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/README.md b/modules/swagger-codegen/src/main/resources/csharp/README.md deleted file mode 100644 index 794a7c49b1b..00000000000 --- a/modules/swagger-codegen/src/main/resources/csharp/README.md +++ /dev/null @@ -1,22 +0,0 @@ -## Frameworks supported -- .NET 4.0 or later -- Windows Phone 7.1 (Mango) - -## Dependencies -- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later -- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later - -The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: -``` -Install-Package RestSharp -Install-Package Newtonsoft.Json -``` - -NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) - -## Installation -Run the following command to generate the DLL -- [Mac/Linux] compile-mono.sh -- [Windows] compile.bat - -Then include the DLL (under the `bin` folder) in the C# project diff --git a/modules/swagger-codegen/src/main/resources/csharp/README.mustache b/modules/swagger-codegen/src/main/resources/csharp/README.mustache new file mode 100644 index 00000000000..06660a3c615 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/README.mustache @@ -0,0 +1,147 @@ +# {{packageName}} - the C# library for the {{appName}} + +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project: + +- API version: {{appVersion}} +- SDK version: {{packageVersion}} +- Build date: {{generatedDate}} +- Build package: {{generatorClass}} +{{#infoUrl}} + For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Frameworks supported +{{^supportUWP}} +- .NET 4.0 or later +- Windows Phone 7.1 (Mango) +{{/supportUWP}} +{{#supportUWP}} +- UWP +{{/supportUWP}} + +## Dependencies +- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later +- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later + +The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package RestSharp +Install-Package Newtonsoft.Json +``` + +NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) + +## Installation +Run the following command to generate the DLL +- [Mac/Linux] `/bin/sh compile-mono.sh` +- [Windows] `compile.bat` + +Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: +```csharp +using {{packageName}}.Api; +using {{packageName}}.Client; +{{#modelPackage}} +using {{{.}}}; +{{/modelPackage}} +``` + +## Getting Started + +```csharp +using System; +using System.Diagnostics; +using {{packageName}}.Api; +using {{packageName}}.Client; +{{#modelPackage}} +using {{{.}}}; +{{/modelPackage}} + +namespace Example +{ + public class {{operationId}}Example + { + public void main() + { + {{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}}{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} + // Configure HTTP basic authorization: {{{name}}} + Configuration.Default.Username = 'YOUR_USERNAME'; + Configuration.Default.Password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + Configuration.Default.ApiKey.Add('{{{keyParamName}}}', 'YOUR_API_KEY'); + // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}} + {{/hasAuthMethods}} + + var apiInstance = new {{classname}}(); + {{#allParams}} + {{#isPrimitiveType}} + var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{/allParams}} + + try + { + {{#summary}} + // {{{.}}} + {{/summary}} + {{#returnType}}{{{.}}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + Debug.WriteLine(result);{{/returnType}} + } + catch (Exception e) + { + Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message ); + } + } + } +}{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{{summary}}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation for Models + +{{#modelPackage}} +{{#models}}{{#model}} - [{{{modelPackage}}}.{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} +{{/modelPackage}} +{{^modelPackage}} +No model defined in this package +{{/modelPackage}} + +## Documentation for Authorization + +{{^authMethods}} All endpoints do not require authorization. +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} +{{#authMethods}}### {{name}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{keyParamName}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{flow}} +- **Authorization URL**: {{authorizationUrl}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - {{scope}}: {{description}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache new file mode 100644 index 00000000000..f1b3c15e616 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/api_doc.mustache @@ -0,0 +1,96 @@ +# {{packageName}}.Api.{{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} {{operationId}} ({{#allParams}}{{{dataType}}} {{paramName}}{{^required}}{{#optionalMethodArgument}} = null{{/optionalMethodArgument}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example +```csharp +using System; +using System.Diagnostics; +using {{packageName}}.Api; +using {{packageName}}.Client; +using {{packageName}}.Model; + +namespace Example +{ + public class {{operationId}}Example + { + public void main() + { + {{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} + // Configure HTTP basic authorization: {{{name}}} + Configuration.Default.Username = 'YOUR_USERNAME'; + Configuration.Default.Password = 'YOUR_PASSWORD';{{/isBasic}}{{#isApiKey}} + // Configure API key authorization: {{{name}}} + Configuration.Default.ApiKey.Add('{{{keyParamName}}}', 'YOUR_API_KEY'); + // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add('{{{keyParamName}}}', 'BEARER');{{/isApiKey}}{{#isOAuth}} + // Configure OAuth2 access token for authorization: {{{name}}} + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN';{{/isOAuth}}{{/authMethods}} + {{/hasAuthMethods}} + + var apiInstance = new {{classname}}(); + {{#allParams}} + {{#isPrimitiveType}} + var {{paramName}} = {{example}}; // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{^isPrimitiveType}} + var {{paramName}} = new {{{dataType}}}(); // {{{dataType}}} | {{{description}}}{{^required}} (optional) {{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} + {{/isPrimitiveType}} + {{/allParams}} + + try + { + {{#summary}} + // {{{.}}} + {{/summary}} + {{#returnType}}{{returnType}} result = {{/returnType}}apiInstance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});{{#returnType}} + Debug.WriteLine(result);{{/returnType}} + } + catch (Exception e) + { + Debug.Print("Exception when calling {{classname}}.{{operationId}}: " + e.Message ); + } + } + } +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{{dataType}}}**{{/isFile}}{{#isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{{dataType}}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/csharp/model_doc.mustache b/modules/swagger-codegen/src/main/resources/csharp/model_doc.mustache new file mode 100644 index 00000000000..aff3e7e0d1e --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/csharp/model_doc.mustache @@ -0,0 +1,14 @@ +{{#models}} +{{#model}} +# {{{packageName}}}.Model.{{{classname}}} +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/vars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}} +{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/go/README.mustache b/modules/swagger-codegen/src/main/resources/go/README.mustache index 586b35ed3f5..026d0648ea6 100644 --- a/modules/swagger-codegen/src/main/resources/go/README.mustache +++ b/modules/swagger-codegen/src/main/resources/go/README.mustache @@ -1,8 +1,19 @@ # Go API client for {{packageName}} +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + ## Overview This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. +- API version: {{appVersion}} +- Package version: {{packageVersion}} +- Build date: {{generatedDate}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} ## Installation Put the package under your project folder and add the following in import: @@ -10,3 +21,43 @@ Put the package under your project folder and add the following in import: "./{{packageName}}" ``` +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}{{{classname}}}.md) +{{/model}}{{/models}} + +## Documentation For Authorization + +{{^authMethods}} All endpoints do not require authorization. +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} +{{#authMethods}}## {{{name}}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorizatoin URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} diff --git a/modules/swagger-codegen/src/main/resources/go/api.mustache b/modules/swagger-codegen/src/main/resources/go/api.mustache index fec404786d4..cfd5ae0296f 100644 --- a/modules/swagger-codegen/src/main/resources/go/api.mustache +++ b/modules/swagger-codegen/src/main/resources/go/api.mustache @@ -38,12 +38,22 @@ func New{{classname}}WithBasePath(basePath string) *{{classname}}{ {{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} */ func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) { + var httpMethod = {{httpMethod}} // create path and map variables path := c.Configuration.BasePath + "{{basePathWithoutHost}}{{path}}" {{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) {{/pathParams}} + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if &{{paramName}} == nil { + return {{#returnType}}*new({{{returnType}}}), {{/returnType}}errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + } + {{/required}} + {{/allParams}} + _sling := sling.New().{{httpMethod}}(a.Configuration.BasePath) {{#authMethods}}// authentication ({{name}}) required diff --git a/modules/swagger-codegen/src/main/resources/go/api_BACKUP_59234.mustache b/modules/swagger-codegen/src/main/resources/go/api_BACKUP_59234.mustache new file mode 100644 index 00000000000..0cf4d311be4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/api_BACKUP_59234.mustache @@ -0,0 +1,169 @@ +package {{packageName}} + +{{#operations}} +import ( + "strings" + "fmt" + "encoding/json" + "errors" +{{#imports}} "{{import}}" +{{/imports}} +) + +type {{classname}} struct { + Configuration Configuration +} + +func New{{classname}}() *{{classname}}{ + configuration := NewConfiguration() + return &{{classname}} { + Configuration: *configuration, + } +} + +func New{{classname}}WithBasePath(basePath string) *{{classname}}{ + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &{{classname}} { + Configuration: *configuration, + } +} + +{{#operation}} +/** + * {{summary}} + * {{notes}} +{{#allParams}} * @param {{paramName}} {{description}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ +func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) { +<<<<<<< HEAD + var httpMethod = {{httpMethod}} + // create path and map variables + path := c.Configuration.BasePath + "{{basePathWithoutHost}}{{path}}" +{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) +{{/pathParams}} + +======= + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if &{{paramName}} == nil { + return {{#returnType}}*new({{{returnType}}}), {{/returnType}}errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + } + {{/required}} + {{/allParams}} +>>>>>>> c375f2fed5138125228c6e881df7acf3a8ada17d + _sling := sling.New().{{httpMethod}}(a.Configuration.BasePath) + + {{#authMethods}}// authentication ({{name}}) required + {{#isApiKey}}{{#isKeyInHeader}} + // set key with prefix in header + _sling.Set("{{keyParamName}}", a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")) + {{/isKeyInHeader}}{{#isKeyInQuery}} + // set key with prefix in querystring + {{#hasKeyParamName}} type KeyQueryParams struct { + {{keyParamName}} string `url:"{{keyParamName}},omitempty"` + } + _sling = _sling.QueryStruct(&KeyQueryParams{ {{keyParamName}}: a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}") }) + {{/hasKeyParamName}} + {{/isKeyInQuery}}{{/isApiKey}} + {{#isBasic}} + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + _sling.Set("Authorization", "Basic " + a.Configuration.GetBasicAuthEncodedString()) + } + {{/isBasic}} + {{#isOAuth}} + // oauth required + if a.Configuration.AccessToken != ""{ + _sling.Set("Authorization", "Bearer " + a.Configuration.AccessToken) + } + {{/isOAuth}} + {{/authMethods}} + + + // add default headers if any + for key := range a.Configuration.DefaultHeader { + _sling = _sling.Set(key, a.Configuration.DefaultHeader[key]) + } + +{{#hasQueryParams}} type QueryParams struct { + {{#queryParams}}{{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` + {{/queryParams}} +} + _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} }) +{{/hasQueryParams}} + + // to determine the Content-Type header + localVarHttpContentTypes := []string { + {{#consumes}} + "{{mediaType}}", + {{/consumes}} + } + //set Content-Type header + localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + _sling = _sling.Set("Content-Type", localVarHttpContentType) + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string { + {{#produces}} + "{{mediaType}}", + {{/produces}} + } + //set Accept header + localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + _sling = _sling.Set("Accept", localVarHttpHeaderAccept) + } +{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}" + _sling = _sling.Set("{{baseName}}", {{paramName}}) +{{/headerParams}}{{/hasHeaderParams}} +{{#hasFormParams}} type FormParams struct { +{{#formParams}} {{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` +{{/formParams}} + } + _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} }) +{{/hasFormParams}} +{{#hasBodyParam}}{{#bodyParams}}// body params + _sling = _sling.BodyJSON({{paramName}}) +{{/bodyParams}}{{/hasBodyParam}} +{{#returnType}} var successPayload = new({{returnType}}){{/returnType}} + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive({{#returnType}}successPayload{{/returnType}}{{^returnType}}nil{{/returnType}}, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return {{#returnType}}*successPayload, {{/returnType}}err +} +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/api_BASE_59234.mustache b/modules/swagger-codegen/src/main/resources/go/api_BASE_59234.mustache new file mode 100644 index 00000000000..f08ba380ec0 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/api_BASE_59234.mustache @@ -0,0 +1,160 @@ +package {{packageName}} + +{{#operations}} +import ( + "strings" + "fmt" + "encoding/json" + "errors" + "github.com/dghubble/sling" +{{#imports}} "{{import}}" +{{/imports}} +) + +type {{classname}} struct { + Configuration Configuration +} + +func New{{classname}}() *{{classname}}{ + configuration := NewConfiguration() + return &{{classname}} { + Configuration: *configuration, + } +} + +func New{{classname}}WithBasePath(basePath string) *{{classname}}{ + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &{{classname}} { + Configuration: *configuration, + } +} + +{{#operation}} +/** + * {{summary}} + * {{notes}} +{{#allParams}} * @param {{paramName}} {{description}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ +func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) { + + _sling := sling.New().{{httpMethod}}(a.Configuration.BasePath) + + {{#authMethods}}// authentication ({{name}}) required + {{#isApiKey}}{{#isKeyInHeader}} + // set key with prefix in header + _sling.Set("{{keyParamName}}", a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")) + {{/isKeyInHeader}}{{#isKeyInQuery}} + // set key with prefix in querystring + {{#hasKeyParamName}} type KeyQueryParams struct { + {{keyParamName}} string `url:"{{keyParamName}},omitempty"` + } + _sling = _sling.QueryStruct(&KeyQueryParams{ {{keyParamName}}: a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}") }) + {{/hasKeyParamName}} + {{/isKeyInQuery}}{{/isApiKey}} + {{#isBasic}} + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + _sling.Set("Authorization", "Basic " + a.Configuration.GetBasicAuthEncodedString()) + } + {{/isBasic}} + {{#isOAuth}} + // oauth required + if a.Configuration.AccessToken != ""{ + _sling.Set("Authorization", "Bearer " + a.Configuration.AccessToken) + } + {{/isOAuth}} + {{/authMethods}} + + // create path and map variables + path := "{{basePathWithoutHost}}{{path}}" +{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) +{{/pathParams}} + + _sling = _sling.Path(path) + + // add default headers if any + for key := range a.Configuration.DefaultHeader { + _sling = _sling.Set(key, a.Configuration.DefaultHeader[key]) + } + +{{#hasQueryParams}} type QueryParams struct { + {{#queryParams}}{{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` + {{/queryParams}} +} + _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} }) +{{/hasQueryParams}} + + // to determine the Content-Type header + localVarHttpContentTypes := []string { + {{#consumes}} + "{{mediaType}}", + {{/consumes}} + } + //set Content-Type header + localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + _sling = _sling.Set("Content-Type", localVarHttpContentType) + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string { + {{#produces}} + "{{mediaType}}", + {{/produces}} + } + //set Accept header + localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + _sling = _sling.Set("Accept", localVarHttpHeaderAccept) + } +{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}" + _sling = _sling.Set("{{baseName}}", {{paramName}}) +{{/headerParams}}{{/hasHeaderParams}} +{{#hasFormParams}} type FormParams struct { +{{#formParams}} {{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` +{{/formParams}} + } + _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} }) +{{/hasFormParams}} +{{#hasBodyParam}}{{#bodyParams}}// body params + _sling = _sling.BodyJSON({{paramName}}) +{{/bodyParams}}{{/hasBodyParam}} +{{#returnType}} var successPayload = new({{returnType}}){{/returnType}} + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive({{#returnType}}successPayload{{/returnType}}{{^returnType}}nil{{/returnType}}, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return {{#returnType}}*successPayload, {{/returnType}}err +} +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/api_LOCAL_59234.mustache b/modules/swagger-codegen/src/main/resources/go/api_LOCAL_59234.mustache new file mode 100644 index 00000000000..fec404786d4 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/api_LOCAL_59234.mustache @@ -0,0 +1,158 @@ +package {{packageName}} + +{{#operations}} +import ( + "strings" + "fmt" + "encoding/json" + "errors" +{{#imports}} "{{import}}" +{{/imports}} +) + +type {{classname}} struct { + Configuration Configuration +} + +func New{{classname}}() *{{classname}}{ + configuration := NewConfiguration() + return &{{classname}} { + Configuration: *configuration, + } +} + +func New{{classname}}WithBasePath(basePath string) *{{classname}}{ + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &{{classname}} { + Configuration: *configuration, + } +} + +{{#operation}} +/** + * {{summary}} + * {{notes}} +{{#allParams}} * @param {{paramName}} {{description}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ +func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) { + var httpMethod = {{httpMethod}} + // create path and map variables + path := c.Configuration.BasePath + "{{basePathWithoutHost}}{{path}}" +{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) +{{/pathParams}} + + _sling := sling.New().{{httpMethod}}(a.Configuration.BasePath) + + {{#authMethods}}// authentication ({{name}}) required + {{#isApiKey}}{{#isKeyInHeader}} + // set key with prefix in header + _sling.Set("{{keyParamName}}", a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")) + {{/isKeyInHeader}}{{#isKeyInQuery}} + // set key with prefix in querystring + {{#hasKeyParamName}} type KeyQueryParams struct { + {{keyParamName}} string `url:"{{keyParamName}},omitempty"` + } + _sling = _sling.QueryStruct(&KeyQueryParams{ {{keyParamName}}: a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}") }) + {{/hasKeyParamName}} + {{/isKeyInQuery}}{{/isApiKey}} + {{#isBasic}} + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + _sling.Set("Authorization", "Basic " + a.Configuration.GetBasicAuthEncodedString()) + } + {{/isBasic}} + {{#isOAuth}} + // oauth required + if a.Configuration.AccessToken != ""{ + _sling.Set("Authorization", "Bearer " + a.Configuration.AccessToken) + } + {{/isOAuth}} + {{/authMethods}} + + + // add default headers if any + for key := range a.Configuration.DefaultHeader { + _sling = _sling.Set(key, a.Configuration.DefaultHeader[key]) + } + +{{#hasQueryParams}} type QueryParams struct { + {{#queryParams}}{{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` + {{/queryParams}} +} + _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} }) +{{/hasQueryParams}} + + // to determine the Content-Type header + localVarHttpContentTypes := []string { + {{#consumes}} + "{{mediaType}}", + {{/consumes}} + } + //set Content-Type header + localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + _sling = _sling.Set("Content-Type", localVarHttpContentType) + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string { + {{#produces}} + "{{mediaType}}", + {{/produces}} + } + //set Accept header + localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + _sling = _sling.Set("Accept", localVarHttpHeaderAccept) + } +{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}" + _sling = _sling.Set("{{baseName}}", {{paramName}}) +{{/headerParams}}{{/hasHeaderParams}} +{{#hasFormParams}} type FormParams struct { +{{#formParams}} {{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` +{{/formParams}} + } + _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} }) +{{/hasFormParams}} +{{#hasBodyParam}}{{#bodyParams}}// body params + _sling = _sling.BodyJSON({{paramName}}) +{{/bodyParams}}{{/hasBodyParam}} +{{#returnType}} var successPayload = new({{returnType}}){{/returnType}} + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive({{#returnType}}successPayload{{/returnType}}{{^returnType}}nil{{/returnType}}, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return {{#returnType}}*successPayload, {{/returnType}}err +} +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/api_REMOTE_59234.mustache b/modules/swagger-codegen/src/main/resources/go/api_REMOTE_59234.mustache new file mode 100644 index 00000000000..35ed984929d --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/api_REMOTE_59234.mustache @@ -0,0 +1,167 @@ +package {{packageName}} + +{{#operations}} +import ( + "strings" + "fmt" + "encoding/json" + "errors" + "github.com/dghubble/sling" +{{#imports}} "{{import}}" +{{/imports}} +) + +type {{classname}} struct { + Configuration Configuration +} + +func New{{classname}}() *{{classname}}{ + configuration := NewConfiguration() + return &{{classname}} { + Configuration: *configuration, + } +} + +func New{{classname}}WithBasePath(basePath string) *{{classname}}{ + configuration := NewConfiguration() + configuration.BasePath = basePath + + return &{{classname}} { + Configuration: *configuration, + } +} + +{{#operation}} +/** + * {{summary}} + * {{notes}} +{{#allParams}} * @param {{paramName}} {{description}} +{{/allParams}} * @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}} + */ +func (a {{classname}}) {{nickname}} ({{#allParams}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}error) { + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if &{{paramName}} == nil { + return {{#returnType}}*new({{{returnType}}}), {{/returnType}}errors.New("Missing required parameter '{{paramName}}' when calling {{classname}}->{{operationId}}") + } + {{/required}} + {{/allParams}} + _sling := sling.New().{{httpMethod}}(a.Configuration.BasePath) + + {{#authMethods}}// authentication ({{name}}) required + {{#isApiKey}}{{#isKeyInHeader}} + // set key with prefix in header + _sling.Set("{{keyParamName}}", a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}")) + {{/isKeyInHeader}}{{#isKeyInQuery}} + // set key with prefix in querystring + {{#hasKeyParamName}} type KeyQueryParams struct { + {{keyParamName}} string `url:"{{keyParamName}},omitempty"` + } + _sling = _sling.QueryStruct(&KeyQueryParams{ {{keyParamName}}: a.Configuration.GetApiKeyWithPrefix("{{keyParamName}}") }) + {{/hasKeyParamName}} + {{/isKeyInQuery}}{{/isApiKey}} + {{#isBasic}} + // http basic authentication required + if a.Configuration.Username != "" || a.Configuration.Password != ""{ + _sling.Set("Authorization", "Basic " + a.Configuration.GetBasicAuthEncodedString()) + } + {{/isBasic}} + {{#isOAuth}} + // oauth required + if a.Configuration.AccessToken != ""{ + _sling.Set("Authorization", "Bearer " + a.Configuration.AccessToken) + } + {{/isOAuth}} + {{/authMethods}} + + // create path and map variables + path := "{{basePathWithoutHost}}{{path}}" +{{#pathParams}} path = strings.Replace(path, "{" + "{{baseName}}" + "}", fmt.Sprintf("%v", {{paramName}}), -1) +{{/pathParams}} + + _sling = _sling.Path(path) + + // add default headers if any + for key := range a.Configuration.DefaultHeader { + _sling = _sling.Set(key, a.Configuration.DefaultHeader[key]) + } + +{{#hasQueryParams}} type QueryParams struct { + {{#queryParams}}{{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` + {{/queryParams}} +} + _sling = _sling.QueryStruct(&QueryParams{ {{#queryParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/queryParams}} }) +{{/hasQueryParams}} + + // to determine the Content-Type header + localVarHttpContentTypes := []string { + {{#consumes}} + "{{mediaType}}", + {{/consumes}} + } + //set Content-Type header + localVarHttpContentType := a.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + _sling = _sling.Set("Content-Type", localVarHttpContentType) + } + + // to determine the Accept header + localVarHttpHeaderAccepts := []string { + {{#produces}} + "{{mediaType}}", + {{/produces}} + } + //set Accept header + localVarHttpHeaderAccept := a.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + _sling = _sling.Set("Accept", localVarHttpHeaderAccept) + } +{{#hasHeaderParams}}{{#headerParams}} // header params "{{baseName}}" + _sling = _sling.Set("{{baseName}}", {{paramName}}) +{{/headerParams}}{{/hasHeaderParams}} +{{#hasFormParams}} type FormParams struct { +{{#formParams}} {{vendorExtensions.x-exportParamName}} {{dataType}} `url:"{{baseName}},omitempty"` +{{/formParams}} + } + _sling = _sling.BodyForm(&FormParams{ {{#formParams}}{{vendorExtensions.x-exportParamName}}: {{paramName}}{{#hasMore}},{{/hasMore}}{{/formParams}} }) +{{/hasFormParams}} +{{#hasBodyParam}}{{#bodyParams}}// body params + _sling = _sling.BodyJSON({{paramName}}) +{{/bodyParams}}{{/hasBodyParam}} +{{#returnType}} var successPayload = new({{returnType}}){{/returnType}} + + // We use this map (below) so that any arbitrary error JSON can be handled. + // FIXME: This is in the absence of this Go generator honoring the non-2xx + // response (error) models, which needs to be implemented at some point. + var failurePayload map[string]interface{} + + httpResponse, err := _sling.Receive({{#returnType}}successPayload{{/returnType}}{{^returnType}}nil{{/returnType}}, &failurePayload) + + if err == nil { + // err == nil only means that there wasn't a sub-application-layer error (e.g. no network error) + if failurePayload != nil { + // If the failurePayload is present, there likely was some kind of non-2xx status + // returned (and a JSON payload error present) + var str []byte + str, err = json.Marshal(failurePayload) + if err == nil { // For safety, check for an error marshalling... probably superfluous + // This will return the JSON error body as a string + err = errors.New(string(str)) + } + } else { + // So, there was no network-type error, and nothing in the failure payload, + // but we should still check the status code + if httpResponse == nil { + // This should never happen... + err = errors.New("No HTTP Response received.") + } else if code := httpResponse.StatusCode; 200 > code || code > 299 { + err = errors.New("HTTP Error: " + string(httpResponse.StatusCode)) + } + } + } + + return {{#returnType}}*successPayload, {{/returnType}}err +} +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/api_doc.mustache b/modules/swagger-codegen/src/main/resources/go/api_doc.mustache new file mode 100644 index 00000000000..e91082ffc99 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/api_doc.mustache @@ -0,0 +1,44 @@ +# {{invokerPackage}}\{{classname}}{{#description}} +{{description}}{{/description}} + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}${{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{mediaType}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/swagger-codegen/src/main/resources/go/model_doc.mustache b/modules/swagger-codegen/src/main/resources/go/model_doc.mustache new file mode 100644 index 00000000000..569550df372 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/model_doc.mustache @@ -0,0 +1,11 @@ +{{#models}}{{#model}}# {{classname}} + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}} +{{/vars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/modules/swagger-codegen/src/main/resources/go/pom.mustache b/modules/swagger-codegen/src/main/resources/go/pom.mustache new file mode 100644 index 00000000000..5cfbc0428c3 --- /dev/null +++ b/modules/swagger-codegen/src/main/resources/go/pom.mustache @@ -0,0 +1,75 @@ + + 4.0.0 + com.wordnik + Go{{packageName}} + pom + {{packageVersion}} + Go{{packageName}} + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + go-get-testify + pre-integration-test + + exec + + + go + + get + github.com/stretchr/testify/assert + + + + + go-get-sling + pre-integration-test + + exec + + + go + + get + github.com/dghubble/sling + + + + + go-test + integration-test + + exec + + + go + + test + -v + + + + + + + + \ No newline at end of file diff --git a/modules/swagger-codegen/src/main/resources/objc/README.mustache b/modules/swagger-codegen/src/main/resources/objc/README.mustache index 2e6ffe2f060..c0bc1178b0b 100644 --- a/modules/swagger-codegen/src/main/resources/objc/README.mustache +++ b/modules/swagger-codegen/src/main/resources/objc/README.mustache @@ -135,7 +135,7 @@ Class | Method | HTTP request | Description {{/isBasic}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{{flow}}} -- **Authorizatoin URL**: {{{authorizationUrl}}} +- **Authorization URL**: {{{authorizationUrl}}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#scopes}} - **{{{scope}}}**: {{{description}}} {{/scopes}} diff --git a/modules/swagger-codegen/src/main/resources/perl/README.mustache b/modules/swagger-codegen/src/main/resources/perl/README.mustache index 630a0a5979b..b312193f1cc 100644 --- a/modules/swagger-codegen/src/main/resources/perl/README.mustache +++ b/modules/swagger-codegen/src/main/resources/perl/README.mustache @@ -303,7 +303,7 @@ Class | Method | HTTP request | Description {{/isBasic}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{{flow}}} -- **Authorizatoin URL**: {{{authorizationUrl}}} +- **Authorization URL**: {{{authorizationUrl}}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#scopes}} - **{{{scope}}}**: {{{description}}} {{/scopes}} diff --git a/modules/swagger-codegen/src/main/resources/php/README.mustache b/modules/swagger-codegen/src/main/resources/php/README.mustache index 8275c4c9d7c..e64b0bf22c6 100644 --- a/modules/swagger-codegen/src/main/resources/php/README.mustache +++ b/modules/swagger-codegen/src/main/resources/php/README.mustache @@ -116,7 +116,7 @@ Class | Method | HTTP request | Description {{/isBasic}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{{flow}}} -- **Authorizatoin URL**: {{{authorizationUrl}}} +- **Authorization URL**: {{{authorizationUrl}}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#scopes}} - **{{{scope}}}**: {{{description}}} {{/scopes}} diff --git a/modules/swagger-codegen/src/main/resources/python/README.mustache b/modules/swagger-codegen/src/main/resources/python/README.mustache index a1ba2f0d298..8fe1045f661 100644 --- a/modules/swagger-codegen/src/main/resources/python/README.mustache +++ b/modules/swagger-codegen/src/main/resources/python/README.mustache @@ -108,7 +108,7 @@ Class | Method | HTTP request | Description {{/isBasic}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{{flow}}} -- **Authorizatoin URL**: {{{authorizationUrl}}} +- **Authorization URL**: {{{authorizationUrl}}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#scopes}} - **{{{scope}}}**: {{{description}}} {{/scopes}} diff --git a/modules/swagger-codegen/src/main/resources/ruby/README.mustache b/modules/swagger-codegen/src/main/resources/ruby/README.mustache index 164285e1533..7f54eef9e69 100644 --- a/modules/swagger-codegen/src/main/resources/ruby/README.mustache +++ b/modules/swagger-codegen/src/main/resources/ruby/README.mustache @@ -119,7 +119,7 @@ Class | Method | HTTP request | Description {{/isBasic}} {{#isOAuth}}- **Type**: OAuth - **Flow**: {{flow}} -- **Authorizatoin URL**: {{authorizationUrl}} +- **Authorization URL**: {{authorizationUrl}} - **Scopes**: {{^scopes}}N/A{{/scopes}} {{#scopes}} - {{scope}}: {{description}} {{/scopes}} diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md index 794a7c49b1b..a73dec9973a 100644 --- a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -1,10 +1,20 @@ +# IO.Swagger - the C# library for the Swagger Petstore +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. + +This C# 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-17T23:54:21.676+08:00 +- Build package: class io.swagger.codegen.languages.CSharpClientCodegen + ## Frameworks supported - .NET 4.0 or later - Windows Phone 7.1 (Mango) ## Dependencies - [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later -- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later +- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: ``` @@ -16,7 +26,112 @@ NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploa ## Installation Run the following command to generate the DLL -- [Mac/Linux] compile-mono.sh -- [Windows] compile.bat +- [Mac/Linux] `/bin/sh compile-mono.sh` +- [Windows] `compile.bat` + +Then include the DLL (under the `bin` folder) in the C# project, and import the packages: +```csharp +using IO.Swagger.Api; +using IO.Swagger.Client; +``` + +## Getting Started + +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; + + +namespace Example +{ + public class Example + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var body = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + +## Documentation for API Endpoints + +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* | [**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* | [**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* | [**GetInventory**](docs/StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +*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 +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [IO.Swagger.Model.Animal](docs/Animal.md) + - [IO.Swagger.Model.ApiResponse](docs/ApiResponse.md) + - [IO.Swagger.Model.Cat](docs/Cat.md) + - [IO.Swagger.Model.Category](docs/Category.md) + - [IO.Swagger.Model.Dog](docs/Dog.md) + - [IO.Swagger.Model.FormatTest](docs/FormatTest.md) + - [IO.Swagger.Model.Model200Response](docs/Model200Response.md) + - [IO.Swagger.Model.ModelReturn](docs/ModelReturn.md) + - [IO.Swagger.Model.Name](docs/Name.md) + - [IO.Swagger.Model.Order](docs/Order.md) + - [IO.Swagger.Model.Pet](docs/Pet.md) + - [IO.Swagger.Model.SpecialModelName](docs/SpecialModelName.md) + - [IO.Swagger.Model.Tag](docs/Tag.md) + - [IO.Swagger.Model.User](docs/User.md) + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - write:pets: modify pets in your account + - read:pets: read your pets -Then include the DLL (under the `bin` folder) in the C# project diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache new file mode 100644 index 00000000000..d5f5ce413b3 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/README.mustache @@ -0,0 +1,184 @@ + - 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 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-14T06:55:47.468-04:00 +- Build package: class io.swagger.codegen.languages.CSharpClientCodegen + +## Frameworks supported +- .NET 4.0 or later +- Windows Phone 7.1 (Mango) + +## Dependencies +- [RestSharp] (https://www.nuget.org/packages/RestSharp) - 105.1.0 or later +- [Json.NET] (https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later + +The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages: +``` +Install-Package RestSharp +Install-Package Newtonsoft.Json +``` + +NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742) + +## Installation +Run the following command to generate the DLL +- [Mac/Linux] compile-mono.sh +- [Windows] compile.bat + +Then include the DLL (under the `bin` folder) in the C# project + + +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Module; + +namespace Example +{ +public class Example +{ +public void main(){ + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + // 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'); + // 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'); + // Configure HTTP basic authorization: test_http_basic + Configuration.Default.Username = 'YOUR_USERNAME'; + Configuration.Default.Password = 'YOUR_PASSWORD'; + // 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 (); + +try { +apiInstance.(); +} catch (Exception e) { +Debug.Print("Exception when calling .: " + e.Message ); +} +} +} +} +``` + +## Documentation for API Endpoints + +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 +*::UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#CreateUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array +*::UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#CreateUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array +*::UserApi* | [**DeleteUser**](docs/UserApi.md#DeleteUser) | **DELETE** /user/{username} | Delete user +*::UserApi* | [**GetUserByName**](docs/UserApi.md#GetUserByName) | **GET** /user/{username} | Get user by user name +*::UserApi* | [**LoginUser**](docs/UserApi.md#LoginUser) | **GET** /user/login | Logs user into the system +*::UserApi* | [**LogoutUser**](docs/UserApi.md#LogoutUser) | **GET** /user/logout | Logs out current logged in user session +*::UserApi* | [**UpdateUser**](docs/UserApi.md#UpdateUser) | **PUT** /user/{username} | Updated user + + +## Documentation for Models + + - [::Animal](docs/Animal.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) + - [::Order](docs/Order.md) + - [::Pet](docs/Pet.md) + - [::SpecialModelName](docs/SpecialModelName.md) + - [::Tag](docs/Tag.md) + - [::User](docs/User.md) + + +## Documentation for Authorization + + +### petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization 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/Animal.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md new file mode 100644 index 00000000000..ef6727b89c4 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Animal.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.Animal + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | + 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..4a551f43998 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md @@ -0,0 +1,10 @@ +# IO.Swagger.Model.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/Cat.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md new file mode 100644 index 00000000000..0acd66d6530 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Cat.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.Cat + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Declawed** | **bool?** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md new file mode 100644 index 00000000000..d0ebf1a1ec7 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.Category + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Name** | **string** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md new file mode 100644 index 00000000000..12949333e19 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Dog.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.Dog + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ClassName** | **string** | | +**Breed** | **string** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md new file mode 100644 index 00000000000..b3276355507 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/FormatTest.md @@ -0,0 +1,19 @@ +# IO.Swagger.Model.FormatTest + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Integer** | **int?** | | [optional] +**Int32** | **int?** | | [optional] +**Int64** | **long?** | | [optional] +**Number** | **double?** | | +**_Float** | **float?** | | [optional] +**_Double** | **double?** | | [optional] +**_String** | **string** | | [optional] +**_Byte** | **byte[]** | | [optional] +**Binary** | **byte[]** | | [optional] +**Date** | **DateTime?** | | [optional] +**DateTime** | **DateTime?** | | [optional] +**Password** | **string** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/InlineResponse200.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/InlineResponse200.md new file mode 100644 index 00000000000..6380096b06b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/InlineResponse200.md @@ -0,0 +1,14 @@ +# InlineResponse200 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**PhotoUrls** | **List<string>** | | [optional] +**Name** | **string** | | [optional] +**Id** | **long?** | | +**Category** | **Object** | | [optional] +**Tags** | [**List<Tag>**](Tag.md) | | [optional] +**Status** | **string** | pet status in the store | [optional] + + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md new file mode 100644 index 00000000000..647d981bc52 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Model200Response.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.Model200Response + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Name** | **int?** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md new file mode 100644 index 00000000000..859f217de9d --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/ModelReturn.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.ModelReturn + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_Return** | **int?** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md new file mode 100644 index 00000000000..a2b0df80869 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Name.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.Name + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_Name** | **int?** | | +**SnakeCase** | **int?** | | [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 new file mode 100644 index 00000000000..b4ffb22e6bb --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md @@ -0,0 +1,13 @@ +# IO.Swagger.Model.Order + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**PetId** | **long?** | | [optional] +**Quantity** | **int?** | | [optional] +**ShipDate** | **DateTime?** | | [optional] +**Status** | **string** | Order Status | [optional] +**Complete** | **bool?** | | [optional] [default to false] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md new file mode 100644 index 00000000000..74d7b6caca7 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md @@ -0,0 +1,13 @@ +# IO.Swagger.Model.Pet + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List<string>** | | +**Tags** | [**List<Tag>**](Tag.md) | | [optional] +**Status** | **string** | pet status in the store | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md new file mode 100644 index 00000000000..46b1d566ba1 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md @@ -0,0 +1,520 @@ +# IO.Swagger.Api.PetApi + +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 +[**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 +[**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 + + +# **AddPet** +> void AddPet (Pet body) + +Add a new pet to the store + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class AddPetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var body = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +# **DeletePet** +> void DeletePet (long? petId, string apiKey = null) + +Deletes a pet + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class DeletePetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var petId = 789; // long? | Pet id to delete + var apiKey = apiKey_example; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| Pet id to delete | + **apiKey** | **string**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **FindPetsByStatus** +> List FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var status = new List(); // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List<Pet> result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List**](string.md)| Status values that need to be considered for filter | + +### Return type + +[**List**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **FindPetsByTags** +> List FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List<Pet> result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List**](string.md)| Tags to filter by | + +### Return type + +[**List**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **GetPetById** +> Pet GetPetById (long? petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class GetPetByIdExample + { + 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 PetApi(); + var petId = 789; // long? | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **UpdatePet** +> void UpdatePet (Pet body) + +Update an existing pet + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class UpdatePetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var body = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/xml, application/json + +# **UpdatePetWithForm** +> void UpdatePetWithForm (long? petId, string name = null, string status = null) + +Updates a pet in the store with form data + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet that needs to be updated + var name = name_example; // string | Updated name of the pet (optional) + var status = status_example; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **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] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/xml, application/json + +# **UploadFile** +> ApiResponse UploadFile (long? petId, string additionalMetadata = null, System.IO.Stream file = null) + +uploads an image + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class UploadFileExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = 'YOUR_ACCESS_TOKEN'; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + **file** | **System.IO.Stream**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md new file mode 100644 index 00000000000..1d6f2f252de --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/SpecialModelName.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.SpecialModelName + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**SpecialPropertyName** | **long?** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md new file mode 100644 index 00000000000..382e56160eb --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md @@ -0,0 +1,248 @@ +# IO.Swagger.Api.StoreApi + +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 +[**GetInventory**](StoreApi.md#getinventory) | **GET** /store/inventory | Returns pet inventories by status +[**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 + + +# **DeleteOrder** +> void DeleteOrder (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 + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var orderId = orderId_example; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **string**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **GetInventory** +> Dictionary GetInventory () + +Returns pet inventories by status + +Returns 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.Model; + +namespace Example +{ + public class GetInventoryExample + { + 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 + { + // Returns pet inventories by status + Dictionary<string, int?> result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Dictionary** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +# **GetOrderById** +> Order GetOrderById (long? orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var orderId = 789; // long? | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **long?**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **PlaceOrder** +> Order PlaceOrder (Order body) + +Place an order for a pet + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var body = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md new file mode 100644 index 00000000000..a68cd6f0ecc --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md @@ -0,0 +1,9 @@ +# IO.Swagger.Model.Tag + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Name** | **string** | | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md new file mode 100644 index 00000000000..54485476d2f --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/User.md @@ -0,0 +1,15 @@ +# IO.Swagger.Model.User + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Username** | **string** | | [optional] +**FirstName** | **string** | | [optional] +**LastName** | **string** | | [optional] +**Email** | **string** | | [optional] +**Password** | **string** | | [optional] +**Phone** | **string** | | [optional] +**UserStatus** | **int?** | User Status | [optional] + diff --git a/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md new file mode 100644 index 00000000000..11061b7a1e2 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md @@ -0,0 +1,482 @@ +# IO.Swagger.Api.UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#createuser) | **POST** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#createuserswitharrayinput) | **POST** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#createuserswithlistinput) | **POST** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#deleteuser) | **DELETE** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#getuserbyname) | **GET** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#loginuser) | **GET** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#logoutuser) | **GET** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#updateuser) | **PUT** /user/{username} | Updated user + + +# **CreateUser** +> void CreateUser (User body) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class CreateUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var body = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **CreateUsersWithArrayInput** +> void CreateUsersWithArrayInput (List body) + +Creates list of users with given input array + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public void main() + { + + var apiInstance = new UserApi(); + var body = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **CreateUsersWithListInput** +> void CreateUsersWithListInput (List body) + +Creates list of users with given input array + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public void main() + { + + var apiInstance = new UserApi(); + var body = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**List**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **DeleteUser** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class DeleteUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **GetUserByName** +> User GetUserByName (string username) + +Get user by user name + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **LoginUser** +> string LoginUser (string username, string password) + +Logs user into the system + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class LoginUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The user name for login + var password = password_example; // string | The password for login in clear text + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(username, password); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **LogoutUser** +> void LogoutUser () + +Logs out current logged in user session + + + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class LogoutUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +# **UpdateUser** +> void UpdateUser (string username, User body) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class UpdateUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | name that need to be deleted + var body = new User(); // User | Updated user object + + try + { + // Updated user + apiInstance.UpdateUser(username, body); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + diff --git a/samples/client/petstore/go/README.md b/samples/client/petstore/go/README.md index 7ce753fba9f..5af32ccefbb 100644 --- a/samples/client/petstore/go/README.md +++ b/samples/client/petstore/go/README.md @@ -1,8 +1,14 @@ # Go API client for swagger +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + ## Overview This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. +- API version: 1.0.0 +- Package version: 1.0.0 +- Build date: 2016-04-16T15:44:50.329-07:00 +- Build package: class io.swagger.codegen.languages.GoClientCodegen ## Installation Put the package under your project folder and add the following in import: @@ -10,3 +16,64 @@ Put the package under your project folder and add the following in import: "./swagger" ``` +## Documentation for API Endpoints + +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* | [**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* | [**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* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status +*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 +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **Post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **Post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **Get** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **Get** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **Get** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Put** /user/{username} | Updated user + + +## Documentation For Models + + - [ApiResponse](docs/ApiResponse.md) + - [Category](docs/Category.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation For Authorization + + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +## Author + +apiteam@swagger.io + diff --git a/samples/client/petstore/go/go-petstore/.gitignore b/samples/client/petstore/go/go-petstore/.gitignore new file mode 100644 index 00000000000..daf913b1b34 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md new file mode 100644 index 00000000000..5890d48282a --- /dev/null +++ b/samples/client/petstore/go/go-petstore/README.md @@ -0,0 +1,79 @@ +# Go API client for swagger + +This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters. + +## Overview +This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build date: 2016-04-17T16:17:52.285+08:00 +- Build package: class io.swagger.codegen.languages.GoClientCodegen + +## Installation +Put the package under your project folder and add the following in import: +``` + "./swagger" +``` + +## Documentation for API Endpoints + +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* | [**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* | [**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* | [**GetInventory**](docs/StoreApi.md#getinventory) | **Get** /store/inventory | Returns pet inventories by status +*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 +*UserApi* | [**CreateUsersWithArrayInput**](docs/UserApi.md#createuserswitharrayinput) | **Post** /user/createWithArray | Creates list of users with given input array +*UserApi* | [**CreateUsersWithListInput**](docs/UserApi.md#createuserswithlistinput) | **Post** /user/createWithList | Creates list of users with given input array +*UserApi* | [**DeleteUser**](docs/UserApi.md#deleteuser) | **Delete** /user/{username} | Delete user +*UserApi* | [**GetUserByName**](docs/UserApi.md#getuserbyname) | **Get** /user/{username} | Get user by user name +*UserApi* | [**LoginUser**](docs/UserApi.md#loginuser) | **Get** /user/login | Logs user into the system +*UserApi* | [**LogoutUser**](docs/UserApi.md#logoutuser) | **Get** /user/logout | Logs out current logged in user session +*UserApi* | [**UpdateUser**](docs/UserApi.md#updateuser) | **Put** /user/{username} | Updated user + + +## Documentation For Models + + - [ApiResponse](docs/ApiResponse.md) + - [Category](docs/Category.md) + - [Order](docs/Order.md) + - [Pet](docs/Pet.md) + - [Tag](docs/Tag.md) + - [User](docs/User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account + - **read:pets**: read your pets + + +## Author + +apiteam@swagger.io + diff --git a/samples/client/petstore/go/swagger/api_client.go b/samples/client/petstore/go/go-petstore/api_client.go similarity index 100% rename from samples/client/petstore/go/swagger/api_client.go rename to samples/client/petstore/go/go-petstore/api_client.go diff --git a/samples/client/petstore/go/swagger/api_response.go b/samples/client/petstore/go/go-petstore/api_response.go similarity index 100% rename from samples/client/petstore/go/swagger/api_response.go rename to samples/client/petstore/go/go-petstore/api_response.go diff --git a/samples/client/petstore/go/swagger/category.go b/samples/client/petstore/go/go-petstore/category.go similarity index 100% rename from samples/client/petstore/go/swagger/category.go rename to samples/client/petstore/go/go-petstore/category.go diff --git a/samples/client/petstore/go/swagger/configuration.go b/samples/client/petstore/go/go-petstore/configuration.go similarity index 100% rename from samples/client/petstore/go/swagger/configuration.go rename to samples/client/petstore/go/go-petstore/configuration.go diff --git a/samples/client/petstore/go/go-petstore/docs/ApiResponse.md b/samples/client/petstore/go/go-petstore/docs/ApiResponse.md new file mode 100644 index 00000000000..3653b42ba24 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/ApiResponse.md @@ -0,0 +1,12 @@ +# ApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Code** | **int32** | | [optional] [default to null] +**Type_** | **string** | | [optional] [default to null] +**Message** | **string** | | [optional] [default to null] + +[[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/go/go-petstore/docs/Category.md b/samples/client/petstore/go/go-petstore/docs/Category.md new file mode 100644 index 00000000000..a64cb0a3904 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Category.md @@ -0,0 +1,11 @@ +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] + +[[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/go/go-petstore/docs/Order.md b/samples/client/petstore/go/go-petstore/docs/Order.md new file mode 100644 index 00000000000..69c55bc5abf --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Order.md @@ -0,0 +1,15 @@ +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] [default to null] +**PetId** | **int64** | | [optional] [default to null] +**Quantity** | **int32** | | [optional] [default to null] +**ShipDate** | [**time.Time**](time.Time.md) | | [optional] [default to null] +**Status** | **string** | Order Status | [optional] [default to null] +**Complete** | **bool** | | [optional] [default to null] + +[[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/go/go-petstore/docs/Pet.md b/samples/client/petstore/go/go-petstore/docs/Pet.md new file mode 100644 index 00000000000..d53855396cd --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Pet.md @@ -0,0 +1,15 @@ +# Pet + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] [default to null] +**Category** | [**Category**](Category.md) | | [optional] [default to null] +**Name** | **string** | | [default to null] +**PhotoUrls** | **[]string** | | [default to null] +**Tags** | [**[]Tag**](Tag.md) | | [optional] [default to null] +**Status** | **string** | pet status in the store | [optional] [default to null] + +[[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/go/go-petstore/docs/PetApi.md b/samples/client/petstore/go/go-petstore/docs/PetApi.md new file mode 100644 index 00000000000..5dad1949b04 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/PetApi.md @@ -0,0 +1,253 @@ +# \PetApi + +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 +[**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 +[**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 + + +# **AddPet** +> AddPet($body) + +Add a new pet to the store + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: 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) + +# **DeletePet** +> DeletePet($petId, $apiKey) + +Deletes a pet + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int64**| Pet id to delete | + **apiKey** | **string**| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **FindPetsByStatus** +> []Pet FindPetsByStatus($status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**[]string**](string.md)| Status values that need to be considered for filter | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **FindPetsByTags** +> []Pet FindPetsByTags($tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**[]string**](string.md)| Tags to filter by | + +### Return type + +[**[]Pet**](Pet.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetPetById** +> Pet GetPetById($petId) + +Find pet by ID + +Returns a single pet + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int64**| ID of pet to return | + +### Return type + +[**Pet**](Pet.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **UpdatePet** +> UpdatePet($body) + +Update an existing pet + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: 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) + +# **UpdatePetWithForm** +> UpdatePetWithForm($petId, $name, $status) + +Updates a pet in the store with form data + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int64**| ID of pet that needs to be updated | + **name** | **string**| Updated name of the pet | [optional] + **status** | **string**| Updated status of the pet | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: application/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) + +# **UploadFile** +> ApiResponse UploadFile($petId, $additionalMetadata, $file) + +uploads an image + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int64**| ID of pet to update | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + **file** | ***os.File**| file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP reuqest headers + + - **Content-Type**: multipart/form-data + - **Accept**: 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/go/go-petstore/docs/StoreApi.md b/samples/client/petstore/go/go-petstore/docs/StoreApi.md new file mode 100644 index 00000000000..11939c1edba --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/StoreApi.md @@ -0,0 +1,125 @@ +# \StoreApi + +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 +[**GetInventory**](StoreApi.md#GetInventory) | **Get** /store/inventory | Returns pet inventories by status +[**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 + + +# **DeleteOrder** +> DeleteOrder($orderId) + +Delete purchase order by ID + +For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **string**| ID of the order that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/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) + +# **GetInventory** +> map[string]int32 GetInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +[**map[string]int32**](map.md) + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: 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) + +# **GetOrderById** +> Order GetOrderById($orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int64**| ID of pet that needs to be fetched | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **PlaceOrder** +> Order PlaceOrder($body) + +Place an order for a pet + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Order**](Order.md)| order placed for purchasing the pet | + +### Return type + +[**Order**](Order.md) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/go/go-petstore/docs/Tag.md b/samples/client/petstore/go/go-petstore/docs/Tag.md new file mode 100644 index 00000000000..378bdbeb1d7 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/Tag.md @@ -0,0 +1,11 @@ +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] [default to null] +**Name** | **string** | | [optional] [default to null] + +[[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/go/go-petstore/docs/User.md b/samples/client/petstore/go/go-petstore/docs/User.md new file mode 100644 index 00000000000..678880bf542 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/User.md @@ -0,0 +1,17 @@ +# User + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **int64** | | [optional] [default to null] +**Username** | **string** | | [optional] [default to null] +**FirstName** | **string** | | [optional] [default to null] +**LastName** | **string** | | [optional] [default to null] +**Email** | **string** | | [optional] [default to null] +**Password** | **string** | | [optional] [default to null] +**Phone** | **string** | | [optional] [default to null] +**UserStatus** | **int32** | User Status | [optional] [default to null] + +[[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/go/go-petstore/docs/UserApi.md b/samples/client/petstore/go/go-petstore/docs/UserApi.md new file mode 100644 index 00000000000..79ee5175bbd --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/UserApi.md @@ -0,0 +1,247 @@ +# \UserApi + +All URIs are relative to *http://petstore.swagger.io/v2* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**CreateUser**](UserApi.md#CreateUser) | **Post** /user | Create user +[**CreateUsersWithArrayInput**](UserApi.md#CreateUsersWithArrayInput) | **Post** /user/createWithArray | Creates list of users with given input array +[**CreateUsersWithListInput**](UserApi.md#CreateUsersWithListInput) | **Post** /user/createWithList | Creates list of users with given input array +[**DeleteUser**](UserApi.md#DeleteUser) | **Delete** /user/{username} | Delete user +[**GetUserByName**](UserApi.md#GetUserByName) | **Get** /user/{username} | Get user by user name +[**LoginUser**](UserApi.md#LoginUser) | **Get** /user/login | Logs user into the system +[**LogoutUser**](UserApi.md#LogoutUser) | **Get** /user/logout | Logs out current logged in user session +[**UpdateUser**](UserApi.md#UpdateUser) | **Put** /user/{username} | Updated user + + +# **CreateUser** +> CreateUser($body) + +Create user + +This can only be done by the logged in user. + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**User**](User.md)| Created user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateUsersWithArrayInput** +> CreateUsersWithArrayInput($body) + +Creates list of users with given input array + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[]User**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **CreateUsersWithListInput** +> CreateUsersWithListInput($body) + +Creates list of users with given input array + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**[]User**](User.md)| List of user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **DeleteUser** +> DeleteUser($username) + +Delete user + +This can only be done by the logged in user. + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be deleted | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **GetUserByName** +> User GetUserByName($username) + +Get user by user name + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The name that needs to be fetched. Use user1 for testing. | + +### Return type + +[**User**](User.md) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/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) + +# **LoginUser** +> string LoginUser($username, $password) + +Logs user into the system + + + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| The user name for login | + **password** | **string**| The password for login in clear text | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **LogoutUser** +> LogoutUser() + +Logs out current logged in user session + + + + +### Parameters +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/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) + +# **UpdateUser** +> UpdateUser($username, $body) + +Updated user + +This can only be done by the logged in user. + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| name that need to be deleted | + **body** | [**User**](User.md)| Updated user object | + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP reuqest headers + + - **Content-Type**: Not defined + - **Accept**: application/xml, application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/go/go-petstore/git_push.sh b/samples/client/petstore/go/go-petstore/git_push.sh new file mode 100644 index 00000000000..1a36388db02 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="YOUR_GIT_USR_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="YOUR_GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/go/swagger/order.go b/samples/client/petstore/go/go-petstore/order.go similarity index 100% rename from samples/client/petstore/go/swagger/order.go rename to samples/client/petstore/go/go-petstore/order.go diff --git a/samples/client/petstore/go/swagger/pet.go b/samples/client/petstore/go/go-petstore/pet.go similarity index 100% rename from samples/client/petstore/go/swagger/pet.go rename to samples/client/petstore/go/go-petstore/pet.go diff --git a/samples/client/petstore/go/swagger/pet_api.go b/samples/client/petstore/go/go-petstore/pet_api.go similarity index 94% rename from samples/client/petstore/go/swagger/pet_api.go rename to samples/client/petstore/go/go-petstore/pet_api.go index cdaed35ce12..461df7449f3 100644 --- a/samples/client/petstore/go/swagger/pet_api.go +++ b/samples/client/petstore/go/go-petstore/pet_api.go @@ -36,7 +36,10 @@ func NewPetApiWithBasePath(basePath string) *PetApi{ * @return void */ func (a PetApi) AddPet (body Pet) (error) { - + // verify the required parameter 'body' is set + if &body == nil { + return errors.New("Missing required parameter 'body' when calling PetApi->AddPet") + } _sling := sling.New().Post(a.Configuration.BasePath) // authentication (petstore_auth) required @@ -124,7 +127,10 @@ func (a PetApi) AddPet (body Pet) (error) { * @return void */ func (a PetApi) DeletePet (petId int64, apiKey string) (error) { - + // verify the required parameter 'petId' is set + if &petId == nil { + return errors.New("Missing required parameter 'petId' when calling PetApi->DeletePet") + } _sling := sling.New().Delete(a.Configuration.BasePath) // authentication (petstore_auth) required @@ -210,7 +216,10 @@ func (a PetApi) DeletePet (petId int64, apiKey string) (error) { * @return []Pet */ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) { - + // verify the required parameter 'status' is set + if &status == nil { + return *new([]Pet), errors.New("Missing required parameter 'status' when calling PetApi->FindPetsByStatus") + } _sling := sling.New().Get(a.Configuration.BasePath) // authentication (petstore_auth) required @@ -297,7 +306,10 @@ func (a PetApi) FindPetsByStatus (status []string) ([]Pet, error) { * @return []Pet */ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) { - + // verify the required parameter 'tags' is set + if &tags == nil { + return *new([]Pet), errors.New("Missing required parameter 'tags' when calling PetApi->FindPetsByTags") + } _sling := sling.New().Get(a.Configuration.BasePath) // authentication (petstore_auth) required @@ -384,7 +396,10 @@ func (a PetApi) FindPetsByTags (tags []string) ([]Pet, error) { * @return Pet */ func (a PetApi) GetPetById (petId int64) (Pet, error) { - + // verify the required parameter 'petId' is set + if &petId == nil { + return *new(Pet), errors.New("Missing required parameter 'petId' when calling PetApi->GetPetById") + } _sling := sling.New().Get(a.Configuration.BasePath) // authentication (api_key) required @@ -467,7 +482,10 @@ func (a PetApi) GetPetById (petId int64) (Pet, error) { * @return void */ func (a PetApi) UpdatePet (body Pet) (error) { - + // verify the required parameter 'body' is set + if &body == nil { + return errors.New("Missing required parameter 'body' when calling PetApi->UpdatePet") + } _sling := sling.New().Put(a.Configuration.BasePath) // authentication (petstore_auth) required @@ -556,7 +574,10 @@ func (a PetApi) UpdatePet (body Pet) (error) { * @return void */ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (error) { - + // verify the required parameter 'petId' is set + if &petId == nil { + return errors.New("Missing required parameter 'petId' when calling PetApi->UpdatePetWithForm") + } _sling := sling.New().Post(a.Configuration.BasePath) // authentication (petstore_auth) required @@ -648,7 +669,10 @@ func (a PetApi) UpdatePetWithForm (petId int64, name string, status string) (err * @return ApiResponse */ func (a PetApi) UploadFile (petId int64, additionalMetadata string, file *os.File) (ApiResponse, error) { - + // verify the required parameter 'petId' is set + if &petId == nil { + return *new(ApiResponse), errors.New("Missing required parameter 'petId' when calling PetApi->UploadFile") + } _sling := sling.New().Post(a.Configuration.BasePath) // authentication (petstore_auth) required diff --git a/samples/client/petstore/go/go-petstore/pom.xml b/samples/client/petstore/go/go-petstore/pom.xml new file mode 100644 index 00000000000..50bfe7f14f8 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/pom.xml @@ -0,0 +1,75 @@ + + 4.0.0 + com.wordnik + Goswagger + pom + 1.0.0 + Goswagger + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + go-get-testify + pre-integration-test + + exec + + + go + + get + github.com/stretchr/testify/assert + + + + + go-get-sling + pre-integration-test + + exec + + + go + + get + github.com/dghubble/sling + + + + + go-test + integration-test + + exec + + + go + + test + -v + + + + + + + + \ No newline at end of file diff --git a/samples/client/petstore/go/swagger/store_api.go b/samples/client/petstore/go/go-petstore/store_api.go similarity index 95% rename from samples/client/petstore/go/swagger/store_api.go rename to samples/client/petstore/go/go-petstore/store_api.go index 3fe6f3f8f2b..2fa59c1efd1 100644 --- a/samples/client/petstore/go/swagger/store_api.go +++ b/samples/client/petstore/go/go-petstore/store_api.go @@ -35,7 +35,10 @@ func NewStoreApiWithBasePath(basePath string) *StoreApi{ * @return void */ func (a StoreApi) DeleteOrder (orderId string) (error) { - + // verify the required parameter 'orderId' is set + if &orderId == nil { + return errors.New("Missing required parameter 'orderId' when calling StoreApi->DeleteOrder") + } _sling := sling.New().Delete(a.Configuration.BasePath) @@ -112,7 +115,6 @@ func (a StoreApi) DeleteOrder (orderId string) (error) { * @return map[string]int32 */ func (a StoreApi) GetInventory () (map[string]int32, error) { - _sling := sling.New().Get(a.Configuration.BasePath) // authentication (api_key) required @@ -193,7 +195,10 @@ func (a StoreApi) GetInventory () (map[string]int32, error) { * @return Order */ func (a StoreApi) GetOrderById (orderId int64) (Order, error) { - + // verify the required parameter 'orderId' is set + if &orderId == nil { + return *new(Order), errors.New("Missing required parameter 'orderId' when calling StoreApi->GetOrderById") + } _sling := sling.New().Get(a.Configuration.BasePath) @@ -271,7 +276,10 @@ func (a StoreApi) GetOrderById (orderId int64) (Order, error) { * @return Order */ func (a StoreApi) PlaceOrder (body Order) (Order, error) { - + // verify the required parameter 'body' is set + if &body == nil { + return *new(Order), errors.New("Missing required parameter 'body' when calling StoreApi->PlaceOrder") + } _sling := sling.New().Post(a.Configuration.BasePath) diff --git a/samples/client/petstore/go/swagger/tag.go b/samples/client/petstore/go/go-petstore/tag.go similarity index 100% rename from samples/client/petstore/go/swagger/tag.go rename to samples/client/petstore/go/go-petstore/tag.go diff --git a/samples/client/petstore/go/swagger/user.go b/samples/client/petstore/go/go-petstore/user.go similarity index 100% rename from samples/client/petstore/go/swagger/user.go rename to samples/client/petstore/go/go-petstore/user.go diff --git a/samples/client/petstore/go/swagger/user_api.go b/samples/client/petstore/go/go-petstore/user_api.go similarity index 92% rename from samples/client/petstore/go/swagger/user_api.go rename to samples/client/petstore/go/go-petstore/user_api.go index ca95f8042fc..b6639d9e65f 100644 --- a/samples/client/petstore/go/swagger/user_api.go +++ b/samples/client/petstore/go/go-petstore/user_api.go @@ -35,7 +35,10 @@ func NewUserApiWithBasePath(basePath string) *UserApi{ * @return void */ func (a UserApi) CreateUser (body User) (error) { - + // verify the required parameter 'body' is set + if &body == nil { + return errors.New("Missing required parameter 'body' when calling UserApi->CreateUser") + } _sling := sling.New().Post(a.Configuration.BasePath) @@ -114,7 +117,10 @@ func (a UserApi) CreateUser (body User) (error) { * @return void */ func (a UserApi) CreateUsersWithArrayInput (body []User) (error) { - + // verify the required parameter 'body' is set + if &body == nil { + return errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithArrayInput") + } _sling := sling.New().Post(a.Configuration.BasePath) @@ -193,7 +199,10 @@ func (a UserApi) CreateUsersWithArrayInput (body []User) (error) { * @return void */ func (a UserApi) CreateUsersWithListInput (body []User) (error) { - + // verify the required parameter 'body' is set + if &body == nil { + return errors.New("Missing required parameter 'body' when calling UserApi->CreateUsersWithListInput") + } _sling := sling.New().Post(a.Configuration.BasePath) @@ -272,7 +281,10 @@ func (a UserApi) CreateUsersWithListInput (body []User) (error) { * @return void */ func (a UserApi) DeleteUser (username string) (error) { - + // verify the required parameter 'username' is set + if &username == nil { + return errors.New("Missing required parameter 'username' when calling UserApi->DeleteUser") + } _sling := sling.New().Delete(a.Configuration.BasePath) @@ -350,7 +362,10 @@ func (a UserApi) DeleteUser (username string) (error) { * @return User */ func (a UserApi) GetUserByName (username string) (User, error) { - + // verify the required parameter 'username' is set + if &username == nil { + return *new(User), errors.New("Missing required parameter 'username' when calling UserApi->GetUserByName") + } _sling := sling.New().Get(a.Configuration.BasePath) @@ -429,7 +444,14 @@ func (a UserApi) GetUserByName (username string) (User, error) { * @return string */ func (a UserApi) LoginUser (username string, password string) (string, error) { - + // verify the required parameter 'username' is set + if &username == nil { + return *new(string), errors.New("Missing required parameter 'username' when calling UserApi->LoginUser") + } + // verify the required parameter 'password' is set + if &password == nil { + return *new(string), errors.New("Missing required parameter 'password' when calling UserApi->LoginUser") + } _sling := sling.New().Get(a.Configuration.BasePath) @@ -510,7 +532,6 @@ Password string `url:"password,omitempty"` * @return void */ func (a UserApi) LogoutUser () (error) { - _sling := sling.New().Get(a.Configuration.BasePath) @@ -588,7 +609,14 @@ func (a UserApi) LogoutUser () (error) { * @return void */ func (a UserApi) UpdateUser (username string, body User) (error) { - + // verify the required parameter 'username' is set + if &username == nil { + return errors.New("Missing required parameter 'username' when calling UserApi->UpdateUser") + } + // verify the required parameter 'body' is set + if &body == nil { + return errors.New("Missing required parameter 'body' when calling UserApi->UpdateUser") + } _sling := sling.New().Put(a.Configuration.BasePath) diff --git a/samples/client/petstore/go/pet_api_test.go b/samples/client/petstore/go/pet_api_test.go index e56468849cd..8ac7dc1a77a 100644 --- a/samples/client/petstore/go/pet_api_test.go +++ b/samples/client/petstore/go/pet_api_test.go @@ -1,10 +1,9 @@ package main import ( - "testing" - - sw "./swagger" + sw "./go-petstore" "github.com/stretchr/testify/assert" + "testing" ) func TestAddPet(t *testing.T) { @@ -29,11 +28,11 @@ func TestGetPetById(t *testing.T) { t.Errorf("Error while getting pet by id") t.Log(err) } else { - assert.Equal(resp.Id, "12830", "Pet id should be equal") + assert.Equal(resp.Id, int64(12830), "Pet id should be equal") assert.Equal(resp.Name, "gopher", "Pet name should be gopher") assert.Equal(resp.Status, "pending", "Pet status should be pending") - t.Log(resp) + //t.Log(resp) } } diff --git a/samples/client/petstore/go/pom.xml b/samples/client/petstore/go/pom.xml new file mode 100644 index 00000000000..50bfe7f14f8 --- /dev/null +++ b/samples/client/petstore/go/pom.xml @@ -0,0 +1,75 @@ + + 4.0.0 + com.wordnik + Goswagger + pom + 1.0.0 + Goswagger + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + go-get-testify + pre-integration-test + + exec + + + go + + get + github.com/stretchr/testify/assert + + + + + go-get-sling + pre-integration-test + + exec + + + go + + get + github.com/dghubble/sling + + + + + go-test + integration-test + + exec + + + go + + test + -v + + + + + + + + \ No newline at end of file diff --git a/samples/client/petstore/go/test.go b/samples/client/petstore/go/test.go index f742307196b..f73d4e338ca 100644 --- a/samples/client/petstore/go/test.go +++ b/samples/client/petstore/go/test.go @@ -1,7 +1,7 @@ package main import ( - sw "./swagger" + sw "./go-petstore" "encoding/json" "fmt" ) diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index 1d6678e55e8..2b49c2d1519 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -165,7 +165,7 @@ Class | Method | HTTP request | Description - **Type**: OAuth - **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - write:pets: modify pets in your account - read:pets: read your pets diff --git a/samples/client/petstore/javascript-promise/docs/PetApi.md b/samples/client/petstore/javascript-promise/docs/PetApi.md index 7e5398dcc13..5aecb88ee7c 100644 --- a/samples/client/petstore/javascript-promise/docs/PetApi.md +++ b/samples/client/petstore/javascript-promise/docs/PetApi.md @@ -61,7 +61,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -110,7 +110,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -162,7 +162,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -211,7 +211,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -260,7 +260,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -314,7 +314,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -368,7 +368,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -422,7 +422,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -471,7 +471,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -525,7 +525,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json, application/xml @@ -579,7 +579,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: multipart/form-data - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript-promise/docs/StoreApi.md b/samples/client/petstore/javascript-promise/docs/StoreApi.md index f9b8e0ac6be..d083e46c0db 100644 --- a/samples/client/petstore/javascript-promise/docs/StoreApi.md +++ b/samples/client/petstore/javascript-promise/docs/StoreApi.md @@ -50,7 +50,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -107,7 +107,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -151,7 +151,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -195,7 +195,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -251,7 +251,7 @@ Name | Type | Description | Notes [test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -308,7 +308,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript-promise/docs/UserApi.md b/samples/client/petstore/javascript-promise/docs/UserApi.md index f9a3a848f7a..b68f2e8bffc 100644 --- a/samples/client/petstore/javascript-promise/docs/UserApi.md +++ b/samples/client/petstore/javascript-promise/docs/UserApi.md @@ -53,7 +53,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -97,7 +97,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -141,7 +141,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -190,7 +190,7 @@ null (empty response body) [test_http_basic](../README.md#test_http_basic) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -233,7 +233,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -279,7 +279,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -316,7 +316,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -363,7 +363,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 9874fc7bfaf..c57237d7ceb 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -168,7 +168,7 @@ Class | Method | HTTP request | Description - **Type**: OAuth - **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - write:pets: modify pets in your account - read:pets: read your pets diff --git a/samples/client/petstore/javascript/docs/PetApi.md b/samples/client/petstore/javascript/docs/PetApi.md index 06c625d7898..35a760e218b 100644 --- a/samples/client/petstore/javascript/docs/PetApi.md +++ b/samples/client/petstore/javascript/docs/PetApi.md @@ -64,7 +64,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -116,7 +116,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -171,7 +171,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -223,7 +223,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -275,7 +275,7 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -332,7 +332,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -389,7 +389,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -446,7 +446,7 @@ Name | Type | Description | Notes [api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -498,7 +498,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - **Accept**: application/json, application/xml @@ -555,7 +555,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json, application/xml @@ -612,7 +612,7 @@ null (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: multipart/form-data - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript/docs/StoreApi.md b/samples/client/petstore/javascript/docs/StoreApi.md index 19da7652129..6ad8406dfc9 100644 --- a/samples/client/petstore/javascript/docs/StoreApi.md +++ b/samples/client/petstore/javascript/docs/StoreApi.md @@ -53,7 +53,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -113,7 +113,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -160,7 +160,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -207,7 +207,7 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -266,7 +266,7 @@ Name | Type | Description | Notes [test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -326,7 +326,7 @@ Name | Type | Description | Notes [test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/javascript/docs/UserApi.md b/samples/client/petstore/javascript/docs/UserApi.md index 3ae4a2e4844..4e990c89426 100644 --- a/samples/client/petstore/javascript/docs/UserApi.md +++ b/samples/client/petstore/javascript/docs/UserApi.md @@ -56,7 +56,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -103,7 +103,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -150,7 +150,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -202,7 +202,7 @@ null (empty response body) [test_http_basic](../README.md#test_http_basic) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -248,7 +248,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -297,7 +297,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -337,7 +337,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml @@ -387,7 +387,7 @@ null (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index b415e127d31..c696eac92cd 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -10,10 +10,13 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -48,7 +51,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -58,10 +61,56 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **add_pet_using_byte_array** +> add_pet_using_byte_array(body => $body) + +Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + +### Example +```perl +use Data::Dumper; + +# Configure OAuth2 access token for authorization: petstore_auth +$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api_instance = WWW::SwaggerClient::PetApi->new(); +my $body = WWW::SwaggerClient::Object::string->new(); # string | Pet object in the form of byte array + +eval { + $api_instance->add_pet_using_byte_array(body => $body); +}; +if ($@) { + warn "Exception when calling PetApi->add_pet_using_byte_array: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string**| 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 [[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) @@ -106,10 +155,10 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -128,7 +177,7 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $status = (); # ARRAY[string] | Status values that need to be considered for filter +my $status = (); # ARRAY[string] | Status values that need to be considered for query eval { my $result = $api_instance->find_pets_by_status(status => $status); @@ -143,7 +192,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for filter | + **status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for query | [optional] [default to available] ### Return type @@ -153,10 +202,10 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -165,7 +214,7 @@ Name | Type | Description | Notes Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. ### Example ```perl @@ -190,7 +239,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**ARRAY[string]**](string.md)| Tags to filter by | + **tags** | [**ARRAY[string]**](string.md)| Tags to filter by | [optional] ### Return type @@ -200,10 +249,10 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -212,7 +261,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a single pet +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example ```perl @@ -222,9 +271,11 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; # uncomment below to setup prefix (e.g. BEARER) for API key, if needed #$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# Configure OAuth2 access token for authorization: petstore_auth +$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet to return +my $pet_id = 789; # int | ID of pet that needs to be fetched eval { my $result = $api_instance->get_pet_by_id(pet_id => $pet_id); @@ -239,7 +290,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to return | + **pet_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -247,12 +298,114 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_pet_by_id_in_object** +> InlineResponse200 get_pet_by_id_in_object(pet_id => $pet_id) + +Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# Configure OAuth2 access token for authorization: petstore_auth +$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api_instance = WWW::SwaggerClient::PetApi->new(); +my $pet_id = 789; # int | ID of pet that needs to be fetched + +eval { + my $result = $api_instance->get_pet_by_id_in_object(pet_id => $pet_id); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->get_pet_by_id_in_object: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **pet_pet_idtesting_byte_arraytrue_get** +> string pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id) + +Fake endpoint to test byte array return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; +# Configure OAuth2 access token for authorization: petstore_auth +$WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; + +my $api_instance = WWW::SwaggerClient::PetApi->new(); +my $pet_id = 789; # int | ID of pet that needs to be fetched + +eval { + my $result = $api_instance->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +**string** + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -285,7 +438,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -295,10 +448,10 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -317,7 +470,7 @@ use Data::Dumper; $WWW::SwaggerClient::Configuration::access_token = 'YOUR_ACCESS_TOKEN'; my $api_instance = WWW::SwaggerClient::PetApi->new(); -my $pet_id = 789; # int | ID of pet that needs to be updated +my $pet_id = 'pet_id_example'; # string | ID of pet that needs to be updated my $name = 'name_example'; # string | Updated name of the pet my $status = 'status_example'; # string | Updated status of the pet @@ -333,7 +486,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be updated | + **pet_id** | **string**| ID of pet that needs to be updated | **name** | **string**| Updated name of the pet | [optional] **status** | **string**| Updated status of the pet | [optional] @@ -345,15 +498,15 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file** -> ApiResponse upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) +> upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file) uploads an image @@ -372,8 +525,7 @@ my $additional_metadata = 'additional_metadata_example'; # string | Additional d my $file = '/path/to/file.txt'; # File | file to upload eval { - my $result = $api_instance->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); - print Dumper($result); + $api_instance->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file); }; if ($@) { warn "Exception when calling PetApi->upload_file: $@\n"; @@ -390,16 +542,16 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +void (empty response body) ### Authorization [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/StoreApi.md b/samples/client/petstore/perl/docs/StoreApi.md index e6c80ad44e3..15b02bca3fd 100644 --- a/samples/client/petstore/perl/docs/StoreApi.md +++ b/samples/client/petstore/perl/docs/StoreApi.md @@ -10,7 +10,9 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status [**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID [**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet @@ -51,10 +53,63 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_orders_by_status** +> ARRAY[Order] find_orders_by_status(status => $status) + +Finds orders by status + +A single status value can be provided as a string + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: test_api_client_id +$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; +# Configure API key authorization: test_api_client_secret +$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; + +my $api_instance = WWW::SwaggerClient::StoreApi->new(); +my $status = 'status_example'; # string | Status value that needs to be considered for query + +eval { + my $result = $api_instance->find_orders_by_status(status => $status); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling StoreApi->find_orders_by_status: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] + +### Return type + +[**ARRAY[Order]**](Order.md) + +### Authorization + +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -96,10 +151,55 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inventory_in_object** +> object get_inventory_in_object() + +Fake endpoint to test arbitrary object return by 'Get inventory' + +Returns an arbitrary object which is actually a map of status codes to quantities + +### Example +```perl +use Data::Dumper; + +# Configure API key authorization: api_key +$WWW::SwaggerClient::Configuration::api_key->{'api_key'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'api_key'} = "BEARER"; + +my $api_instance = WWW::SwaggerClient::StoreApi->new(); + +eval { + my $result = $api_instance->get_inventory_in_object(); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling StoreApi->get_inventory_in_object: $@\n"; +} +``` + +### 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 [[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) @@ -114,8 +214,17 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```perl use Data::Dumper; +# Configure API key authorization: test_api_key_header +$WWW::SwaggerClient::Configuration::api_key->{'test_api_key_header'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_header'} = "BEARER"; +# Configure API key authorization: test_api_key_query +$WWW::SwaggerClient::Configuration::api_key->{'test_api_key_query'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'test_api_key_query'} = "BEARER"; + my $api_instance = WWW::SwaggerClient::StoreApi->new(); -my $order_id = 789; # int | ID of pet that needs to be fetched +my $order_id = 'order_id_example'; # string | ID of pet that needs to be fetched eval { my $result = $api_instance->get_order_by_id(order_id => $order_id); @@ -130,7 +239,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **int**| ID of pet that needs to be fetched | + **order_id** | **string**| ID of pet that needs to be fetched | ### Return type @@ -138,12 +247,12 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -158,6 +267,15 @@ Place an order for a pet ```perl use Data::Dumper; +# Configure API key authorization: test_api_client_id +$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_id'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_id'} = "BEARER"; +# Configure API key authorization: test_api_client_secret +$WWW::SwaggerClient::Configuration::api_key->{'x-test_api_client_secret'} = 'YOUR_API_KEY'; +# uncomment below to setup prefix (e.g. BEARER) for API key, if needed +#$WWW::SwaggerClient::Configuration::api_key_prefix->{'x-test_api_client_secret'} = "BEARER"; + my $api_instance = WWW::SwaggerClient::StoreApi->new(); my $body = WWW::SwaggerClient::Object::Order->new(); # Order | order placed for purchasing the pet @@ -174,7 +292,7 @@ if ($@) { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] ### Return type @@ -182,12 +300,12 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/perl/docs/UserApi.md b/samples/client/petstore/perl/docs/UserApi.md index 8b4a07efa49..faa4c799739 100644 --- a/samples/client/petstore/perl/docs/UserApi.md +++ b/samples/client/petstore/perl/docs/UserApi.md @@ -55,7 +55,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -98,7 +98,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -141,7 +141,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -184,7 +184,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -228,7 +228,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -274,7 +274,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -313,7 +313,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -358,7 +358,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 18eb2791d46..d7a43368cac 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -132,7 +132,7 @@ Class | Method | HTTP request | Description - **Type**: OAuth - **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - **write:pets**: modify pets in your account - **read:pets**: read your pets diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md index 16dd52ff047..ad4d3c804ef 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/PetApi.md @@ -5,10 +5,13 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store +[**addPetUsingByteArray**](PetApi.md#addPetUsingByteArray) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**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 @@ -44,7 +47,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | + **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -54,10 +57,57 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **addPetUsingByteArray** +> addPetUsingByteArray($body) + +Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + +### Example +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + +$api_instance = new Swagger\Client\Api\PetApi(); +$body = "B"; // string | Pet object in the form of byte array + +try { + $api_instance->addPetUsingByteArray($body); +} catch (Exception $e) { + echo 'Exception when calling PetApi->addPetUsingByteArray: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **string**| 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 [[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) @@ -103,10 +153,10 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -126,7 +176,7 @@ require_once(__DIR__ . '/vendor/autoload.php'); Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\Api\PetApi(); -$status = array("status_example"); // string[] | Status values that need to be considered for filter +$status = array("available"); // string[] | Status values that need to be considered for query try { $result = $api_instance->findPetsByStatus($status); @@ -141,7 +191,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**string[]**](string.md)| Status values that need to be considered for filter | + **status** | [**string[]**](string.md)| Status values that need to be considered for query | [optional] [default to available] ### Return type @@ -151,10 +201,10 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -163,7 +213,7 @@ Name | Type | Description | Notes Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. ### Example ```php @@ -189,7 +239,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**string[]**](string.md)| Tags to filter by | + **tags** | [**string[]**](string.md)| Tags to filter by | [optional] ### Return type @@ -199,10 +249,10 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -211,7 +261,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a single pet +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example ```php @@ -222,9 +272,11 @@ require_once(__DIR__ . '/vendor/autoload.php'); Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('api_key', 'YOUR_API_KEY'); // Uncomment below to setup prefix (e.g. BEARER) for API key, if needed // Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\Api\PetApi(); -$pet_id = 789; // int | ID of pet to return +$pet_id = 789; // int | ID of pet that needs to be fetched try { $result = $api_instance->getPetById($pet_id); @@ -239,7 +291,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to return | + **pet_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -247,12 +299,116 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **getPetByIdInObject** +> \Swagger\Client\Model\InlineResponse200 getPetByIdInObject($pet_id) + +Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```php +setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + +$api_instance = new Swagger\Client\Api\PetApi(); +$pet_id = 789; // int | ID of pet that needs to be fetched + +try { + $result = $api_instance->getPetByIdInObject($pet_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->getPetByIdInObject: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**\Swagger\Client\Model\InlineResponse200**](InlineResponse200.md) + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **petPetIdtestingByteArraytrueGet** +> string petPetIdtestingByteArraytrueGet($pet_id) + +Fake endpoint to test byte array return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```php +setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); +// Configure OAuth2 access token for authorization: petstore_auth +Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); + +$api_instance = new Swagger\Client\Api\PetApi(); +$pet_id = 789; // int | ID of pet that needs to be fetched + +try { + $result = $api_instance->petPetIdtestingByteArraytrueGet($pet_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling PetApi->petPetIdtestingByteArraytrueGet: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +**string** + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -286,7 +442,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | + **body** | [**\Swagger\Client\Model\Pet**](\Swagger\Client\Model\Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -296,10 +452,10 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -319,7 +475,7 @@ require_once(__DIR__ . '/vendor/autoload.php'); Swagger\Client\Configuration::getDefaultConfiguration()->setAccessToken('YOUR_ACCESS_TOKEN'); $api_instance = new Swagger\Client\Api\PetApi(); -$pet_id = 789; // int | ID of pet that needs to be updated +$pet_id = "pet_id_example"; // string | ID of pet that needs to be updated $name = "name_example"; // string | Updated name of the pet $status = "status_example"; // string | Updated status of the pet @@ -335,7 +491,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be updated | + **pet_id** | **string**| ID of pet that needs to be updated | **name** | **string**| Updated name of the pet | [optional] **status** | **string**| Updated status of the pet | [optional] @@ -347,15 +503,15 @@ void (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **uploadFile** -> \Swagger\Client\Model\ApiResponse uploadFile($pet_id, $additional_metadata, $file) +> uploadFile($pet_id, $additional_metadata, $file) uploads an image @@ -375,8 +531,7 @@ $additional_metadata = "additional_metadata_example"; // string | Additional dat $file = "/path/to/file.txt"; // \SplFileObject | file to upload try { - $result = $api_instance->uploadFile($pet_id, $additional_metadata, $file); - print_r($result); + $api_instance->uploadFile($pet_id, $additional_metadata, $file); } catch (Exception $e) { echo 'Exception when calling PetApi->uploadFile: ', $e->getMessage(), "\n"; } @@ -393,16 +548,16 @@ Name | Type | Description | Notes ### Return type -[**\Swagger\Client\Model\ApiResponse**](ApiResponse.md) +void (empty response body) ### Authorization [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md index efbdc89a511..0ba6fa092de 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/StoreApi.md @@ -5,7 +5,9 @@ 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 @@ -47,10 +49,64 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **findOrdersByStatus** +> \Swagger\Client\Model\Order[] findOrdersByStatus($status) + +Finds orders by status + +A single status value can be provided as a string + +### Example +```php +setApiKey('x-test_api_client_id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_id', 'BEARER'); +// Configure API key authorization: test_api_client_secret +Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_secret', 'BEARER'); + +$api_instance = new Swagger\Client\Api\StoreApi(); +$status = "placed"; // string | Status value that needs to be considered for query + +try { + $result = $api_instance->findOrdersByStatus($status); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->findOrdersByStatus: ', $e->getMessage(), "\n"; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **string**| Status value that needs to be considered for query | [optional] [default to placed] + +### Return type + +[**\Swagger\Client\Model\Order[]**](Order.md) + +### Authorization + +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -93,10 +149,56 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **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 +```php +setApiKey('api_key', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('api_key', 'BEARER'); + +$api_instance = new Swagger\Client\Api\StoreApi(); + +try { + $result = $api_instance->getInventoryInObject(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling StoreApi->getInventoryInObject: ', $e->getMessage(), "\n"; +} +?> +``` + +### 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 [[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) @@ -112,8 +214,17 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge setApiKey('test_api_key_header', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_header', 'BEARER'); +// Configure API key authorization: test_api_key_query +Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('test_api_key_query', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('test_api_key_query', 'BEARER'); + $api_instance = new Swagger\Client\Api\StoreApi(); -$order_id = 789; // int | ID of pet that needs to be fetched +$order_id = "order_id_example"; // string | ID of pet that needs to be fetched try { $result = $api_instance->getOrderById($order_id); @@ -128,7 +239,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **int**| ID of pet that needs to be fetched | + **order_id** | **string**| ID of pet that needs to be fetched | ### Return type @@ -136,12 +247,12 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -157,6 +268,15 @@ Place an order for a pet setApiKey('x-test_api_client_id', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_id', 'BEARER'); +// Configure API key authorization: test_api_client_secret +Swagger\Client\Configuration::getDefaultConfiguration()->setApiKey('x-test_api_client_secret', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +// Swagger\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('x-test_api_client_secret', 'BEARER'); + $api_instance = new Swagger\Client\Api\StoreApi(); $body = new \Swagger\Client\Model\Order(); // \Swagger\Client\Model\Order | order placed for purchasing the pet @@ -173,7 +293,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**\Swagger\Client\Model\Order**](\Swagger\Client\Model\Order.md)| order placed for purchasing the pet | + **body** | [**\Swagger\Client\Model\Order**](\Swagger\Client\Model\Order.md)| order placed for purchasing the pet | [optional] ### Return type @@ -181,12 +301,12 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md index c5cb7a34cc7..7f048a429e3 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/UserApi.md @@ -51,7 +51,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -95,7 +95,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -139,7 +139,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -183,7 +183,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -228,7 +228,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -275,7 +275,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -315,7 +315,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -361,7 +361,7 @@ void (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index 8aca4b71d54..85da3806f31 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -124,7 +124,7 @@ Class | Method | HTTP request | Description - **Type**: OAuth - **Flow**: implicit -- **Authorizatoin URL**: http://petstore.swagger.io/api/oauth/dialog +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog - **Scopes**: - **write:pets**: modify pets in your account - **read:pets**: read your pets diff --git a/samples/client/petstore/python/docs/PetApi.md b/samples/client/petstore/python/docs/PetApi.md index 3b14d2b8062..82a47548fb8 100644 --- a/samples/client/petstore/python/docs/PetApi.md +++ b/samples/client/petstore/python/docs/PetApi.md @@ -5,17 +5,20 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image # **add_pet** -> add_pet(body) +> add_pet(body=body) Add a new pet to the store @@ -33,11 +36,11 @@ 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 +body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional) try: # Add a new pet to the store - api_instance.add_pet(body) + api_instance.add_pet(body=body) except ApiException as e: print "Exception when calling PetApi->add_pet: %s\n" % e ``` @@ -46,7 +49,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -59,7 +62,56 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **add_pet_using_byte_array** +> add_pet_using_byte_array(body=body) + +Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + +### Example +```python +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# Configure OAuth2 access token for authorization: petstore_auth +swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = swagger_client.PetApi() +body = 'B' # str | Pet object in the form of byte array (optional) + +try: + # Fake endpoint to test byte array in body parameter for adding a new pet to the store + api_instance.add_pet_using_byte_array(body=body) +except ApiException as e: + print "Exception when calling PetApi->add_pet_using_byte_array: %s\n" % e +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **str**| Pet object in the form of byte array | [optional] + +### Return type + +void (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -110,12 +162,12 @@ void (empty response body) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **find_pets_by_status** -> list[Pet] find_pets_by_status(status) +> list[Pet] find_pets_by_status(status=status) Finds Pets by status @@ -133,11 +185,11 @@ swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = swagger_client.PetApi() -status = ['status_example'] # list[str] | Status values that need to be considered for filter +status = ['available'] # list[str] | Status values that need to be considered for query (optional) (default to available) try: # Finds Pets by status - api_response = api_instance.find_pets_by_status(status) + api_response = api_instance.find_pets_by_status(status=status) pprint(api_response) except ApiException as e: print "Exception when calling PetApi->find_pets_by_status: %s\n" % e @@ -147,7 +199,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**list[str]**](str.md)| Status values that need to be considered for filter | + **status** | [**list[str]**](str.md)| Status values that need to be considered for query | [optional] [default to available] ### Return type @@ -160,16 +212,16 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **find_pets_by_tags** -> list[Pet] find_pets_by_tags(tags) +> list[Pet] find_pets_by_tags(tags=tags) Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. ### Example ```python @@ -183,11 +235,11 @@ swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = swagger_client.PetApi() -tags = ['tags_example'] # list[str] | Tags to filter by +tags = ['tags_example'] # list[str] | Tags to filter by (optional) try: # Finds Pets by tags - api_response = api_instance.find_pets_by_tags(tags) + api_response = api_instance.find_pets_by_tags(tags=tags) pprint(api_response) except ApiException as e: print "Exception when calling PetApi->find_pets_by_tags: %s\n" % e @@ -197,7 +249,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**list[str]**](str.md)| Tags to filter by | + **tags** | [**list[str]**](str.md)| Tags to filter by | [optional] ### Return type @@ -210,7 +262,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -219,7 +271,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a single pet +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example ```python @@ -232,10 +284,12 @@ from pprint import pprint swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' # Uncomment below to setup prefix (e.g. BEARER) for API key, if needed # swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER' +# Configure OAuth2 access token for authorization: petstore_auth +swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = swagger_client.PetApi() -pet_id = 789 # int | ID of pet to return +pet_id = 789 # int | ID of pet that needs to be fetched try: # Find pet by ID @@ -249,7 +303,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet to return | + **pet_id** | **int**| ID of pet that needs to be fetched | ### Return type @@ -257,17 +311,125 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_pet_by_id_in_object** +> InlineResponse200 get_pet_by_id_in_object(pet_id) + +Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```python +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key +swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER' +# Configure OAuth2 access token for authorization: petstore_auth +swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = swagger_client.PetApi() +pet_id = 789 # int | ID of pet that needs to be fetched + +try: + # Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + api_response = api_instance.get_pet_by_id_in_object(pet_id) + pprint(api_response) +except ApiException as e: + print "Exception when calling PetApi->get_pet_by_id_in_object: %s\n" % e +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **pet_pet_idtesting_byte_arraytrue_get** +> str pet_pet_idtesting_byte_arraytrue_get(pet_id) + +Fake endpoint to test byte array return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```python +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key +swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER' +# Configure OAuth2 access token for authorization: petstore_auth +swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' + +# create an instance of the API class +api_instance = swagger_client.PetApi() +pet_id = 789 # int | ID of pet that needs to be fetched + +try: + # Fake endpoint to test byte array return by 'Find pet by ID' + api_response = api_instance.pet_pet_idtesting_byte_arraytrue_get(pet_id) + pprint(api_response) +except ApiException as e: + print "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: %s\n" % e +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet that needs to be fetched | + +### Return type + +**str** + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_pet** -> update_pet(body) +> update_pet(body=body) Update an existing pet @@ -285,11 +447,11 @@ 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 +body = swagger_client.Pet() # Pet | Pet object that needs to be added to the store (optional) try: # Update an existing pet - api_instance.update_pet(body) + api_instance.update_pet(body=body) except ApiException as e: print "Exception when calling PetApi->update_pet: %s\n" % e ``` @@ -298,7 +460,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -311,7 +473,7 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -334,7 +496,7 @@ swagger_client.configuration.access_token = 'YOUR_ACCESS_TOKEN' # create an instance of the API class api_instance = swagger_client.PetApi() -pet_id = 789 # int | ID of pet that needs to be updated +pet_id = 'pet_id_example' # str | ID of pet that needs to be updated name = 'name_example' # str | Updated name of the pet (optional) status = 'status_example' # str | Updated status of the pet (optional) @@ -349,7 +511,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **int**| ID of pet that needs to be updated | + **pet_id** | **str**| ID of pet that needs to be updated | **name** | **str**| Updated name of the pet | [optional] **status** | **str**| Updated status of the pet | [optional] @@ -364,12 +526,12 @@ void (empty response body) ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **upload_file** -> ApiResponse upload_file(pet_id, additional_metadata=additional_metadata, file=file) +> upload_file(pet_id, additional_metadata=additional_metadata, file=file) uploads an image @@ -393,8 +555,7 @@ file = '/path/to/file.txt' # file | file to upload (optional) try: # uploads an image - api_response = api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file) - pprint(api_response) + api_instance.upload_file(pet_id, additional_metadata=additional_metadata, file=file) except ApiException as e: print "Exception when calling PetApi->upload_file: %s\n" % e ``` @@ -409,7 +570,7 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +void (empty response body) ### Authorization @@ -418,7 +579,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/python/docs/StoreApi.md b/samples/client/petstore/python/docs/StoreApi.md index 04b4300d58d..89c5ff60eb9 100644 --- a/samples/client/petstore/python/docs/StoreApi.md +++ b/samples/client/petstore/python/docs/StoreApi.md @@ -5,7 +5,9 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status [**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID [**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet @@ -52,7 +54,63 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **find_orders_by_status** +> list[Order] find_orders_by_status(status=status) + +Finds orders by status + +A single status value can be provided as a string + +### Example +```python +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# Configure API key authorization: test_api_client_id +swagger_client.configuration.api_key['x-test_api_client_id'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['x-test_api_client_id'] = 'BEARER' +# Configure API key authorization: test_api_client_secret +swagger_client.configuration.api_key['x-test_api_client_secret'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['x-test_api_client_secret'] = 'BEARER' + +# create an instance of the API class +api_instance = swagger_client.StoreApi() +status = 'placed' # str | Status value that needs to be considered for query (optional) (default to placed) + +try: + # Finds orders by status + api_response = api_instance.find_orders_by_status(status=status) + pprint(api_response) +except ApiException as e: + print "Exception when calling StoreApi->find_orders_by_status: %s\n" % e +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **str**| Status value that needs to be considered for query | [optional] [default to placed] + +### Return type + +[**list[Order]**](Order.md) + +### Authorization + +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -100,7 +158,55 @@ This endpoint does not need any parameter. ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json + - **Accept**: application/json, application/xml + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **get_inventory_in_object** +> object get_inventory_in_object() + +Fake endpoint to test arbitrary object return by 'Get inventory' + +Returns an arbitrary object which is actually a map of status codes to quantities + +### Example +```python +import time +import swagger_client +from swagger_client.rest import ApiException +from pprint import pprint + +# Configure API key authorization: api_key +swagger_client.configuration.api_key['api_key'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['api_key'] = 'BEARER' + +# create an instance of the API class +api_instance = swagger_client.StoreApi() + +try: + # Fake endpoint to test arbitrary object return by 'Get inventory' + api_response = api_instance.get_inventory_in_object() + pprint(api_response) +except ApiException as e: + print "Exception when calling StoreApi->get_inventory_in_object: %s\n" % e +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**object** + +### Authorization + +[api_key](../README.md#api_key) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -118,9 +224,18 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint +# Configure API key authorization: test_api_key_header +swagger_client.configuration.api_key['test_api_key_header'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['test_api_key_header'] = 'BEARER' +# Configure API key authorization: test_api_key_query +swagger_client.configuration.api_key['test_api_key_query'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['test_api_key_query'] = 'BEARER' + # create an instance of the API class api_instance = swagger_client.StoreApi() -order_id = 789 # int | ID of pet that needs to be fetched +order_id = 'order_id_example' # str | ID of pet that needs to be fetched try: # Find purchase order by ID @@ -134,7 +249,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **int**| ID of pet that needs to be fetched | + **order_id** | **str**| ID of pet that needs to be fetched | ### Return type @@ -142,17 +257,17 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **place_order** -> Order place_order(body) +> Order place_order(body=body) Place an order for a pet @@ -165,13 +280,22 @@ import swagger_client from swagger_client.rest import ApiException from pprint import pprint +# Configure API key authorization: test_api_client_id +swagger_client.configuration.api_key['x-test_api_client_id'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['x-test_api_client_id'] = 'BEARER' +# Configure API key authorization: test_api_client_secret +swagger_client.configuration.api_key['x-test_api_client_secret'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. BEARER) for API key, if needed +# swagger_client.configuration.api_key_prefix['x-test_api_client_secret'] = 'BEARER' + # create an instance of the API class api_instance = swagger_client.StoreApi() -body = swagger_client.Order() # Order | order placed for purchasing the pet +body = swagger_client.Order() # Order | order placed for purchasing the pet (optional) try: # Place an order for a pet - api_response = api_instance.place_order(body) + api_response = api_instance.place_order(body=body) pprint(api_response) except ApiException as e: print "Exception when calling StoreApi->place_order: %s\n" % e @@ -181,7 +305,7 @@ except ApiException as e: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] ### Return type @@ -189,12 +313,12 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[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/xml, application/json + - **Accept**: application/json, application/xml [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/ruby/docs/PetApi.md b/samples/client/petstore/ruby/docs/PetApi.md index 4fcf59da24c..36ca634b739 100644 --- a/samples/client/petstore/ruby/docs/PetApi.md +++ b/samples/client/petstore/ruby/docs/PetApi.md @@ -5,17 +5,20 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store +[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store [**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet [**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status [**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags [**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID +[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID' +[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID' [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image # **add_pet** -> add_pet(body) +> add_pet(opts) Add a new pet to the store @@ -33,12 +36,13 @@ end api_instance = Petstore::PetApi.new -body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store - +opts = { + 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(body) + api_instance.add_pet(opts) rescue Petstore::ApiError => e puts "Exception when calling PetApi->add_pet: #{e}" end @@ -48,7 +52,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -58,10 +62,62 @@ nil (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + + + +# **add_pet_using_byte_array** +> add_pet_using_byte_array(opts) + +Fake endpoint to test byte array in body parameter for adding a new pet to the store + + + +### Example +```ruby +# load the gem +require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = Petstore::PetApi.new + +opts = { + body: "B" # String | Pet object in the form of byte array +} + +begin + #Fake endpoint to test byte array in body parameter for adding a new pet to the store + api_instance.add_pet_using_byte_array(opts) +rescue Petstore::ApiError => e + puts "Exception when calling PetApi->add_pet_using_byte_array: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **String**| Pet object in the form of byte array | [optional] + +### Return type + +nil (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: application/json, application/xml @@ -113,15 +169,15 @@ nil (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml # **find_pets_by_status** -> Array<Pet> find_pets_by_status(status) +> Array<Pet> find_pets_by_status(opts) Finds Pets by status @@ -139,12 +195,13 @@ end api_instance = Petstore::PetApi.new -status = ["status_example"] # Array | Status values that need to be considered for filter - +opts = { + status: ["available"] # Array | Status values that need to be considered for query +} begin #Finds Pets by status - result = api_instance.find_pets_by_status(status) + result = api_instance.find_pets_by_status(opts) p result rescue Petstore::ApiError => e puts "Exception when calling PetApi->find_pets_by_status: #{e}" @@ -155,7 +212,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**Array<String>**](String.md)| Status values that need to be considered for filter | + **status** | [**Array<String>**](String.md)| Status values that need to be considered for query | [optional] [default to available] ### Return type @@ -165,19 +222,19 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml # **find_pets_by_tags** -> Array<Pet> find_pets_by_tags(tags) +> Array<Pet> find_pets_by_tags(opts) Finds Pets by tags -Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing. ### Example ```ruby @@ -191,12 +248,13 @@ end api_instance = Petstore::PetApi.new -tags = ["tags_example"] # Array | Tags to filter by - +opts = { + tags: ["tags_example"] # Array | Tags to filter by +} begin #Finds Pets by tags - result = api_instance.find_pets_by_tags(tags) + result = api_instance.find_pets_by_tags(opts) p result rescue Petstore::ApiError => e puts "Exception when calling PetApi->find_pets_by_tags: #{e}" @@ -207,7 +265,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**Array<String>**](String.md)| Tags to filter by | + **tags** | [**Array<String>**](String.md)| Tags to filter by | [optional] ### Return type @@ -217,10 +275,10 @@ Name | Type | Description | Notes [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml @@ -229,7 +287,7 @@ Name | Type | Description | Notes Find pet by ID -Returns a single pet +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions ### Example ```ruby @@ -241,11 +299,14 @@ Petstore.configure do |config| config.api_key['api_key'] = 'YOUR API KEY' # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) #config.api_key_prefix['api_key'] = 'BEARER' + + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = 'YOUR ACCESS TOKEN' end api_instance = Petstore::PetApi.new -pet_id = 789 # Integer | ID of pet to return +pet_id = 789 # Integer | ID of pet that needs to be fetched begin @@ -261,7 +322,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **Integer**| ID of pet to return | + **pet_id** | **Integer**| ID of pet that needs to be fetched | ### Return type @@ -269,17 +330,131 @@ Name | Type | Description | Notes ### Authorization -[api_key](../README.md#api_key) +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + + + +# **get_pet_by_id_in_object** +> InlineResponse200 get_pet_by_id_in_object(pet_id) + +Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```ruby +# load the gem +require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure API key authorization: api_key + config.api_key['api_key'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['api_key'] = 'BEARER' + + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = Petstore::PetApi.new + +pet_id = 789 # Integer | ID of pet that needs to be fetched + + +begin + #Fake endpoint to test inline arbitrary object return by 'Find pet by ID' + result = api_instance.get_pet_by_id_in_object(pet_id) + p result +rescue Petstore::ApiError => e + puts "Exception when calling PetApi->get_pet_by_id_in_object: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **Integer**| ID of pet that needs to be fetched | + +### Return type + +[**InlineResponse200**](InlineResponse200.md) + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml + + + +# **pet_pet_idtesting_byte_arraytrue_get** +> String pet_pet_idtesting_byte_arraytrue_get(pet_id) + +Fake endpoint to test byte array return by 'Find pet by ID' + +Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions + +### Example +```ruby +# load the gem +require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure API key authorization: api_key + config.api_key['api_key'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['api_key'] = 'BEARER' + + # Configure OAuth2 access token for authorization: petstore_auth + config.access_token = 'YOUR ACCESS TOKEN' +end + +api_instance = Petstore::PetApi.new + +pet_id = 789 # Integer | ID of pet that needs to be fetched + + +begin + #Fake endpoint to test byte array return by 'Find pet by ID' + result = api_instance.pet_pet_idtesting_byte_arraytrue_get(pet_id) + p result +rescue Petstore::ApiError => e + puts "Exception when calling PetApi->pet_pet_idtesting_byte_arraytrue_get: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **Integer**| ID of pet that needs to be fetched | + +### Return type + +**String** + +### Authorization + +[api_key](../README.md#api_key), [petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml # **update_pet** -> update_pet(body) +> update_pet(opts) Update an existing pet @@ -297,12 +472,13 @@ end api_instance = Petstore::PetApi.new -body = Petstore::Pet.new # Pet | Pet object that needs to be added to the store - +opts = { + body: Petstore::Pet.new # Pet | Pet object that needs to be added to the store +} begin #Update an existing pet - api_instance.update_pet(body) + api_instance.update_pet(opts) rescue Petstore::ApiError => e puts "Exception when calling PetApi->update_pet: #{e}" end @@ -312,7 +488,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional] ### Return type @@ -322,10 +498,10 @@ nil (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml @@ -348,7 +524,7 @@ end api_instance = Petstore::PetApi.new -pet_id = 789 # Integer | ID of pet that needs to be updated +pet_id = "pet_id_example" # String | ID of pet that needs to be updated opts = { name: "name_example", # String | Updated name of the pet @@ -367,7 +543,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **pet_id** | **Integer**| ID of pet that needs to be updated | + **pet_id** | **String**| ID of pet that needs to be updated | **name** | **String**| Updated name of the pet | [optional] **status** | **String**| Updated status of the pet | [optional] @@ -379,15 +555,15 @@ nil (empty response body) [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml # **upload_file** -> ApiResponse upload_file(pet_id, opts) +> upload_file(pet_id, opts) uploads an image @@ -414,8 +590,7 @@ opts = { begin #uploads an image - result = api_instance.upload_file(pet_id, opts) - p result + api_instance.upload_file(pet_id, opts) rescue Petstore::ApiError => e puts "Exception when calling PetApi->upload_file: #{e}" end @@ -431,16 +606,16 @@ Name | Type | Description | Notes ### Return type -[**ApiResponse**](ApiResponse.md) +nil (empty response body) ### Authorization [petstore_auth](../README.md#petstore_auth) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: multipart/form-data - - **Accept**: application/json + - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/ruby/docs/StoreApi.md b/samples/client/petstore/ruby/docs/StoreApi.md index 273f7f2ac2c..9165f119ba5 100644 --- a/samples/client/petstore/ruby/docs/StoreApi.md +++ b/samples/client/petstore/ruby/docs/StoreApi.md @@ -5,7 +5,9 @@ All URIs are relative to *http://petstore.swagger.io/v2* Method | HTTP request | Description ------------- | ------------- | ------------- [**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID +[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status [**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status +[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory' [**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID [**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet @@ -49,10 +51,70 @@ nil (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml + + + +# **find_orders_by_status** +> Array<Order> find_orders_by_status(opts) + +Finds orders by status + +A single status value can be provided as a string + +### Example +```ruby +# load the gem +require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure API key authorization: test_api_client_id + config.api_key['x-test_api_client_id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['x-test_api_client_id'] = 'BEARER' + + # Configure API key authorization: test_api_client_secret + config.api_key['x-test_api_client_secret'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['x-test_api_client_secret'] = 'BEARER' +end + +api_instance = Petstore::StoreApi.new + +opts = { + status: "placed" # String | Status value that needs to be considered for query +} + +begin + #Finds orders by status + result = api_instance.find_orders_by_status(opts) + p result +rescue Petstore::ApiError => e + puts "Exception when calling StoreApi->find_orders_by_status: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **String**| Status value that needs to be considered for query | [optional] [default to placed] + +### Return type + +[**Array<Order>**](Order.md) + +### Authorization + +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json, application/xml @@ -97,10 +159,58 @@ This endpoint does not need any parameter. [api_key](../README.md#api_key) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/json + - **Accept**: application/json, application/xml + + + +# **get_inventory_in_object** +> Object get_inventory_in_object + +Fake endpoint to test arbitrary object return by 'Get inventory' + +Returns an arbitrary object which is actually a map of status codes to quantities + +### Example +```ruby +# load the gem +require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure API key authorization: api_key + config.api_key['api_key'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['api_key'] = 'BEARER' +end + +api_instance = Petstore::StoreApi.new + +begin + #Fake endpoint to test arbitrary object return by 'Get inventory' + result = api_instance.get_inventory_in_object + p result +rescue Petstore::ApiError => e + puts "Exception when calling StoreApi->get_inventory_in_object: #{e}" +end +``` + +### 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 @@ -115,10 +225,22 @@ For valid response try integer IDs with value <= 5 or > 10. Other values will ge ```ruby # load the gem require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure API key authorization: test_api_key_header + config.api_key['test_api_key_header'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['test_api_key_header'] = 'BEARER' + + # Configure API key authorization: test_api_key_query + config.api_key['test_api_key_query'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['test_api_key_query'] = 'BEARER' +end api_instance = Petstore::StoreApi.new -order_id = 789 # Integer | ID of pet that needs to be fetched +order_id = "order_id_example" # String | ID of pet that needs to be fetched begin @@ -134,7 +256,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **order_id** | **Integer**| ID of pet that needs to be fetched | + **order_id** | **String**| ID of pet that needs to be fetched | ### Return type @@ -142,17 +264,17 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[test_api_key_header](../README.md#test_api_key_header), [test_api_key_query](../README.md#test_api_key_query) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml # **place_order** -> Order place_order(body) +> Order place_order(opts) Place an order for a pet @@ -162,15 +284,28 @@ Place an order for a pet ```ruby # load the gem require 'petstore' +# setup authorization +Petstore.configure do |config| + # Configure API key authorization: test_api_client_id + config.api_key['x-test_api_client_id'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['x-test_api_client_id'] = 'BEARER' + + # Configure API key authorization: test_api_client_secret + config.api_key['x-test_api_client_secret'] = 'YOUR API KEY' + # Uncomment the following line to set a prefix for the API key, e.g. 'BEARER' (defaults to nil) + #config.api_key_prefix['x-test_api_client_secret'] = 'BEARER' +end api_instance = Petstore::StoreApi.new -body = Petstore::Order.new # Order | order placed for purchasing the pet - +opts = { + body: Petstore::Order.new # Order | order placed for purchasing the pet +} begin #Place an order for a pet - result = api_instance.place_order(body) + result = api_instance.place_order(opts) p result rescue Petstore::ApiError => e puts "Exception when calling StoreApi->place_order: #{e}" @@ -181,7 +316,7 @@ end Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional] ### Return type @@ -189,12 +324,12 @@ Name | Type | Description | Notes ### Authorization -No authorization required +[test_api_client_id](../README.md#test_api_client_id), [test_api_client_secret](../README.md#test_api_client_secret) -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: application/json, application/xml diff --git a/samples/client/petstore/ruby/docs/UserApi.md b/samples/client/petstore/ruby/docs/UserApi.md index 1c1ae32ac50..87a63e19584 100644 --- a/samples/client/petstore/ruby/docs/UserApi.md +++ b/samples/client/petstore/ruby/docs/UserApi.md @@ -53,7 +53,7 @@ nil (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -99,7 +99,7 @@ nil (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -145,7 +145,7 @@ nil (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -191,7 +191,7 @@ nil (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -238,7 +238,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -288,7 +288,7 @@ Name | Type | Description | Notes No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -328,7 +328,7 @@ nil (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json @@ -377,7 +377,7 @@ nil (empty response body) No authorization required -### HTTP reuqest headers +### HTTP request headers - **Content-Type**: Not defined - **Accept**: application/xml, application/json diff --git a/samples/server/petstore/spring-mvc-j8-async/pom.xml b/samples/server/petstore/spring-mvc-j8-async/pom.xml index cc78851ae30..1c535f34084 100644 --- a/samples/server/petstore/spring-mvc-j8-async/pom.xml +++ b/samples/server/petstore/spring-mvc-j8-async/pom.xml @@ -159,7 +159,7 @@ - 1.5.7 + 1.5.8 9.2.9.v20150224 1.13 1.6.3 diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java index 5cba2d3db86..20930979750 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java index 81dbc940508..c8a46b8ac99 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java index 51d9bb1e2d0..91b3d9d6d36 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java index 0e298e5c443..40471f4716f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java index ff793304ac5..df8a67686b6 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/PetApi.java @@ -3,6 +3,7 @@ package io.swagger.api; import io.swagger.model.*; import io.swagger.model.Pet; +import io.swagger.model.ApiResponse; import java.io.File; import java.util.concurrent.Callable; @@ -34,9 +35,123 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public interface PetApi { - + + @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input") }) + @RequestMapping(value = "", + produces = { "application/xml", "application/json" }, + consumes = { "application/json", "application/xml" }, + method = RequestMethod.POST) + default Callable> addPet( + +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid pet value") }) + @RequestMapping(value = "/{petId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.DELETE) + default Callable> deletePet( +@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId + +, + +@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey + +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation"), + @ApiResponse(code = 400, message = "Invalid status value") }) + @RequestMapping(value = "/findByStatus", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + default Callable>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", required = true) @RequestParam(value = "status", required = true) List status + + +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { + @Authorization(value = "petstore_auth", scopes = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation"), + @ApiResponse(code = 400, message = "Invalid tag value") }) + @RequestMapping(value = "/findByTags", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + default Callable>> findPetsByTags(@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags + + +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { + @Authorization(value = "api_key") + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation"), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Pet not found") }) + @RequestMapping(value = "/{petId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + default Callable> getPetById( +@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId + +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -49,116 +164,18 @@ public interface PetApi { @ApiResponse(code = 404, message = "Pet not found"), @ApiResponse(code = 405, message = "Validation exception") }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) default Callable> updatePet( -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body +@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @RequestBody Pet body ) throws NotFoundException { // do some magic! return () -> new ResponseEntity(HttpStatus.OK); } - - - @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @ApiResponses(value = { - @ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, - consumes = { "application/json", "application/xml" }, - method = RequestMethod.POST) - default Callable> addPet( - -@ApiParam(value = "Pet object that needs to be added to the store" ) @RequestBody Pet body -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma seperated strings", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid status value") }) - @RequestMapping(value = "/findByStatus", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable>> findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue = "available") @RequestParam(value = "status", required = false, defaultValue="available") List status - - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity>(HttpStatus.OK); - } - - - - @ApiOperation(value = "Finds Pets by tags", notes = "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid tag value") }) - @RequestMapping(value = "/findByTags", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable>> findPetsByTags(@ApiParam(value = "Tags to filter by") @RequestParam(value = "tags", required = false) List tags - - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity>(HttpStatus.OK); - } - - - - @ApiOperation(value = "Find pet by ID", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = Pet.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }), - @Authorization(value = "api_key") - }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Pet not found") }) - @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable> getPetById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @@ -169,11 +186,11 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 405, message = "Invalid input") }) @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) default Callable> updatePetWithForm( -@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") String petId +@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId , @@ -191,36 +208,8 @@ public interface PetApi { return () -> new ResponseEntity(HttpStatus.OK); } - - @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }) - }) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid pet value") }) - @RequestMapping(value = "/{petId}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.DELETE) - default Callable> deletePet( -@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId - -, - -@ApiParam(value = "" ) @RequestHeader(value="apiKey", required=false) String apiKey - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "uploads an image", notes = "", response = Void.class, authorizations = { + @ApiOperation(value = "uploads an image", notes = "", response = ApiResponse.class, authorizations = { @Authorization(value = "petstore_auth", scopes = { @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), @AuthorizationScope(scope = "read:pets", description = "read your pets") @@ -229,10 +218,10 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/{petId}/uploadImage", - produces = { "application/json", "application/xml" }, + produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - default Callable> uploadFile( + default Callable> uploadFile( @ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId , @@ -247,34 +236,7 @@ public interface PetApi { ) throws NotFoundException { // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); + return () -> new ResponseEntity(HttpStatus.OK); } - - - @ApiOperation(value = "Fake endpoint to test byte array return by 'Find pet by ID'", notes = "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions", response = byte[].class, authorizations = { - @Authorization(value = "petstore_auth", scopes = { - @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), - @AuthorizationScope(scope = "read:pets", description = "read your pets") - }), - @Authorization(value = "api_key") - }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Pet not found") }) - @RequestMapping(value = "/{petId}?testing_byte_array=true", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable> petPetIdtestingByteArraytrueGet( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("petId") Long petId - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java index a664cac3c60..5063976abb9 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/StoreApi.java @@ -34,78 +34,15 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public interface StoreApi { - - - @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { - @Authorization(value = "api_key") - }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/inventory", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable>> getInventory() - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity>(HttpStatus.OK); - } - - - - @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, authorizations = { - @Authorization(value = "test_api_client_id"), - @Authorization(value = "test_api_client_secret") - }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid Order") }) - @RequestMapping(value = "/order", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.POST) - default Callable> placeOrder( - -@ApiParam(value = "order placed for purchasing the pet" ) @RequestBody Order body -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, authorizations = { - @Authorization(value = "test_api_key_query"), - @Authorization(value = "test_api_key_header") - }) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid ID supplied"), - @ApiResponse(code = 404, message = "Order not found") }) - @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable> getOrderById( -@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") String orderId - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid ID supplied"), @ApiResponse(code = 404, message = "Order not found") }) @RequestMapping(value = "/order/{orderId}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) default Callable> deleteOrder( @@ -117,5 +54,57 @@ public interface StoreApi { return () -> new ResponseEntity(HttpStatus.OK); } - + + @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { + @Authorization(value = "api_key") + }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/inventory", + produces = { "application/json" }, + + method = RequestMethod.GET) + default Callable>> getInventory() + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity>(HttpStatus.OK); + } + + + @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation"), + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) + @RequestMapping(value = "/order/{orderId}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + default Callable> getOrderById( +@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("orderId") Long orderId + +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation"), + @ApiResponse(code = 400, message = "Invalid Order") }) + @RequestMapping(value = "/order", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.POST) + default Callable> placeOrder( + +@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @RequestBody Order body +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java index d0fb1070a6f..73c8893c5cf 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/UserApi.java @@ -34,151 +34,66 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public interface UserApi { - @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) default Callable> createUser( -@ApiParam(value = "Created user object" ) @RequestBody User body +@ApiParam(value = "Created user object" ,required=true ) @RequestBody User body ) throws NotFoundException { // do some magic! return () -> new ResponseEntity(HttpStatus.OK); } - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithArray", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) default Callable> createUsersWithArrayInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! return () -> new ResponseEntity(HttpStatus.OK); } - @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/createWithList", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.POST) default Callable> createUsersWithListInput( -@ApiParam(value = "List of user object" ) @RequestBody List body +@ApiParam(value = "List of user object" ,required=true ) @RequestBody List body ) throws NotFoundException { // do some magic! return () -> new ResponseEntity(HttpStatus.OK); } - - - @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid username/password supplied") }) - @RequestMapping(value = "/login", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable> loginUser(@ApiParam(value = "The user name for login") @RequestParam(value = "username", required = false) String username - - -, - @ApiParam(value = "The password for login in clear text") @RequestParam(value = "password", required = false) String password - - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/logout", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable> logoutUser() - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Get user by user name", notes = "", response = User.class) - @ApiResponses(value = { - @ApiResponse(code = 200, message = "successful operation"), - @ApiResponse(code = 400, message = "Invalid username supplied"), - @ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.GET) - default Callable> getUserByName( -@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true ) @PathVariable("username") String username - -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - - - @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) - @ApiResponses(value = { - @ApiResponse(code = 400, message = "Invalid user supplied"), - @ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, - - method = RequestMethod.PUT) - default Callable> updateUser( -@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username - -, - - -@ApiParam(value = "Updated user object" ) @RequestBody User body -) - throws NotFoundException { - // do some magic! - return () -> new ResponseEntity(HttpStatus.OK); - } - - @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class) @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid username supplied"), @ApiResponse(code = 404, message = "User not found") }) @RequestMapping(value = "/{username}", - produces = { "application/json", "application/xml" }, + produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) default Callable> deleteUser( @@ -190,5 +105,81 @@ public interface UserApi { return () -> new ResponseEntity(HttpStatus.OK); } - + + @ApiOperation(value = "Get user by user name", notes = "", response = User.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation"), + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) + @RequestMapping(value = "/{username}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + default Callable> getUserByName( +@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username + +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation"), + @ApiResponse(code = 400, message = "Invalid username/password supplied") }) + @RequestMapping(value = "/login", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + default Callable> loginUser(@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username + + +, + @ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password + + +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/logout", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.GET) + default Callable> logoutUser() + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid user supplied"), + @ApiResponse(code = 404, message = "User not found") }) + @RequestMapping(value = "/{username}", + produces = { "application/xml", "application/json" }, + + method = RequestMethod.PUT) + default Callable> updateUser( +@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username + +, + + +@ApiParam(value = "Updated user object" ,required=true ) @RequestBody User body +) + throws NotFoundException { + // do some magic! + return () -> new ResponseEntity(HttpStatus.OK); + } + } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java index 0069b4ee73e..9573f7880f8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -18,13 +18,13 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { ApiInfo apiInfo = new ApiInfo( "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 is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.", "1.0.0", "", "apiteam@swagger.io", diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 491739a2ad0..7673f5afbcb 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java index dfa0e46a747..f8658aaaa29 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index fd2cd4c5667..aab4bf2e7d1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ApiResponse.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ApiResponse.java new file mode 100644 index 00000000000..c7fe864003b --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/ApiResponse.java @@ -0,0 +1,84 @@ +package io.swagger.model; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import io.swagger.annotations.*; +import com.fasterxml.jackson.annotation.JsonProperty; + +import java.util.Objects; + + +@ApiModel(description = "") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") +public class ApiResponse { + + private Integer code = null; + private String type = null; + private String message = null; + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("code") + public Integer getCode() { + return code; + } + public void setCode(Integer code) { + this.code = code; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("type") + public String getType() { + return type; + } + public void setType(String type) { + this.type = type; + } + + /** + **/ + @ApiModelProperty(value = "") + @JsonProperty("message") + public String getMessage() { + return message; + } + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ApiResponse apiResponse = (ApiResponse) o; + return Objects.equals(code, apiResponse.code) && + Objects.equals(type, apiResponse.type) && + Objects.equals(message, apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @Override + public String toString() { + StringBuilder 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(); + } +} diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java index a88265302f8..f4690dd7900 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Category.java @@ -10,13 +10,12 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class Category { private Long id = null; private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -28,7 +27,6 @@ public class Category { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -40,7 +38,6 @@ public class Category { this.name = name; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java index 2d17233f461..8b5355db47f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Order.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class Order { private Long id = null; @@ -23,9 +23,8 @@ public class Order { }; private StatusEnum status = null; - private Boolean complete = null; + private Boolean complete = false; - /** **/ @ApiModelProperty(value = "") @@ -37,7 +36,6 @@ public class Order { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -49,7 +47,6 @@ public class Order { this.petId = petId; } - /** **/ @ApiModelProperty(value = "") @@ -61,7 +58,6 @@ public class Order { this.quantity = quantity; } - /** **/ @ApiModelProperty(value = "") @@ -73,7 +69,6 @@ public class Order { this.shipDate = shipDate; } - /** * Order Status **/ @@ -86,7 +81,6 @@ public class Order { this.status = status; } - /** **/ @ApiModelProperty(value = "") @@ -98,7 +92,6 @@ public class Order { this.complete = complete; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java index 0ef203c0e0b..e767e6f079c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Pet.java @@ -14,7 +14,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class Pet { private Long id = null; @@ -28,7 +28,6 @@ public class Pet { private StatusEnum status = null; - /** **/ @ApiModelProperty(value = "") @@ -40,7 +39,6 @@ public class Pet { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -52,7 +50,6 @@ public class Pet { this.category = category; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -64,7 +61,6 @@ public class Pet { this.name = name; } - /** **/ @ApiModelProperty(required = true, value = "") @@ -76,7 +72,6 @@ public class Pet { this.photoUrls = photoUrls; } - /** **/ @ApiModelProperty(value = "") @@ -88,7 +83,6 @@ public class Pet { this.tags = tags; } - /** * pet status in the store **/ @@ -101,7 +95,6 @@ public class Pet { this.status = status; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java index 1cdbf92b021..9b7bd88ad3c 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/Tag.java @@ -10,13 +10,12 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class Tag { private Long id = null; private String name = null; - /** **/ @ApiModelProperty(value = "") @@ -28,7 +27,6 @@ public class Tag { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -40,7 +38,6 @@ public class Tag { this.name = name; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java index 49c4e4c3b46..f05fe4b6099 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/User.java @@ -10,7 +10,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-02-26T13:59:02.543Z") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:50:52.711+08:00") public class User { private Long id = null; @@ -22,7 +22,6 @@ public class User { private String phone = null; private Integer userStatus = null; - /** **/ @ApiModelProperty(value = "") @@ -34,7 +33,6 @@ public class User { this.id = id; } - /** **/ @ApiModelProperty(value = "") @@ -46,7 +44,6 @@ public class User { this.username = username; } - /** **/ @ApiModelProperty(value = "") @@ -58,7 +55,6 @@ public class User { this.firstName = firstName; } - /** **/ @ApiModelProperty(value = "") @@ -70,7 +66,6 @@ public class User { this.lastName = lastName; } - /** **/ @ApiModelProperty(value = "") @@ -82,7 +77,6 @@ public class User { this.email = email; } - /** **/ @ApiModelProperty(value = "") @@ -94,7 +88,6 @@ public class User { this.password = password; } - /** **/ @ApiModelProperty(value = "") @@ -106,7 +99,6 @@ public class User { this.phone = phone; } - /** * User Status **/ @@ -119,7 +111,6 @@ public class User { this.userStatus = userStatus; } - @Override public boolean equals(Object o) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java index 35a4d8dd806..74ea4cbc4c7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java index 8e404f707a0..d174ef951f4 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class ApiOriginFilter implements javax.servlet.Filter { @Override public void doFilter(ServletRequest request, ServletResponse response, diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java index 96bda78c904..d53fb5b1bf7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package io.swagger.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java index 47f0b9857d3..077573dfcd5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/NotFoundException.java @@ -1,6 +1,6 @@ package io.swagger.api; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java index 224ea8d5d08..3db41f8b7b1 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/PetApi.java @@ -32,7 +32,7 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/pet", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/pet", description = "the pet API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class PetApi { @ApiOperation(value = "Add a new pet to the store", notes = "", response = Void.class, authorizations = { @@ -42,8 +42,8 @@ public class PetApi { }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping(value = "", + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) @@ -64,8 +64,8 @@ public class PetApi { }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value") }) - @RequestMapping(value = "/{petId}", + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid pet value", response = Void.class) }) + @RequestMapping(value = "/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) @@ -90,9 +90,9 @@ public class PetApi { }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value") }) - @RequestMapping(value = "/findByStatus", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Pet.class) }) + @RequestMapping(value = "/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -113,9 +113,9 @@ public class PetApi { }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value") }) - @RequestMapping(value = "/findByTags", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Pet.class) }) + @RequestMapping(value = "/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -133,10 +133,10 @@ public class PetApi { @Authorization(value = "api_key") }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found") }) - @RequestMapping(value = "/{petId}", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Pet.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Pet.class) }) + @RequestMapping(value = "/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -157,10 +157,10 @@ public class PetApi { }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found"), - @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception") }) - @RequestMapping(value = "", + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) + @RequestMapping(value = "", produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) @@ -181,8 +181,8 @@ public class PetApi { }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input") }) - @RequestMapping(value = "/{petId}", + @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) + @RequestMapping(value = "/{petId}", produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) @@ -213,8 +213,8 @@ public class PetApi { }) }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/{petId}/uploadImage", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ApiResponse.class) }) + @RequestMapping(value = "/{petId}/uploadImage", produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java index b1071168eb2..916532b6bce 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/StoreApi.java @@ -31,14 +31,14 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/store", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/store", description = "the store API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class StoreApi { @ApiOperation(value = "Delete purchase order by ID", notes = "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors", response = Void.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found") }) - @RequestMapping(value = "/order/{orderId}", + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Void.class) }) + @RequestMapping(value = "/order/{orderId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) @@ -56,8 +56,8 @@ public class StoreApi { @Authorization(value = "api_key") }) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/inventory", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Integer.class) }) + @RequestMapping(value = "/inventory", produces = { "application/json" }, method = RequestMethod.GET) @@ -70,10 +70,10 @@ public class StoreApi { @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found") }) - @RequestMapping(value = "/order/{orderId}", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid ID supplied", response = Order.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "Order not found", response = Order.class) }) + @RequestMapping(value = "/order/{orderId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -89,9 +89,9 @@ public class StoreApi { @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order") }) - @RequestMapping(value = "/order", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Order.class) }) + @RequestMapping(value = "/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java index d121b2ee27d..c7bd55fd05b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/UserApi.java @@ -31,13 +31,13 @@ import static org.springframework.http.MediaType.*; @Controller @RequestMapping(value = "/user", produces = {APPLICATION_JSON_VALUE}) @Api(value = "/user", description = "the user API") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class UserApi { @ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) @@ -53,8 +53,8 @@ public class UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/createWithArray", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) @@ -70,8 +70,8 @@ public class UserApi { @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/createWithList", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) @@ -87,9 +87,9 @@ public class UserApi { @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/{username}", + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) @@ -105,10 +105,10 @@ public class UserApi { @ApiOperation(value = "Get user by user name", notes = "", response = User.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/{username}", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = User.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = User.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = User.class) }) + @RequestMapping(value = "/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -124,9 +124,9 @@ public class UserApi { @ApiOperation(value = "Logs user into the system", notes = "", response = String.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation"), - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied") }) - @RequestMapping(value = "/login", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = String.class), + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username/password supplied", response = String.class) }) + @RequestMapping(value = "/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -146,8 +146,8 @@ public class UserApi { @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation") }) - @RequestMapping(value = "/logout", + @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) + @RequestMapping(value = "/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) @@ -160,9 +160,9 @@ public class UserApi { @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class) @io.swagger.annotations.ApiResponses(value = { - @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied"), - @io.swagger.annotations.ApiResponse(code = 404, message = "User not found") }) - @RequestMapping(value = "/{username}", + @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid user supplied", response = Void.class), + @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) + @RequestMapping(value = "/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java index ce9f55730f6..2e99e717296 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerConfig.java @@ -18,7 +18,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; @EnableSwagger2 //Loads the spring beans required by the framework @PropertySource("classpath:swagger.properties") @Import(SwaggerUiConfiguration.class) -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class SwaggerConfig { @Bean ApiInfo apiInfo() { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java index 97f36a314a6..e552ecc15fb 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/SwaggerUiConfiguration.java @@ -8,7 +8,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter @Configuration @EnableWebMvc -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class SwaggerUiConfiguration extends WebMvcConfigurerAdapter { private static final String[] SERVLET_RESOURCE_LOCATIONS = { "/" }; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java index 145e1702c36..ea9b029ba8d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebApplication.java @@ -2,7 +2,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class WebApplication extends AbstractAnnotationConfigDispatcherServletInitializer { @Override diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java index a28af377e32..61bfeda1555 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/configuration/WebMvcConfiguration.java @@ -3,7 +3,7 @@ package io.swagger.configuration; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class WebMvcConfiguration extends WebMvcConfigurationSupport { @Override public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) { diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java index f63be372820..31e09116e3a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/ApiResponse.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class ApiResponse { private Integer code = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java index f19ad61729d..a59702faace 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Category.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class Category { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java index 17ca86f79d5..9dd2d718ba3 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Order.java @@ -13,7 +13,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class Order { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java index 237334cecd8..2a85f8f23c5 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Pet.java @@ -16,7 +16,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class Pet { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java index 198c82110d2..911ea429dc7 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/Tag.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class Tag { private Long id = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java index 0d016a705a6..1bb2c285432 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/User.java @@ -11,7 +11,7 @@ import java.util.Objects; @ApiModel(description = "") -@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-15T00:38:43.027+08:00") +@javax.annotation.Generated(value = "class io.swagger.codegen.languages.SpringMVCServerCodegen", date = "2016-04-17T17:49:05.879+08:00") public class User { private Long id = null;