Created
September 27, 2019 17:17
-
-
Save johndpope/6b08cad61a0ac69f3590beae82fe304a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tslint:disable | |
/// <reference path="./custom.d.ts" /> | |
/** | |
* LoopBack Application | |
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
* | |
* The version of the OpenAPI document: 1.0.0 | |
* | |
* | |
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |
* https://openapi-generator.tech | |
* Do not edit the class manually. | |
*/ | |
import { Configuration } from "./configuration"; | |
// Some imports not used depending on template conditions | |
// @ts-ignore | |
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios'; | |
export const BASE_PATH = "http://[::1]:3000".replace(/\/+$/, ""); | |
/** | |
* | |
* @export | |
*/ | |
export const COLLECTION_FORMATS = { | |
csv: ",", | |
ssv: " ", | |
tsv: "\t", | |
pipes: "|", | |
}; | |
/** | |
* | |
* @export | |
* @interface RequestArgs | |
*/ | |
export interface RequestArgs { | |
url: string; | |
options: any; | |
} | |
/** | |
* | |
* @export | |
* @class BaseAPI | |
*/ | |
export class BaseAPI { | |
protected configuration: Configuration | undefined; | |
constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { | |
if (configuration) { | |
this.configuration = configuration; | |
this.basePath = configuration.basePath || this.basePath; | |
} | |
} | |
}; | |
/** | |
* | |
* @export | |
* @class RequiredError | |
* @extends {Error} | |
*/ | |
export class RequiredError extends Error { | |
name: "RequiredError" = "RequiredError"; | |
constructor(public field: string, msg?: string) { | |
super(msg); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// tslint:disable | |
/** | |
* LoopBack Application | |
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) | |
* | |
* The version of the OpenAPI document: 1.0.0 | |
* | |
* | |
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | |
* https://openapi-generator.tech | |
* Do not edit the class manually. | |
*/ | |
export interface ConfigurationParameters { | |
apiKey?: string | ((name: string) => string); | |
username?: string; | |
password?: string; | |
accessToken?: string | ((name?: string, scopes?: string[]) => string); | |
basePath?: string; | |
baseOptions?: any; | |
} | |
export class Configuration { | |
/** | |
* parameter for apiKey security | |
* @param name security name | |
* @memberof Configuration | |
*/ | |
apiKey?: string | ((name: string) => string); | |
/** | |
* parameter for basic security | |
* | |
* @type {string} | |
* @memberof Configuration | |
*/ | |
username?: string; | |
/** | |
* parameter for basic security | |
* | |
* @type {string} | |
* @memberof Configuration | |
*/ | |
password?: string; | |
/** | |
* parameter for oauth2 security | |
* @param name security name | |
* @param scopes oauth2 scope | |
* @memberof Configuration | |
*/ | |
accessToken?: string | ((name?: string, scopes?: string[]) => string); | |
/** | |
* override base path | |
* | |
* @type {string} | |
* @memberof Configuration | |
*/ | |
basePath?: string; | |
/** | |
* base options for axios calls | |
* | |
* @type {any} | |
* @memberof Configuration | |
*/ | |
baseOptions?: any; | |
constructor(param: ConfigurationParameters = {}) { | |
this.apiKey = param.apiKey; | |
this.username = param.username; | |
this.password = param.password; | |
this.accessToken = param.accessToken; | |
this.basePath = param.basePath; | |
this.baseOptions = param.baseOptions; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment