swaxios
Version:
Swagger API client generator based on axios and TypeScript.
45 lines (44 loc) • 1.42 kB
TypeScript
import { OpenAPIV2 } from 'openapi-types';
import { GeneratorContext, TemplateGenerator } from './TemplateGenerator';
export declare enum SwaggerType {
ARRAY = "array",
BOOLEAN = "boolean",
INTEGER = "integer",
NUMBER = "number",
OBJECT = "object",
STRING = "string"
}
export declare enum TypeScriptType {
ANY = "any",
ARRAY = "Array",
BOOLEAN = "boolean",
EMPTY_OBJECT = "{}",
NUMBER = "number",
STRING = "string",
INTERFACE = "interface",
TYPE = "type"
}
interface SwaxiosInterface {
basicType?: TypeScriptType;
type: string;
imports: string[];
}
interface Context extends GeneratorContext {
basicType?: string;
imports: string[];
name: string;
typeData: string;
}
export declare class InterfaceGenerator extends TemplateGenerator {
protected readonly name: string;
protected readonly templateFile: string;
private readonly spec;
private readonly definition;
private readonly outputDirectory;
constructor(definitionName: string, definition: OpenAPIV2.Schema, spec: OpenAPIV2.Document, outputDirectory: string);
static buildInterface(spec: OpenAPIV2.Document, schema: OpenAPIV2.Schema, schemaName: string, imports?: string[], basicType?: TypeScriptType): SwaxiosInterface;
generateInterface(): SwaxiosInterface;
write(): Promise<void>;
protected getContext(): Promise<Context>;
}
export {};