forked from loafle/openapi-generator-original
WIP: Models & API
This commit is contained in:
parent
b0f8dc9505
commit
fe2cc24f4d
@ -17,10 +17,13 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.NumberSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.utils.ModelUtils;
|
||||
@ -29,6 +32,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptClientCodegen.class);
|
||||
@ -128,8 +132,13 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
supportingFiles.add(new SupportingFile("index.mustache", "index.ts"));
|
||||
|
||||
// models
|
||||
this.modelPackage = "";
|
||||
this.modelTemplateFiles.put("models/models.mustache", ".ts");
|
||||
this.setModelPackage("");
|
||||
this.modelTemplateFiles.put("models.mustache", ".ts");
|
||||
|
||||
// api
|
||||
this.setApiPackage("");
|
||||
this.supportingFiles.add(new SupportingFile("baseapi.mustache", "apis", "baseapi.ts"));
|
||||
this.apiTemplateFiles.put("api.mustache", ".ts");
|
||||
}
|
||||
|
||||
|
||||
@ -137,7 +146,26 @@ public class TypeScriptClientCodegen extends DefaultCodegen implements CodegenCo
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> postProcessOperations(Map<String, Object> operations) {
|
||||
Map<String, Object> objs = (Map<String, Object>) operations.get("operations");
|
||||
|
||||
|
||||
// Add additional filename information for model imports in the apis
|
||||
List<Map<String, Object>> imports = (List<Map<String, Object>>) operations.get("imports");
|
||||
for (Map<String, Object> im : imports) {
|
||||
im.put("filename", ((String) im.get("import")).replace('.', '/'));
|
||||
im.put("classname", getModelnameFromModelFilename(im.get("import").toString()));
|
||||
}
|
||||
return operations;
|
||||
}
|
||||
|
||||
private String getModelnameFromModelFilename(String filename) {
|
||||
String name = filename.substring((modelPackage() + File.separator).length());
|
||||
return camelize(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String escapeReservedWord(String name) {
|
||||
if (this.reservedWordsMappings().containsKey(name)) {
|
||||
|
41
modules/openapi-generator/src/main/resources/typescript/api.mustache
vendored
Normal file
41
modules/openapi-generator/src/main/resources/typescript/api.mustache
vendored
Normal file
@ -0,0 +1,41 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseApiRequestFactory } from './baseapi';
|
||||
import { RequestContext } from '../http/http';
|
||||
{{#imports}}
|
||||
import { {{classname}} } from '..{{filename}}';
|
||||
{{/imports}}
|
||||
|
||||
|
||||
|
||||
{{#operations}}
|
||||
|
||||
/**
|
||||
* {{classname}} - interface{{#description}}
|
||||
* {{&description}}{{/description}}
|
||||
* @export
|
||||
* @interface {{classname}}
|
||||
*/
|
||||
export class {{classname}}RequestFactory {
|
||||
|
||||
{{#operation}}
|
||||
/**
|
||||
* {{¬es}}
|
||||
{{#summary}}
|
||||
* @summary {{&summary}}
|
||||
{{/summary}}
|
||||
{{#allParams}}
|
||||
* @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}}
|
||||
{{/allParams}}
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof {{classname}}Interface
|
||||
*/
|
||||
public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
{{/operation}}
|
||||
}
|
||||
{{/operations}}
|
37
modules/openapi-generator/src/main/resources/typescript/baseapi.mustache
vendored
Normal file
37
modules/openapi-generator/src/main/resources/typescript/baseapi.mustache
vendored
Normal file
@ -0,0 +1,37 @@
|
||||
import { Configuration } from '../configuration'
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class BaseAPI
|
||||
*/
|
||||
export class BaseAPIRequestFactory {
|
||||
|
||||
constructor(protected configuration: Configuration) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class RequiredError
|
||||
* @extends {Error}
|
||||
*/
|
||||
export class RequiredError extends Error {
|
||||
name: "RequiredError" = "RequiredError";
|
||||
constructor(public field: string, msg?: string) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ export interface ConfigurationParameters {
|
||||
baseServer?: ServerConfiguration;
|
||||
httpApi?: HttpLibrary; // override for fetch implementation
|
||||
middleware?: Middleware[]; // middleware to apply before/after fetch requests
|
||||
|
||||
username?: string; // parameter for basic security
|
||||
password?: string; // parameter for basic security
|
||||
apiKey?: string | ((name: string) => string); // parameter for apiKey security
|
||||
|
@ -6,10 +6,10 @@
|
||||
import { {{.}} } from './{{.}}';
|
||||
{{/imports}}
|
||||
{{#isEnum}}
|
||||
{{>models/modelEnum}}
|
||||
{{>modelEnum}}
|
||||
{{/isEnum}}
|
||||
{{^isEnum}}
|
||||
{{>models/modelGeneric}}
|
||||
{{>modelGeneric}}
|
||||
{{/isEnum}}
|
||||
{{/model}}
|
||||
{{/models}}
|
134
samples/client/petstore/typescript/builds/default/apis/PetApi.ts
Normal file
134
samples/client/petstore/typescript/builds/default/apis/PetApi.ts
Normal file
@ -0,0 +1,134 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseApiRequestFactory } from './baseapi';
|
||||
import { RequestContext } from '../http/http';
|
||||
import { ApiResponse } from '../models/ApiResponse';
|
||||
import { Pet } from '../models/Pet';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* PetApi - interface
|
||||
* @export
|
||||
* @interface PetApi
|
||||
*/
|
||||
export class PetApiRequestFactory {
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Add a new pet to the store
|
||||
* @param {Pet} pet Pet object that needs to be added to the store
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public addPet(pet: Pet, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Deletes a pet
|
||||
* @param {number} petId Pet id to delete
|
||||
* @param {string} [apiKey]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public deletePet(petId: number, apiKey?: string, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @summary Finds Pets by status
|
||||
* @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @summary Finds Pets by tags
|
||||
* @param {Array<string>} tags Tags to filter by
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public findPetsByTags(tags: Array<string>, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a single pet
|
||||
* @summary Find pet by ID
|
||||
* @param {number} petId ID of pet to return
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public getPetById(petId: number, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Update an existing pet
|
||||
* @param {Pet} pet Pet object that needs to be added to the store
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public updatePet(pet: Pet, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Updates a pet in the store with form data
|
||||
* @param {number} petId ID of pet that needs to be updated
|
||||
* @param {string} [name] Updated name of the pet
|
||||
* @param {string} [status] Updated status of the pet
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public updatePetWithForm(petId: number, name?: string, status?: string, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary uploads an image
|
||||
* @param {number} petId ID of pet to update
|
||||
* @param {string} [additionalMetadata] Additional data to pass to server
|
||||
* @param {any} [file] file to upload
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseApiRequestFactory } from './baseapi';
|
||||
import { RequestContext } from '../http/http';
|
||||
import { Order } from '../models/Order';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* StoreApi - interface
|
||||
* @export
|
||||
* @interface StoreApi
|
||||
*/
|
||||
export class StoreApiRequestFactory {
|
||||
|
||||
/**
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @summary Delete purchase order by ID
|
||||
* @param {string} orderId ID of the order that needs to be deleted
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
public deleteOrder(orderId: string, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a map of status codes to quantities
|
||||
* @summary Returns pet inventories by status
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
public getInventory(options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @summary Find purchase order by ID
|
||||
* @param {number} orderId ID of pet that needs to be fetched
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
public getOrderById(orderId: number, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Place an order for a pet
|
||||
* @param {Order} order order placed for purchasing the pet
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
public placeOrder(order: Order, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
// TODO: better import syntax?
|
||||
import { BaseApiRequestFactory } from './baseapi';
|
||||
import { RequestContext } from '../http/http';
|
||||
import { User } from '../models/User';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* UserApi - interface
|
||||
* @export
|
||||
* @interface UserApi
|
||||
*/
|
||||
export class UserApiRequestFactory {
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
* @summary Create user
|
||||
* @param {User} user Created user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public createUser(user: User, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Creates list of users with given input array
|
||||
* @param {Array<User>} user List of user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public createUsersWithArrayInput(user: Array<User>, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Creates list of users with given input array
|
||||
* @param {Array<User>} user List of user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public createUsersWithListInput(user: Array<User>, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
* @summary Delete user
|
||||
* @param {string} username The name that needs to be deleted
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public deleteUser(username: string, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Get user by user name
|
||||
* @param {string} username The name that needs to be fetched. Use user1 for testing.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public getUserByName(username: string, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Logs user into the system
|
||||
* @param {string} username The user name for login
|
||||
* @param {string} password The password for login in clear text
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public loginUser(username: string, password: string, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Logs out current logged in user session
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public logoutUser(options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
* @summary Updated user
|
||||
* @param {string} username name that need to be deleted
|
||||
* @param {User} user Updated user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
public updateUser(username: string, user: User, options?: any): RequestContext {
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
// TODO: better import syntax?
|
||||
|
||||
import { ApiResponse } from '../';
|
||||
import { Pet } from '../';
|
||||
/**
|
||||
* PetApi - interface
|
||||
* @export
|
||||
* @interface PetApi
|
||||
*/
|
||||
export interface PetApiInterface {
|
||||
/**
|
||||
*
|
||||
* @summary Add a new pet to the store
|
||||
* @param {Pet} pet Pet object that needs to be added to the store
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
addPet(pet: Pet, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Deletes a pet
|
||||
* @param {number} petId Pet id to delete
|
||||
* @param {string} [apiKey]
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
deletePet(petId: number, apiKey?: string, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
* Multiple status values can be provided with comma separated strings
|
||||
* @summary Finds Pets by status
|
||||
* @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): Promise<Array<Pet>>;
|
||||
|
||||
/**
|
||||
* Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
|
||||
* @summary Finds Pets by tags
|
||||
* @param {Array<string>} tags Tags to filter by
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
findPetsByTags(tags: Array<string>, options?: any): Promise<Array<Pet>>;
|
||||
|
||||
/**
|
||||
* Returns a single pet
|
||||
* @summary Find pet by ID
|
||||
* @param {number} petId ID of pet to return
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
getPetById(petId: number, options?: any): Promise<Pet>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Update an existing pet
|
||||
* @param {Pet} pet Pet object that needs to be added to the store
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
updatePet(pet: Pet, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Updates a pet in the store with form data
|
||||
* @param {number} petId ID of pet that needs to be updated
|
||||
* @param {string} [name] Updated name of the pet
|
||||
* @param {string} [status] Updated status of the pet
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
updatePetWithForm(petId: number, name?: string, status?: string, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary uploads an image
|
||||
* @param {number} petId ID of pet to update
|
||||
* @param {string} [additionalMetadata] Additional data to pass to server
|
||||
* @param {any} [file] file to upload
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof PetApiInterface
|
||||
*/
|
||||
uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): Promise<ApiResponse>;
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
// TODO: better import syntax?
|
||||
|
||||
import { Order } from '../';
|
||||
/**
|
||||
* StoreApi - interface
|
||||
* @export
|
||||
* @interface StoreApi
|
||||
*/
|
||||
export interface StoreApiInterface {
|
||||
/**
|
||||
* For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
|
||||
* @summary Delete purchase order by ID
|
||||
* @param {string} orderId ID of the order that needs to be deleted
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
deleteOrder(orderId: string, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
* Returns a map of status codes to quantities
|
||||
* @summary Returns pet inventories by status
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
getInventory(options?: any): Promise<{ [key: string]: number; }>;
|
||||
|
||||
/**
|
||||
* For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
|
||||
* @summary Find purchase order by ID
|
||||
* @param {number} orderId ID of pet that needs to be fetched
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
getOrderById(orderId: number, options?: any): Promise<Order>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Place an order for a pet
|
||||
* @param {Order} order order placed for purchasing the pet
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof StoreApiInterface
|
||||
*/
|
||||
placeOrder(order: Order, options?: any): Promise<Order>;
|
||||
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
// TODO: better import syntax?
|
||||
|
||||
import { User } from '../';
|
||||
/**
|
||||
* UserApi - interface
|
||||
* @export
|
||||
* @interface UserApi
|
||||
*/
|
||||
export interface UserApiInterface {
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
* @summary Create user
|
||||
* @param {User} user Created user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
createUser(user: User, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Creates list of users with given input array
|
||||
* @param {Array<User>} user List of user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
createUsersWithArrayInput(user: Array<User>, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Creates list of users with given input array
|
||||
* @param {Array<User>} user List of user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
createUsersWithListInput(user: Array<User>, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
* @summary Delete user
|
||||
* @param {string} username The name that needs to be deleted
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
deleteUser(username: string, options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Get user by user name
|
||||
* @param {string} username The name that needs to be fetched. Use user1 for testing.
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
getUserByName(username: string, options?: any): Promise<User>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Logs user into the system
|
||||
* @param {string} username The user name for login
|
||||
* @param {string} password The password for login in clear text
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
loginUser(username: string, password: string, options?: any): Promise<string>;
|
||||
|
||||
/**
|
||||
*
|
||||
* @summary Logs out current logged in user session
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
logoutUser(options?: any): Promise<{}>;
|
||||
|
||||
/**
|
||||
* This can only be done by the logged in user.
|
||||
* @summary Updated user
|
||||
* @param {string} username name that need to be deleted
|
||||
* @param {User} user Updated user object
|
||||
* @param {*} [options] Override http request option.
|
||||
* @throws {RequiredError}
|
||||
* @memberof UserApiInterface
|
||||
*/
|
||||
updateUser(username: string, user: User, options?: any): Promise<{}>;
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
import { Configuration } from '../configuration'
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
*/
|
||||
export const COLLECTION_FORMATS = {
|
||||
csv: ",",
|
||||
ssv: " ",
|
||||
tsv: "\t",
|
||||
pipes: "|",
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class BaseAPI
|
||||
*/
|
||||
export class BaseAPIRequestFactory {
|
||||
|
||||
constructor(protected configuration: Configuration) {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @export
|
||||
* @class RequiredError
|
||||
* @extends {Error}
|
||||
*/
|
||||
export class RequiredError extends Error {
|
||||
name: "RequiredError" = "RequiredError";
|
||||
constructor(public field: string, msg?: string) {
|
||||
super(msg);
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
// tslint:disable
|
||||
/*
|
||||
TODO: LICENSE INFO
|
||||
*/
|
||||
/**
|
||||
* Describes the result of uploading an image resource
|
||||
* @export
|
||||
* @interface ApiResponse
|
||||
*/
|
||||
export interface ApiResponse {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ApiResponse
|
||||
*/
|
||||
code?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ApiResponse
|
||||
*/
|
||||
type?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ApiResponse
|
||||
*/
|
||||
message?: string;
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
// tslint:disable
|
||||
/*
|
||||
TODO: LICENSE INFO
|
||||
*/
|
||||
/**
|
||||
* A category for a pet
|
||||
* @export
|
||||
* @interface Category
|
||||
*/
|
||||
export interface Category {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Category
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Category
|
||||
*/
|
||||
name?: string;
|
||||
}
|
||||
|
@ -0,0 +1,64 @@
|
||||
// tslint:disable
|
||||
/*
|
||||
TODO: LICENSE INFO
|
||||
*/
|
||||
/**
|
||||
* An order for a pets from the pet store
|
||||
* @export
|
||||
* @interface Order
|
||||
*/
|
||||
export interface Order {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Order
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Order
|
||||
*/
|
||||
petId?: number;
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Order
|
||||
*/
|
||||
quantity?: number;
|
||||
/**
|
||||
*
|
||||
* @type {Date}
|
||||
* @memberof Order
|
||||
*/
|
||||
shipDate?: Date;
|
||||
/**
|
||||
* Order Status
|
||||
* @type {string}
|
||||
* @memberof Order
|
||||
*/
|
||||
status?: Order.StatusEnum;
|
||||
/**
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof Order
|
||||
*/
|
||||
complete?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @namespace Order
|
||||
*/
|
||||
export namespace Order {
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum StatusEnum {
|
||||
Placed = <any> 'placed',
|
||||
Approved = <any> 'approved',
|
||||
Delivered = <any> 'delivered'
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
// tslint:disable
|
||||
/*
|
||||
TODO: LICENSE INFO
|
||||
*/
|
||||
import { Category } from './Category';
|
||||
import { Tag } from './Tag';
|
||||
/**
|
||||
* A pet for sale in the pet store
|
||||
* @export
|
||||
* @interface Pet
|
||||
*/
|
||||
export interface Pet {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Pet
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {Category}
|
||||
* @memberof Pet
|
||||
*/
|
||||
category?: Category;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Pet
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
*
|
||||
* @type {Array<string>}
|
||||
* @memberof Pet
|
||||
*/
|
||||
photoUrls: Array<string>;
|
||||
/**
|
||||
*
|
||||
* @type {Array<Tag>}
|
||||
* @memberof Pet
|
||||
*/
|
||||
tags?: Array<Tag>;
|
||||
/**
|
||||
* pet status in the store
|
||||
* @type {string}
|
||||
* @memberof Pet
|
||||
*/
|
||||
status?: Pet.StatusEnum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @export
|
||||
* @namespace Pet
|
||||
*/
|
||||
export namespace Pet {
|
||||
/**
|
||||
* @export
|
||||
* @enum {string}
|
||||
*/
|
||||
export enum StatusEnum {
|
||||
Available = <any> 'available',
|
||||
Pending = <any> 'pending',
|
||||
Sold = <any> 'sold'
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
// tslint:disable
|
||||
/*
|
||||
TODO: LICENSE INFO
|
||||
*/
|
||||
/**
|
||||
* A tag for a pet
|
||||
* @export
|
||||
* @interface Tag
|
||||
*/
|
||||
export interface Tag {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof Tag
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof Tag
|
||||
*/
|
||||
name?: string;
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
// tslint:disable
|
||||
/*
|
||||
TODO: LICENSE INFO
|
||||
*/
|
||||
/**
|
||||
* A User who is purchasing from the pet store
|
||||
* @export
|
||||
* @interface User
|
||||
*/
|
||||
export interface User {
|
||||
/**
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof User
|
||||
*/
|
||||
id?: number;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
username?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
firstName?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
lastName?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
email?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
password?: string;
|
||||
/**
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof User
|
||||
*/
|
||||
phone?: string;
|
||||
/**
|
||||
* User Status
|
||||
* @type {number}
|
||||
* @memberof User
|
||||
*/
|
||||
userStatus?: number;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user