updated package

This commit is contained in:
Tony Tam 2015-06-06 23:43:34 -07:00
parent 44af46c9b3
commit 0c1657d744
83 changed files with 1246 additions and 1636 deletions

View File

@ -154,7 +154,7 @@ Great for creating libraries on your ci server, from the [Swagger Editor](http:/
There are different aspects of customizing the code generator beyond just creating or modifying templates. Each language has a supporting configuration file to handle different type mappings, etc:
```
$ ls -1 modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/
$ ls -1 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/
AndroidClientCodegen.java
AsyncScalaClientCodegen.java
CSharpClientCodegen.java
@ -237,7 +237,7 @@ To change, for example, the prefix for the Objective-C generated files, simply s
```
package com.mycompany.swagger.codegen;
import com.wordnik.swagger.codegen.languages.*;
import io.swagger.codegen.languages.*;
public class MyObjcCodegen extends ObjcClientCodegen {
static {

View File

@ -1,9 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>com.wordnik</groupId>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-project</artifactId>
<version>2.1.1-M2-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../..</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -30,7 +30,7 @@
<configuration>
<archive>
<manifest>
<mainClass>com.wordnik.swagger.codegen.SwaggerCodegen</mainClass>
<mainClass>io.swagger.codegen.SwaggerCodegen</mainClass>
</manifest>
</archive>
</configuration>
@ -74,7 +74,7 @@
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen</artifactId>
<version>${project.version}</version>
</dependency>

View File

@ -1,37 +0,0 @@
package com.wordnik.swagger.codegen;
import com.wordnik.swagger.codegen.cmd.ConfigHelp;
import com.wordnik.swagger.codegen.cmd.Generate;
import com.wordnik.swagger.codegen.cmd.Langs;
import com.wordnik.swagger.codegen.cmd.Meta;
import io.airlift.airline.Cli;
import io.airlift.airline.Help;
/**
* User: lanwen
* Date: 24.03.15
* Time: 17:56
*
* Command line interface for swagger codegen
* use `swagger-codegen-cli.jar help` for more info
*
* @since 2.1.3-M1
*/
public class SwaggerCodegen {
public static void main(String[] args) {
Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("swagger")
.withDescription("Swagger code generator CLI. More info on swagger.io")
.withDefaultCommand(Langs.class)
.withCommands(
Generate.class,
Meta.class,
Langs.class,
Help.class,
ConfigHelp.class
);
builder.build().parse(args).run();
}
}

View File

@ -1,49 +0,0 @@
package com.wordnik.swagger.codegen.cmd;
import com.wordnik.swagger.codegen.CliOption;
import com.wordnik.swagger.codegen.CodegenConfig;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import java.util.ServiceLoader;
import static java.util.ServiceLoader.load;
@Command(name = "config-help", description = "Config help for chosen lang")
public class ConfigHelp implements Runnable {
@Option(name = {"-l", "--lang"}, title = "language", required = true,
description = "language to get config help for")
private String lang;
@Override
public void run() {
System.out.println();
CodegenConfig config = forName(lang);
System.out.println("CONFIG OPTIONS");
for (CliOption langCliOption : config.cliOptions()) {
System.out.println("\t" + langCliOption.getOpt());
System.out.println("\t " + langCliOption.getDescription());
System.out.println();
}
}
/**
* Tries to load config class with SPI first, then with class name directly from classpath
* @param name name of config, or full qualified class name in classpath
* @return config class
*/
private static CodegenConfig forName(String name) {
ServiceLoader<CodegenConfig> loader = load(CodegenConfig.class);
for (CodegenConfig config : loader) {
if (config.getName().equals(name)) {
return config;
}
}
// else try to load directly
try {
return (CodegenConfig) Class.forName(name).newInstance();
} catch (Exception e) {
throw new RuntimeException("Can't load config class with name ".concat(name), e);
}
}
}

View File

@ -1,156 +0,0 @@
package com.wordnik.swagger.codegen.cmd;
import com.wordnik.swagger.codegen.CliOption;
import com.wordnik.swagger.codegen.ClientOptInput;
import com.wordnik.swagger.codegen.ClientOpts;
import com.wordnik.swagger.codegen.CodegenConfig;
import com.wordnik.swagger.codegen.DefaultGenerator;
import com.wordnik.swagger.models.Swagger;
import config.Config;
import config.ConfigParser;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import io.swagger.parser.SwaggerParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.ServiceLoader;
import static java.util.ServiceLoader.load;
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
/**
* User: lanwen
* Date: 24.03.15
* Time: 20:22
*/
@Command(name = "generate", description = "Generate code with chosen lang")
public class Generate implements Runnable {
public static final Logger LOG = LoggerFactory.getLogger(Generate.class);
public static final String TEMPLATE_DIR_PARAM = "templateDir";
@Option(name = {"-v", "--verbose"}, description = "verbose mode")
private boolean verbose;
@Option(name = {"-l", "--lang"}, title = "language", required = true,
description = "client language to generate (maybe class name in classpath, required)")
private String lang;
@Option(name = {"-o", "--output"}, title = "output directory",
description = "where to write the generated files (current dir by default)")
private String output = "";
@Option(name = {"-i", "--input-spec"}, title = "spec file", required = true,
description = "location of the swagger spec, as URL or file (required)")
private String spec;
@Option(name = {"-t", "--template-dir"}, title = "template directory",
description = "folder containing the template files")
private String templateDir;
@Option(name = {"-a", "--auth"}, title = "authorization",
description = "adds authorization headers when fetching the swagger definitions remotely. " +
"Pass in a URL-encoded string of name:header with a comma separating multiple values")
private String auth;
@Option( name= {"-D"}, title = "system properties", description = "sets specified system properties in " +
"the format of name=value,name=value")
private String systemProperties;
@Option( name= {"-c", "--config"}, title = "configuration file", description = "Path to json configuration file. " +
"File content should be in a json format {\"optionKey\":\"optionValue\", \"optionKey1\":\"optionValue1\"...} " +
"Supported options can be different for each language. Run config-help -l {lang} command for language specific config options.")
private String configFile;
@Override
public void run() {
verbosed(verbose);
setSystemProperties();
ClientOptInput input = new ClientOptInput();
if (isNotEmpty(auth)) {
input.setAuth(auth);
}
CodegenConfig config = forName(lang);
config.setOutputDir(new File(output).getAbsolutePath());
if (null != templateDir) {
config.additionalProperties().put(TEMPLATE_DIR_PARAM, new File(templateDir).getAbsolutePath());
}
if(null != configFile){
Config genConfig = ConfigParser.read(configFile);
if (null != genConfig) {
for (CliOption langCliOption : config.cliOptions()) {
if (genConfig.hasOption(langCliOption.getOpt())) {
config.additionalProperties().put(langCliOption.getOpt(), genConfig.getOption(langCliOption.getOpt()));
}
}
}
}
input.setConfig(config);
Swagger swagger = new SwaggerParser().read(spec, input.getAuthorizationValues(), true);
new DefaultGenerator().opts(input.opts(new ClientOpts()).swagger(swagger)).generate();
}
private void setSystemProperties() {
if( systemProperties != null && systemProperties.length() > 0 ){
for( String property : systemProperties.split(",")) {
int ix = property.indexOf('=');
if( ix > 0 && ix < property.length()-1 ){
System.setProperty( property.substring(0, ix), property.substring(ix+1) );
}
}
}
}
/**
* If true parameter, adds system properties which enables debug mode in generator
* @param verbose - if true, enables debug mode
*/
private void verbosed(boolean verbose) {
if (!verbose) {
return;
}
LOG.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
"\n - [debugSwagger] prints the swagger specification as interpreted by the codegen" +
"\n - [debugModels] prints models passed to the template engine" +
"\n - [debugOperations] prints operations passed to the template engine" +
"\n - [debugSupportingFiles] prints additional data passed to the template engine");
System.setProperty("debugSwagger", "");
System.setProperty("debugModels", "");
System.setProperty("debugOperations", "");
System.setProperty("debugSupportingFiles", "");
}
/**
* Tries to load config class with SPI first, then with class name directly from classpath
* @param name name of config, or full qualified class name in classpath
* @return config class
*/
private static CodegenConfig forName(String name) {
ServiceLoader<CodegenConfig> loader = load(CodegenConfig.class);
for (CodegenConfig config : loader) {
if (config.getName().equals(name)) {
return config;
}
}
// else try to load directly
try {
return (CodegenConfig) Class.forName(name).newInstance();
} catch (Exception e) {
throw new RuntimeException("Can't load config class with name ".concat(name), e);
}
}
}

View File

@ -1,23 +0,0 @@
package com.wordnik.swagger.codegen.cmd;
import ch.lambdaj.collection.LambdaIterable;
import com.wordnik.swagger.codegen.CodegenConfig;
import io.airlift.airline.Command;
import static ch.lambdaj.Lambda.on;
import static ch.lambdaj.collection.LambdaCollections.with;
import static java.util.ServiceLoader.load;
/**
* User: lanwen
* Date: 24.03.15
* Time: 20:25
*/
@Command(name = "langs", description = "Shows available langs")
public class Langs implements Runnable {
@Override
public void run() {
LambdaIterable<String> langs = with(load(CodegenConfig.class)).extract(on(CodegenConfig.class).getName());
System.out.printf("Available languages: %s%n", langs);
}
}

View File

@ -1,144 +0,0 @@
package com.wordnik.swagger.codegen.cmd;
import ch.lambdaj.function.convert.Converter;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.samskivert.mustache.Mustache;
import com.wordnik.swagger.codegen.DefaultGenerator;
import com.wordnik.swagger.codegen.SupportingFile;
import io.airlift.airline.Command;
import io.airlift.airline.Option;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.util.List;
import java.util.Map;
import static ch.lambdaj.collection.LambdaCollections.with;
import static com.google.common.base.Joiner.on;
/**
* User: lanwen
* Date: 24.03.15
* Time: 20:22
*/
@Command(name = "meta", description = "MetaGenerator. Generator for creating a new template set " +
"and configuration for Codegen. The output will be based on the language you " +
"specify, and includes default templates to include.")
public class Meta implements Runnable {
private static final Logger LOG = LoggerFactory.getLogger(Meta.class);
private static final String TEMPLATE_DIR_CLASSPATH = "codegen";
private static final String MUSTACHE_EXTENSION = ".mustache";
@Option(name = {"-o", "--output"}, title = "output directory",
description = "where to write the generated files (current dir by default)")
private String outputFolder = "";
@Option(name = {"-n", "--name"}, title = "name",
description = "the human-readable name of the generator")
private String name = "default";
@Option(name = {"-p", "--package"}, title = "package",
description = "the package to put the main class into (defaults to com.wordnik.swagger.codegen)")
private String targetPackage = "com.wordnik.swagger.codegen";
@Override
public void run() {
final File targetDir = new File(outputFolder);
LOG.info("writing to folder [{}]", targetDir.getAbsolutePath());
String mainClass = StringUtils.capitalize(name) + "Generator";
List<SupportingFile> supportingFiles = ImmutableList.of(
new SupportingFile("pom.mustache", "", "pom.xml"),
new SupportingFile("generatorClass.mustache",
on(File.separator).join("src/main/java", asPath(targetPackage)), mainClass.concat(".java")),
new SupportingFile("README.mustache", "", "README.md"),
new SupportingFile("api.template", "src/main/resources" + File.separator + name, "api.mustache"),
new SupportingFile("model.template", "src/main/resources" + File.separator + name, "model.mustache"),
new SupportingFile("services.mustache",
"src/main/resources/META-INF/services", "com.wordnik.swagger.codegen.CodegenConfig")
);
Map<String, Object> data = new ImmutableMap.Builder<String, Object>()
.put("generatorPackage", targetPackage)
.put("generatorClass", mainClass)
.put("name", name)
.put("fullyQualifiedGeneratorClass", targetPackage + "." + mainClass).build();
with(supportingFiles).convert(processFiles(targetDir, data));
}
/**
* Converter method to process supporting files: execute with mustache,
* or simply copy to destination directory
* @param targetDir - destination directory
* @param data - map with additional params needed to process templates
* @return converter object to pass to lambdaj
*/
private Converter<SupportingFile, File> processFiles(final File targetDir, final Map<String, Object> data) {
return new Converter<SupportingFile, File>() {
private DefaultGenerator generator = new DefaultGenerator();
@Override
public File convert(SupportingFile support) {
try {
File destinationFolder = new File(new File(targetDir.getAbsolutePath()), support.folder);
File outputFile = new File(destinationFolder, support.destinationFilename);
String template = generator
.readTemplate(new File(TEMPLATE_DIR_CLASSPATH, support.templateFile).getPath());
String formatted = template;
if (support.templateFile.endsWith(MUSTACHE_EXTENSION)) {
LOG.info("writing file to {}", outputFile.getAbsolutePath());
formatted = Mustache.compiler().withLoader(loader(generator))
.defaultValue("")
.compile(template)
.execute(data);
} else {
LOG.info("copying file to {}", outputFile.getAbsolutePath());
}
FileUtils.writeStringToFile(outputFile, formatted);
return outputFile;
} catch (IOException e) {
throw new RuntimeException("Can't generate project", e);
}
}
};
}
/**
* Creates mustache loader for template using classpath loader
* @param generator - class with reader getter
* @return loader for template
*/
private Mustache.TemplateLoader loader(final DefaultGenerator generator) {
return new Mustache.TemplateLoader() {
public Reader getTemplate(String name) {
return generator.getTemplateReader(TEMPLATE_DIR_CLASSPATH
+ File.separator + name.concat(MUSTACHE_EXTENSION));
}
};
}
/**
* Converts package name to path on file system
* @param packageName - package name to convert
* @return relative path
*/
private String asPath(String packageName) {
return packageName.replace(".", File.separator);
}
}

View File

@ -5,7 +5,7 @@
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<logger name="com.wordnik" level="debug"/>
<logger name="io.swagger" level="debug"/>
<root level="error">
<appender-ref ref="STDOUT" />
</root>

View File

@ -22,7 +22,7 @@ public class AkkaScalaClientCodegen extends DefaultCodegen implements CodegenCon
protected String mainPackage = "io.swagger.client";
protected String invokerPackage = mainPackage + ".core";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-client";
protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/scala";

View File

@ -8,7 +8,7 @@ import java.io.File;
public class AsyncScalaClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String invokerPackage = "io.swagger.client";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-async-scala-client";
protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/scala";

View File

@ -9,7 +9,7 @@ import java.io.File;
public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String invokerPackage = "SwaggerClient";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-client";
protected String artifactVersion = "1.0.0";

View File

@ -9,7 +9,7 @@ import java.io.File;
public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String invokerPackage = "com.wordnik.client";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-client";
protected String artifactVersion = "1.0.0";

View File

@ -8,7 +8,7 @@ import java.io.File;
public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig {
protected String invokerPackage = "io.swagger.client";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-scala-client";
protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/scala";

View File

@ -9,7 +9,7 @@ import java.io.File;
public class ScalatraServerCodegen extends DefaultCodegen implements CodegenConfig {
protected String invokerPackage = "com.wordnik.client";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-client";
protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/scala";

View File

@ -32,7 +32,7 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen
}
public SpringMVCServerCodegen() {
super();
super.processOpts();
outputFolder = "generated-code/javaSpringMVC";
modelTemplateFiles.put("model.mustache", ".java");
apiTemplateFiles.put("api.mustache", ".java");
@ -50,6 +50,22 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen
additionalProperties.put("apiPackage", apiPackage);
additionalProperties.put("configPackage", configPackage);
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"String",
"boolean",
"Boolean",
"Double",
"Integer",
"Long",
"Float")
);
}
@Override
public void processOpts() {
super.processOpts();
supportingFiles.clear();
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
@ -73,16 +89,6 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen
supportingFiles.add(new SupportingFile("swagger.properties",
("src.main.resources").replace(".", java.io.File.separator), "swagger.properties"));
languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"String",
"boolean",
"Boolean",
"Double",
"Integer",
"Long",
"Float")
);
}
@Override

