forked from loafle/openapi-generator-original
Removed accidentally created generated code
This commit is contained in:
parent
c330a9f872
commit
40f3c4f4dd
@ -1,23 +0,0 @@
|
|||||||
# OpenAPI Generator Ignore
|
|
||||||
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
|
|
||||||
|
|
||||||
# Use this file to prevent files from being overwritten by the generator.
|
|
||||||
# The patterns follow closely to .gitignore or .dockerignore.
|
|
||||||
|
|
||||||
# As an example, the C# client generator defines ApiClient.cs.
|
|
||||||
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
|
|
||||||
#ApiClient.cs
|
|
||||||
|
|
||||||
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
|
|
||||||
#foo/*/qux
|
|
||||||
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
|
|
||||||
#foo/**/qux
|
|
||||||
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
|
|
||||||
|
|
||||||
# You can also negate patterns with an exclamation (!).
|
|
||||||
# For example, you can ignore all files in a docs folder with the file extension .md:
|
|
||||||
#docs/*.md
|
|
||||||
# Then explicitly reverse the ignore rule for a single file:
|
|
||||||
#!docs/README.md
|
|
@ -1 +0,0 @@
|
|||||||
unset
|
|
@ -1 +0,0 @@
|
|||||||
readme
|
|
@ -1,38 +0,0 @@
|
|||||||
import {HttpLibrary} from './http/http';
|
|
||||||
import {Middleware} from './middleware';
|
|
||||||
|
|
||||||
export interface ConfigurationParameters {
|
|
||||||
basePath?: string; // override base path
|
|
||||||
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
|
|
||||||
accessToken?: string | ((name: string, scopes?: string[]) => string); // parameter for oauth2 security
|
|
||||||
}
|
|
||||||
|
|
||||||
export class Configuration {
|
|
||||||
|
|
||||||
basePath: string;
|
|
||||||
httpApi: HttpLibrary;
|
|
||||||
middleware: Middleware[];
|
|
||||||
username?: string;
|
|
||||||
password?: string;
|
|
||||||
apiKey?: (name: string) => string;
|
|
||||||
accessToken?: (name: string, scopes?: string[]) => string;
|
|
||||||
|
|
||||||
constructor(conf: ConfigurationParameters = {}) {
|
|
||||||
this.basePath = conf.basePath !== undefined ? conf.basePath : BASE_PATH;
|
|
||||||
this.fetchApi = conf.fetchApi || window.fetch.bind(window);
|
|
||||||
this.middleware = conf.middleware || [];
|
|
||||||
this.username = conf.username;
|
|
||||||
this.password = conf.password;
|
|
||||||
const { apiKey, accessToken } = conf;
|
|
||||||
if (apiKey) {
|
|
||||||
this.apiKey = typeof apiKey === 'function' ? apiKey : () => apiKey;
|
|
||||||
}
|
|
||||||
if (accessToken) {
|
|
||||||
this.accessToken = typeof accessToken === 'function' ? accessToken : () => accessToken;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,51 +0,0 @@
|
|||||||
export enum HttpMethod {
|
|
||||||
GET = "GET",
|
|
||||||
HEAD = "HEAD",
|
|
||||||
POST = "POST",
|
|
||||||
PUT = "PUT",
|
|
||||||
DELETE = "DELETE",
|
|
||||||
CONNECT = "CONNECT",
|
|
||||||
OPTIONS = "OPTIONS",
|
|
||||||
TRACE = "TRACE",
|
|
||||||
PATCH = "PATCH"
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface FormEntry {
|
|
||||||
contentType: string;
|
|
||||||
value: string | Blob;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type FormData = { [key: string]: FormEntry };
|
|
||||||
|
|
||||||
|
|
||||||
export class RequestContext {
|
|
||||||
public headers: { [key: string]: string } = {};
|
|
||||||
public body: string | FormData = "";
|
|
||||||
|
|
||||||
public constructor(public url: string, public httpMethod: HttpMethod) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public addCookie(name: string, value: string): void {
|
|
||||||
if (!this.headers["Cookie"]) {
|
|
||||||
this.headers["Cookie"] = "";
|
|
||||||
}
|
|
||||||
this.headers["Cookie"] += name + "=" + value + "; ";
|
|
||||||
}
|
|
||||||
|
|
||||||
public setHeader(key: string, value: string): void {
|
|
||||||
this.headers[key] = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export class ResponseContext {
|
|
||||||
|
|
||||||
public constructor(public httpStatusCode: number,
|
|
||||||
public headers: { [key: string]: string }, public body: string) {
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface HttpLibrary {
|
|
||||||
send(request: RequestContext): Promise<ResponseContext>;
|
|
||||||
}
|
|
@ -1,38 +0,0 @@
|
|||||||
import {HttpLibrary, RequestContext, ResponseContext} from './http';
|
|
||||||
import * as e6p from 'es6-promise'
|
|
||||||
e6p.polyfill();
|
|
||||||
import 'isomorphic-fetch';
|
|
||||||
|
|
||||||
export class IsomorphicFetchHttpLibrary implements HttpLibrary {
|
|
||||||
|
|
||||||
public send(request: RequestContext): Promise<ResponseContext> {
|
|
||||||
let method = request.httpMethod.toString();
|
|
||||||
let body: string | FormData = "";
|
|
||||||
if (typeof request.body === "string") {
|
|
||||||
body = request.body;
|
|
||||||
} else {
|
|
||||||
body = new FormData();
|
|
||||||
for (const key in request.body) {
|
|
||||||
body.append(key, request.body[key].value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fetch(request.url, {
|
|
||||||
method: method,
|
|
||||||
body: body,
|
|
||||||
headers: request.headers,
|
|
||||||
credentials: "same-origin"
|
|
||||||
}).then((resp) => {
|
|
||||||
// hack
|
|
||||||
let headers = (resp.headers as any)._headers;
|
|
||||||
for (let key in headers) {
|
|
||||||
headers[key] = (headers[key] as Array<string>).join("; ");
|
|
||||||
}
|
|
||||||
|
|
||||||
return resp.text().then((body) => {
|
|
||||||
return new ResponseContext(resp.status, headers, body)
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +0,0 @@
|
|||||||
import {RequestContext, ResponseContext} from './http/http';
|
|
||||||
|
|
||||||
export interface Middleware {
|
|
||||||
pre?(context: RequestContext): Promise<RequestContext>;
|
|
||||||
post?(context: ResponseContext): Promise<ResponseContext>;
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "",
|
|
||||||
"version": "",
|
|
||||||
"description": "OpenAPI client for ",
|
|
||||||
"author": "OpenAPI-Generator Contributors",
|
|
||||||
"keywords": [
|
|
||||||
"fetch",
|
|
||||||
"typescript",
|
|
||||||
"openapi-client",
|
|
||||||
"openapi-generator",
|
|
||||||
""
|
|
||||||
],
|
|
||||||
"license": "Unlicense",
|
|
||||||
"main": "./dist/index.js",
|
|
||||||
"typings": "./dist/index.d.ts",
|
|
||||||
"scripts" : {
|
|
||||||
"build": "tsc",
|
|
||||||
"prepublishOnly": "npm run build"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"es6-promise": "^4.2.4",
|
|
||||||
"isomorphic-fetch": "^2.2.1",
|
|
||||||
"@types/isomorphic-fetch": "0.0.34"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "^2.9.2"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"strict": true,
|
|
||||||
/* Basic Options */
|
|
||||||
"target": "es5",
|
|
||||||
"module": "commonjs",
|
|
||||||
"declaration": true,
|
|
||||||
|
|
||||||
/* Additional Checks */
|
|
||||||
"noUnusedLocals": true, /* Report errors on unused locals. */
|
|
||||||
"noUnusedParameters": true, /* Report errors on unused parameters. */
|
|
||||||
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
|
||||||
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
|
||||||
|
|
||||||
"removeComments": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"outDir": "./dist",
|
|
||||||
"noLib": false,
|
|
||||||
"declaration": true,
|
|
||||||
"lib": [ "es6", "dom" ]
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
],
|
|
||||||
"filesGlob": [
|
|
||||||
"./**/*.ts",
|
|
||||||
]
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user