forked from loafle/openapi-generator-original
* generate docs for typescript * commit changed files * Fix NullPointerException on ComposedSchema * Fix merge issues
This commit is contained in:
parent
cb71ae95a6
commit
74e28a7709
@ -5,3 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
additionalProperties:
|
||||
platform: deno
|
||||
npmName: ts-petstore-client
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
|
@ -6,3 +6,5 @@ additionalProperties:
|
||||
platform: node
|
||||
npmName: ts-petstore-client
|
||||
useInversify: true
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
|
@ -5,3 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
additionalProperties:
|
||||
framework: jquery
|
||||
npmName: ts-petstore-client
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
|
@ -6,3 +6,5 @@ additionalProperties:
|
||||
platform: node
|
||||
npmName: ts-petstore-client
|
||||
useObjectParameters: true
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
|
@ -5,3 +5,5 @@ templateDir: modules/openapi-generator/src/main/resources/typescript
|
||||
additionalProperties:
|
||||
platform: node
|
||||
npmName: ts-petstore-client
|
||||
projectName: ts-petstore-client
|
||||
moduleName: petstore
|
||||
|
@ -17,6 +17,13 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import io.swagger.v3.core.util.Json;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.media.MediaType;
|
||||
import io.swagger.v3.oas.models.parameters.RequestBody;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
@ -24,13 +31,22 @@ import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.CodegenDiscriminator.MappedModel;
|
||||
import org.openapitools.codegen.meta.GeneratorMetadata;
|
||||
import org.openapitools.codegen.meta.Stability;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.github.curiousoddman.rgxgen.RgxGen;
|
||||
import com.github.curiousoddman.rgxgen.config.RgxGenOption;
|
||||
import com.github.curiousoddman.rgxgen.config.RgxGenProperties;
|
||||
|
||||
import java.io.File;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@ -38,6 +54,8 @@ import java.util.stream.Collectors;
|
||||
import static org.openapitools.codegen.utils.StringUtils.camelize;
|
||||
import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
|
||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||
|
||||
|
||||
public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(TypeScriptClientCodegen.class);
|
||||
@ -80,6 +98,9 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
protected String modelPropertyNaming = "camelCase";
|
||||
protected HashSet<String> languageGenericTypes;
|
||||
|
||||
private DateTimeFormatter iso8601Date = DateTimeFormatter.ISO_DATE;
|
||||
private DateTimeFormatter iso8601DateTime = DateTimeFormatter.ISO_DATE_TIME;
|
||||
|
||||
public TypeScriptClientCodegen() {
|
||||
super();
|
||||
|
||||
@ -219,6 +240,7 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
supportingFiles.add(new SupportingFile("api" + File.separator + "middleware.mustache", "", "middleware.ts"));
|
||||
supportingFiles.add(new SupportingFile("api" + File.separator + "baseapi.mustache", "apis", "baseapi.ts"));
|
||||
apiTemplateFiles.put("api" + File.separator + "api.mustache", ".ts");
|
||||
apiDocTemplateFiles.put("api_doc.mustache", ".md");
|
||||
}
|
||||
|
||||
public String getNpmName() {
|
||||
@ -880,6 +902,616 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
addImport(codegenModel, codegenModel.additionalPropertiesType);
|
||||
}
|
||||
|
||||
public String typescriptDate(Object dateValue) {
|
||||
String strValue = null;
|
||||
if (dateValue instanceof OffsetDateTime) {
|
||||
OffsetDateTime date = null;
|
||||
try {
|
||||
date = (OffsetDateTime) dateValue;
|
||||
} catch (ClassCastException e) {
|
||||
LOGGER.warn("Invalid `date` format for value {}", dateValue);
|
||||
date = ((Date) dateValue).toInstant().atOffset(ZoneOffset.UTC);
|
||||
}
|
||||
strValue = date.format(iso8601Date);
|
||||
} else {
|
||||
strValue = dateValue.toString();
|
||||
}
|
||||
return "new Date('" + strValue + "').toISOString().split('T')[0];";
|
||||
}
|
||||
|
||||
public String typescriptDateTime(Object dateTimeValue) {
|
||||
String strValue = null;
|
||||
if (dateTimeValue instanceof OffsetDateTime) {
|
||||
OffsetDateTime dateTime = null;
|
||||
try {
|
||||
dateTime = (OffsetDateTime) dateTimeValue;
|
||||
} catch (ClassCastException e) {
|
||||
LOGGER.warn("Invalid `date-time` format for value {}", dateTimeValue);
|
||||
dateTime = ((Date) dateTimeValue).toInstant().atOffset(ZoneOffset.UTC);
|
||||
}
|
||||
strValue = dateTime.format(iso8601DateTime);
|
||||
} else {
|
||||
strValue = dateTimeValue.toString();
|
||||
}
|
||||
return "new Date('" + strValue + "')";
|
||||
}
|
||||
|
||||
public String getModelName(Schema sc) {
|
||||
if (sc.get$ref() != null) {
|
||||
Schema unaliasedSchema = unaliasSchema(sc, importMapping);
|
||||
if (unaliasedSchema.get$ref() != null) {
|
||||
return toModelName(ModelUtils.getSimpleRef(sc.get$ref()));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an example if it exists
|
||||
*
|
||||
* @param sc input schema
|
||||
* @return the example value
|
||||
*/
|
||||
protected Object getObjectExample(Schema sc) {
|
||||
Schema schema = sc;
|
||||
String ref = sc.get$ref();
|
||||
if (ref != null) {
|
||||
schema = ModelUtils.getSchema(this.openAPI, ModelUtils.getSimpleRef(ref));
|
||||
}
|
||||
// TODO handle examples in object models in the future
|
||||
Boolean objectModel = (ModelUtils.isObjectSchema(schema) || ModelUtils.isMapSchema(schema) || ModelUtils.isComposedSchema(schema));
|
||||
if (objectModel) {
|
||||
return null;
|
||||
}
|
||||
if (schema.getExample() != null) {
|
||||
return schema.getExample();
|
||||
}
|
||||
if (schema.getDefault() != null) {
|
||||
return schema.getDefault();
|
||||
} else if (schema.getEnum() != null && !schema.getEnum().isEmpty()) {
|
||||
return schema.getEnum().get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/***
|
||||
* Ensures that the string has a leading and trailing quote
|
||||
*
|
||||
* @param in input string
|
||||
* @return quoted string
|
||||
*/
|
||||
private String ensureQuotes(String in) {
|
||||
Pattern pattern = Pattern.compile("\r\n|\r|\n");
|
||||
Matcher matcher = pattern.matcher(in);
|
||||
if (matcher.find()) {
|
||||
// if a string has a new line in it add backticks to make it a typescript multiline string
|
||||
return "`" + in + "`";
|
||||
}
|
||||
String strPattern = "^['\"].*?['\"]$";
|
||||
if (in.matches(strPattern)) {
|
||||
return in;
|
||||
}
|
||||
return "\"" + in + "\"";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toExampleValue(Schema schema) {
|
||||
Object objExample = getObjectExample(schema);
|
||||
return toExampleValue(schema, objExample);
|
||||
}
|
||||
|
||||
public String toExampleValue(Schema schema, Object objExample) {
|
||||
String modelName = getModelName(schema);
|
||||
return toExampleValueRecursive(modelName, schema, objExample, 1, "", 0, Sets.newHashSet());
|
||||
}
|
||||
|
||||
private Boolean simpleStringSchema(Schema schema) {
|
||||
Schema sc = schema;
|
||||
String ref = schema.get$ref();
|
||||
if (ref != null) {
|
||||
sc = ModelUtils.getSchema(this.openAPI, ModelUtils.getSimpleRef(ref));
|
||||
}
|
||||
return ModelUtils.isStringSchema(sc) && !ModelUtils.isDateSchema(sc) && !ModelUtils.isDateTimeSchema(sc) && !"Number".equalsIgnoreCase(sc.getFormat()) && !ModelUtils.isByteArraySchema(sc) && !ModelUtils.isBinarySchema(sc) && schema.getPattern() == null;
|
||||
}
|
||||
|
||||
private MappedModel getDiscriminatorMappedModel(CodegenDiscriminator disc) {
|
||||
for (MappedModel mm : disc.getMappedModels()) {
|
||||
String modelName = mm.getModelName();
|
||||
Schema modelSchema = getModelNameToSchemaCache().get(modelName);
|
||||
if (ModelUtils.isObjectSchema(modelSchema)) {
|
||||
return mm;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/***
|
||||
* Recursively generates string examples for schemas
|
||||
*
|
||||
* @param modelName the string name of the refed model that will be generated for the schema or null
|
||||
* @param schema the schema that we need an example for
|
||||
* @param objExample the example that applies to this schema, for now only string example are used
|
||||
* @param indentationLevel integer indentation level that we are currently at
|
||||
* we assume the indentaion amount is 2 spaces times this integer
|
||||
* @param prefix the string prefix that we will use when assigning an example for this line
|
||||
* this is used when setting key: value, pairs "key: " is the prefix
|
||||
* and this is used when setting properties like some_property='some_property_example'
|
||||
* @param exampleLine this is the current line that we are generatign an example for, starts at 0
|
||||
* we don't indentin the 0th line because using the example value looks like:
|
||||
* prop = ModelName( line 0
|
||||
* some_property='some_property_example' line 1
|
||||
* ) line 2
|
||||
* and our example value is:
|
||||
* ModelName( line 0
|
||||
* some_property='some_property_example' line 1
|
||||
* ) line 2
|
||||
* @param seenSchemas This set contains all the schemas passed into the recursive function. It is used to check
|
||||
* if a schema was already passed into the function and breaks the infinite recursive loop. The
|
||||
* only schemas that are not added are ones that contain $ref != null
|
||||
* @return the string example
|
||||
*/
|
||||
private String toExampleValueRecursive(String modelName, Schema schema, Object objExample, int indentationLevel, String prefix, Integer exampleLine, Set<Schema> seenSchemas) {
|
||||
final String indentionConst = " ";
|
||||
String currentIndentation = "";
|
||||
String closingIndentation = "";
|
||||
for (int i = 0; i < indentationLevel; i++) currentIndentation += indentionConst;
|
||||
if (exampleLine.equals(0)) {
|
||||
closingIndentation = currentIndentation;
|
||||
currentIndentation = "";
|
||||
} else {
|
||||
closingIndentation = currentIndentation;
|
||||
}
|
||||
String openChars = "";
|
||||
String closeChars = "";
|
||||
String fullPrefix = currentIndentation + prefix + openChars;
|
||||
|
||||
String example = null;
|
||||
if (objExample != null) {
|
||||
example = objExample.toString();
|
||||
}
|
||||
// checks if the current schema has already been passed in. If so, breaks the current recursive pass
|
||||
if (seenSchemas.contains(schema)) {
|
||||
if (modelName != null) {
|
||||
return fullPrefix + closeChars;
|
||||
} else {
|
||||
// this is a recursive schema
|
||||
// need to add a reasonable example to avoid
|
||||
// infinite recursion
|
||||
if (ModelUtils.isNullable(schema)) {
|
||||
// if the schema is nullable, then 'null' is a valid value
|
||||
return fullPrefix + "null" + closeChars;
|
||||
} else if (ModelUtils.isArraySchema(schema)) {
|
||||
// the schema is an array, add an empty array
|
||||
return fullPrefix + "[]" + closeChars;
|
||||
} else {
|
||||
// the schema is an object, make an empty object
|
||||
return fullPrefix + "{}" + closeChars;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (null != schema.get$ref()) {
|
||||
Map<String, Schema> allDefinitions = ModelUtils.getSchemas(this.openAPI);
|
||||
String ref = ModelUtils.getSimpleRef(schema.get$ref());
|
||||
Schema refSchema = allDefinitions.get(ref);
|
||||
if (null == refSchema) {
|
||||
LOGGER.warn("Unable to find referenced schema " + schema.get$ref() + "\n");
|
||||
return fullPrefix + "null" + closeChars;
|
||||
}
|
||||
String refModelName = getModelName(schema);
|
||||
return toExampleValueRecursive(refModelName, refSchema, objExample, indentationLevel, prefix, exampleLine, seenSchemas);
|
||||
} else if (ModelUtils.isNullType(schema) || isAnyTypeSchema(schema)) {
|
||||
// The 'null' type is allowed in OAS 3.1 and above. It is not supported by OAS 3.0.x,
|
||||
// though this tooling supports it.
|
||||
return fullPrefix + "null" + closeChars;
|
||||
} else if (ModelUtils.isBooleanSchema(schema)) {
|
||||
if (objExample == null) {
|
||||
example = "true";
|
||||
} else {
|
||||
if ("false".equalsIgnoreCase(objExample.toString())) {
|
||||
example = "false";
|
||||
} else {
|
||||
example = "true";
|
||||
}
|
||||
}
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (ModelUtils.isDateSchema(schema)) {
|
||||
if (objExample == null) {
|
||||
example = typescriptDate("1970-01-01");
|
||||
} else {
|
||||
example = typescriptDate(objExample);
|
||||
}
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (ModelUtils.isDateTimeSchema(schema)) {
|
||||
if (objExample == null) {
|
||||
example = typescriptDateTime("1970-01-01T00:00:00.00Z");
|
||||
} else {
|
||||
example = typescriptDateTime(objExample);
|
||||
}
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (ModelUtils.isBinarySchema(schema)) {
|
||||
if (objExample == null) {
|
||||
example = "/path/to/file";
|
||||
}
|
||||
example = "{ data: Buffer.from(fs.readFileSync('" + example + "', 'utf-8')), name: '" + example + "' }";
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (ModelUtils.isByteArraySchema(schema)) {
|
||||
if (objExample == null) {
|
||||
example = "'YQ=='";
|
||||
}
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (ModelUtils.isStringSchema(schema)) {
|
||||
if (objExample == null) {
|
||||
// a BigDecimal:
|
||||
if ("Number".equalsIgnoreCase(schema.getFormat())) {
|
||||
example = "2";
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (StringUtils.isNotBlank(schema.getPattern())) {
|
||||
String pattern = schema.getPattern();
|
||||
/*
|
||||
RxGen does not support our ECMA dialect https://github.com/curious-odd-man/RgxGen/issues/56
|
||||
So strip off the leading / and trailing / and turn on ignore case if we have it
|
||||
*/
|
||||
Pattern valueExtractor = Pattern.compile("^/?(.+?)/?(.?)$");
|
||||
Matcher m = valueExtractor.matcher(pattern);
|
||||
RgxGen rgxGen = null;
|
||||
if (m.find()) {
|
||||
int groupCount = m.groupCount();
|
||||
if (groupCount == 1) {
|
||||
// only pattern found
|
||||
String isolatedPattern = m.group(1);
|
||||
rgxGen = new RgxGen(isolatedPattern);
|
||||
} else if (groupCount == 2) {
|
||||
// patterns and flag found
|
||||
String isolatedPattern = m.group(1);
|
||||
String flags = m.group(2);
|
||||
if (flags.contains("i")) {
|
||||
rgxGen = new RgxGen(isolatedPattern);
|
||||
RgxGenProperties properties = new RgxGenProperties();
|
||||
RgxGenOption.CASE_INSENSITIVE.setInProperties(properties, true);
|
||||
rgxGen.setProperties(properties);
|
||||
} else {
|
||||
rgxGen = new RgxGen(isolatedPattern);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
rgxGen = new RgxGen(pattern);
|
||||
}
|
||||
|
||||
// this seed makes it so if we have [a-z] we pick a
|
||||
Random random = new Random(18);
|
||||
example = rgxGen.generate(random);
|
||||
} else if (schema.getMinLength() != null) {
|
||||
example = "";
|
||||
int len = schema.getMinLength().intValue();
|
||||
for (int i = 0; i < len; i++) example += "a";
|
||||
} else if (ModelUtils.isUUIDSchema(schema)) {
|
||||
example = "046b6c7f-0b8a-43b9-b35d-6489e6daee91";
|
||||
} else {
|
||||
example = "string_example";
|
||||
}
|
||||
}
|
||||
return fullPrefix + ensureQuotes(example) + closeChars;
|
||||
} else if (ModelUtils.isIntegerSchema(schema)) {
|
||||
if (objExample == null) {
|
||||
if (schema.getMinimum() != null) {
|
||||
example = schema.getMinimum().toString();
|
||||
} else {
|
||||
example = "1";
|
||||
}
|
||||
}
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (ModelUtils.isNumberSchema(schema)) {
|
||||
if (objExample == null) {
|
||||
if (schema.getMinimum() != null) {
|
||||
example = schema.getMinimum().toString();
|
||||
} else {
|
||||
example = "3.14";
|
||||
}
|
||||
}
|
||||
return fullPrefix + example + closeChars;
|
||||
} else if (ModelUtils.isArraySchema(schema)) {
|
||||
ArraySchema arrayschema = (ArraySchema) schema;
|
||||
Schema itemSchema = arrayschema.getItems();
|
||||
String itemModelName = getModelName(itemSchema);
|
||||
if (objExample instanceof Iterable && itemModelName == null) {
|
||||
// If the example is already a list, return it directly instead of wrongly wrap it in another list
|
||||
return fullPrefix + objExample.toString() + closeChars;
|
||||
}
|
||||
Set<Schema> newSeenSchemas = new HashSet<>(seenSchemas);
|
||||
newSeenSchemas.add(schema);
|
||||
example = fullPrefix + "[" + "\n" + toExampleValueRecursive(itemModelName, itemSchema, objExample, indentationLevel + 1, "", exampleLine + 1, newSeenSchemas) + ",\n" + closingIndentation + "]" + closeChars;
|
||||
return example;
|
||||
} else if (ModelUtils.isMapSchema(schema)) {
|
||||
if (modelName == null) {
|
||||
fullPrefix += "{";
|
||||
closeChars = "}";
|
||||
}
|
||||
Object addPropsObj = schema.getAdditionalProperties();
|
||||
// TODO handle true case for additionalProperties
|
||||
if (addPropsObj instanceof Schema) {
|
||||
Schema addPropsSchema = (Schema) addPropsObj;
|
||||
String key = "key";
|
||||
Object addPropsExample = getObjectExample(addPropsSchema);
|
||||
if (addPropsSchema.getEnum() != null && !addPropsSchema.getEnum().isEmpty()) {
|
||||
key = addPropsSchema.getEnum().get(0).toString();
|
||||
}
|
||||
addPropsExample = exampleFromStringOrArraySchema(addPropsSchema, addPropsExample, key);
|
||||
String addPropPrefix = key + ": ";
|
||||
if (modelName == null) {
|
||||
addPropPrefix = ensureQuotes(key) + ": ";
|
||||
}
|
||||
String addPropsModelName = "\"" + getModelName(addPropsSchema) + "\"";
|
||||
Set<Schema> newSeenSchemas = new HashSet<>(seenSchemas);
|
||||
newSeenSchemas.add(schema);
|
||||
example = fullPrefix + "\n" + toExampleValueRecursive(addPropsModelName, addPropsSchema, addPropsExample, indentationLevel + 1, addPropPrefix, exampleLine + 1, newSeenSchemas) + ",\n" + closingIndentation + closeChars;
|
||||
} else {
|
||||
example = fullPrefix + closeChars;
|
||||
}
|
||||
return example;
|
||||
} else if (ModelUtils.isComposedSchema(schema)) {
|
||||
ComposedSchema cm = (ComposedSchema) schema;
|
||||
List<Schema> ls = cm.getOneOf();
|
||||
if (ls != null && !ls.isEmpty()) {
|
||||
return fullPrefix + toExampleValue(ls.get(0)) + closeChars;
|
||||
}
|
||||
return fullPrefix + closeChars;
|
||||
} else if (ModelUtils.isObjectSchema(schema)) {
|
||||
fullPrefix += "{";
|
||||
closeChars = "}";
|
||||
CodegenDiscriminator disc = createDiscriminator(modelName, schema, openAPI);
|
||||
if (disc != null) {
|
||||
MappedModel mm = getDiscriminatorMappedModel(disc);
|
||||
if (mm != null) {
|
||||
String discPropNameValue = mm.getMappingName();
|
||||
String chosenModelName = mm.getModelName();
|
||||
// TODO handle this case in the future, this is when the discriminated
|
||||
// schema allOf includes this schema, like Cat allOf includes Pet
|
||||
// so this is the composed schema use case
|
||||
} else {
|
||||
return fullPrefix + closeChars;
|
||||
}
|
||||
}
|
||||
|
||||
Set<Schema> newSeenSchemas = new HashSet<>(seenSchemas);
|
||||
newSeenSchemas.add(schema);
|
||||
String exampleForObjectModel = exampleForObjectModel(schema, fullPrefix, closeChars, null, indentationLevel, exampleLine, closingIndentation, newSeenSchemas);
|
||||
return exampleForObjectModel;
|
||||
} else {
|
||||
LOGGER.warn("Type " + schema.getType() + " not handled properly in toExampleValue");
|
||||
}
|
||||
|
||||
return example;
|
||||
}
|
||||
|
||||
private String exampleForObjectModel(Schema schema, String fullPrefix, String closeChars, CodegenProperty discProp, int indentationLevel, int exampleLine, String closingIndentation, Set<Schema> seenSchemas) {
|
||||
Map<String, Schema> requiredAndOptionalProps = schema.getProperties();
|
||||
if (requiredAndOptionalProps == null || requiredAndOptionalProps.isEmpty()) {
|
||||
return fullPrefix + closeChars;
|
||||
}
|
||||
|
||||
String example = fullPrefix + "\n";
|
||||
for (Map.Entry<String, Schema> entry : requiredAndOptionalProps.entrySet()) {
|
||||
String propName = entry.getKey();
|
||||
Schema propSchema = entry.getValue();
|
||||
boolean readOnly = false;
|
||||
if (propSchema.getReadOnly() != null) {
|
||||
readOnly = propSchema.getReadOnly();
|
||||
}
|
||||
if (readOnly) {
|
||||
continue;
|
||||
}
|
||||
String ref = propSchema.get$ref();
|
||||
if (ref != null) {
|
||||
Schema refSchema = ModelUtils.getSchema(this.openAPI, ModelUtils.getSimpleRef(ref));
|
||||
if (refSchema.getReadOnly() != null) {
|
||||
readOnly = refSchema.getReadOnly();
|
||||
}
|
||||
if (readOnly) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
propName = toVarName(propName);
|
||||
String propModelName = null;
|
||||
Object propExample = null;
|
||||
if (discProp != null && propName.equals(discProp.name)) {
|
||||
propModelName = null;
|
||||
propExample = discProp.example;
|
||||
} else {
|
||||
propModelName = getModelName(propSchema);
|
||||
propExample = exampleFromStringOrArraySchema(propSchema, null, propName);
|
||||
}
|
||||
example += toExampleValueRecursive(propModelName, propSchema, propExample, indentationLevel + 1, propName + ": ", exampleLine + 1, seenSchemas) + ",\n";
|
||||
}
|
||||
// TODO handle additionalProperties also
|
||||
example += closingIndentation + closeChars;
|
||||
return example;
|
||||
}
|
||||
|
||||
private Object exampleFromStringOrArraySchema(Schema sc, Object currentExample, String propName) {
|
||||
if (currentExample != null) {
|
||||
return currentExample;
|
||||
}
|
||||
Schema schema = sc;
|
||||
String ref = sc.get$ref();
|
||||
if (ref != null) {
|
||||
schema = ModelUtils.getSchema(this.openAPI, ModelUtils.getSimpleRef(ref));
|
||||
}
|
||||
Object example = getObjectExample(schema);
|
||||
if (example != null) {
|
||||
return example;
|
||||
} else if (simpleStringSchema(schema)) {
|
||||
return propName + "_example";
|
||||
} else if (ModelUtils.isArraySchema(schema)) {
|
||||
ArraySchema arraySchema = (ArraySchema) schema;
|
||||
Schema itemSchema = arraySchema.getItems();
|
||||
example = getObjectExample(itemSchema);
|
||||
if (example != null) {
|
||||
return example;
|
||||
} else if (simpleStringSchema(itemSchema)) {
|
||||
return propName + "_example";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String setPropertyExampleValue(CodegenProperty p) {
|
||||
String example;
|
||||
|
||||
if (p == null) {
|
||||
return "null";
|
||||
}
|
||||
|
||||
if (p.defaultValue == null) {
|
||||
example = p.example;
|
||||
} else {
|
||||
example = p.defaultValue;
|
||||
}
|
||||
|
||||
String type = p.baseType;
|
||||
if (type == null) {
|
||||
type = p.dataType;
|
||||
}
|
||||
|
||||
if (Boolean.TRUE.equals(p.isInteger)) {
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(p.isLong)) {
|
||||
if (example == null) {
|
||||
example = "789";
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(p.isDouble)
|
||||
|| Boolean.TRUE.equals(p.isFloat)
|
||||
|| Boolean.TRUE.equals(p.isNumber)) {
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(p.isBoolean)) {
|
||||
if (example == null) {
|
||||
example = "true";
|
||||
}
|
||||
} else if (Boolean.TRUE.equals(p.isFile) || Boolean.TRUE.equals(p.isBinary)) {
|
||||
if (example == null) {
|
||||
example = "/path/to/file";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
} else if (Boolean.TRUE.equals(p.isDate)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20";
|
||||
}
|
||||
example = "new Date(\"" + escapeText(example) + "\")";
|
||||
} else if (Boolean.TRUE.equals(p.isDateTime)) {
|
||||
if (example == null) {
|
||||
example = "2013-10-20T19:20:30+01:00";
|
||||
}
|
||||
example = "new Date(\"" + escapeText(example) + "\")";
|
||||
} else if (Boolean.TRUE.equals(p.isString)) {
|
||||
if (example == null) {
|
||||
example = p.name + "_example";
|
||||
}
|
||||
example = "\"" + escapeText(example) + "\"";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = "new " + "{{moduleName}}" + "." + type + "()";
|
||||
}
|
||||
|
||||
return example;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*
|
||||
* Set the codegenParameter example value
|
||||
* We have a custom version of this function so we can invoke toExampleValue
|
||||
*
|
||||
* @param codegenParameter the item we are setting the example on
|
||||
* @param parameter the base parameter that came from the spec
|
||||
*/
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter codegenParameter, Parameter parameter) {
|
||||
Schema schema = parameter.getSchema();
|
||||
if (schema == null) {
|
||||
LOGGER.warn("CodegenParameter.example defaulting to null because parameter lacks a schema");
|
||||
return;
|
||||
}
|
||||
|
||||
Object example = null;
|
||||
if (codegenParameter.vendorExtensions != null && codegenParameter.vendorExtensions.containsKey("x-example")) {
|
||||
example = codegenParameter.vendorExtensions.get("x-example");
|
||||
} else if (parameter.getExample() != null) {
|
||||
example = parameter.getExample();
|
||||
} else if (parameter.getExamples() != null && !parameter.getExamples().isEmpty() && parameter.getExamples().values().iterator().next().getValue() != null) {
|
||||
example = parameter.getExamples().values().iterator().next().getValue();
|
||||
} else {
|
||||
example = getObjectExample(schema);
|
||||
}
|
||||
example = exampleFromStringOrArraySchema(schema, example, parameter.getName());
|
||||
String finalExample = toExampleValue(schema, example);
|
||||
codegenParameter.example = finalExample;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the example value of the parameter.
|
||||
*
|
||||
* @param codegenParameter Codegen parameter
|
||||
* @param requestBody Request body
|
||||
*/
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter codegenParameter, RequestBody requestBody) {
|
||||
if (codegenParameter.vendorExtensions != null && codegenParameter.vendorExtensions.containsKey("x-example")) {
|
||||
codegenParameter.example = Json.pretty(codegenParameter.vendorExtensions.get("x-example"));
|
||||
}
|
||||
|
||||
Content content = requestBody.getContent();
|
||||
|
||||
if (content.size() > 1) {
|
||||
// @see ModelUtils.getSchemaFromContent()
|
||||
once(LOGGER).warn("Multiple MediaTypes found, using only the first one");
|
||||
}
|
||||
|
||||
MediaType mediaType = content.values().iterator().next();
|
||||
Schema schema = mediaType.getSchema();
|
||||
if (schema == null) {
|
||||
LOGGER.warn("CodegenParameter.example defaulting to null because requestBody content lacks a schema");
|
||||
return;
|
||||
}
|
||||
|
||||
Object example = null;
|
||||
if (mediaType.getExample() != null) {
|
||||
example = mediaType.getExample();
|
||||
} else if (mediaType.getExamples() != null && !mediaType.getExamples().isEmpty() && mediaType.getExamples().values().iterator().next().getValue() != null) {
|
||||
example = mediaType.getExamples().values().iterator().next().getValue();
|
||||
} else {
|
||||
example = getObjectExample(schema);
|
||||
}
|
||||
example = exampleFromStringOrArraySchema(schema, example, codegenParameter.paramName);
|
||||
codegenParameter.example = toExampleValue(schema, example);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a CodegenParameter for a Form Property
|
||||
* We have a custom version of this method so we can invoke
|
||||
* setParameterExampleValue(codegenParameter, parameter)
|
||||
* rather than setParameterExampleValue(codegenParameter)
|
||||
* This ensures that all of our samples are generated in
|
||||
* toExampleValueRecursive
|
||||
*
|
||||
* @param name the property name
|
||||
* @param propertySchema the property schema
|
||||
* @param imports our import set
|
||||
* @return the resultant CodegenParameter
|
||||
*/
|
||||
@Override
|
||||
public CodegenParameter fromFormProperty(String name, Schema propertySchema, Set<String> imports) {
|
||||
CodegenParameter cp = super.fromFormProperty(name, propertySchema, imports);
|
||||
Parameter p = new Parameter();
|
||||
p.setSchema(propertySchema);
|
||||
p.setName(cp.paramName);
|
||||
setParameterExampleValue(cp, p);
|
||||
return cp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toAnyOfName(List<String> names, ComposedSchema composedSchema) {
|
||||
List<String> types = getTypesFromSchemas(composedSchema.getAnyOf());
|
||||
|
84
modules/openapi-generator/src/main/resources/typescript/api_doc.mustache
vendored
Normal file
84
modules/openapi-generator/src/main/resources/typescript/api_doc.mustache
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
# {{moduleName}}.{{classname}}{{#description}}
|
||||
|
||||
{{description}}{{/description}}
|
||||
|
||||
All URIs are relative to *{{basePath}}*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}}
|
||||
{{/operation}}{{/operations}}
|
||||
|
||||
{{#operations}}
|
||||
{{#operation}}
|
||||
# **{{{operationId}}}**
|
||||
> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#requiredParams}}{{^defaultValue}}{{paramName}}{{^-last}}, {{/-last}}{{/defaultValue}}{{/requiredParams}})
|
||||
|
||||
{{#notes}}
|
||||
{{{notes}}}
|
||||
{{/notes}}
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { {{{moduleName}}} } from '{{{projectName}}}';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = {{{moduleName}}}.createConfiguration();
|
||||
const apiInstance = new {{{moduleName}}}.{{classname}}(configuration);
|
||||
|
||||
{{#hasParams}}
|
||||
let body:{{{moduleName}}}.{{classname}}{{operationIdCamelCase}}Request = {
|
||||
{{#allParams}}
|
||||
// {{{dataType}}}{{#description}} | {{{description}}}{{/description}}{{^required}} (optional){{/required}}
|
||||
{{paramName}}: {{{example}}},
|
||||
{{/allParams}}
|
||||
};
|
||||
{{/hasParams}}
|
||||
{{^hasParams}}
|
||||
let body:any = {};
|
||||
{{/hasParams}}
|
||||
|
||||
apiInstance.{{{operationId}}}(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
{{^hasParams}}This endpoint does not need any parameter.{{/hasParams}}{{#allParams}}{{#-last}}
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}
|
||||
{{#allParams}}{{^defaultValue}} **{{paramName}}** | {{^isPrimitiveType}}**{{{dataType}}}**{{/isPrimitiveType}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}| {{description}} |
|
||||
{{/defaultValue}}{{/allParams}}{{#allParams}}{{#defaultValue}} **{{paramName}}** | {{^isPrimitiveType}}{{^isEnum}}**{{dataType}}**{{/isEnum}}{{/isPrimitiveType}}{{#isPrimitiveType}}[**{{dataType}}**]{{/isPrimitiveType}}{{#isEnum}}{{#allowableValues}}{{#enumVars}}{{#-first}}**Array<{{/-first}}{{value}}{{^-last}} | {{/-last}}{{#-last}}>**{{/-last}}{{/enumVars}}{{/allowableValues}}{{/isEnum}} | {{description}} |{{^required}} (optional){{/required}} defaults to {{{.}}}
|
||||
{{/defaultValue}}{{/allParams}}
|
||||
|
||||
### Return type
|
||||
|
||||
{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}}
|
||||
|
||||
### Authorization
|
||||
|
||||
{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}}
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: {{#consumes}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/consumes}}{{^consumes}}Not defined{{/consumes}}
|
||||
- **Accept**: {{#produces}}{{{mediaType}}}{{^-last}}, {{/-last}}{{/produces}}{{^produces}}Not defined{{/produces}}
|
||||
|
||||
{{#responses.0}}
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
{{#responses}}
|
||||
**{{code}}** | {{message}} | {{#headers}} * {{baseName}} - {{description}} <br> {{/headers}}{{^headers.0}} - {{/headers.0}} |
|
||||
{{/responses}}
|
||||
{{/responses.0}}
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
{{/operation}}
|
||||
{{/operations}}
|
||||
|
@ -1,5 +1,8 @@
|
||||
.gitignore
|
||||
PetApi.md
|
||||
README.md
|
||||
StoreApi.md
|
||||
UserApi.md
|
||||
apis/PetApi.ts
|
||||
apis/StoreApi.ts
|
||||
apis/UserApi.ts
|
||||
|
@ -0,0 +1,505 @@
|
||||
# petstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
> Pet addPet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiAddPetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.addPet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deletePet**
|
||||
> deletePet()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiDeletePetRequest = {
|
||||
// number | Pet id to delete
|
||||
petId: 1,
|
||||
// string (optional)
|
||||
apiKey: "api_key_example",
|
||||
};
|
||||
|
||||
apiInstance.deletePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | Pet id to delete | defaults to undefined
|
||||
**apiKey** | [**string**] | | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid pet value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByStatus**
|
||||
> Array<Pet> findPetsByStatus()
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByStatusRequest = {
|
||||
// Array<'available' | 'pending' | 'sold'> | Status values that need to be considered for filter
|
||||
status: [
|
||||
"available",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByStatus(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **Array<'available' | 'pending' | 'sold'>** | Status values that need to be considered for filter | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid status value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByTags**
|
||||
> Array<Pet> findPetsByTags()
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByTagsRequest = {
|
||||
// Array<string> | Tags to filter by
|
||||
tags: [
|
||||
"tags_example",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByTags(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | **Array<string>** | Tags to filter by | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid tag value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getPetById**
|
||||
> Pet getPetById()
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiGetPetByIdRequest = {
|
||||
// number | ID of pet to return
|
||||
petId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getPetById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to return | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePet**
|
||||
> Pet updatePet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updatePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
**405** | Validation exception | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetWithFormRequest = {
|
||||
// number | ID of pet that needs to be updated
|
||||
petId: 1,
|
||||
// string | Updated name of the pet (optional)
|
||||
name: "name_example",
|
||||
// string | Updated status of the pet (optional)
|
||||
status: "status_example",
|
||||
};
|
||||
|
||||
apiInstance.updatePetWithForm(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet that needs to be updated | defaults to undefined
|
||||
**name** | [**string**] | Updated name of the pet | (optional) defaults to undefined
|
||||
**status** | [**string**] | Updated status of the pet | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUploadFileRequest = {
|
||||
// number | ID of pet to update
|
||||
petId: 1,
|
||||
// string | Additional data to pass to server (optional)
|
||||
additionalMetadata: "additionalMetadata_example",
|
||||
// HttpFile | file to upload (optional)
|
||||
file: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
|
||||
};
|
||||
|
||||
apiInstance.uploadFile(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to update | defaults to undefined
|
||||
**additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined
|
||||
**file** | [**HttpFile**] | file to upload | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**ApiResponse**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,233 @@
|
||||
# petstore.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **deleteOrder**
|
||||
> deleteOrder()
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiDeleteOrderRequest = {
|
||||
// string | ID of the order that needs to be deleted
|
||||
orderId: "orderId_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**string**] | ID of the order that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getInventory**
|
||||
> { [key: string]: number; } getInventory()
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.getInventory(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**{ [key: string]: number; }**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getOrderById**
|
||||
> Order getOrderById()
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiGetOrderByIdRequest = {
|
||||
// number | ID of pet that needs to be fetched
|
||||
orderId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getOrderById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**number**] | ID of pet that needs to be fetched | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **placeOrder**
|
||||
> Order placeOrder(order)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiPlaceOrderRequest = {
|
||||
// Order | order placed for purchasing the pet
|
||||
order: {
|
||||
id: 1,
|
||||
petId: 1,
|
||||
quantity: 1,
|
||||
shipDate: new Date('1970-01-01T00:00:00.00Z'),
|
||||
status: "placed",
|
||||
complete: false,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.placeOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | **Order**| order placed for purchasing the pet |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid Order | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,489 @@
|
||||
# petstore.UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **createUser**
|
||||
> createUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUserRequest = {
|
||||
// User | Created user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.createUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Created user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithArrayInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithArrayInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithListInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithListInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deleteUser**
|
||||
> deleteUser()
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiDeleteUserRequest = {
|
||||
// string | The name that needs to be deleted
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getUserByName**
|
||||
> User getUserByName()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiGetUserByNameRequest = {
|
||||
// string | The name that needs to be fetched. Use user1 for testing.
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.getUserByName(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be fetched. Use user1 for testing. | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**User**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **loginUser**
|
||||
> string loginUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiLoginUserRequest = {
|
||||
// string | The user name for login
|
||||
username: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
// string | The password for login in clear text
|
||||
password: "password_example",
|
||||
};
|
||||
|
||||
apiInstance.loginUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The user name for login | defaults to undefined
|
||||
**password** | [**string**] | The password for login in clear text | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication. <br> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when toekn expires <br> |
|
||||
**400** | Invalid username/password supplied | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.logoutUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updateUser**
|
||||
> updateUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiUpdateUserRequest = {
|
||||
// string | name that need to be deleted
|
||||
username: "username_example",
|
||||
// User | Updated user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updateUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Updated user object |
|
||||
**username** | [**string**] | name that need to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid user supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
.gitignore
|
||||
PetApi.md
|
||||
StoreApi.md
|
||||
UserApi.md
|
||||
apis/PetApi.ts
|
||||
apis/StoreApi.ts
|
||||
apis/UserApi.ts
|
||||
|
@ -0,0 +1,505 @@
|
||||
# petstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
> Pet addPet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiAddPetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.addPet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deletePet**
|
||||
> deletePet()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiDeletePetRequest = {
|
||||
// number | Pet id to delete
|
||||
petId: 1,
|
||||
// string (optional)
|
||||
apiKey: "api_key_example",
|
||||
};
|
||||
|
||||
apiInstance.deletePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | Pet id to delete | defaults to undefined
|
||||
**apiKey** | [**string**] | | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid pet value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByStatus**
|
||||
> Array<Pet> findPetsByStatus()
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByStatusRequest = {
|
||||
// Array<'available' | 'pending' | 'sold'> | Status values that need to be considered for filter
|
||||
status: [
|
||||
"available",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByStatus(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **Array<'available' | 'pending' | 'sold'>** | Status values that need to be considered for filter | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid status value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByTags**
|
||||
> Array<Pet> findPetsByTags()
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByTagsRequest = {
|
||||
// Array<string> | Tags to filter by
|
||||
tags: [
|
||||
"tags_example",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByTags(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | **Array<string>** | Tags to filter by | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid tag value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getPetById**
|
||||
> Pet getPetById()
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiGetPetByIdRequest = {
|
||||
// number | ID of pet to return
|
||||
petId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getPetById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to return | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePet**
|
||||
> Pet updatePet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updatePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
**405** | Validation exception | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetWithFormRequest = {
|
||||
// number | ID of pet that needs to be updated
|
||||
petId: 1,
|
||||
// string | Updated name of the pet (optional)
|
||||
name: "name_example",
|
||||
// string | Updated status of the pet (optional)
|
||||
status: "status_example",
|
||||
};
|
||||
|
||||
apiInstance.updatePetWithForm(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet that needs to be updated | defaults to undefined
|
||||
**name** | [**string**] | Updated name of the pet | (optional) defaults to undefined
|
||||
**status** | [**string**] | Updated status of the pet | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUploadFileRequest = {
|
||||
// number | ID of pet to update
|
||||
petId: 1,
|
||||
// string | Additional data to pass to server (optional)
|
||||
additionalMetadata: "additionalMetadata_example",
|
||||
// HttpFile | file to upload (optional)
|
||||
file: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
|
||||
};
|
||||
|
||||
apiInstance.uploadFile(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to update | defaults to undefined
|
||||
**additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined
|
||||
**file** | [**HttpFile**] | file to upload | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**ApiResponse**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,233 @@
|
||||
# petstore.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **deleteOrder**
|
||||
> deleteOrder()
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiDeleteOrderRequest = {
|
||||
// string | ID of the order that needs to be deleted
|
||||
orderId: "orderId_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**string**] | ID of the order that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getInventory**
|
||||
> { [key: string]: number; } getInventory()
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.getInventory(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**{ [key: string]: number; }**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getOrderById**
|
||||
> Order getOrderById()
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiGetOrderByIdRequest = {
|
||||
// number | ID of pet that needs to be fetched
|
||||
orderId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getOrderById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**number**] | ID of pet that needs to be fetched | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **placeOrder**
|
||||
> Order placeOrder(order)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiPlaceOrderRequest = {
|
||||
// Order | order placed for purchasing the pet
|
||||
order: {
|
||||
id: 1,
|
||||
petId: 1,
|
||||
quantity: 1,
|
||||
shipDate: new Date('1970-01-01T00:00:00.00Z'),
|
||||
status: "placed",
|
||||
complete: false,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.placeOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | **Order**| order placed for purchasing the pet |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid Order | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,489 @@
|
||||
# petstore.UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **createUser**
|
||||
> createUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUserRequest = {
|
||||
// User | Created user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.createUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Created user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithArrayInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithArrayInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithListInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithListInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deleteUser**
|
||||
> deleteUser()
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiDeleteUserRequest = {
|
||||
// string | The name that needs to be deleted
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getUserByName**
|
||||
> User getUserByName()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiGetUserByNameRequest = {
|
||||
// string | The name that needs to be fetched. Use user1 for testing.
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.getUserByName(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be fetched. Use user1 for testing. | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**User**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **loginUser**
|
||||
> string loginUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiLoginUserRequest = {
|
||||
// string | The user name for login
|
||||
username: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
// string | The password for login in clear text
|
||||
password: "password_example",
|
||||
};
|
||||
|
||||
apiInstance.loginUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The user name for login | defaults to undefined
|
||||
**password** | [**string**] | The password for login in clear text | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication. <br> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when toekn expires <br> |
|
||||
**400** | Invalid username/password supplied | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.logoutUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updateUser**
|
||||
> updateUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiUpdateUserRequest = {
|
||||
// string | name that need to be deleted
|
||||
username: "username_example",
|
||||
// User | Updated user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updateUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Updated user object |
|
||||
**username** | [**string**] | name that need to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid user supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
.gitignore
|
||||
PetApi.md
|
||||
README.md
|
||||
StoreApi.md
|
||||
UserApi.md
|
||||
apis/PetApi.service.ts
|
||||
apis/PetApi.ts
|
||||
apis/StoreApi.service.ts
|
||||
|
@ -0,0 +1,505 @@
|
||||
# petstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
> Pet addPet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiAddPetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.addPet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deletePet**
|
||||
> deletePet()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiDeletePetRequest = {
|
||||
// number | Pet id to delete
|
||||
petId: 1,
|
||||
// string (optional)
|
||||
apiKey: "api_key_example",
|
||||
};
|
||||
|
||||
apiInstance.deletePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | Pet id to delete | defaults to undefined
|
||||
**apiKey** | [**string**] | | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid pet value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByStatus**
|
||||
> Array<Pet> findPetsByStatus()
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByStatusRequest = {
|
||||
// Array<'available' | 'pending' | 'sold'> | Status values that need to be considered for filter
|
||||
status: [
|
||||
"available",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByStatus(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **Array<'available' | 'pending' | 'sold'>** | Status values that need to be considered for filter | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid status value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByTags**
|
||||
> Array<Pet> findPetsByTags()
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByTagsRequest = {
|
||||
// Array<string> | Tags to filter by
|
||||
tags: [
|
||||
"tags_example",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByTags(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | **Array<string>** | Tags to filter by | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid tag value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getPetById**
|
||||
> Pet getPetById()
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiGetPetByIdRequest = {
|
||||
// number | ID of pet to return
|
||||
petId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getPetById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to return | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePet**
|
||||
> Pet updatePet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updatePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
**405** | Validation exception | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetWithFormRequest = {
|
||||
// number | ID of pet that needs to be updated
|
||||
petId: 1,
|
||||
// string | Updated name of the pet (optional)
|
||||
name: "name_example",
|
||||
// string | Updated status of the pet (optional)
|
||||
status: "status_example",
|
||||
};
|
||||
|
||||
apiInstance.updatePetWithForm(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet that needs to be updated | defaults to undefined
|
||||
**name** | [**string**] | Updated name of the pet | (optional) defaults to undefined
|
||||
**status** | [**string**] | Updated status of the pet | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUploadFileRequest = {
|
||||
// number | ID of pet to update
|
||||
petId: 1,
|
||||
// string | Additional data to pass to server (optional)
|
||||
additionalMetadata: "additionalMetadata_example",
|
||||
// HttpFile | file to upload (optional)
|
||||
file: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
|
||||
};
|
||||
|
||||
apiInstance.uploadFile(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to update | defaults to undefined
|
||||
**additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined
|
||||
**file** | [**HttpFile**] | file to upload | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**ApiResponse**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,233 @@
|
||||
# petstore.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **deleteOrder**
|
||||
> deleteOrder()
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiDeleteOrderRequest = {
|
||||
// string | ID of the order that needs to be deleted
|
||||
orderId: "orderId_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**string**] | ID of the order that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getInventory**
|
||||
> { [key: string]: number; } getInventory()
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.getInventory(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**{ [key: string]: number; }**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getOrderById**
|
||||
> Order getOrderById()
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiGetOrderByIdRequest = {
|
||||
// number | ID of pet that needs to be fetched
|
||||
orderId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getOrderById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**number**] | ID of pet that needs to be fetched | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **placeOrder**
|
||||
> Order placeOrder(order)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiPlaceOrderRequest = {
|
||||
// Order | order placed for purchasing the pet
|
||||
order: {
|
||||
id: 1,
|
||||
petId: 1,
|
||||
quantity: 1,
|
||||
shipDate: new Date('1970-01-01T00:00:00.00Z'),
|
||||
status: "placed",
|
||||
complete: false,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.placeOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | **Order**| order placed for purchasing the pet |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid Order | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,489 @@
|
||||
# petstore.UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **createUser**
|
||||
> createUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUserRequest = {
|
||||
// User | Created user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.createUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Created user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithArrayInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithArrayInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithListInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithListInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deleteUser**
|
||||
> deleteUser()
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiDeleteUserRequest = {
|
||||
// string | The name that needs to be deleted
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getUserByName**
|
||||
> User getUserByName()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiGetUserByNameRequest = {
|
||||
// string | The name that needs to be fetched. Use user1 for testing.
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.getUserByName(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be fetched. Use user1 for testing. | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**User**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **loginUser**
|
||||
> string loginUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiLoginUserRequest = {
|
||||
// string | The user name for login
|
||||
username: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
// string | The password for login in clear text
|
||||
password: "password_example",
|
||||
};
|
||||
|
||||
apiInstance.loginUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The user name for login | defaults to undefined
|
||||
**password** | [**string**] | The password for login in clear text | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication. <br> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when toekn expires <br> |
|
||||
**400** | Invalid username/password supplied | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.logoutUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updateUser**
|
||||
> updateUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiUpdateUserRequest = {
|
||||
// string | name that need to be deleted
|
||||
username: "username_example",
|
||||
// User | Updated user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updateUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Updated user object |
|
||||
**username** | [**string**] | name that need to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid user supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
.gitignore
|
||||
PetApi.md
|
||||
README.md
|
||||
StoreApi.md
|
||||
UserApi.md
|
||||
apis/PetApi.ts
|
||||
apis/StoreApi.ts
|
||||
apis/UserApi.ts
|
||||
|
@ -0,0 +1,505 @@
|
||||
# petstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
> Pet addPet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiAddPetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.addPet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deletePet**
|
||||
> deletePet()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiDeletePetRequest = {
|
||||
// number | Pet id to delete
|
||||
petId: 1,
|
||||
// string (optional)
|
||||
apiKey: "api_key_example",
|
||||
};
|
||||
|
||||
apiInstance.deletePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | Pet id to delete | defaults to undefined
|
||||
**apiKey** | [**string**] | | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid pet value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByStatus**
|
||||
> Array<Pet> findPetsByStatus()
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByStatusRequest = {
|
||||
// Array<'available' | 'pending' | 'sold'> | Status values that need to be considered for filter
|
||||
status: [
|
||||
"available",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByStatus(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **Array<'available' | 'pending' | 'sold'>** | Status values that need to be considered for filter | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid status value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByTags**
|
||||
> Array<Pet> findPetsByTags()
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByTagsRequest = {
|
||||
// Array<string> | Tags to filter by
|
||||
tags: [
|
||||
"tags_example",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByTags(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | **Array<string>** | Tags to filter by | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid tag value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getPetById**
|
||||
> Pet getPetById()
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiGetPetByIdRequest = {
|
||||
// number | ID of pet to return
|
||||
petId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getPetById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to return | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePet**
|
||||
> Pet updatePet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updatePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
**405** | Validation exception | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetWithFormRequest = {
|
||||
// number | ID of pet that needs to be updated
|
||||
petId: 1,
|
||||
// string | Updated name of the pet (optional)
|
||||
name: "name_example",
|
||||
// string | Updated status of the pet (optional)
|
||||
status: "status_example",
|
||||
};
|
||||
|
||||
apiInstance.updatePetWithForm(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet that needs to be updated | defaults to undefined
|
||||
**name** | [**string**] | Updated name of the pet | (optional) defaults to undefined
|
||||
**status** | [**string**] | Updated status of the pet | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUploadFileRequest = {
|
||||
// number | ID of pet to update
|
||||
petId: 1,
|
||||
// string | Additional data to pass to server (optional)
|
||||
additionalMetadata: "additionalMetadata_example",
|
||||
// HttpFile | file to upload (optional)
|
||||
file: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
|
||||
};
|
||||
|
||||
apiInstance.uploadFile(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to update | defaults to undefined
|
||||
**additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined
|
||||
**file** | [**HttpFile**] | file to upload | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**ApiResponse**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,233 @@
|
||||
# petstore.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **deleteOrder**
|
||||
> deleteOrder()
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiDeleteOrderRequest = {
|
||||
// string | ID of the order that needs to be deleted
|
||||
orderId: "orderId_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**string**] | ID of the order that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getInventory**
|
||||
> { [key: string]: number; } getInventory()
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.getInventory(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**{ [key: string]: number; }**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getOrderById**
|
||||
> Order getOrderById()
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiGetOrderByIdRequest = {
|
||||
// number | ID of pet that needs to be fetched
|
||||
orderId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getOrderById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**number**] | ID of pet that needs to be fetched | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **placeOrder**
|
||||
> Order placeOrder(order)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiPlaceOrderRequest = {
|
||||
// Order | order placed for purchasing the pet
|
||||
order: {
|
||||
id: 1,
|
||||
petId: 1,
|
||||
quantity: 1,
|
||||
shipDate: new Date('1970-01-01T00:00:00.00Z'),
|
||||
status: "placed",
|
||||
complete: false,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.placeOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | **Order**| order placed for purchasing the pet |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid Order | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,489 @@
|
||||
# petstore.UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **createUser**
|
||||
> createUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUserRequest = {
|
||||
// User | Created user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.createUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Created user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithArrayInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithArrayInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithListInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithListInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deleteUser**
|
||||
> deleteUser()
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiDeleteUserRequest = {
|
||||
// string | The name that needs to be deleted
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getUserByName**
|
||||
> User getUserByName()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiGetUserByNameRequest = {
|
||||
// string | The name that needs to be fetched. Use user1 for testing.
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.getUserByName(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be fetched. Use user1 for testing. | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**User**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **loginUser**
|
||||
> string loginUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiLoginUserRequest = {
|
||||
// string | The user name for login
|
||||
username: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
// string | The password for login in clear text
|
||||
password: "password_example",
|
||||
};
|
||||
|
||||
apiInstance.loginUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The user name for login | defaults to undefined
|
||||
**password** | [**string**] | The password for login in clear text | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication. <br> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when toekn expires <br> |
|
||||
**400** | Invalid username/password supplied | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.logoutUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updateUser**
|
||||
> updateUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiUpdateUserRequest = {
|
||||
// string | name that need to be deleted
|
||||
username: "username_example",
|
||||
// User | Updated user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updateUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Updated user object |
|
||||
**username** | [**string**] | name that need to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid user supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
.gitignore
|
||||
PetApi.md
|
||||
README.md
|
||||
StoreApi.md
|
||||
UserApi.md
|
||||
apis/PetApi.ts
|
||||
apis/StoreApi.ts
|
||||
apis/UserApi.ts
|
||||
|
@ -0,0 +1,505 @@
|
||||
# petstore.PetApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
|
||||
[**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
|
||||
[**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
|
||||
[**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
|
||||
[**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
|
||||
[**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
|
||||
[**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
|
||||
[**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
|
||||
|
||||
|
||||
# **addPet**
|
||||
> Pet addPet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiAddPetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.addPet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deletePet**
|
||||
> deletePet()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiDeletePetRequest = {
|
||||
// number | Pet id to delete
|
||||
petId: 1,
|
||||
// string (optional)
|
||||
apiKey: "api_key_example",
|
||||
};
|
||||
|
||||
apiInstance.deletePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | Pet id to delete | defaults to undefined
|
||||
**apiKey** | [**string**] | | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid pet value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByStatus**
|
||||
> Array<Pet> findPetsByStatus()
|
||||
|
||||
Multiple status values can be provided with comma separated strings
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByStatusRequest = {
|
||||
// Array<'available' | 'pending' | 'sold'> | Status values that need to be considered for filter
|
||||
status: [
|
||||
"available",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByStatus(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**status** | **Array<'available' | 'pending' | 'sold'>** | Status values that need to be considered for filter | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid status value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **findPetsByTags**
|
||||
> Array<Pet> findPetsByTags()
|
||||
|
||||
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiFindPetsByTagsRequest = {
|
||||
// Array<string> | Tags to filter by
|
||||
tags: [
|
||||
"tags_example",
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.findPetsByTags(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**tags** | **Array<string>** | Tags to filter by | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Array<Pet>**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid tag value | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getPetById**
|
||||
> Pet getPetById()
|
||||
|
||||
Returns a single pet
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiGetPetByIdRequest = {
|
||||
// number | ID of pet to return
|
||||
petId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getPetById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to return | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePet**
|
||||
> Pet updatePet(pet)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetRequest = {
|
||||
// Pet | Pet object that needs to be added to the store
|
||||
pet: {
|
||||
id: 1,
|
||||
category: {
|
||||
id: 1,
|
||||
name: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
},
|
||||
name: "doggie",
|
||||
photoUrls: [
|
||||
"photoUrls_example",
|
||||
],
|
||||
tags: [
|
||||
{
|
||||
id: 1,
|
||||
name: "name_example",
|
||||
},
|
||||
],
|
||||
status: "available",
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updatePet(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**pet** | **Pet**| Pet object that needs to be added to the store |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Pet**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json, application/xml
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Pet not found | - |
|
||||
**405** | Validation exception | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updatePetWithForm**
|
||||
> updatePetWithForm()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUpdatePetWithFormRequest = {
|
||||
// number | ID of pet that needs to be updated
|
||||
petId: 1,
|
||||
// string | Updated name of the pet (optional)
|
||||
name: "name_example",
|
||||
// string | Updated status of the pet (optional)
|
||||
status: "status_example",
|
||||
};
|
||||
|
||||
apiInstance.updatePetWithForm(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet that needs to be updated | defaults to undefined
|
||||
**name** | [**string**] | Updated name of the pet | (optional) defaults to undefined
|
||||
**status** | [**string**] | Updated status of the pet | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/x-www-form-urlencoded
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**405** | Invalid input | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **uploadFile**
|
||||
> ApiResponse uploadFile()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.PetApi(configuration);
|
||||
|
||||
let body:petstore.PetApiUploadFileRequest = {
|
||||
// number | ID of pet to update
|
||||
petId: 1,
|
||||
// string | Additional data to pass to server (optional)
|
||||
additionalMetadata: "additionalMetadata_example",
|
||||
// HttpFile | file to upload (optional)
|
||||
file: { data: Buffer.from(fs.readFileSync('/path/to/file', 'utf-8')), name: '/path/to/file' },
|
||||
};
|
||||
|
||||
apiInstance.uploadFile(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**petId** | [**number**] | ID of pet to update | defaults to undefined
|
||||
**additionalMetadata** | [**string**] | Additional data to pass to server | (optional) defaults to undefined
|
||||
**file** | [**HttpFile**] | file to upload | (optional) defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**ApiResponse**
|
||||
|
||||
### Authorization
|
||||
|
||||
[petstore_auth](README.md#petstore_auth)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: multipart/form-data
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,233 @@
|
||||
# petstore.StoreApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**deleteOrder**](StoreApi.md#deleteOrder) | **DELETE** /store/order/{orderId} | Delete purchase order by ID
|
||||
[**getInventory**](StoreApi.md#getInventory) | **GET** /store/inventory | Returns pet inventories by status
|
||||
[**getOrderById**](StoreApi.md#getOrderById) | **GET** /store/order/{orderId} | Find purchase order by ID
|
||||
[**placeOrder**](StoreApi.md#placeOrder) | **POST** /store/order | Place an order for a pet
|
||||
|
||||
|
||||
# **deleteOrder**
|
||||
> deleteOrder()
|
||||
|
||||
For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiDeleteOrderRequest = {
|
||||
// string | ID of the order that needs to be deleted
|
||||
orderId: "orderId_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**string**] | ID of the order that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getInventory**
|
||||
> { [key: string]: number; } getInventory()
|
||||
|
||||
Returns a map of status codes to quantities
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.getInventory(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**{ [key: string]: number; }**
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getOrderById**
|
||||
> Order getOrderById()
|
||||
|
||||
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiGetOrderByIdRequest = {
|
||||
// number | ID of pet that needs to be fetched
|
||||
orderId: 1,
|
||||
};
|
||||
|
||||
apiInstance.getOrderById(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**orderId** | [**number**] | ID of pet that needs to be fetched | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid ID supplied | - |
|
||||
**404** | Order not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **placeOrder**
|
||||
> Order placeOrder(order)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.StoreApi(configuration);
|
||||
|
||||
let body:petstore.StoreApiPlaceOrderRequest = {
|
||||
// Order | order placed for purchasing the pet
|
||||
order: {
|
||||
id: 1,
|
||||
petId: 1,
|
||||
quantity: 1,
|
||||
shipDate: new Date('1970-01-01T00:00:00.00Z'),
|
||||
status: "placed",
|
||||
complete: false,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.placeOrder(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**order** | **Order**| order placed for purchasing the pet |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**Order**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid Order | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
@ -0,0 +1,489 @@
|
||||
# petstore.UserApi
|
||||
|
||||
All URIs are relative to *http://petstore.swagger.io/v2*
|
||||
|
||||
Method | HTTP request | Description
|
||||
------------- | ------------- | -------------
|
||||
[**createUser**](UserApi.md#createUser) | **POST** /user | Create user
|
||||
[**createUsersWithArrayInput**](UserApi.md#createUsersWithArrayInput) | **POST** /user/createWithArray | Creates list of users with given input array
|
||||
[**createUsersWithListInput**](UserApi.md#createUsersWithListInput) | **POST** /user/createWithList | Creates list of users with given input array
|
||||
[**deleteUser**](UserApi.md#deleteUser) | **DELETE** /user/{username} | Delete user
|
||||
[**getUserByName**](UserApi.md#getUserByName) | **GET** /user/{username} | Get user by user name
|
||||
[**loginUser**](UserApi.md#loginUser) | **GET** /user/login | Logs user into the system
|
||||
[**logoutUser**](UserApi.md#logoutUser) | **GET** /user/logout | Logs out current logged in user session
|
||||
[**updateUser**](UserApi.md#updateUser) | **PUT** /user/{username} | Updated user
|
||||
|
||||
|
||||
# **createUser**
|
||||
> createUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUserRequest = {
|
||||
// User | Created user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.createUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Created user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithArrayInput**
|
||||
> createUsersWithArrayInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithArrayInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithArrayInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **createUsersWithListInput**
|
||||
> createUsersWithListInput(user)
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiCreateUsersWithListInputRequest = {
|
||||
// Array<User> | List of user object
|
||||
user: [
|
||||
{
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
apiInstance.createUsersWithListInput(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **Array<User>**| List of user object |
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **deleteUser**
|
||||
> deleteUser()
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiDeleteUserRequest = {
|
||||
// string | The name that needs to be deleted
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.deleteUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **getUserByName**
|
||||
> User getUserByName()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiGetUserByNameRequest = {
|
||||
// string | The name that needs to be fetched. Use user1 for testing.
|
||||
username: "username_example",
|
||||
};
|
||||
|
||||
apiInstance.getUserByName(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The name that needs to be fetched. Use user1 for testing. | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**User**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | - |
|
||||
**400** | Invalid username supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **loginUser**
|
||||
> string loginUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiLoginUserRequest = {
|
||||
// string | The user name for login
|
||||
username: "CbUUGjjNSwg0_bs9ZayIMrKdgNvb6gvxmPb9GcsM61ate1RA89q3w1l4eH4XxEz.5awLMdeXylwK0lMGUSM4jsrh4dstlnQUN5vVdMLPA",
|
||||
// string | The password for login in clear text
|
||||
password: "password_example",
|
||||
};
|
||||
|
||||
apiInstance.loginUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**username** | [**string**] | The user name for login | defaults to undefined
|
||||
**password** | [**string**] | The password for login in clear text | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
**string**
|
||||
|
||||
### Authorization
|
||||
|
||||
No authorization required
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: application/xml, application/json
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**200** | successful operation | * Set-Cookie - Cookie authentication key for use with the `api_key` apiKey authentication. <br> * X-Rate-Limit - calls per hour allowed by the user <br> * X-Expires-After - date in UTC when toekn expires <br> |
|
||||
**400** | Invalid username/password supplied | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **logoutUser**
|
||||
> logoutUser()
|
||||
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:any = {};
|
||||
|
||||
apiInstance.logoutUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
This endpoint does not need any parameter.
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: Not defined
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**0** | successful operation | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
# **updateUser**
|
||||
> updateUser(user)
|
||||
|
||||
This can only be done by the logged in user.
|
||||
|
||||
### Example
|
||||
|
||||
|
||||
```typescript
|
||||
import { petstore } from 'ts-petstore-client';
|
||||
import * as fs from 'fs';
|
||||
|
||||
const configuration = petstore.createConfiguration();
|
||||
const apiInstance = new petstore.UserApi(configuration);
|
||||
|
||||
let body:petstore.UserApiUpdateUserRequest = {
|
||||
// string | name that need to be deleted
|
||||
username: "username_example",
|
||||
// User | Updated user object
|
||||
user: {
|
||||
id: 1,
|
||||
username: "username_example",
|
||||
firstName: "firstName_example",
|
||||
lastName: "lastName_example",
|
||||
email: "email_example",
|
||||
password: "password_example",
|
||||
phone: "phone_example",
|
||||
userStatus: 1,
|
||||
},
|
||||
};
|
||||
|
||||
apiInstance.updateUser(body).then((data:any) => {
|
||||
console.log('API called successfully. Returned data: ' + data);
|
||||
}).catch((error:any) => console.error(error));
|
||||
```
|
||||
|
||||
|
||||
### Parameters
|
||||
|
||||
Name | Type | Description | Notes
|
||||
------------- | ------------- | ------------- | -------------
|
||||
**user** | **User**| Updated user object |
|
||||
**username** | [**string**] | name that need to be deleted | defaults to undefined
|
||||
|
||||
|
||||
### Return type
|
||||
|
||||
void (empty response body)
|
||||
|
||||
### Authorization
|
||||
|
||||
[api_key](README.md#api_key)
|
||||
|
||||
### HTTP request headers
|
||||
|
||||
- **Content-Type**: application/json
|
||||
- **Accept**: Not defined
|
||||
|
||||
|
||||
### HTTP response details
|
||||
| Status code | Description | Response headers |
|
||||
|-------------|-------------|------------------|
|
||||
**400** | Invalid user supplied | - |
|
||||
**404** | User not found | - |
|
||||
|
||||
[[Back to top]](#) [[Back to API list]](README.md#documentation-for-api-endpoints) [[Back to Model list]](README.md#documentation-for-models) [[Back to README]](README.md)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user