View File

@ -8,7 +8,7 @@ import java.io.File;
public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
protected String invokerPackage = "com.wordnik.client";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-client";
protected String artifactVersion = "1.0.0";
protected String sourceFolder = "docs";

View File

@ -11,7 +11,7 @@ import java.io.File;
public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig {
private static final String ALL_OPERATIONS = "";
protected String invokerPackage = "com.wordnik.client";
protected String groupId = "com.wordnik";
protected String groupId = "io.swagger";
protected String artifactId = "swagger-client";
protected String artifactVersion = "1.0.0";
protected String sourceFolder = "src/main/scala";

View File

@ -3,7 +3,7 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import com.wordnik.swagger.annotations.*;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
{{#models}}

View File

@ -4,7 +4,7 @@ import {{modelPackage}}.*;
import {{package}}.{{classname}}Service;
import {{package}}.factories.{{classname}}ServiceFactory;
import com.wordnik.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import com.sun.jersey.multipart.FormDataParam;
@ -25,7 +25,7 @@ import javax.ws.rs.*;
@Path("/{{baseName}}")
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@com.wordnik.swagger.annotations.Api(value = "/{{baseName}}", description = "the {{baseName}} API")
@io.swagger.annotations.Api(value = "/{{baseName}}", description = "the {{baseName}} API")
{{#operations}}
public class {{classname}} {
@ -36,9 +36,9 @@ public class {{classname}} {
{{#subresourceOperation}}@Path("{{path}}"){{/subresourceOperation}}
{{#hasConsumes}}@Consumes({ {{#consumes}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}}
{{#hasProduces}}@Produces({ {{#produces}}"{{mediaType}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }){{/hasProduces}}
@com.wordnik.swagger.annotations.ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}})
@com.wordnik.swagger.annotations.ApiResponses(value = { {{#responses}}
@com.wordnik.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},
@io.swagger.annotations.ApiOperation(value = "{{{summary}}}", notes = "{{{notes}}}", response = {{{returnType}}}.class{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}})
@io.swagger.annotations.ApiResponses(value = { {{#responses}}
@io.swagger.annotations.ApiResponse(code = {{{code}}}, message = "{{{message}}}"){{#hasMore}},
{{/hasMore}}{{/responses}} })
public Response {{nickname}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},

View File

@ -3,7 +3,7 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import com.wordnik.swagger.annotations.*;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
{{#models}}

View File

@ -8,7 +8,7 @@
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.wordnik.swagger.jaxrs.json;com.wordnik.swagger.jaxrs.listing;{{apiPackage}}</param-value>
<param-value>io.swagger.jaxrs.json;io.swagger.jaxrs.listing;{{apiPackage}}</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.spi.container.ContainerRequestFilters</param-name>
@ -23,7 +23,7 @@
<servlet>
<servlet-name>DefaultJaxrsConfig</servlet-name>
<servlet-class>com.wordnik.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
<servlet-class>io.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
<init-param>
<param-name>api.version</param-name>
<param-value>1.0.0</param-value>

View File

@ -5,11 +5,11 @@ import {{modelPackage}}.*;
{{#imports}}import {{import}};
{{/imports}}
import com.wordnik.swagger.annotations.Api;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import com.wordnik.swagger.annotations.ApiResponse;
import com.wordnik.swagger.annotations.ApiResponses;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;

View File

@ -3,7 +3,7 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import com.wordnik.swagger.annotations.*;
import io.swagger.annotations.*;
import com.fasterxml.jackson.annotation.JsonProperty;
{{#models}}

View File

@ -1,24 +0,0 @@
com.wordnik.swagger.codegen.languages.AndroidClientCodegen
com.wordnik.swagger.codegen.languages.AsyncScalaClientCodegen
com.wordnik.swagger.codegen.languages.CSharpClientCodegen
com.wordnik.swagger.codegen.languages.JavaClientCodegen
com.wordnik.swagger.codegen.languages.JaxRSServerCodegen
com.wordnik.swagger.codegen.languages.NodeJSServerCodegen
com.wordnik.swagger.codegen.languages.ObjcClientCodegen
com.wordnik.swagger.codegen.languages.PerlClientCodegen
com.wordnik.swagger.codegen.languages.PhpClientCodegen
com.wordnik.swagger.codegen.languages.PythonClientCodegen
com.wordnik.swagger.codegen.languages.Python3ClientCodegen
com.wordnik.swagger.codegen.languages.Qt5CPPGenerator
com.wordnik.swagger.codegen.languages.RetrofitClientCodegen
com.wordnik.swagger.codegen.languages.RubyClientCodegen
com.wordnik.swagger.codegen.languages.ScalaClientCodegen
com.wordnik.swagger.codegen.languages.ScalatraServerCodegen
com.wordnik.swagger.codegen.languages.SpringMVCServerCodegen
com.wordnik.swagger.codegen.languages.StaticDocCodegen
com.wordnik.swagger.codegen.languages.StaticHtmlGenerator
com.wordnik.swagger.codegen.languages.SwaggerGenerator
com.wordnik.swagger.codegen.languages.SwaggerYamlGenerator
com.wordnik.swagger.codegen.languages.SwiftGenerator
com.wordnik.swagger.codegen.languages.TizenClientCodegen
com.wordnik.swagger.codegen.languages.AkkaScalaClientCodegen

View File

@ -3,7 +3,7 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import com.wordnik.swagger.annotations.*;
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
{{#models}}

View File

@ -2,7 +2,7 @@ package {{package}}
{{#imports}}import {{import}}
{{/imports}}
import com.wordnik.swagger.client._
import io.swagger.client._
import scala.concurrent.{ Future, Await }
import scala.concurrent.duration._
import collection.mutable

View File

@ -4,7 +4,7 @@ package {{invokerPackage}}
{{/imports}}
import {{apiPackage}}._
import com.wordnik.swagger.client._
import io.swagger.client._
import java.io.Closeable

View File

@ -3,7 +3,7 @@ organization := "{{package}}"
name := "{{projectName}}-client"
libraryDependencies ++= Seq(
"com.wordnik.swagger" %% "swagger-async-httpclient" % "0.3.5",
"io.swagger" %% "swagger-async-httpclient" % "0.3.5",
"joda-time" % "joda-time" % "2.3",
"org.joda" % "joda-convert" % "1.3.1",
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",

View File

@ -26,7 +26,7 @@ At this point, you've likely generated a client setup. It will include somethin
|----- {{name}} // template files
|----- META-INF
|------ services
|------- com.wordnik.swagger.codegen.CodegenConfig
|------- io.swagger.codegen.CodegenConfig
```
You _will_ need to make changes in at least the following:
@ -46,7 +46,7 @@ mvn package
In your generator project. A single jar file will be produced in `target`. You can now use that with codegen:
```
java -cp /path/to/swagger-codegen-distribution:/path/to/your/jar com.wordnik.swagger.codegen.Codegen -l {{name}} -o ./test
java -cp /path/to/swagger-codegen-distribution:/path/to/your/jar io.swagger.codegen.Codegen -l {{name}} -o ./test
```
Now your templates are available to the client generator and you can write output values
@ -67,7 +67,7 @@ the object you have available during client generation:
# -DdebugOperations prints operations passed to the template engine
# -DdebugSupportingFiles prints additional data passed to the template engine
java -DdebugOperations -cp /path/to/swagger-codegen-distribution:/path/to/your/jar com.wordnik.swagger.codegen.Codegen -l {{name}} -o ./test
java -DdebugOperations -cp /path/to/swagger-codegen-distribution:/path/to/your/jar io.swagger.codegen.Codegen -l {{name}} -o ./test
```
Will, for example, output the debug info for operations. You can use this info

View File

@ -1,7 +1,7 @@
package {{generatorPackage}};
import com.wordnik.swagger.codegen.*;
import com.wordnik.swagger.models.properties.*;
import io.swagger.codegen.*;
import io.swagger.models.properties.*;
import java.util.*;
import java.io.File;
@ -16,7 +16,7 @@ public class {{generatorClass}} extends DefaultCodegen implements CodegenConfig
* Configures the type of generator.
*
* @return the CodegenType for this generator
* @see com.wordnik.swagger.codegen.CodegenType
* @see io.swagger.codegen.CodegenType
*/
public CodegenType getTag() {
return CodegenType.CLIENT;
@ -173,7 +173,7 @@ public class {{generatorClass}} extends DefaultCodegen implements CodegenConfig
* either language specific types via `typeMapping` or into complex models if there is not a mapping.
*
* @return a string value of the type or complex model for this property
* @see com.wordnik.swagger.models.properties.Property
* @see io.swagger.models.properties.Property
*/
@Override
public String getSwaggerType(Property p) {

View File

@ -1,5 +1,5 @@
package com.wordnik.swagger.event {
import com.wordnik.swagger.event.Response;
package io.swagger.event {
import io.swagger.event.Response;
import flash.events.Event;

View File

@ -1,4 +1,4 @@
package com.wordnik.swagger.exception
package io.swagger.exception
{
public class ApiError extends Error
{

View File

@ -1,4 +1,4 @@
package com.wordnik.swagger.exception
package io.swagger.exception
{
public class ApiErrorCodes
{

View File

@ -1,11 +1,11 @@
package com.wordnik.swagger.common
package io.swagger.common
{
import asaxb.xml.bind.ASAXBContext;
import asaxb.xml.bind.Unmarshaller;
import com.wordnik.swagger.event.ApiClientEvent;
import com.wordnik.swagger.event.Response;
import com.wordnik.swagger.common.ApiUserCredentials;
import io.swagger.event.ApiClientEvent;
import io.swagger.event.Response;
import io.swagger.common.ApiUserCredentials;
import flash.events.EventDispatcher;
import flash.utils.Dictionary;

View File

@ -1,5 +1,5 @@
package com.wordnik.swagger.common {
import com.wordnik.swagger.common.ApiUserCredentials;
package io.swagger.common {
import io.swagger.common.ApiUserCredentials;
/**
* @private

View File

@ -1,4 +1,4 @@
package com.wordnik.swagger.common {
package io.swagger.common {
/**
* Api account credentials.

View File

@ -1,4 +1,4 @@
package com.wordnik.swagger.common
package io.swagger.common
{
public interface ListWrapper
{

View File

@ -1,4 +1,4 @@
package com.wordnik.swagger.event {
package io.swagger.event {
/**
* Response contains info on the result of an API invocation.

View File

@ -1,6 +1,6 @@
package com.wordnik.swagger.common
package io.swagger.common
{
import com.wordnik.swagger.common.ApiUserCredentials;
import io.swagger.common.ApiUserCredentials;
import flash.events.EventDispatcher;
import flash.events.IEventDispatcher;

View File

@ -1,4 +1,4 @@
package com.wordnik.swagger.common
package io.swagger.common
{
public class XMLWriter
{

View File

@ -1,11 +1,11 @@
package {{package}} {
import com.wordnik.swagger.common.ApiInvoker;
import com.wordnik.swagger.exception.ApiErrorCodes;
import com.wordnik.swagger.exception.ApiError;
import com.wordnik.swagger.common.ApiUserCredentials;
import com.wordnik.swagger.event.Response;
import com.wordnik.swagger.common.SwaggerApi;
import io.swagger.common.ApiInvoker;
import io.swagger.exception.ApiErrorCodes;
import io.swagger.exception.ApiError;
import io.swagger.common.ApiUserCredentials;
import io.swagger.event.Response;
import io.swagger.common.SwaggerApi;
{{#imports}}import {{import}};
{{/imports}}

View File

@ -62,11 +62,11 @@
<arg line="-doc-sources ${sourcepath}"/>
<arg line="-source-path ${sourcepath}"/>
<arg line="-footer 'Copyright Wordnik'"/>
<arg line="-package com.wordnik.swagger.api 'Contains the apis which are used by clients to make calls to the services deployed'"/>
<arg line="-package com.wordnik.swagger.codegen.model 'Contains common classes which encapsulate data elements required'"/>
<arg line="-package com.wordnik.swagger.common 'Contains classes which are used by the api classes to invoke the deployed api like SwaggerApi - a base class, ApiUserCredentials, etc.'"/>
<arg line="-package com.wordnik.swagger.event 'Results of calls made to Wordnik are returned via dispatched events. This package contains such event classes. Right now thats just ApiClientEvent and Response.'"/>
<arg line="-package com.wordnik.swagger.exception 'Contains classes that encapsulate the errors generated'"/>
<arg line="-package io.swagger.api 'Contains the apis which are used by clients to make calls to the services deployed'"/>
<arg line="-package io.swagger.codegen.model 'Contains common classes which encapsulate data elements required'"/>
<arg line="-package io.swagger.common 'Contains classes which are used by the api classes to invoke the deployed api like SwaggerApi - a base class, ApiUserCredentials, etc.'"/>
<arg line="-package io.swagger.event 'Results of calls made to Wordnik are returned via dispatched events. This package contains such event classes. Right now thats just ApiClientEvent and Response.'"/>
<arg line="-package io.swagger.exception 'Contains classes that encapsulate the errors generated'"/>
<arg value="-window-title"/>
<arg value="${title}"/>

View File

@ -1,6 +1,6 @@
package {{package}} {
import com.wordnik.swagger.common.ListWrapper;
import io.swagger.common.ListWrapper;
{{#imports}}import {{import}};
{{/imports}}

View File

@ -5,7 +5,7 @@
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<logger name="com.wordnik" level="DEBUG"/>
<logger name="io.swagger" level="DEBUG"/>
<root level="error">
<appender-ref ref="STDOUT" />
</root>

View File

@ -3,7 +3,7 @@ package {{package}};
{{#imports}}import {{import}};
{{/imports}}
import com.wordnik.swagger.annotations.*;
import io.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;
{{#models}}

View File

@ -1,6 +1,6 @@
import {{apiPackage}}._
import akka.actor.ActorSystem
import com.wordnik.swagger.app.{ResourcesApp, SwaggerApp}
import io.swagger.app.{ResourcesApp, SwaggerApp}
import javax.servlet.ServletContext
import org.scalatra.LifeCycle

View File

@ -1,4 +1,4 @@
package com.wordnik.swagger.app
package io.swagger.app
import _root_.akka.actor.ActorSystem

View File

@ -17,6 +17,5 @@ class SwaggerMigratorTest extends FlatSpec with Matchers {
it should "read a 1.2 spec" in {
val loader = new SwaggerParser()
val swagger = loader.read("src/test/resources/1_2/petstore-1.2/api-docs")
Json.prettyPrint(swagger)
}
}

View File

@ -1,9 +1,9 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.wordnik</groupId>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-project</artifactId>
<version>2.1.1-M2-SNAPSHOT</version>
<version>2.1.1</version>
<relativePath>../..</relativePath>
</parent>
<artifactId>swagger-generator</artifactId>
@ -130,12 +130,12 @@
</build>
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<groupId>io.swagger</groupId>
<artifactId>swagger-jersey2-jaxrs</artifactId>
<version>${swagger-core-version}</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen</artifactId>
<version>${project.parent.version}</version>
</dependency>
@ -149,18 +149,7 @@
<artifactId>logback-core</artifactId>
<version>${logback-version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>
<version>${scala-test-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
@ -213,6 +202,12 @@
<version>${scala-test-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>

View File

@ -1,45 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator;
import com.wordnik.swagger.models.*;
import javax.servlet.http.HttpServlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
public class Bootstrap extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
ServletContext context = config.getServletContext();
DynamicSwaggerConfig bc = new DynamicSwaggerConfig();
bc.setBasePath("/api");
bc.setTitle("Swagger Generator");
bc.setDescription("This is an online swagger codegen server. You can find out more " +
"at <a href=\"https://github.com/wordnik/swagger-generator\">https://github.com/swagger-api/swagger-codegen</a> or on irc.freenode.net, #swagger." +
"http://helloreverb.com/terms/");
bc.setTermsOfServiceUrl("http://helloreverb.com/terms/");
bc.setContact("apiteam@swagger.io");
bc.setLicense("Apache 2.0");
bc.setVersion("1.0.0");
bc.setHost("generator.swagger.io");
bc.setLicenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html");
bc.setResourcePackage("com.wordnik.swagger.generator.resource");
bc.setScan(true);
}
}

View File

@ -1,69 +0,0 @@
package com.wordnik.swagger.generator;
import com.wordnik.swagger.models.*;
import com.wordnik.swagger.models.parameters.*;
import com.wordnik.swagger.models.properties.*;
import com.wordnik.swagger.codegen.*;
import com.wordnik.swagger.util.Json;
import com.wordnik.swagger.jaxrs.config.BeanConfig;
import java.util.*;
public class DynamicSwaggerConfig extends BeanConfig {
static List<String> clients = new ArrayList<String>();
static List<String> servers = new ArrayList<String>();
static {
List<CodegenConfig> extensions = Codegen.getExtensions();
for(CodegenConfig config : extensions) {
if(config.getTag().equals(CodegenType.CLIENT) || config.getTag().equals(CodegenType.DOCUMENTATION)) {
clients.add(config.getName());
}
else if(config.getTag().equals(CodegenType.SERVER)) {
servers.add(config.getName());
}
}
}
@Override
public Swagger configure(Swagger swagger) {
Path clientPath = swagger.getPaths().get("/gen/clients/{language}");
// update the path description based on what clients are available via SPI
if(clientPath != null) {
Operation post = clientPath.getPost();
Parameter framework = post.getParameters().get(0);
if(framework instanceof PathParameter) {
PathParameter param = (PathParameter) framework;
StringBuilder b = new StringBuilder();
for(String client : clients) {
if(b.toString().length() > 0)
b.append(", ");
b.append(client);
}
param.setDescription("available clients: " + b.toString());
}
}
Path serverPath = swagger.getPaths().get("/gen/servers/{framework}");
// update the path description based on what servers are available via SPI
if(serverPath != null) {
Operation post = serverPath.getPost();
Parameter framework = post.getParameters().get(0);
if(framework instanceof PathParameter) {
PathParameter param = (PathParameter) framework;
StringBuilder b = new StringBuilder();
for(String server : servers) {
if(b.toString().length() > 0)
b.append(", ");
b.append(server);
}
param.setDescription("available clients: " + b.toString());
}
}
return swagger.info(getInfo())
.host(getHost())
.basePath("/api");
}
}

View File

@ -1,25 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.exception;
public class ApiException extends Exception{
private int code;
public ApiException (int code, String msg) {
super(msg);
this.code = code;
}
}

View File

@ -1,25 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.exception;
public class BadRequestException extends ApiException {
private int code;
public BadRequestException (int code, String msg) {
super(code, msg);
this.code = code;
}
}

View File

@ -1,25 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.exception;
public class NotFoundException extends ApiException {
private int code;
public NotFoundException (int code, String msg) {
super(code, msg);
this.code = code;
}
}

View File

@ -1,84 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.model;
import javax.xml.bind.annotation.XmlTransient;
@javax.xml.bind.annotation.XmlRootElement
public class ApiResponse {
public static final int ERROR = 1;
public static final int WARNING = 2;
public static final int INFO = 3;
public static final int OK = 4;
public static final int TOO_BUSY = 5;
int code;
String type;
String message;
public ApiResponse(){}
public ApiResponse(int code, String message){
this.code = code;
switch(code){
case ERROR:
setType("error");
break;
case WARNING:
setType("warning");
break;
case INFO:
setType("info");
break;
case OK:
setType("ok");
break;
case TOO_BUSY:
setType("too busy");
break;
default:
setType("unknown");
break;
}
this.message = message;
}
@XmlTransient
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
}

View File

@ -1,36 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.model;
public class Generated {
private String filename;
private String friendlyName;
public String getFilename() {
return filename;
}
public void setFilename(String filename) {
this.filename = filename;
}
public String getFriendlyName() {
return friendlyName;
}
public void setFriendlyName(String friendlyName) {
this.friendlyName = friendlyName;
}
}

View File

@ -1,44 +0,0 @@
package com.wordnik.swagger.generator.model;
import com.wordnik.swagger.annotations.ApiModelProperty;
import com.wordnik.swagger.models.auth.SecuritySchemeDefinition;
import com.fasterxml.jackson.databind.*;
import java.util.*;
public class GeneratorInput {
private JsonNode spec;
private Map<String, String> options;
private String swaggerUrl;
private SecuritySchemeDefinition auth;
@ApiModelProperty(dataType="Object")
public JsonNode getSpec() {
return spec;
}
public void setSpec(JsonNode spec) {
this.spec = spec;
}
public Map<String, String> getOptions() {
return options;
}
public void setOptions(Map<String, String> options) {
this.options = options;
}
public String getSwaggerUrl() {
return swaggerUrl;
}
public void setSwaggerUrl(String url) {
this.swaggerUrl = url;
}
public SecuritySchemeDefinition getSecurityDefinition() {
return auth;
}
public void setSecurityDefinition(SecuritySchemeDefinition auth) {
this.auth = auth;
}
}

View File

@ -1,65 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.model;
public class InputOption {
private String name;
private String description;
private Boolean required;
private String defaultValue;
public InputOption() {}
public InputOption(String name, String description, String defaultValue, Boolean required) {
this.name = name;
this.description = description;
this.defaultValue = defaultValue;
this.required = required;
}
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setDescription(String description) {
this.description = description;
}
public String getDescription() {
return description;
}
public void setRequired(Boolean required) {
this.required = required;
}
public Boolean getRequired() {
return required;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public String getDefaultValue() {
return defaultValue;
}
}

View File

@ -1,26 +0,0 @@
package com.wordnik.swagger.generator.model;
public class ResponseCode {
private String code;
private String link;
public ResponseCode() {}
public ResponseCode(String code, String link) {
setCode(code);
setLink(link);
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
}

View File

@ -1,167 +0,0 @@
package com.wordnik.swagger.generator.online;
import io.swagger.parser.SwaggerParser;
import com.wordnik.swagger.generator.exception.*;
import com.wordnik.swagger.codegen.*;
import com.wordnik.swagger.models.Swagger;
import com.wordnik.swagger.generator.model.*;
import com.wordnik.swagger.util.Json;
import com.wordnik.swagger.generator.util.ZipUtil;
import com.fasterxml.jackson.databind.JsonNode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.List;
import java.util.ArrayList;
public class Generator {
static Logger LOGGER = LoggerFactory.getLogger(Generator.class);
public static String generateClient(String language, GeneratorInput opts) throws ApiException {
Swagger swagger;
LOGGER.debug("generate client for " + language);
if(opts == null) {
throw new BadRequestException(400, "No options were supplied");
}
JsonNode node = opts.getSpec();
if(node == null) {
if(opts.getSwaggerUrl() != null) {
swagger = new SwaggerParser().read(opts.getSwaggerUrl());
}
else
throw new BadRequestException(400, "No swagger specification was supplied");
}
else {
swagger = new SwaggerParser().read(node);
}
if(swagger == null) {
throw new BadRequestException(400, "The swagger specification supplied was not valid");
}
ClientOptInput clientOptInput = new ClientOptInput();
ClientOpts clientOpts = new ClientOpts();
String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + language + "-client";
String outputFilename = outputFolder + "-bundle.zip";
clientOptInput
.opts(clientOpts)
.swagger(swagger);
CodegenConfig codegenConfig = Codegen.getConfig(language);
if(codegenConfig == null) {
throw new BadRequestException(400, "Unsupported target " + language + " supplied");
}
codegenConfig.setOutputDir(outputFolder);
Json.prettyPrint(clientOpts);
clientOptInput.setConfig(codegenConfig);
try{
List<File> files = new Codegen().opts(clientOptInput).generate();
if(files.size() > 0) {
List<File> filesToAdd = new ArrayList<File>();
System.out.println("adding to " + outputFolder);
filesToAdd.add(new File(outputFolder));
ZipUtil zip = new ZipUtil();
zip.compressFiles(filesToAdd, outputFilename);
}
else {
throw new BadRequestException(400, "A target generation was attempted, but no files were created!");
}
}
catch (Exception e) {
throw new BadRequestException(500, "Unable to build target: " + e.getMessage());
}
return outputFilename;
}
public static String generateServer(String language, GeneratorInput opts) throws ApiException {
LOGGER.debug("generate server for " + language);
Swagger swagger;
if(opts == null) {
throw new BadRequestException(400, "No options were supplied");
}
if(opts == null) {
throw new BadRequestException(400, "No options were supplied");
}
JsonNode node = opts.getSpec();
if(node == null) {
if(opts.getSwaggerUrl() != null) {
swagger = new SwaggerParser().read(opts.getSwaggerUrl());
}
else
throw new BadRequestException(400, "No swagger specification was supplied");
}
else {
swagger = new SwaggerParser().read(node);
}
if(swagger == null) {
throw new BadRequestException(400, "The swagger specification supplied was not valid");
}
ClientOptInput clientOptInput = new ClientOptInput();
ClientOpts clientOpts = new ClientOpts();
String outputFolder = getTmpFolder().getAbsolutePath() + File.separator + language + "-server";
String outputFilename = outputFolder + "-bundle.zip";
clientOptInput
.opts(clientOpts)
.swagger(swagger);
CodegenConfig codegenConfig = Codegen.getConfig(language);
if(codegenConfig == null) {
throw new BadRequestException(400, "Unsupported target " + language + " supplied");
}
codegenConfig.setOutputDir(outputFolder);
Json.prettyPrint(clientOpts);
clientOptInput.setConfig(codegenConfig);
try{
List<File> files = new Codegen().opts(clientOptInput).generate();
if(files.size() > 0) {
List<File> filesToAdd = new ArrayList<File>();
filesToAdd.add(new File(outputFolder));
ZipUtil zip = new ZipUtil();
zip.compressFiles(filesToAdd, outputFilename);
}
else {
throw new BadRequestException(400, "A target generation was attempted, but no files were created!");
}
}
catch (Exception e) {
throw new BadRequestException(500, "Unable to build target: " + e.getMessage());
}
return outputFilename;
}
public static InputOption clientOptions(String language) {
return null;
}
public static InputOption serverOptions(String language) {
return null;
}
protected static File getTmpFolder() {
try {
File outputFolder = File.createTempFile("codegen-", "-tmp");
outputFolder.delete();
outputFolder.mkdir();
outputFolder.deleteOnExit();
return outputFolder;
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
}

View File

@ -1,50 +0,0 @@
package com.wordnik.swagger.generator.resource;
import com.wordnik.swagger.generator.util.ValidationException;
import com.wordnik.swagger.generator.exception.ApiException;
import com.wordnik.swagger.generator.exception.BadRequestException;
import com.wordnik.swagger.generator.exception.NotFoundException;
import com.wordnik.swagger.generator.model.ApiResponse;
import javax.ws.rs.ext.*;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
@Provider
public class ExceptionWriter implements ExceptionMapper<Exception> {
public Response toResponse(Exception exception) {
if (exception instanceof javax.ws.rs.WebApplicationException) {
javax.ws.rs.WebApplicationException e = (javax.ws.rs.WebApplicationException) exception;
return Response
.status(e.getResponse().getStatus())
.entity(new ApiResponse(e.getResponse().getStatus(),
exception.getMessage())).build();
} else if (exception instanceof com.fasterxml.jackson.core.JsonParseException) {
return Response.status(400)
.entity(new ApiResponse(400, "bad input")).build();
} else if (exception instanceof ValidationException) {
ValidationException e = (ValidationException) exception;
return Response.status(Status.BAD_REQUEST).entity(e.getMessage()).build();
} else if (exception instanceof NotFoundException) {
return Response
.status(Status.NOT_FOUND)
.entity(new ApiResponse(ApiResponse.ERROR, exception
.getMessage())).build();
} else if (exception instanceof BadRequestException) {
return Response
.status(Status.BAD_REQUEST)
.entity(new ApiResponse(ApiResponse.ERROR, exception
.getMessage())).build();
} else if (exception instanceof ApiException) {
return Response
.status(Status.BAD_REQUEST)
.entity(new ApiResponse(ApiResponse.ERROR, exception
.getMessage())).build();
} else {
return Response.status(500)
.entity(new ApiResponse(500, "something bad happened"))
.build();
}
}
}

View File

@ -1,138 +0,0 @@
package com.wordnik.swagger.generator.resource;
import com.wordnik.swagger.codegen.*;
import com.wordnik.swagger.generator.util.*;
import com.wordnik.swagger.annotations.*;
import com.wordnik.swagger.generator.model.*;
import com.wordnik.swagger.generator.exception.BadRequestException;
import com.wordnik.swagger.generator.online.Generator;
import java.io.File;
import java.util.*;
import javax.ws.rs.*;
import javax.ws.rs.core.*;
@Path("/gen")
@Api(value = "/gen", description = "Resource for generating swagger components")
public class SwaggerResource {
private static Map<String, Generated> fileMap = new HashMap<String, Generated>();
static List<String> clients = new ArrayList<String>();
static List<String> servers = new ArrayList<String>();
static {
List<CodegenConfig> extensions = Codegen.getExtensions();
for(CodegenConfig config : extensions) {
if(config.getTag().equals(CodegenType.CLIENT) || config.getTag().equals(CodegenType.DOCUMENTATION)) {
clients.add(config.getName());
}
else if(config.getTag().equals(CodegenType.SERVER)) {
servers.add(config.getName());
}
}
}
@GET
@Path("/download/{fileId}")
@Produces({MediaType.APPLICATION_OCTET_STREAM})
@ApiOperation(value = "Downloads a pre-generated file",
response = String.class,
tags = {"clients", "servers"})
public Response downloadFile(@PathParam("fileId") String fileId) throws Exception {
Generated g = fileMap.get(fileId);
System.out.println("looking for fileId " + fileId);
System.out.println("got filename " + g.getFilename());
if(g.getFilename() != null) {
byte[] bytes = org.apache.commons.io.FileUtils.readFileToByteArray(new java.io.File(g.getFilename()));
return Response.ok(bytes, "application/zip")
.header("Content-Disposition","attachment; filename=\"" + g.getFriendlyName() + "-generated.zip\"")
.header("Accept-Range", "bytes")
.header("Content-Length", bytes.length)
.build();
}
else {
return Response.status(404).build();
}
}
@POST
@Path("/clients/{language}")
@ApiOperation(
value = "Generates a client library based on the config",
response = ResponseCode.class,
tags = "clients")
public Response generateClient(
@ApiParam(value = "The target language for the client library", allowableValues = "android,java,php,objc,docs", required = true) @PathParam("language") String language,
@ApiParam(value = "Configuration for building the client library", required = true) GeneratorInput opts) throws Exception {
String filename = Generator.generateClient(language, opts);
if(filename != null) {
String code = String.valueOf(System.currentTimeMillis());
Generated g = new Generated();
g.setFilename(filename);
g.setFriendlyName(language + "-client");
fileMap.put(code, g);
System.out.println(code + ", " + filename);
String link = "http://generator.swagger.io/api/gen/download/" + code;
return Response.ok().entity(new ResponseCode(code, link)).build();
}
else {
return Response.status(500).build();
}
}
@GET
@Path("/clients")
@ApiOperation(value = "Gets languages supported by the client generator",
response = String.class,
responseContainer = "List",
tags = "clients")
public Response clientOptions() {
String[] languages = new String[clients.size()];
languages = clients.toArray(languages);
return Response.ok().entity(languages).build();
}
@GET
@Path("/servers")
@ApiOperation(value = "Gets languages supported by the server generator",
response = String.class,
responseContainer = "List",
tags = "servers")
public Response serverOptions() {
String[] languages = new String[servers.size()];
languages = servers.toArray(languages);
return Response.ok().entity(languages).build();
}
@POST
@Path("/servers/{framework}")
@ApiOperation(value = "Generates a server library for the supplied server framework",
response = ResponseCode.class,
tags = "servers")
public Response generateServerForLanguage(
@ApiParam(value = "framework", allowableValues = "jaxrs,nodejs", required = true) @PathParam("framework") String framework,
@ApiParam(value = "parameters", required = true) GeneratorInput opts)
throws Exception {
if(framework == null)
throw new BadRequestException(400, "Framework is required");
String filename = Generator.generateServer(framework, opts);
System.out.println("generated name: " + filename);
if(filename != null) {
String code = String.valueOf(System.currentTimeMillis());
Generated g = new Generated();
g.setFilename(filename);
g.setFriendlyName(framework + "-server");
fileMap.put(code, g);
System.out.println(code + ", " + filename);
String link = "http://generator.swagger.io/api/gen/download/" + code;
return Response.ok().entity(new ResponseCode(code, link)).build();
}
else {
return Response.status(500).build();
}
}
}

View File

@ -1,42 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.util;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.HttpServletResponse;
public class ApiOriginFilter implements javax.servlet.Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
HttpServletResponse res = (HttpServletResponse) response;
res.addHeader("Access-Control-Allow-Origin", "*");
res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT");
res.addHeader("Access-Control-Allow-Headers", "Content-Type");
chain.doFilter(request, response);
}
@Override
public void destroy() {
}
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
}

View File

@ -1,27 +0,0 @@
package com.wordnik.swagger.generator.util;
import java.util.List;
public class ValidationException extends Exception {
private int code;
private String msg;
private List<ValidationMessage> errors;
public ValidationException(String msg) {
super(msg);
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return msg;
}
public void setMessage(String msg) {
this.msg = msg;
}
}

View File

@ -1,26 +0,0 @@
package com.wordnik.swagger.generator.util;
public class ValidationMessage {
private String path, message, severity;
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getSeverity() {
return severity;
}
public void setSeverity(String severity) {
this.severity = severity;
}
}

View File

@ -1,124 +0,0 @@
/**
* Copyright 2015 Reverb, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.wordnik.swagger.generator.util;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/**
* This utility compresses a list of files to standard ZIP format file.
* It is able to compresses all sub files and sub directories, recursively.
* @author Ha Minh Nam
*
*/
public class ZipUtil {
/**
* A constants for buffer size used to read/write data
*/
private static final int BUFFER_SIZE = 4096;
/**
* Compresses a collection of files to a destination zip file
* @param listFiles A collection of files and directories
* @param destZipFile The path of the destination zip file
* @throws FileNotFoundException
* @throws IOException
*/
public void compressFiles(List<File> listFiles, String destZipFile) throws FileNotFoundException, IOException {
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(destZipFile));
for (File file : listFiles) {
if (file.isDirectory()) {
addFolderToZip(file, file.getName(), zos);
} else {
addFileToZip(file, zos);
}
}
zos.flush();
zos.close();
}
/**
* Adds a directory to the current zip output stream
* @param folder the directory to be added
* @param parentFolder the path of parent directory
* @param zos the current zip output stream
* @throws FileNotFoundException
* @throws IOException
*/
private void addFolderToZip(File folder, String parentFolder,
ZipOutputStream zos) throws FileNotFoundException, IOException {
for (File file : folder.listFiles()) {
if (file.isDirectory()) {
addFolderToZip(file, parentFolder + "/" + file.getName(), zos);
continue;
}
zos.putNextEntry(new ZipEntry(parentFolder + "/" + file.getName()));
BufferedInputStream bis = new BufferedInputStream(
new FileInputStream(file));
long bytesRead = 0;
byte[] bytesIn = new byte[BUFFER_SIZE];
int read = 0;
while ((read = bis.read(bytesIn)) != -1) {
zos.write(bytesIn, 0, read);
bytesRead += read;
}
zos.closeEntry();
}
}
/**
* Adds a file to the current zip output stream
* @param file the file to be added
* @param zos the current zip output stream
* @throws FileNotFoundException
* @throws IOException
*/
private void addFileToZip(File file, ZipOutputStream zos)
throws FileNotFoundException, IOException {
zos.putNextEntry(new ZipEntry(file.getName()));
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(
file));
long bytesRead = 0;
byte[] bytesIn = new byte[BUFFER_SIZE];
int read = 0;
while ((read = bis.read(bytesIn)) != -1) {
zos.write(bytesIn, 0, read);
bytesRead += read;
}
zos.closeEntry();
}
}

View File

@ -5,7 +5,7 @@
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<logger name="com.wordnik.swagger.jaxrs" level="debug"/>
<logger name="io.swagger.jaxrs" level="debug"/>
<root level="error">
<appender-ref ref="STDOUT" />
</root>

View File

@ -9,17 +9,17 @@
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>
com.wordnik.swagger.jaxrs.json,
com.wordnik.swagger.generator.resource
io.swagger.jaxrs.json,
io.swagger.generator.resource
</param-value>
</init-param>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>
com.wordnik.swagger.online.ExceptionWriter,
com.wordnik.swagger.jersey.listing.ApiListingResourceJSON,
com.wordnik.swagger.jersey.listing.JerseyApiDeclarationProvider,
com.wordnik.swagger.jersey.listing.JerseyResourceListingProvider
io.swagger.online.ExceptionWriter,
io.swagger.jersey.listing.ApiListingResourceJSON,
io.swagger.jersey.listing.JerseyApiDeclarationProvider,
io.swagger.jersey.listing.JerseyResourceListingProvider
</param-value>
</init-param>
<init-param>
@ -36,11 +36,11 @@
<filter>
<filter-name>ApiOriginFilter</filter-name>
<filter-class>com.wordnik.swagger.generator.util.ApiOriginFilter</filter-class>
<filter-class>io.swagger.generator.util.ApiOriginFilter</filter-class>
</filter>
<servlet>
<servlet-name>Bootstrap</servlet-name>
<servlet-class>com.wordnik.swagger.generator.Bootstrap</servlet-class>
<servlet-class>io.swagger.generator.Bootstrap</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<filter-mapping>

View File

@ -1,6 +1,6 @@
import com.wordnik.swagger.generator.online._
import com.wordnik.swagger.generator.model._
import com.wordnik.swagger.util.Json
import io.swagger.generator.online._
import io.swagger.generator.model._
import io.swagger.util.Json
import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner

View File

@ -9,7 +9,7 @@
<artifactId>swagger-codegen-project</artifactId>
<packaging>pom</packaging>
<name>swagger-codegen-project</name>
<version>2.1.1-M2-SNAPSHOT</version>
<version>2.1.1</version>
<url>https://github.com/swagger-api/swagger-codegen</url>
<scm>
<connection>scm:git:git@github.com:swagger-api/swagger-codegen.git</connection>
@ -463,7 +463,7 @@
</repositories>
<properties>
<swagger-parser-version>1.0.7</swagger-parser-version>
<scala-version>2.10.4</scala-version>
<scala-version>2.11.1</scala-version>
<felix-version>2.3.4</felix-version>
<swagger-core-version>1.5.2-M2</swagger-core-version>
<scala-test-version>2.1.4</scala-test-version>

View File

@ -56,10 +56,10 @@ dependencies {
compile "com.google.code.gson:gson:$gson_version"
compile "org.apache.httpcomponents:httpcore:$httpclient_version"
compile "org.apache.httpcomponents:httpclient:$httpclient_version"
compile ("org.apache.httpcomponents:httpcore:$httpcore_version") {
compile ("org.apache.httpcomponents:httpcore:$httpclient_version") {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
compile ("org.apache.httpcomponents:httpmime:$httpmime_version") {
compile ("org.apache.httpcomponents:httpmime:$httpclient_version") {
exclude(group: 'org.apache.httpcomponents', module: 'httpclient')
}
testCompile "junit:junit:$junit_version"

View File

@ -1,15 +1,134 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using RestSharp;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace IO.Swagger.Api {
public interface IPetApi {
/// <summary>
/// Update an existing pet
/// </summary>
/// <param name="Body">Pet object that needs to be added to the store</param>
/// <returns></returns>
void UpdatePet (Pet Body);
/// <summary>
/// Update an existing pet
/// </summary>
/// <param name="Body">Pet object that needs to be added to the store</param>
/// <returns></returns>
Task UpdatePetAsync (Pet Body);
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <param name="Body">Pet object that needs to be added to the store</param>
/// <returns></returns>
void AddPet (Pet Body);
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <param name="Body">Pet object that needs to be added to the store</param>
/// <returns></returns>
Task AddPetAsync (Pet Body);
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma seperated strings
/// </summary>
/// <param name="Status">Status values that need to be considered for filter</param>
/// <returns>List<Pet></returns>
List<Pet> FindPetsByStatus (List<string> Status);
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma seperated strings
/// </summary>
/// <param name="Status">Status values that need to be considered for filter</param>
/// <returns>List<Pet></returns>
Task<List<Pet>> FindPetsByStatusAsync (List<string> Status);
/// <summary>
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
/// <param name="Tags">Tags to filter by</param>
/// <returns>List<Pet></returns>
List<Pet> FindPetsByTags (List<string> Tags);
/// <summary>
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
/// <param name="Tags">Tags to filter by</param>
/// <returns>List<Pet></returns>
Task<List<Pet>> FindPetsByTagsAsync (List<string> Tags);
/// <summary>
/// Find pet by ID Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
/// <param name="PetId">ID of pet that needs to be fetched</param>
/// <returns>Pet</returns>
Pet GetPetById (long? PetId);
/// <summary>
/// Find pet by ID Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
/// <param name="PetId">ID of pet that needs to be fetched</param>
/// <returns>Pet</returns>
Task<Pet> GetPetByIdAsync (long? PetId);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="PetId">ID of pet that needs to be updated</param>/// <param name="Name">Updated name of the pet</param>/// <param name="Status">Updated status of the pet</param>
/// <returns></returns>
void UpdatePetWithForm (string PetId, string Name, string Status);
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="PetId">ID of pet that needs to be updated</param>/// <param name="Name">Updated name of the pet</param>/// <param name="Status">Updated status of the pet</param>
/// <returns></returns>
Task UpdatePetWithFormAsync (string PetId, string Name, string Status);
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="ApiKey"></param>/// <param name="PetId">Pet id to delete</param>
/// <returns></returns>
void DeletePet (string ApiKey, long? PetId);
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="ApiKey"></param>/// <param name="PetId">Pet id to delete</param>
/// <returns></returns>
Task DeletePetAsync (string ApiKey, long? PetId);
/// <summary>
/// uploads an image
/// </summary>
/// <param name="PetId">ID of pet to update</param>/// <param name="AdditionalMetadata">Additional data to pass to server</param>/// <param name="File">file to upload</param>
/// <returns></returns>
void UploadFile (long? PetId, string AdditionalMetadata, string File);
/// <summary>
/// uploads an image
/// </summary>
/// <param name="PetId">ID of pet to update</param>/// <param name="AdditionalMetadata">Additional data to pass to server</param>/// <param name="File">file to upload</param>
/// <returns></returns>
Task UploadFileAsync (long? PetId, string AdditionalMetadata, string File);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class PetApi {
public class PetApi : IPetApi {
/// <summary>
/// Initializes a new instance of the <see cref="PetApi"/> class.
/// </summary>
@ -88,7 +207,44 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Update an existing pet
/// </summary>
/// <param name="Body">Pet object that needs to be added to the store</param>
/// <returns></returns>
public async Task UpdatePetAsync (Pet Body) {
var path = "/pet";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
postBody = apiClient.Serialize(Body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content);
}
return;
@ -126,7 +282,44 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Add a new pet to the store
/// </summary>
/// <param name="Body">Pet object that needs to be added to the store</param>
/// <returns></returns>
public async Task AddPetAsync (Pet Body) {
var path = "/pet";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
postBody = apiClient.Serialize(Body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content);
}
return;
@ -164,11 +357,47 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
}
return (List<Pet>) apiClient.Deserialize(response.Content, typeof(List<Pet>));
}
/// <summary>
/// Finds Pets by status Multiple status values can be provided with comma seperated strings
/// </summary>
/// <param name="Status">Status values that need to be considered for filter</param>
/// <returns>List<Pet></returns>
public async Task<List<Pet>> FindPetsByStatusAsync (List<string> Status) {
var path = "/pet/findByStatus";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
if (Status != null) queryParams.Add("status", apiClient.ParameterToString(Status)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content);
}
return (List<Pet>) ApiInvoker.Deserialize(response.Content, typeof(List<Pet>));
}
/// <summary>
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
@ -201,11 +430,47 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
}
return (List<Pet>) apiClient.Deserialize(response.Content, typeof(List<Pet>));
}
/// <summary>
/// Finds Pets by tags Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
/// </summary>
/// <param name="Tags">Tags to filter by</param>
/// <returns>List<Pet></returns>
public async Task<List<Pet>> FindPetsByTagsAsync (List<string> Tags) {
var path = "/pet/findByTags";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
if (Tags != null) queryParams.Add("tags", apiClient.ParameterToString(Tags)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content);
}
return (List<Pet>) ApiInvoker.Deserialize(response.Content, typeof(List<Pet>));
}
/// <summary>
/// Find pet by ID Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
@ -241,17 +506,54 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
}
return (Pet) apiClient.Deserialize(response.Content, typeof(Pet));
}
/// <summary>
/// Find pet by ID Returns a pet when ID &lt; 10. ID &gt; 10 or nonintegers will simulate API error conditions
/// </summary>
/// <param name="PetId">ID of pet that needs to be fetched</param>
/// <returns>Pet</returns>
public async Task<Pet> GetPetByIdAsync (long? PetId) {
// verify the required parameter 'PetId' is set
if (PetId == null) throw new ApiException(400, "Missing required parameter 'PetId' when calling GetPetById");
var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", apiClient.ParameterToString(PetId));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
// authentication setting, if any
String[] authSettings = new String[] { "api_key", "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content);
}
return (Pet) ApiInvoker.Deserialize(response.Content, typeof(Pet));
}
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="PetId">ID of pet that needs to be updated</param>
/// <param name="Name">Updated name of the pet</param>
/// <param name="Status">Updated status of the pet</param>
/// <param name="PetId">ID of pet that needs to be updated</param>/// <param name="Name">Updated name of the pet</param>/// <param name="Status">Updated status of the pet</param>
/// <returns></returns>
public void UpdatePetWithForm (string PetId, string Name, string Status) {
@ -285,7 +587,49 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Updates a pet in the store with form data
/// </summary>
/// <param name="PetId">ID of pet that needs to be updated</param>/// <param name="Name">Updated name of the pet</param>/// <param name="Status">Updated status of the pet</param>
/// <returns></returns>
public async Task UpdatePetWithFormAsync (string PetId, string Name, string Status) {
// verify the required parameter 'PetId' is set
if (PetId == null) throw new ApiException(400, "Missing required parameter 'PetId' when calling UpdatePetWithForm");
var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", apiClient.ParameterToString(PetId));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
if (Name != null) formParams.Add("name", apiClient.ParameterToString(Name)); // form parameter
if (Status != null) formParams.Add("status", apiClient.ParameterToString(Status)); // form parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content);
}
return;
@ -294,8 +638,7 @@ namespace IO.Swagger.Api {
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="ApiKey"></param>
/// <param name="PetId">Pet id to delete</param>
/// <param name="ApiKey"></param>/// <param name="PetId">Pet id to delete</param>
/// <returns></returns>
public void DeletePet (string ApiKey, long? PetId) {
@ -328,7 +671,48 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Deletes a pet
/// </summary>
/// <param name="ApiKey"></param>/// <param name="PetId">Pet id to delete</param>
/// <returns></returns>
public async Task DeletePetAsync (string ApiKey, long? PetId) {
// verify the required parameter 'PetId' is set
if (PetId == null) throw new ApiException(400, "Missing required parameter 'PetId' when calling DeletePet");
var path = "/pet/{petId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", apiClient.ParameterToString(PetId));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
if (ApiKey != null) headerParams.Add("api_key", apiClient.ParameterToString(ApiKey)); // header parameter
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content);
}
return;
@ -337,9 +721,7 @@ namespace IO.Swagger.Api {
/// <summary>
/// uploads an image
/// </summary>
/// <param name="PetId">ID of pet to update</param>
/// <param name="AdditionalMetadata">Additional data to pass to server</param>
/// <param name="File">file to upload</param>
/// <param name="PetId">ID of pet to update</param>/// <param name="AdditionalMetadata">Additional data to pass to server</param>/// <param name="File">file to upload</param>
/// <returns></returns>
public void UploadFile (long? PetId, string AdditionalMetadata, string File) {
@ -373,7 +755,49 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// uploads an image
/// </summary>
/// <param name="PetId">ID of pet to update</param>/// <param name="AdditionalMetadata">Additional data to pass to server</param>/// <param name="File">file to upload</param>
/// <returns></returns>
public async Task UploadFileAsync (long? PetId, string AdditionalMetadata, string File) {
// verify the required parameter 'PetId' is set
if (PetId == null) throw new ApiException(400, "Missing required parameter 'PetId' when calling UploadFile");
var path = "/pet/{petId}/uploadImage";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "petId" + "}", apiClient.ParameterToString(PetId));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
if (AdditionalMetadata != null) formParams.Add("additionalMetadata", apiClient.ParameterToString(AdditionalMetadata)); // form parameter
if (File != null) fileParams.Add("file", File);
// authentication setting, if any
String[] authSettings = new String[] { "petstore_auth" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content);
}
return;

View File

@ -1,15 +1,78 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using RestSharp;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace IO.Swagger.Api {
public interface IStoreApi {
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary<String, int?></returns>
Dictionary<String, int?> GetInventory ();
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary<String, int?></returns>
Task<Dictionary<String, int?>> GetInventoryAsync ();
/// <summary>
/// Place an order for a pet
/// </summary>
/// <param name="Body">order placed for purchasing the pet</param>
/// <returns>Order</returns>
Order PlaceOrder (Order Body);
/// <summary>
/// Place an order for a pet
/// </summary>
/// <param name="Body">order placed for purchasing the pet</param>
/// <returns>Order</returns>
Task<Order> PlaceOrderAsync (Order Body);
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </summary>
/// <param name="OrderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
Order GetOrderById (string OrderId);
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </summary>
/// <param name="OrderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
Task<Order> GetOrderByIdAsync (string OrderId);
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <param name="OrderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
void DeleteOrder (string OrderId);
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <param name="OrderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
Task DeleteOrderAsync (string OrderId);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class StoreApi {
public class StoreApi : IStoreApi {
/// <summary>
/// Initializes a new instance of the <see cref="StoreApi"/> class.
/// </summary>
@ -59,6 +122,7 @@ namespace IO.Swagger.Api {
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary<String, int?></returns>
public Dictionary<String, int?> GetInventory () {
@ -86,11 +150,46 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
}
return (Dictionary<String, int?>) apiClient.Deserialize(response.Content, typeof(Dictionary<String, int?>));
}
/// <summary>
/// Returns pet inventories by status Returns a map of status codes to quantities
/// </summary>
/// <returns>Dictionary<String, int?></returns>
public async Task<Dictionary<String, int?>> GetInventoryAsync () {
var path = "/store/inventory";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
// authentication setting, if any
String[] authSettings = new String[] { "api_key" };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content);
}
return (Dictionary<String, int?>) ApiInvoker.Deserialize(response.Content, typeof(Dictionary<String, int?>));
}
/// <summary>
/// Place an order for a pet
/// </summary>
@ -123,11 +222,47 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
}
return (Order) apiClient.Deserialize(response.Content, typeof(Order));
}
/// <summary>
/// Place an order for a pet
/// </summary>
/// <param name="Body">order placed for purchasing the pet</param>
/// <returns>Order</returns>
public async Task<Order> PlaceOrderAsync (Order Body) {
var path = "/store/order";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
postBody = apiClient.Serialize(Body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content);
}
return (Order) ApiInvoker.Deserialize(response.Content, typeof(Order));
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </summary>
@ -163,11 +298,50 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
}
return (Order) apiClient.Deserialize(response.Content, typeof(Order));
}
/// <summary>
/// Find purchase order by ID For valid response try integer IDs with value &lt;= 5 or &gt; 10. Other values will generated exceptions
/// </summary>
/// <param name="OrderId">ID of pet that needs to be fetched</param>
/// <returns>Order</returns>
public async Task<Order> GetOrderByIdAsync (string OrderId) {
// verify the required parameter 'OrderId' is set
if (OrderId == null) throw new ApiException(400, "Missing required parameter 'OrderId' when calling GetOrderById");
var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", apiClient.ParameterToString(OrderId));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content);
}
return (Order) ApiInvoker.Deserialize(response.Content, typeof(Order));
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
@ -203,7 +377,47 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Delete purchase order by ID For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors
/// </summary>
/// <param name="OrderId">ID of the order that needs to be deleted</param>
/// <returns></returns>
public async Task DeleteOrderAsync (string OrderId) {
// verify the required parameter 'OrderId' is set
if (OrderId == null) throw new ApiException(400, "Missing required parameter 'OrderId' when calling DeleteOrder");
var path = "/store/order/{orderId}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "orderId" + "}", apiClient.ParameterToString(OrderId));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content);
}
return;

View File

@ -1,15 +1,134 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using RestSharp;
using IO.Swagger.Client;
using IO.Swagger.Model;
namespace IO.Swagger.Api {
public interface IUserApi {
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
/// <param name="Body">Created user object</param>
/// <returns></returns>
void CreateUser (User Body);
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
/// <param name="Body">Created user object</param>
/// <returns></returns>
Task CreateUserAsync (User Body);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="Body">List of user object</param>
/// <returns></returns>
void CreateUsersWithArrayInput (List<User> Body);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="Body">List of user object</param>
/// <returns></returns>
Task CreateUsersWithArrayInputAsync (List<User> Body);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="Body">List of user object</param>
/// <returns></returns>
void CreateUsersWithListInput (List<User> Body);
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="Body">List of user object</param>
/// <returns></returns>
Task CreateUsersWithListInputAsync (List<User> Body);
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="Username">The user name for login</param>/// <param name="Password">The password for login in clear text</param>
/// <returns>string</returns>
string LoginUser (string Username, string Password);
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="Username">The user name for login</param>/// <param name="Password">The password for login in clear text</param>
/// <returns>string</returns>
Task<string> LoginUserAsync (string Username, string Password);
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
void LogoutUser ();
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
Task LogoutUserAsync ();
/// <summary>
/// Get user by user name
/// </summary>
/// <param name="Username">The name that needs to be fetched. Use user1 for testing. </param>
/// <returns>User</returns>
User GetUserByName (string Username);
/// <summary>
/// Get user by user name
/// </summary>
/// <param name="Username">The name that needs to be fetched. Use user1 for testing. </param>
/// <returns>User</returns>
Task<User> GetUserByNameAsync (string Username);
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="Username">name that need to be deleted</param>/// <param name="Body">Updated user object</param>
/// <returns></returns>
void UpdateUser (string Username, User Body);
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="Username">name that need to be deleted</param>/// <param name="Body">Updated user object</param>
/// <returns></returns>
Task UpdateUserAsync (string Username, User Body);
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
/// <param name="Username">The name that needs to be deleted</param>
/// <returns></returns>
void DeleteUser (string Username);
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
/// <param name="Username">The name that needs to be deleted</param>
/// <returns></returns>
Task DeleteUserAsync (string Username);
}
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public class UserApi {
public class UserApi : IUserApi {
/// <summary>
/// Initializes a new instance of the <see cref="UserApi"/> class.
/// </summary>
@ -88,7 +207,44 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Create user This can only be done by the logged in user.
/// </summary>
/// <param name="Body">Created user object</param>
/// <returns></returns>
public async Task CreateUserAsync (User Body) {
var path = "/user";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
postBody = apiClient.Serialize(Body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content);
}
return;
@ -126,7 +282,44 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="Body">List of user object</param>
/// <returns></returns>
public async Task CreateUsersWithArrayInputAsync (List<User> Body) {
var path = "/user/createWithArray";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
postBody = apiClient.Serialize(Body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content);
}
return;
@ -164,7 +357,44 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Creates list of users with given input array
/// </summary>
/// <param name="Body">List of user object</param>
/// <returns></returns>
public async Task CreateUsersWithListInputAsync (List<User> Body) {
var path = "/user/createWithList";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
postBody = apiClient.Serialize(Body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content);
}
return;
@ -173,8 +403,7 @@ namespace IO.Swagger.Api {
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="Username">The user name for login</param>
/// <param name="Password">The password for login in clear text</param>
/// <param name="Username">The user name for login</param>/// <param name="Password">The password for login in clear text</param>
/// <returns>string</returns>
public string LoginUser (string Username, string Password) {
@ -204,14 +433,52 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
}
return (string) apiClient.Deserialize(response.Content, typeof(string));
}
/// <summary>
/// Logs user into the system
/// </summary>
/// <param name="Username">The user name for login</param>/// <param name="Password">The password for login in clear text</param>
/// <returns>string</returns>
public async Task<string> LoginUserAsync (string Username, string Password) {
var path = "/user/login";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
if (Username != null) queryParams.Add("username", apiClient.ParameterToString(Username)); // query parameter
if (Password != null) queryParams.Add("password", apiClient.ParameterToString(Password)); // query parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content);
}
return (string) ApiInvoker.Deserialize(response.Content, typeof(string));
}
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
public void LogoutUser () {
@ -239,7 +506,43 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Logs out current logged in user session
/// </summary>
/// <returns></returns>
public async Task LogoutUserAsync () {
var path = "/user/logout";
path = path.Replace("{format}", "json");
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content);
}
return;
@ -280,16 +583,54 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
}
return (User) apiClient.Deserialize(response.Content, typeof(User));
}
/// <summary>
/// Get user by user name
/// </summary>
/// <param name="Username">The name that needs to be fetched. Use user1 for testing. </param>
/// <returns>User</returns>
public async Task<User> GetUserByNameAsync (string Username) {
// verify the required parameter 'Username' is set
if (Username == null) throw new ApiException(400, "Missing required parameter 'Username' when calling GetUserByName");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", apiClient.ParameterToString(Username));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content);
}
return (User) ApiInvoker.Deserialize(response.Content, typeof(User));
}
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="Username">name that need to be deleted</param>
/// <param name="Body">Updated user object</param>
/// <param name="Username">name that need to be deleted</param>/// <param name="Body">Updated user object</param>
/// <returns></returns>
public void UpdateUser (string Username, User Body) {
@ -322,7 +663,48 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Updated user This can only be done by the logged in user.
/// </summary>
/// <param name="Username">name that need to be deleted</param>/// <param name="Body">Updated user object</param>
/// <returns></returns>
public async Task UpdateUserAsync (string Username, User Body) {
// verify the required parameter 'Username' is set
if (Username == null) throw new ApiException(400, "Missing required parameter 'Username' when calling UpdateUser");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", apiClient.ParameterToString(Username));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
postBody = apiClient.Serialize(Body); // http body (model) parameter
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content);
}
return;
@ -363,7 +745,47 @@ namespace IO.Swagger.Api {
IRestResponse response = (IRestResponse) apiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content);
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
}
return;
}
/// <summary>
/// Delete user This can only be done by the logged in user.
/// </summary>
/// <param name="Username">The name that needs to be deleted</param>
/// <returns></returns>
public async Task DeleteUserAsync (string Username) {
// verify the required parameter 'Username' is set
if (Username == null) throw new ApiException(400, "Missing required parameter 'Username' when calling DeleteUser");
var path = "/user/{username}";
path = path.Replace("{format}", "json");
path = path.Replace("{" + "username" + "}", apiClient.ParameterToString(Username));
var queryParams = new Dictionary<String, String>();
var headerParams = new Dictionary<String, String>();
var formParams = new Dictionary<String, String>();
var fileParams = new Dictionary<String, String>();
String postBody = null;
// authentication setting, if any
String[] authSettings = new String[] { };
// make the HTTP request
IRestResponse response = (IRestResponse) await apiClient.CallApiAsync(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings);
if (((int)response.StatusCode) >= 400) {
throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content);
}
return;

View File

@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using RestSharp;
@ -38,6 +39,15 @@ namespace IO.Swagger.Client {
public Object CallApi(String Path, RestSharp.Method Method, Dictionary<String, String> QueryParams, String PostBody,
Dictionary<String, String> HeaderParams, Dictionary<String, String> FormParams, Dictionary<String, String> FileParams, String[] AuthSettings) {
var response = Task.Run(async () => {
var resp = await CallApiAsync(Path, Method, QueryParams, PostBody, HeaderParams, FormParams, FileParams, AuthSettings);
return resp;
});
return response.Result;
}
public async Task<Object> CallApiAsync(String Path, RestSharp.Method Method, Dictionary<String, String> QueryParams, String PostBody,
Dictionary<String, String> HeaderParams, Dictionary<String, String> FormParams, Dictionary<String, String> FileParams, String[] AuthSettings) {
var request = new RestRequest(Path, Method);
@ -67,7 +77,7 @@ namespace IO.Swagger.Client {
request.AddParameter("application/json", PostBody, ParameterType.RequestBody); // http body (model) parameter
}
return (Object)restClient.Execute(request);
return (Object) await restClient.ExecuteTaskAsync(request);
}

View File

@ -11,6 +11,12 @@ namespace IO.Swagger.Client {
/// <value>The error code (HTTP status code).</value>
public int ErrorCode { get; set; }
/// <summary>
/// Gets or sets the error content (body json object)
/// </summary>
/// <value>The error content (Http response body).</value>
public dynamic ErrorContent { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiException"/> class.
/// </summary>
@ -26,6 +32,11 @@ namespace IO.Swagger.Client {
this.ErrorCode = errorCode;
}
public ApiException(int errorCode, string message, dynamic errorContent = null) : base(message) {
this.ErrorCode = errorCode;
this.ErrorContent = errorContent;
}
}
}

View File

@ -1,5 +1,5 @@
platform :ios, '6.0'
xcodeproj 'PetstoreClient/PetstoreClient.xcodeproj'
xcodeproj 'swaggerClient/swaggerClient.xcodeproj'
pod 'AFNetworking', '~> 2.1'
pod 'JSONModel', '~> 1.0'
pod 'ISO8601'

View File

@ -1,8 +1,8 @@
package io.swagger.client.model;
import io.swagger.client.model.Category;
import java.util.*;
import io.swagger.client.model.Tag;
import java.util.*;
import com.wordnik.swagger.annotations.*;
import com.google.gson.annotations.SerializedName;

View File

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<groupId>io.swagger</groupId>
<artifactId>swagger-scala-client</artifactId>
<packaging>jar</packaging>
<name>swagger-scala-client</name>

View File

@ -301,7 +301,7 @@
<h3 class="field-label">Example data</h3>
<div class="example-data-content-type">Content-Type: application/xml</div>
<pre class="example"><code>not implemented com.wordnik.swagger.models.properties.MapProperty@3e</code></pre>
<pre class="example"><code>not implemented io.swagger.models.properties.MapProperty@3e</code></pre>
</div> <!-- method -->
<hr>
@ -332,7 +332,7 @@
&quot;complete&quot; : true,
&quot;status&quot; : &quot;aeiou&quot;,
&quot;quantity&quot; : 123,
&quot;shipDate&quot; : &quot;2015-05-23T15:56:49.441+0000&quot;
&quot;shipDate&quot; : &quot;2015-06-07T06:42:05.171+0000&quot;
}</code></pre>
<h3 class="field-label">Example data</h3>
@ -341,7 +341,7 @@
&lt;id&gt;123456&lt;/id&gt;
&lt;petId&gt;123456&lt;/petId&gt;
&lt;quantity&gt;0&lt;/quantity&gt;
&lt;shipDate&gt;2015-05-23T08:56:49.444Z&lt;/shipDate&gt;
&lt;shipDate&gt;2015-06-06T23:42:05.174Z&lt;/shipDate&gt;
&lt;status&gt;string&lt;/status&gt;
&lt;complete&gt;true&lt;/complete&gt;
&lt;/Order&gt;</code></pre>
@ -375,7 +375,7 @@
&quot;complete&quot; : true,
&quot;status&quot; : &quot;aeiou&quot;,
&quot;quantity&quot; : 123,
&quot;shipDate&quot; : &quot;2015-05-23T15:56:49.445+0000&quot;
&quot;shipDate&quot; : &quot;2015-06-07T06:42:05.175+0000&quot;
}</code></pre>
<h3 class="field-label">Example data</h3>
@ -384,7 +384,7 @@
&lt;id&gt;123456&lt;/id&gt;
&lt;petId&gt;123456&lt;/petId&gt;
&lt;quantity&gt;0&lt;/quantity&gt;
&lt;shipDate&gt;2015-05-23T08:56:49.445Z&lt;/shipDate&gt;
&lt;shipDate&gt;2015-06-06T23:42:05.176Z&lt;/shipDate&gt;
&lt;status&gt;string&lt;/status&gt;
&lt;complete&gt;true&lt;/complete&gt;
&lt;/Order&gt;</code></pre>

View File

@ -44,7 +44,6 @@ public class PetApi {
public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
throws NotFoundException {
// do some magic!
return delegate.updatePet(body);
}
@POST
@ -57,7 +56,6 @@ public class PetApi {
public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ) Pet body)
throws NotFoundException {
// do some magic!
return delegate.addPet(body);
}
@GET
@ -72,7 +70,6 @@ public class PetApi {
public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter", defaultValue="available") @QueryParam("status") List<String> status)
throws NotFoundException {
// do some magic!
return delegate.findPetsByStatus(status);
}
@GET
@ -87,7 +84,6 @@ public class PetApi {
public Response findPetsByTags(@ApiParam(value = "Tags to filter by") @QueryParam("tags") List<String> tags)
throws NotFoundException {
// do some magic!
return delegate.findPetsByTags(tags);
}
@GET
@ -104,7 +100,6 @@ public class PetApi {
public Response getPetById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("petId") Long petId)
throws NotFoundException {
// do some magic!
return delegate.getPetById(petId);
}
@POST
@ -119,7 +114,6 @@ public class PetApi {
@ApiParam(value = "Updated name of the pet" )@FormParam("name") String name,
@ApiParam(value = "Updated status of the pet" )@FormParam("status") String status)
throws NotFoundException {
// do some magic!
return delegate.updatePetWithForm(petId,name,status);
}
@DELETE
@ -133,7 +127,6 @@ public class PetApi {
public Response deletePet(@ApiParam(value = "" )@HeaderParam("api_key") String apiKey,
@ApiParam(value = "Pet id to delete",required=true ) @PathParam("petId") Long petId)
throws NotFoundException {
// do some magic!
return delegate.deletePet(apiKey,petId);
}
@POST
@ -149,7 +142,6 @@ public class PetApi {
@ApiParam(value = "file to upload") @FormDataParam("file") InputStream inputStream,
@ApiParam(value = "file detail") @FormDataParam("file") FormDataContentDisposition fileDetail)
throws NotFoundException {
// do some magic!
return delegate.uploadFile(petId,additionalMetadata,fileDetail);
}
}

View File

@ -40,7 +40,6 @@ public class StoreApi {
public Response getInventory()
throws NotFoundException {
// do some magic!
return delegate.getInventory();
}
@POST
@ -55,7 +54,6 @@ public class StoreApi {
public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ) Order body)
throws NotFoundException {
// do some magic!
return delegate.placeOrder(body);
}
@GET
@ -72,7 +70,6 @@ public class StoreApi {
public Response getOrderById(@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathParam("orderId") String orderId)
throws NotFoundException {
// do some magic!
return delegate.getOrderById(orderId);
}
@DELETE
@ -87,7 +84,6 @@ public class StoreApi {
public Response deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathParam("orderId") String orderId)
throws NotFoundException {
// do some magic!
return delegate.deleteOrder(orderId);
}
}

View File

@ -40,7 +40,6 @@ public class UserApi {
public Response createUser(@ApiParam(value = "Created user object" ) User body)
throws NotFoundException {
// do some magic!
return delegate.createUser(body);
}
@POST
@ -53,7 +52,6 @@ public class UserApi {
public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ) List<User> body)
throws NotFoundException {
// do some magic!
return delegate.createUsersWithArrayInput(body);
}
@POST
@ -66,7 +64,6 @@ public class UserApi {
public Response createUsersWithListInput(@ApiParam(value = "List of user object" ) List<User> body)
throws NotFoundException {
// do some magic!
return delegate.createUsersWithListInput(body);
}
@GET
@ -82,7 +79,6 @@ public class UserApi {
public Response loginUser(@ApiParam(value = "The user name for login") @QueryParam("username") String username,
@ApiParam(value = "The password for login in clear text") @QueryParam("password") String password)
throws NotFoundException {
// do some magic!
return delegate.loginUser(username,password);
}
@GET
@ -95,7 +91,6 @@ public class UserApi {
public Response logoutUser()
throws NotFoundException {
// do some magic!
return delegate.logoutUser();
}
@GET
@ -112,7 +107,6 @@ public class UserApi {
public Response getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathParam("username") String username)
throws NotFoundException {
// do some magic!
return delegate.getUserByName(username);
}
@PUT
@ -128,7 +122,6 @@ public class UserApi {
public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathParam("username") String username,
@ApiParam(value = "Updated user object" ) User body)
throws NotFoundException {
// do some magic!
return delegate.updateUser(username,body);
}
@DELETE
@ -143,7 +136,6 @@ public class UserApi {
public Response deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathParam("username") String username)
throws NotFoundException {
// do some magic!
return delegate.deleteUser(username);
}
}