forked from loafle/openapi-generator-original
Merge pull request #2320 from wing328/perl_doc
[Perl] Add auto-generated Perl documentation in Markdown
This commit is contained in:
commit
70cd71fd35
@ -69,6 +69,7 @@ public abstract class AbstractGenerator {
|
||||
*
|
||||
* @param config Codegen config
|
||||
* @param templateFile Template file
|
||||
* @return String Full template file path
|
||||
*/
|
||||
public String getFullTemplateFile(CodegenConfig config, String templateFile) {
|
||||
String library = config.getLibrary();
|
||||
|
@ -29,6 +29,8 @@ public interface CodegenConfig {
|
||||
|
||||
String apiTestFileFolder();
|
||||
|
||||
String apiDocFileFolder();
|
||||
|
||||
String fileSuffix();
|
||||
|
||||
String outputFolder();
|
||||
@ -41,6 +43,8 @@ public interface CodegenConfig {
|
||||
|
||||
String modelTestFileFolder();
|
||||
|
||||
String modelDocFileFolder();
|
||||
|
||||
String modelPackage();
|
||||
|
||||
String toApiName(String name);
|
||||
@ -99,6 +103,10 @@ public interface CodegenConfig {
|
||||
|
||||
Map<String, String> modelTestTemplateFiles();
|
||||
|
||||
Map<String, String> apiDocTemplateFiles();
|
||||
|
||||
Map<String, String> modelDocTemplateFiles();
|
||||
|
||||
Set<String> languageSpecificPrimitives();
|
||||
|
||||
void preprocessSwagger(Swagger swagger);
|
||||
@ -115,6 +123,10 @@ public interface CodegenConfig {
|
||||
|
||||
String toModelTestFilename(String name);
|
||||
|
||||
String toApiDocFilename(String name);
|
||||
|
||||
String toModelDocFilename(String name);
|
||||
|
||||
String toModelImport(String name);
|
||||
|
||||
String toApiImport(String name);
|
||||
@ -137,6 +149,8 @@ public interface CodegenConfig {
|
||||
|
||||
String apiTestFilename(String templateName, String tag);
|
||||
|
||||
String apiDocFilename(String templateName, String tag);
|
||||
|
||||
boolean shouldOverwrite(String filename);
|
||||
|
||||
boolean isSkipOverwrite();
|
||||
|
@ -8,8 +8,9 @@ import java.util.List;
|
||||
public class CodegenParameter {
|
||||
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||
isCookieParam, isBodyParam, hasMore, isContainer,
|
||||
secondaryParam, isCollectionFormatMulti;
|
||||
secondaryParam, isCollectionFormatMulti, isPrimitiveType;
|
||||
public String baseName, paramName, dataType, datatypeWithEnum, collectionFormat, description, baseType, defaultValue;
|
||||
public String example; // example value (x-example)
|
||||
public String jsonSchema;
|
||||
public Boolean isString, isInteger, isLong, isFloat, isDouble, isByteArray, isBinary, isBoolean, isDate, isDateTime;
|
||||
public Boolean isListContainer, isMapContainer;
|
||||
@ -107,6 +108,7 @@ public class CodegenParameter {
|
||||
output.multipleOf = this.multipleOf;
|
||||
output.jsonSchema = this.jsonSchema;
|
||||
output.defaultValue = this.defaultValue;
|
||||
output.example = this.example;
|
||||
output.isEnum = this.isEnum;
|
||||
if (this._enum != null) {
|
||||
output._enum = new ArrayList<String>(this._enum);
|
||||
|
@ -69,6 +69,8 @@ public class DefaultCodegen {
|
||||
protected Map<String, String> modelTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> apiTestTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelTestTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> apiDocTemplateFiles = new HashMap<String, String>();
|
||||
protected Map<String, String> modelDocTemplateFiles = new HashMap<String, String>();
|
||||
protected String templateDir;
|
||||
protected String embeddedTemplateDir;
|
||||
protected Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
@ -228,6 +230,14 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> apiDocTemplateFiles() {
|
||||
return apiDocTemplateFiles;
|
||||
}
|
||||
|
||||
public Map<String, String> modelDocTemplateFiles() {
|
||||
return modelDocTemplateFiles;
|
||||
}
|
||||
|
||||
public Map<String, String> apiTestTemplateFiles() {
|
||||
return apiTestTemplateFiles;
|
||||
}
|
||||
@ -260,6 +270,14 @@ public class DefaultCodegen {
|
||||
return outputFolder + "/" + testPackage().replace('.', '/');
|
||||
}
|
||||
|
||||
public String apiDocFileFolder() {
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
public String modelDocFileFolder() {
|
||||
return outputFolder;
|
||||
}
|
||||
|
||||
public Map<String, Object> additionalProperties() {
|
||||
return additionalProperties;
|
||||
}
|
||||
@ -322,6 +340,16 @@ public class DefaultCodegen {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file name of the Api Documentation
|
||||
*
|
||||
* @param name the file name of the Api
|
||||
* @return the file name of the Api
|
||||
*/
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiName(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file name of the Api Test
|
||||
*
|
||||
@ -362,6 +390,16 @@ public class DefaultCodegen {
|
||||
return initialCaps(name) + "Test";
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the capitalized file name of the model documentation
|
||||
*
|
||||
* @param name the model name
|
||||
* @return the file name of the model
|
||||
*/
|
||||
public String toModelDocFilename(String name) {
|
||||
return initialCaps(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the operation ID (method name)
|
||||
*
|
||||
@ -614,13 +652,21 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the example value of the parameter.
|
||||
*
|
||||
* @param p Swagger property object
|
||||
*/
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the example value of the property
|
||||
*
|
||||
* @param p Swagger property object
|
||||
* @return string presentation of the example value of the property
|
||||
*/
|
||||
@SuppressWarnings("static-method")
|
||||
public String toExampleValue(Property p) {
|
||||
if(p.getExample() != null) {
|
||||
return p.getExample().toString();
|
||||
@ -1452,6 +1498,14 @@ public class DefaultCodegen {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set isPrimitiveType and baseType for allParams
|
||||
/*if (languageSpecificPrimitives.contains(p.baseType)) {
|
||||
p.isPrimitiveType = true;
|
||||
p.baseType = getSwaggerType(p);
|
||||
}*/
|
||||
|
||||
|
||||
allParams.add(p);
|
||||
if (param instanceof QueryParameter) {
|
||||
p.isQueryParam = new Boolean(true);
|
||||
@ -1723,7 +1777,9 @@ public class DefaultCodegen {
|
||||
prop.setRequired(bp.getRequired());
|
||||
CodegenProperty cp = fromProperty("property", prop);
|
||||
if (cp != null) {
|
||||
p.baseType = cp.baseType;
|
||||
p.dataType = cp.datatype;
|
||||
p.isPrimitiveType = cp.isPrimitiveType;
|
||||
p.isBinary = cp.datatype.toLowerCase().startsWith("byte");
|
||||
}
|
||||
|
||||
@ -1743,6 +1799,8 @@ public class DefaultCodegen {
|
||||
}
|
||||
imports.add(cp.baseType);
|
||||
p.dataType = cp.datatype;
|
||||
p.baseType = cp.complexType;
|
||||
p.isPrimitiveType = cp.isPrimitiveType;
|
||||
p.isContainer = true;
|
||||
p.isListContainer = true;
|
||||
|
||||
@ -1763,11 +1821,47 @@ public class DefaultCodegen {
|
||||
name = getTypeDeclaration(name);
|
||||
}
|
||||
p.dataType = name;
|
||||
p.baseType = name;
|
||||
}
|
||||
}
|
||||
p.paramName = toParamName(bp.getName());
|
||||
}
|
||||
|
||||
// set the example value
|
||||
// if not specified in x-example, generate a default value
|
||||
if (p.vendorExtensions.containsKey("x-example")) {
|
||||
p.example = (String) p.vendorExtensions.get("x-example");
|
||||
} else if (Boolean.TRUE.equals(p.isString)) {
|
||||
p.example = p.paramName + "_example";
|
||||
} else if (Boolean.TRUE.equals(p.isBoolean)) {
|
||||
p.example = new String("true");
|
||||
} else if (Boolean.TRUE.equals(p.isLong)) {
|
||||
p.example = new String("789");
|
||||
} else if (Boolean.TRUE.equals(p.isInteger)) {
|
||||
p.example = new String("56");
|
||||
} else if (Boolean.TRUE.equals(p.isFloat)) {
|
||||
p.example = new String("3.4");
|
||||
} else if (Boolean.TRUE.equals(p.isDouble)) {
|
||||
p.example = new String("1.2");
|
||||
} else if (Boolean.TRUE.equals(p.isBinary)) {
|
||||
p.example = new String("BINARY_DATA_HERE");
|
||||
} else if (Boolean.TRUE.equals(p.isByteArray)) {
|
||||
p.example = new String("B");
|
||||
} else if (Boolean.TRUE.equals(p.isDate)) {
|
||||
p.example = new String("2013-10-20");
|
||||
} else if (Boolean.TRUE.equals(p.isDateTime)) {
|
||||
p.example = new String("2013-10-20T19:20:30+01:00");
|
||||
} else if (param instanceof FormParameter &&
|
||||
("file".equalsIgnoreCase(((FormParameter) param).getType()) ||
|
||||
"file".equals(p.baseType))) {
|
||||
p.isFile = true;
|
||||
p.example = new String("/path/to/file.txt");
|
||||
}
|
||||
|
||||
// set the parameter excample value
|
||||
// should be overridden by lang codegen
|
||||
setParameterExampleValue(p);
|
||||
|
||||
postProcessParameter(p);
|
||||
return p;
|
||||
}
|
||||
@ -2196,6 +2290,19 @@ public class DefaultCodegen {
|
||||
return apiFileFolder() + '/' + toApiFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full path and API documentation file
|
||||
*
|
||||
* @param templateName template name
|
||||
* @param tag tag
|
||||
*
|
||||
* @return the API documentation file name with full path
|
||||
*/
|
||||
public String apiDocFilename(String templateName, String tag) {
|
||||
String suffix = apiDocTemplateFiles().get(templateName);
|
||||
return apiDocFileFolder() + '/' + toApiDocFilename(tag) + suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full path and API test file
|
||||
*
|
||||
@ -2361,24 +2468,34 @@ public class DefaultCodegen {
|
||||
|
||||
if (Boolean.TRUE.equals(property.isString)) {
|
||||
parameter.isString = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isBoolean)) {
|
||||
parameter.isBoolean = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isLong)) {
|
||||
parameter.isLong = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isInteger)) {
|
||||
parameter.isInteger = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isDouble)) {
|
||||
parameter.isDouble = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isFloat)) {
|
||||
parameter.isFloat = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isByteArray)) {
|
||||
parameter.isByteArray = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isBinary)) {
|
||||
parameter.isByteArray = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isDate)) {
|
||||
parameter.isDate = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else if (Boolean.TRUE.equals(property.isDateTime)) {
|
||||
parameter.isDateTime = true;
|
||||
parameter.isPrimitiveType = true;
|
||||
} else {
|
||||
LOGGER.debug("Property type is not primitive: " + property.datatype);
|
||||
}
|
||||
|
@ -263,6 +263,28 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
writeToFile(filename, tmpl.execute(models));
|
||||
files.add(new File(filename));
|
||||
}
|
||||
|
||||
// to generate model documentation files
|
||||
for (String templateName : config.modelDocTemplateFiles().keySet()) {
|
||||
String suffix = config.modelDocTemplateFiles().get(templateName);
|
||||
String filename = config.modelDocFileFolder() + File.separator + config.toModelDocFilename(name) + suffix;
|
||||
if (!config.shouldOverwrite(filename)) {
|
||||
continue;
|
||||
}
|
||||
String templateFile = getFullTemplateFile(config, templateName);
|
||||
String template = readTemplate(templateFile);
|
||||
Template tmpl = Mustache.compiler()
|
||||
.withLoader(new Mustache.TemplateLoader() {
|
||||
@Override
|
||||
public Reader getTemplate(String name) {
|
||||
return getTemplateReader(getFullTemplateFile(config, name + ".mustache"));
|
||||
}
|
||||
})
|
||||
.defaultValue("")
|
||||
.compile(template);
|
||||
writeToFile(filename, tmpl.execute(models));
|
||||
files.add(new File(filename));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not generate model '" + name + "'", e);
|
||||
}
|
||||
@ -368,6 +390,29 @@ public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||
files.add(new File(filename));
|
||||
}
|
||||
|
||||
// to generate api documentation files
|
||||
for (String templateName : config.apiDocTemplateFiles().keySet()) {
|
||||
String filename = config.apiDocFilename(templateName, tag);
|
||||
if (!config.shouldOverwrite(filename) && new File(filename).exists()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String templateFile = getFullTemplateFile(config, templateName);
|
||||
String template = readTemplate(templateFile);
|
||||
Template tmpl = Mustache.compiler()
|
||||
.withLoader(new Mustache.TemplateLoader() {
|
||||
@Override
|
||||
public Reader getTemplate(String name) {
|
||||
return getTemplateReader(getFullTemplateFile(config, name + ".mustache"));
|
||||
}
|
||||
})
|
||||
.defaultValue("")
|
||||
.compile(template);
|
||||
|
||||
writeToFile(filename, tmpl.execute(operation));
|
||||
files.add(new File(filename));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Could not generate api file for '" + tag + "'", e);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenParameter;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.SupportingFile;
|
||||
@ -9,6 +10,17 @@ import io.swagger.codegen.CliOption;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.Property;
|
||||
import io.swagger.models.properties.StringProperty;
|
||||
import io.swagger.models.properties.LongProperty;
|
||||
import io.swagger.models.properties.IntegerProperty;
|
||||
import io.swagger.models.properties.FloatProperty;
|
||||
import io.swagger.models.properties.DoubleProperty;
|
||||
import io.swagger.models.properties.BooleanProperty;
|
||||
import io.swagger.models.properties.BinaryProperty;
|
||||
import io.swagger.models.properties.ByteArrayProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.DateProperty;
|
||||
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
@ -23,6 +35,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
protected String moduleName = "WWW::SwaggerClient";
|
||||
protected String modulePathPart = moduleName.replaceAll("::", Matcher.quoteReplacement(File.separator));
|
||||
protected String moduleVersion = "1.0.0";
|
||||
protected String apiDocPath = "docs/";
|
||||
protected String modelDocPath = "docs/";
|
||||
|
||||
protected static int emptyFunctionNameCounter = 0;
|
||||
|
||||
@ -34,6 +48,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
apiTemplateFiles.put("api.mustache", ".pm");
|
||||
modelTestTemplateFiles.put("object_test.mustache", ".t");
|
||||
apiTestTemplateFiles.put("api_test.mustache", ".t");
|
||||
modelDocTemplateFiles.put("object_doc.mustache", ".md");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
embeddedTemplateDir = templateDir = "perl";
|
||||
|
||||
|
||||
@ -108,6 +124,10 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
additionalProperties.put(MODULE_NAME, moduleName);
|
||||
}
|
||||
|
||||
// make api and model doc path available in mustache template
|
||||
additionalProperties.put("apiDocPath", apiDocPath);
|
||||
additionalProperties.put("modelDocPath", modelDocPath);
|
||||
|
||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiClient.pm"));
|
||||
supportingFiles.add(new SupportingFile("Configuration.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "Configuration.pm"));
|
||||
supportingFiles.add(new SupportingFile("ApiFactory.mustache", ("lib/" + modulePathPart).replace('/', File.separatorChar), "ApiFactory.pm"));
|
||||
@ -147,7 +167,6 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return (outputFolder + "/lib/" + modulePathPart + modelPackage()).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String apiTestFileFolder() {
|
||||
return (outputFolder + "/t").replace('/', File.separatorChar);
|
||||
@ -158,6 +177,16 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return (outputFolder + "/t").replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String apiDocFileFolder() {
|
||||
return (outputFolder + "/" + apiDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String modelDocFileFolder() {
|
||||
return (outputFolder + "/" + modelDocPath).replace('/', File.separatorChar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTypeDeclaration(Property p) {
|
||||
if (p instanceof ArrayProperty) {
|
||||
@ -192,7 +221,43 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public String toDefaultValue(Property p) {
|
||||
return "null";
|
||||
if (p instanceof StringProperty) {
|
||||
StringProperty dp = (StringProperty) p;
|
||||
if (dp.getDefault() != null) {
|
||||
return "'" + dp.getDefault().toString() + "'";
|
||||
}
|
||||
} else if (p instanceof BooleanProperty) {
|
||||
BooleanProperty dp = (BooleanProperty) p;
|
||||
if (dp.getDefault() != null) {
|
||||
return dp.getDefault().toString();
|
||||
}
|
||||
} else if (p instanceof DateProperty) {
|
||||
// TODO
|
||||
} else if (p instanceof DateTimeProperty) {
|
||||
// TODO
|
||||
} else if (p instanceof DoubleProperty) {
|
||||
DoubleProperty dp = (DoubleProperty) p;
|
||||
if (dp.getDefault() != null) {
|
||||
return dp.getDefault().toString();
|
||||
}
|
||||
} else if (p instanceof FloatProperty) {
|
||||
FloatProperty dp = (FloatProperty) p;
|
||||
if (dp.getDefault() != null) {
|
||||
return dp.getDefault().toString();
|
||||
}
|
||||
} else if (p instanceof IntegerProperty) {
|
||||
IntegerProperty dp = (IntegerProperty) p;
|
||||
if (dp.getDefault() != null) {
|
||||
return dp.getDefault().toString();
|
||||
}
|
||||
} else if (p instanceof LongProperty) {
|
||||
LongProperty dp = (LongProperty) p;
|
||||
if (dp.getDefault() != null) {
|
||||
return dp.getDefault().toString();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@ -251,11 +316,21 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return toModelFilename(name) + "Test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toModelDocFilename(String name) {
|
||||
return toModelFilename(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiTestFilename(String name) {
|
||||
return toApiFilename(name) + "Test";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiDocFilename(String name) {
|
||||
return toApiFilename(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toApiFilename(String name) {
|
||||
// replace - with _ e.g. created-at => created_at
|
||||
@ -303,4 +378,20 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void setModuleVersion(String moduleVersion) {
|
||||
this.moduleVersion = moduleVersion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
if (Boolean.TRUE.equals(p.isString) || Boolean.TRUE.equals(p.isBinary) ||
|
||||
Boolean.TRUE.equals(p.isByteArray) || Boolean.TRUE.equals(p.isFile)) {
|
||||
p.example = "'" + p.example + "'";
|
||||
} else if (Boolean.TRUE.equals(p.isBoolean)) {
|
||||
if (Boolean.parseBoolean(p.example))
|
||||
p.example = new String("1");
|
||||
else
|
||||
p.example = new String("0");
|
||||
} else if (Boolean.TRUE.equals(p.isDateTime) || Boolean.TRUE.equals(p.isDate)) {
|
||||
p.example = "DateTime->from_epoch(epoch => str2time('" + p.example + "'))";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -217,3 +217,17 @@ spec. If so, this is available via the `class_documentation()` and
|
||||
|
||||
|
||||
Each of these calls returns a hashref with various useful pieces of information.
|
||||
|
||||
# DOCUMENTATION FOR API ENDPOINTS
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{nickname}}**]({{apiDocPath}}{{classname}}.md#{{nickname}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}}
|
||||
|
||||
# DOCUMENTATION FOR MODELS
|
||||
{{#models}}{{#model}} - [{{moduleName}}::Object::{{classname}}]({{modelDocPath}}{{classname}}.md)
|
||||
{{/model}}{{/models}}
|
||||
|
||||
|
@ -54,7 +54,7 @@ sub new {
|
||||
{{#operation}}
|
||||
|
||||
#
|
||||
# {{{nickname}}}
|
||||
# {{{operationId}}}
|
||||
#
|
||||
# {{{summary}}}
|
||||
#
|
||||
@ -70,7 +70,7 @@ sub new {
|
||||
},
|
||||
{{/allParams}}
|
||||
};
|
||||
__PACKAGE__->method_documentation->{ {{nickname}} } = {
|
||||
__PACKAGE__->method_documentation->{ {{operationId}} } = {
|
||||
summary => '{{summary}}',
|
||||
params => $params,
|
||||
returns => {{#returnType}}'{{{returnType}}}'{{/returnType}}{{^returnType}}undef{{/returnType}},
|
||||
@ -78,13 +78,13 @@ sub new {
|
||||
}
|
||||
# @return {{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}
|
||||
#
|
||||
sub {{nickname}} {
|
||||
sub {{operationId}} {
|
||||
my ($self, %args) = @_;
|
||||
|
||||
{{#allParams}}{{#required}}
|
||||
# verify the required parameter '{{paramName}}' is set
|
||||
unless (exists $args{'{{paramName}}'}) {
|
||||
croak("Missing the required parameter '{{paramName}}' when calling {{nickname}}");
|
||||
croak("Missing the required parameter '{{paramName}}' when calling {{operationId}}");
|
||||
}
|
||||
{{/required}}{{/allParams}}
|
||||
|
||||
|
@ -1293,6 +1293,7 @@
|
||||
}
|
||||
},
|
||||
"Return": {
|
||||
"descripton": "Model for testing reserved words",
|
||||
"properties": {
|
||||
"return": {
|
||||
"type": "integer",
|
||||
|
@ -8,7 +8,7 @@ WWW::SwaggerClient::Role - a Moose role for the Swagger Petstore
|
||||
|
||||
Automatically generated by the Perl Swagger Codegen project:
|
||||
|
||||
- Build date: 2016-03-04T14:39:09.479+08:00
|
||||
- Build date: 2016-03-08T16:48:08.361+08:00
|
||||
- Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
||||
- Codegen version:
|
||||
|
||||
@ -217,3 +217,48 @@ spec. If so, this is available via the `class_documentation()` and
|
||||
|
||||
|
||||
Each of these calls returns a hashref with various useful pieces of information.
|
||||
|
||||
# DOCUMENTATION FOR API ENDPOINTS
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Class | Method | HTTP request | Description
|
||||
------------ | ------------- | ------------- | -------------
|
||||
*UserApi* | [**create_user**](docs/UserApi.md#create_user) | **POST** /user | Create user
|
||||
*UserApi* | [**create_users_with_array_input**](docs/UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
*UserApi* | [**create_users_with_list_input**](docs/UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
*UserApi* | [**login_user**](docs/UserApi.md#login_user) | **GET** /user/login | Logs user into the system
|
||||
*UserApi* | [**logout_user**](docs/UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
|
||||
*UserApi* | [**get_user_by_name**](docs/UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
|
||||
*UserApi* | [**update_user**](docs/UserApi.md#update_user) | **PUT** /user/{username} | Updated user
|
||||
*UserApi* | [**delete_user**](docs/UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
|
||||
*PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
*PetApi* | [**add_pet**](docs/PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
*PetApi* | [**find_pets_by_status**](docs/PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
*PetApi* | [**find_pets_by_tags**](docs/PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
*PetApi* | [**get_pet_by_id**](docs/PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
|
||||
*PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
*PetApi* | [**delete_pet**](docs/PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
*PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
*PetApi* | [**get_pet_by_id_in_object**](docs/PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
*PetApi* | [**pet_pet_idtesting_byte_arraytrue_get**](docs/PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
*PetApi* | [**add_pet_using_byte_array**](docs/PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
*StoreApi* | [**find_orders_by_status**](docs/StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
|
||||
*StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
*StoreApi* | [**get_inventory_in_object**](docs/StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
*StoreApi* | [**place_order**](docs/StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
*StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
*StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
|
||||
|
||||
# DOCUMENTATION FOR MODELS
|
||||
- [WWW::SwaggerClient::Object::User](docs/User.md)
|
||||
- [WWW::SwaggerClient::Object::Category](docs/Category.md)
|
||||
- [WWW::SwaggerClient::Object::Pet](docs/Pet.md)
|
||||
- [WWW::SwaggerClient::Object::Tag](docs/Tag.md)
|
||||
- [WWW::SwaggerClient::Object::ModelReturn](docs/ModelReturn.md)
|
||||
- [WWW::SwaggerClient::Object::Order](docs/Order.md)
|
||||
- [WWW::SwaggerClient::Object::SpecialModelName](docs/SpecialModelName.md)
|
||||
- [WWW::SwaggerClient::Object::InlineResponse200](docs/InlineResponse200.md)
|
||||
|
||||
|
||||
|
14
samples/client/petstore/perl/docs/Category.md
Normal file
14
samples/client/petstore/perl/docs/Category.md
Normal file
@ -0,0 +1,14 @@
|
||||
# WWW::SwaggerClient::Object::Category
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::Category;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **string** | | [optional]
|
||||
|
||||
|
18
samples/client/petstore/perl/docs/InlineResponse200.md
Normal file
18
samples/client/petstore/perl/docs/InlineResponse200.md
Normal file
@ -0,0 +1,18 @@
|
||||
# WWW::SwaggerClient::Object::InlineResponse200
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::InlineResponse200;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**tags** | [**ARRAY[Tag]**](Tag.md) | | [optional]
|
||||
**id** | **int** | |
|
||||
**category** | **object** | | [optional]
|
||||
**status** | **string** | pet status in the store | [optional]
|
||||
**name** | **string** | | [optional]
|
||||
**photo_urls** | **ARRAY[string]** | | [optional]
|
||||
|
||||
|
13
samples/client/petstore/perl/docs/ObjectReturn.md
Normal file
13
samples/client/petstore/perl/docs/ObjectReturn.md
Normal file
@ -0,0 +1,13 @@
|
||||
# WWW::SwaggerClient::Object::ObjectReturn
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::ObjectReturn;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**return** | **int** | | [optional]
|
||||
|
||||
|
18
samples/client/petstore/perl/docs/Order.md
Normal file
18
samples/client/petstore/perl/docs/Order.md
Normal file
@ -0,0 +1,18 @@
|
||||
# WWW::SwaggerClient::Object::Order
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::Order;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**pet_id** | **int** | | [optional]
|
||||
**quantity** | **int** | | [optional]
|
||||
**ship_date** | **DateTime** | | [optional]
|
||||
**status** | **string** | Order Status | [optional]
|
||||
**complete** | **boolean** | | [optional]
|
||||
|
||||
|
18
samples/client/petstore/perl/docs/Pet.md
Normal file
18
samples/client/petstore/perl/docs/Pet.md
Normal file
@ -0,0 +1,18 @@
|
||||
# WWW::SwaggerClient::Object::Pet
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::Pet;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**category** | [**Category**](Category.md) | | [optional]
|
||||
**name** | **string** | |
|
||||
**photo_urls** | **ARRAY[string]** | |
|
||||
**tags** | [**ARRAY[Tag]**](Tag.md) | | [optional]
|
||||
**status** | **string** | pet status in the store | [optional]
|
||||
|
||||
|
491
samples/client/petstore/perl/docs/PetApi.md
Normal file
491
samples/client/petstore/perl/docs/PetApi.md
Normal file
@ -0,0 +1,491 @@
|
||||
# WWW::SwaggerClient::PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet
|
||||
[**add_pet**](PetApi.md#add_pet) | **POST** /pet | Add a new pet to the store
|
||||
[**find_pets_by_status**](PetApi.md#find_pets_by_status) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**find_pets_by_tags**](PetApi.md#find_pets_by_tags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**get_pet_by_id**](PetApi.md#get_pet_by_id) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**delete_pet**](PetApi.md#delete_pet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
[**get_pet_by_id_in_object**](PetApi.md#get_pet_by_id_in_object) | **GET** /pet/{petId}?response=inline_arbitrary_object | Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
[**pet_pet_idtesting_byte_arraytrue_get**](PetApi.md#pet_pet_idtesting_byte_arraytrue_get) | **GET** /pet/{petId}?testing_byte_array=true | Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
[**add_pet_using_byte_array**](PetApi.md#add_pet_using_byte_array) | **POST** /pet?testing_byte_array=true | Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
|
||||
|
||||
# **update_pet**
|
||||
> update_pet(body => $body)
|
||||
|
||||
Update an existing pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $body = WWW::SwaggerClient::Object::Pet->new(); # [Pet] Pet object that needs to be added to the store
|
||||
|
||||
eval {
|
||||
$api->update_pet(body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling update_pet: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **add_pet**
|
||||
> add_pet(body => $body)
|
||||
|
||||
Add a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $body = WWW::SwaggerClient::Object::Pet->new(); # [Pet] Pet object that needs to be added to the store
|
||||
|
||||
eval {
|
||||
$api->add_pet(body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling add_pet: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **find_pets_by_status**
|
||||
> ARRAY[Pet] find_pets_by_status(status => $status)
|
||||
|
||||
Finds Pets by status
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $status = (); # [ARRAY[string]] Status values that need to be considered for query
|
||||
|
||||
eval {
|
||||
my $result = $api->find_pets_by_status(status => $status);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling find_pets_by_status: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | [**ARRAY[string]**](string.md)| Status values that need to be considered for query | [optional] [default to available]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ARRAY[Pet]**](Pet.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **find_pets_by_tags**
|
||||
> ARRAY[Pet] find_pets_by_tags(tags => $tags)
|
||||
|
||||
Finds Pets by tags
|
||||
|
||||
Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $tags = (); # [ARRAY[string]] Tags to filter by
|
||||
|
||||
eval {
|
||||
my $result = $api->find_pets_by_tags(tags => $tags);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling find_pets_by_tags: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | [**ARRAY[string]**](string.md)| Tags to filter by | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ARRAY[Pet]**](Pet.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **get_pet_by_id**
|
||||
> Pet get_pet_by_id(pet_id => $pet_id)
|
||||
|
||||
Find pet by ID
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $pet_id = 789; # [int] ID of pet that needs to be fetched
|
||||
|
||||
eval {
|
||||
my $result = $api->get_pet_by_id(pet_id => $pet_id);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling get_pet_by_id: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Pet**](Pet.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
api_keypetstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **update_pet_with_form**
|
||||
> update_pet_with_form(pet_id => $pet_id, name => $name, status => $status)
|
||||
|
||||
Updates a pet in the store with form data
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $pet_id = 'pet_id_example'; # [string] ID of pet that needs to be updated
|
||||
my $name = 'name_example'; # [string] Updated name of the pet
|
||||
my $status = 'status_example'; # [string] Updated status of the pet
|
||||
|
||||
eval {
|
||||
$api->update_pet_with_form(pet_id => $pet_id, name => $name, status => $status);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling update_pet_with_form: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **string**| ID of pet that needs to be updated |
|
||||
**name** | **string**| Updated name of the pet | [optional]
|
||||
**status** | **string**| Updated status of the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **delete_pet**
|
||||
> delete_pet(pet_id => $pet_id, api_key => $api_key)
|
||||
|
||||
Deletes a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $pet_id = 789; # [int] Pet id to delete
|
||||
my $api_key = 'api_key_example'; # [string]
|
||||
|
||||
eval {
|
||||
$api->delete_pet(pet_id => $pet_id, api_key => $api_key);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling delete_pet: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| Pet id to delete |
|
||||
**api_key** | **string**| | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **upload_file**
|
||||
> upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file)
|
||||
|
||||
uploads an image
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $pet_id = 789; # [int] ID of pet to update
|
||||
my $additional_metadata = 'additional_metadata_example'; # [string] Additional data to pass to server
|
||||
my $file = '/path/to/file.txt'; # [File] file to upload
|
||||
|
||||
eval {
|
||||
$api->upload_file(pet_id => $pet_id, additional_metadata => $additional_metadata, file => $file);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling upload_file: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet to update |
|
||||
**additional_metadata** | **string**| Additional data to pass to server | [optional]
|
||||
**file** | [**File**](.md)| file to upload | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **get_pet_by_id_in_object**
|
||||
> InlineResponse200 get_pet_by_id_in_object(pet_id => $pet_id)
|
||||
|
||||
Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $pet_id = 789; # [int] ID of pet that needs to be fetched
|
||||
|
||||
eval {
|
||||
my $result = $api->get_pet_by_id_in_object(pet_id => $pet_id);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling get_pet_by_id_in_object: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**InlineResponse200**](InlineResponse200.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
api_keypetstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **pet_pet_idtesting_byte_arraytrue_get**
|
||||
> string pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id)
|
||||
|
||||
Fake endpoint to test byte array return by 'Find pet by ID'
|
||||
|
||||
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $pet_id = 789; # [int] ID of pet that needs to be fetched
|
||||
|
||||
eval {
|
||||
my $result = $api->pet_pet_idtesting_byte_arraytrue_get(pet_id => $pet_id);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling pet_pet_idtesting_byte_arraytrue_get: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet_id** | **int**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
api_keypetstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **add_pet_using_byte_array**
|
||||
> add_pet_using_byte_array(body => $body)
|
||||
|
||||
Fake endpoint to test byte array in body parameter for adding a new pet to the store
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
my $body = WWW::SwaggerClient::Object::string->new(); # [string] Pet object in the form of byte array
|
||||
|
||||
eval {
|
||||
$api->add_pet_using_byte_array(body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling add_pet_using_byte_array: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | **string**| Pet object in the form of byte array | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
petstore_auth
|
||||
|
||||
|
||||
|
||||
|
||||
|
13
samples/client/petstore/perl/docs/SpecialModelName.md
Normal file
13
samples/client/petstore/perl/docs/SpecialModelName.md
Normal file
@ -0,0 +1,13 @@
|
||||
# WWW::SwaggerClient::Object::SpecialModelName
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::SpecialModelName;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**__special[property/name]** | **int** | | [optional]
|
||||
|
||||
|
262
samples/client/petstore/perl/docs/StoreApi.md
Normal file
262
samples/client/petstore/perl/docs/StoreApi.md
Normal file
@ -0,0 +1,262 @@
|
||||
# WWW::SwaggerClient::StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**find_orders_by_status**](StoreApi.md#find_orders_by_status) | **GET** /store/findByStatus | Finds orders by status
|
||||
[**get_inventory**](StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**get_inventory_in_object**](StoreApi.md#get_inventory_in_object) | **GET** /store/inventory?response=arbitrary_object | Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
[**place_order**](StoreApi.md#place_order) | **POST** /store/order | Place an order for a pet
|
||||
[**get_order_by_id**](StoreApi.md#get_order_by_id) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**delete_order**](StoreApi.md#delete_order) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
|
||||
|
||||
# **find_orders_by_status**
|
||||
> ARRAY[Order] find_orders_by_status(status => $status)
|
||||
|
||||
Finds orders by status
|
||||
|
||||
A single status value can be provided as a string
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::StoreApi->new();
|
||||
my $status = 'status_example'; # [string] Status value that needs to be considered for query
|
||||
|
||||
eval {
|
||||
my $result = $api->find_orders_by_status(status => $status);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling find_orders_by_status: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **string**| Status value that needs to be considered for query | [optional] [default to placed]
|
||||
|
||||
### Return type
|
||||
|
||||
[**ARRAY[Order]**](Order.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
test_api_client_idtest_api_client_secret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **get_inventory**
|
||||
> HASH[string,int] get_inventory()
|
||||
|
||||
Returns pet inventories by status
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::StoreApi->new();
|
||||
|
||||
eval {
|
||||
my $result = $api->get_inventory();
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling get_inventory: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
|
||||
### Return type
|
||||
|
||||
**HASH[string,int]**
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
api_key
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **get_inventory_in_object**
|
||||
> object get_inventory_in_object()
|
||||
|
||||
Fake endpoint to test arbitrary object return by 'Get inventory'
|
||||
|
||||
Returns an arbitrary object which is actually a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::StoreApi->new();
|
||||
|
||||
eval {
|
||||
my $result = $api->get_inventory_in_object();
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling get_inventory_in_object: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
|
||||
### Return type
|
||||
|
||||
**object**
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
api_key
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **place_order**
|
||||
> Order place_order(body => $body)
|
||||
|
||||
Place an order for a pet
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::StoreApi->new();
|
||||
my $body = WWW::SwaggerClient::Object::Order->new(); # [Order] order placed for purchasing the pet
|
||||
|
||||
eval {
|
||||
my $result = $api->place_order(body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling place_order: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**Order**](Order.md)| order placed for purchasing the pet | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
test_api_client_idtest_api_client_secret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **get_order_by_id**
|
||||
> Order get_order_by_id(order_id => $order_id)
|
||||
|
||||
Find purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::StoreApi->new();
|
||||
my $order_id = 'order_id_example'; # [string] ID of pet that needs to be fetched
|
||||
|
||||
eval {
|
||||
my $result = $api->get_order_by_id(order_id => $order_id);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling get_order_by_id: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order_id** | **string**| ID of pet that needs to be fetched |
|
||||
|
||||
### Return type
|
||||
|
||||
[**Order**](Order.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
test_api_key_headertest_api_key_query
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **delete_order**
|
||||
> delete_order(order_id => $order_id)
|
||||
|
||||
Delete purchase order by ID
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::StoreApi->new();
|
||||
my $order_id = 'order_id_example'; # [string] ID of the order that needs to be deleted
|
||||
|
||||
eval {
|
||||
$api->delete_order(order_id => $order_id);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling delete_order: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order_id** | **string**| ID of the order that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
14
samples/client/petstore/perl/docs/Tag.md
Normal file
14
samples/client/petstore/perl/docs/Tag.md
Normal file
@ -0,0 +1,14 @@
|
||||
# WWW::SwaggerClient::Object::Tag
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::Tag;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**name** | **string** | | [optional]
|
||||
|
||||
|
20
samples/client/petstore/perl/docs/User.md
Normal file
20
samples/client/petstore/perl/docs/User.md
Normal file
@ -0,0 +1,20 @@
|
||||
# WWW::SwaggerClient::Object::User
|
||||
|
||||
## Import the module
|
||||
```perl
|
||||
use WWW::SwaggerClient::Object::User;
|
||||
```
|
||||
|
||||
## Properties
|
||||
Name | Type | Description | Notes
|
||||
------------ | ------------- | ------------- | -------------
|
||||
**id** | **int** | | [optional]
|
||||
**username** | **string** | | [optional]
|
||||
**first_name** | **string** | | [optional]
|
||||
**last_name** | **string** | | [optional]
|
||||
**email** | **string** | | [optional]
|
||||
**password** | **string** | | [optional]
|
||||
**phone** | **string** | | [optional]
|
||||
**user_status** | **int** | User Status | [optional]
|
||||
|
||||
|
354
samples/client/petstore/perl/docs/UserApi.md
Normal file
354
samples/client/petstore/perl/docs/UserApi.md
Normal file
@ -0,0 +1,354 @@
|
||||
# WWW::SwaggerClient::UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**create_user**](UserApi.md#create_user) | **POST** /user | Create user
|
||||
[**create_users_with_array_input**](UserApi.md#create_users_with_array_input) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**create_users_with_list_input**](UserApi.md#create_users_with_list_input) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**login_user**](UserApi.md#login_user) | **GET** /user/login | Logs user into the system
|
||||
[**logout_user**](UserApi.md#logout_user) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**get_user_by_name**](UserApi.md#get_user_by_name) | **GET** /user/{username} | Get user by user name
|
||||
[**update_user**](UserApi.md#update_user) | **PUT** /user/{username} | Updated user
|
||||
[**delete_user**](UserApi.md#delete_user) | **DELETE** /user/{username} | Delete user
|
||||
|
||||
|
||||
# **create_user**
|
||||
> create_user(body => $body)
|
||||
|
||||
Create user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
my $body = WWW::SwaggerClient::Object::User->new(); # [User] Created user object
|
||||
|
||||
eval {
|
||||
$api->create_user(body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling create_user: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**User**](User.md)| Created user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **create_users_with_array_input**
|
||||
> create_users_with_array_input(body => $body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # [ARRAY[User]] List of user object
|
||||
|
||||
eval {
|
||||
$api->create_users_with_array_input(body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling create_users_with_array_input: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**ARRAY[User]**](User.md)| List of user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **create_users_with_list_input**
|
||||
> create_users_with_list_input(body => $body)
|
||||
|
||||
Creates list of users with given input array
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
my $body = (WWW::SwaggerClient::Object::ARRAY[User]->new()); # [ARRAY[User]] List of user object
|
||||
|
||||
eval {
|
||||
$api->create_users_with_list_input(body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling create_users_with_list_input: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**body** | [**ARRAY[User]**](User.md)| List of user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **login_user**
|
||||
> string login_user(username => $username, password => $password)
|
||||
|
||||
Logs user into the system
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
my $username = 'username_example'; # [string] The user name for login
|
||||
my $password = 'password_example'; # [string] The password for login in clear text
|
||||
|
||||
eval {
|
||||
my $result = $api->login_user(username => $username, password => $password);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling login_user: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **string**| The user name for login | [optional]
|
||||
**password** | **string**| The password for login in clear text | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **logout_user**
|
||||
> logout_user()
|
||||
|
||||
Logs out current logged in user session
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
|
||||
eval {
|
||||
$api->logout_user();
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling logout_user: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **get_user_by_name**
|
||||
> User get_user_by_name(username => $username)
|
||||
|
||||
Get user by user name
|
||||
|
||||
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
my $username = 'username_example'; # [string] The name that needs to be fetched. Use user1 for testing.
|
||||
|
||||
eval {
|
||||
my $result = $api->get_user_by_name(username => $username);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling get_user_by_name: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **string**| The name that needs to be fetched. Use user1 for testing. |
|
||||
|
||||
### Return type
|
||||
|
||||
[**User**](User.md)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **update_user**
|
||||
> update_user(username => $username, body => $body)
|
||||
|
||||
Updated user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
my $username = 'username_example'; # [string] name that need to be deleted
|
||||
my $body = WWW::SwaggerClient::Object::User->new(); # [User] Updated user object
|
||||
|
||||
eval {
|
||||
$api->update_user(username => $username, body => $body);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling update_user: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **string**| name that need to be deleted |
|
||||
**body** | [**User**](User.md)| Updated user object | [optional]
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# **delete_user**
|
||||
> delete_user(username => $username)
|
||||
|
||||
Delete user
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
```perl
|
||||
my $api = WWW::SwaggerClient::UserApi->new();
|
||||
my $username = 'username_example'; # [string] The name that needs to be deleted
|
||||
|
||||
eval {
|
||||
$api->delete_user(username => $username);
|
||||
};
|
||||
if ($@) {
|
||||
warn "Exception when calling delete_user: $@\n";
|
||||
}
|
||||
```
|
||||
|
||||
### Parameters
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | **string**| The name that needs to be deleted |
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### HTTP headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json, application/xml
|
||||
|
||||
### Authentication scheme
|
||||
|
||||
No authentiation required
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -103,6 +103,13 @@ __PACKAGE__->class_documentation({description => '',
|
||||
} );
|
||||
|
||||
__PACKAGE__->method_documentation({
|
||||
'tags' => {
|
||||
datatype => 'ARRAY[Tag]',
|
||||
base_name => 'tags',
|
||||
description => '',
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
'id' => {
|
||||
datatype => 'int',
|
||||
base_name => 'id',
|
||||
@ -117,6 +124,13 @@ __PACKAGE__->method_documentation({
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
'status' => {
|
||||
datatype => 'string',
|
||||
base_name => 'status',
|
||||
description => 'pet status in the store',
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
'name' => {
|
||||
datatype => 'string',
|
||||
base_name => 'name',
|
||||
@ -124,19 +138,32 @@ __PACKAGE__->method_documentation({
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
'photo_urls' => {
|
||||
datatype => 'ARRAY[string]',
|
||||
base_name => 'photoUrls',
|
||||
description => '',
|
||||
format => '',
|
||||
read_only => '',
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
__PACKAGE__->swagger_types( {
|
||||
'tags' => 'ARRAY[Tag]',
|
||||
'id' => 'int',
|
||||
'category' => 'object',
|
||||
'name' => 'string'
|
||||
'status' => 'string',
|
||||
'name' => 'string',
|
||||
'photo_urls' => 'ARRAY[string]'
|
||||
} );
|
||||
|
||||
__PACKAGE__->attribute_map( {
|
||||
'tags' => 'tags',
|
||||
'id' => 'id',
|
||||
'category' => 'category',
|
||||
'name' => 'name'
|
||||
'status' => 'status',
|
||||
'name' => 'name',
|
||||
'photo_urls' => 'photoUrls'
|
||||
} );
|
||||
|
||||
__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map});
|
||||
|
@ -37,7 +37,7 @@ has version_info => ( is => 'ro',
|
||||
default => sub { {
|
||||
app_name => 'Swagger Petstore',
|
||||
app_version => '1.0.0',
|
||||
generated_date => '2016-03-04T14:39:09.479+08:00',
|
||||
generated_date => '2016-03-08T16:48:08.361+08:00',
|
||||
generator_class => 'class io.swagger.codegen.languages.PerlClientCodegen',
|
||||
} },
|
||||
documentation => 'Information about the application version and the codegen codebase version'
|
||||
@ -103,7 +103,7 @@ Automatically generated by the Perl Swagger Codegen project:
|
||||
|
||||
=over 4
|
||||
|
||||
=item Build date: 2016-03-04T14:39:09.479+08:00
|
||||
=item Build date: 2016-03-08T16:48:08.361+08:00
|
||||
|
||||
=item Build package: class io.swagger.codegen.languages.PerlClientCodegen
|
||||
|
||||
|
@ -25,6 +25,14 @@ $WWW::SwaggerClient::Configuration::password = 'password';
|
||||
|
||||
my $api = WWW::SwaggerClient::PetApi->new();
|
||||
|
||||
# exception handling
|
||||
#eval {
|
||||
# print "\nget_pet_by_id:".Dumper $api->get_pet_by_id(pet_id => 9999);
|
||||
#};
|
||||
#if ($@) {
|
||||
# print "Exception when calling: $@\n";
|
||||
#}
|
||||
|
||||
my $pet_id = 10008;
|
||||
|
||||
my $category = WWW::SwaggerClient::Object::Category->new('id' => '2', 'name' => 'perl');
|
||||
|
Loading…
x
Reference in New Issue
Block a user