feat: adding openapi spect generation to the frontend client aas well as to fast api. Broke API out into different routes

This commit is contained in:
lucas.oskorep
2023-07-17 02:51:13 -04:00
parent 4a20152ff5
commit 9aa9122e2b
35 changed files with 1132 additions and 27146 deletions

View File

@@ -0,0 +1,4 @@
wwwroot/*.js
node_modules
typings
dist

View File

@@ -0,0 +1 @@
# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm

View File

@@ -1,13 +1,8 @@
apis/ConfigApi.ts
apis/MtaDataApi.ts
apis/StartApi.ts
apis/index.ts
.gitignore
.npmignore
api.ts
base.ts
common.ts
configuration.ts
git_push.sh
index.ts
models/AllStationModel.ts
models/HTTPValidationError.ts
models/Route.ts
models/RouteResponse.ts
models/StationResponse.ts
models/ValidationError.ts
models/index.ts
runtime.ts

View File

@@ -0,0 +1,545 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 type { Configuration } from './configuration';
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from './common';
import type { RequestArgs } from './base';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, BaseAPI, RequiredError } from './base';
/**
*
* @export
* @interface AllStationModel
*/
export interface AllStationModel {
/**
*
* @type {{ [key: string]: StationResponse; }}
* @memberof AllStationModel
*/
'stations': { [key: string]: StationResponse; };
}
/**
*
* @export
* @interface HTTPValidationError
*/
export interface HTTPValidationError {
/**
*
* @type {any}
* @memberof HTTPValidationError
*/
'detail'?: any;
}
/**
* An enumeration.
* @export
* @interface Route
*/
export interface Route {
}
/**
*
* @export
* @interface RouteResponse
*/
export interface RouteResponse {
/**
*
* @type {any}
* @memberof RouteResponse
*/
'arrival_times': any;
}
/**
*
* @export
* @interface StationResponse
*/
export interface StationResponse {
/**
*
* @type {{ [key: string]: RouteResponse; }}
* @memberof StationResponse
*/
'routes': { [key: string]: RouteResponse; };
}
/**
*
* @export
* @interface ValidationError
*/
export interface ValidationError {
/**
*
* @type {any}
* @memberof ValidationError
*/
'loc': any;
/**
*
* @type {any}
* @memberof ValidationError
*/
'msg': any;
/**
*
* @type {any}
* @memberof ValidationError
*/
'type': any;
}
/**
* ConfigApi - axios parameter creator
* @export
*/
export const ConfigApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllApiConfigGet: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/config`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* ConfigApi - functional programming interface
* @export
*/
export const ConfigApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = ConfigApiAxiosParamCreator(configuration)
return {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getAllApiConfigGet(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllApiConfigGet(options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
}
};
/**
* ConfigApi - factory interface
* @export
*/
export const ConfigApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = ConfigApiFp(configuration)
return {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllApiConfigGet(options?: any): AxiosPromise<any> {
return localVarFp.getAllApiConfigGet(options).then((request) => request(axios, basePath));
},
};
};
/**
* ConfigApi - object-oriented interface
* @export
* @class ConfigApi
* @extends {BaseAPI}
*/
export class ConfigApi extends BaseAPI {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ConfigApi
*/
public getAllApiConfigGet(options?: AxiosRequestConfig) {
return ConfigApiFp(this.configuration).getAllApiConfigGet(options).then((request) => request(this.axios, this.basePath));
}
}
/**
* MtaDataApi - axios parameter creator
* @export
*/
export const MtaDataApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllApiMtaPost: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/mta`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get Route
* @param {any} stopId
* @param {Route} route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRouteApiMtaStopIdRoutePost: async (stopId: any, route: Route, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'stopId' is not null or undefined
assertParamExists('getRouteApiMtaStopIdRoutePost', 'stopId', stopId)
// verify required parameter 'route' is not null or undefined
assertParamExists('getRouteApiMtaStopIdRoutePost', 'route', route)
const localVarPath = `/api/mta/{stop_id}/{route}`
.replace(`{${"stop_id"}}`, encodeURIComponent(String(stopId)))
.replace(`{${"route"}}`, encodeURIComponent(String(route)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get Station
* @param {any} stopId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStationApiMtaStopIdPost: async (stopId: any, options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'stopId' is not null or undefined
assertParamExists('getStationApiMtaStopIdPost', 'stopId', stopId)
const localVarPath = `/api/mta/{stop_id}`
.replace(`{${"stop_id"}}`, encodeURIComponent(String(stopId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* MtaDataApi - functional programming interface
* @export
*/
export const MtaDataApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = MtaDataApiAxiosParamCreator(configuration)
return {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getAllApiMtaPost(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AllStationModel>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getAllApiMtaPost(options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Get Route
* @param {any} stopId
* @param {Route} route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getRouteApiMtaStopIdRoutePost(stopId: any, route: Route, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<RouteResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getRouteApiMtaStopIdRoutePost(stopId, route, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
/**
*
* @summary Get Station
* @param {any} stopId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getStationApiMtaStopIdPost(stopId: any, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<StationResponse>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getStationApiMtaStopIdPost(stopId, options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
}
};
/**
* MtaDataApi - factory interface
* @export
*/
export const MtaDataApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = MtaDataApiFp(configuration)
return {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getAllApiMtaPost(options?: any): AxiosPromise<AllStationModel> {
return localVarFp.getAllApiMtaPost(options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get Route
* @param {any} stopId
* @param {Route} route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getRouteApiMtaStopIdRoutePost(stopId: any, route: Route, options?: any): AxiosPromise<RouteResponse> {
return localVarFp.getRouteApiMtaStopIdRoutePost(stopId, route, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get Station
* @param {any} stopId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStationApiMtaStopIdPost(stopId: any, options?: any): AxiosPromise<StationResponse> {
return localVarFp.getStationApiMtaStopIdPost(stopId, options).then((request) => request(axios, basePath));
},
};
};
/**
* MtaDataApi - object-oriented interface
* @export
* @class MtaDataApi
* @extends {BaseAPI}
*/
export class MtaDataApi extends BaseAPI {
/**
*
* @summary Get All
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof MtaDataApi
*/
public getAllApiMtaPost(options?: AxiosRequestConfig) {
return MtaDataApiFp(this.configuration).getAllApiMtaPost(options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get Route
* @param {any} stopId
* @param {Route} route
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof MtaDataApi
*/
public getRouteApiMtaStopIdRoutePost(stopId: any, route: Route, options?: AxiosRequestConfig) {
return MtaDataApiFp(this.configuration).getRouteApiMtaStopIdRoutePost(stopId, route, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get Station
* @param {any} stopId
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof MtaDataApi
*/
public getStationApiMtaStopIdPost(stopId: any, options?: AxiosRequestConfig) {
return MtaDataApiFp(this.configuration).getStationApiMtaStopIdPost(stopId, options).then((request) => request(this.axios, this.basePath));
}
}
/**
* StartApi - axios parameter creator
* @export
*/
export const StartApiAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Get Start Time
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStartTimeApiStartTimePost: async (options: AxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/start_time`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* StartApi - functional programming interface
* @export
*/
export const StartApiFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = StartApiAxiosParamCreator(configuration)
return {
/**
*
* @summary Get Start Time
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getStartTimeApiStartTimePost(options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<any>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getStartTimeApiStartTimePost(options);
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
},
}
};
/**
* StartApi - factory interface
* @export
*/
export const StartApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = StartApiFp(configuration)
return {
/**
*
* @summary Get Start Time
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getStartTimeApiStartTimePost(options?: any): AxiosPromise<any> {
return localVarFp.getStartTimeApiStartTimePost(options).then((request) => request(axios, basePath));
},
};
};
/**
* StartApi - object-oriented interface
* @export
* @class StartApi
* @extends {BaseAPI}
*/
export class StartApi extends BaseAPI {
/**
*
* @summary Get Start Time
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof StartApi
*/
public getStartTimeApiStartTimePost(options?: AxiosRequestConfig) {
return StartApiFp(this.configuration).getStartTimeApiStartTimePost(options).then((request) => request(this.axios, this.basePath));
}
}

View File

@@ -1,53 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 * as runtime from '../runtime';
/**
*
*/
export class ConfigApi extends runtime.BaseAPI {
/**
* Get All
*/
async getAllApiConfigGetRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<any>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/api/config`,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse<any>(response);
} else {
return new runtime.TextApiResponse(response) as any;
}
}
/**
* Get All
*/
async getAllApiConfigGet(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<any> {
const response = await this.getAllApiConfigGetRaw(initOverrides);
return await response.value();
}
}

View File

@@ -1,141 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 * as runtime from '../runtime';
import type {
AllStationModel,
HTTPValidationError,
Route,
RouteResponse,
StationResponse,
} from '../models';
import {
AllStationModelFromJSON,
AllStationModelToJSON,
HTTPValidationErrorFromJSON,
HTTPValidationErrorToJSON,
RouteFromJSON,
RouteToJSON,
RouteResponseFromJSON,
RouteResponseToJSON,
StationResponseFromJSON,
StationResponseToJSON,
} from '../models';
export interface GetRouteApiMtaStopIdRoutePostRequest {
stopId: any;
route: Route;
}
export interface GetStationApiMtaStopIdPostRequest {
stopId: any;
}
/**
*
*/
export class MtaDataApi extends runtime.BaseAPI {
/**
* Get All
*/
async getAllApiMtaPostRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AllStationModel>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/api/mta`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => AllStationModelFromJSON(jsonValue));
}
/**
* Get All
*/
async getAllApiMtaPost(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AllStationModel> {
const response = await this.getAllApiMtaPostRaw(initOverrides);
return await response.value();
}
/**
* Get Route
*/
async getRouteApiMtaStopIdRoutePostRaw(requestParameters: GetRouteApiMtaStopIdRoutePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RouteResponse>> {
if (requestParameters.stopId === null || requestParameters.stopId === undefined) {
throw new runtime.RequiredError('stopId','Required parameter requestParameters.stopId was null or undefined when calling getRouteApiMtaStopIdRoutePost.');
}
if (requestParameters.route === null || requestParameters.route === undefined) {
throw new runtime.RequiredError('route','Required parameter requestParameters.route was null or undefined when calling getRouteApiMtaStopIdRoutePost.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/api/mta/{stop_id}/{route}`.replace(`{${"stop_id"}}`, encodeURIComponent(String(requestParameters.stopId))).replace(`{${"route"}}`, encodeURIComponent(String(requestParameters.route))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => RouteResponseFromJSON(jsonValue));
}
/**
* Get Route
*/
async getRouteApiMtaStopIdRoutePost(requestParameters: GetRouteApiMtaStopIdRoutePostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RouteResponse> {
const response = await this.getRouteApiMtaStopIdRoutePostRaw(requestParameters, initOverrides);
return await response.value();
}
/**
* Get Station
*/
async getStationApiMtaStopIdPostRaw(requestParameters: GetStationApiMtaStopIdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<StationResponse>> {
if (requestParameters.stopId === null || requestParameters.stopId === undefined) {
throw new runtime.RequiredError('stopId','Required parameter requestParameters.stopId was null or undefined when calling getStationApiMtaStopIdPost.');
}
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/api/mta/{stop_id}`.replace(`{${"stop_id"}}`, encodeURIComponent(String(requestParameters.stopId))),
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => StationResponseFromJSON(jsonValue));
}
/**
* Get Station
*/
async getStationApiMtaStopIdPost(requestParameters: GetStationApiMtaStopIdPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<StationResponse> {
const response = await this.getStationApiMtaStopIdPostRaw(requestParameters, initOverrides);
return await response.value();
}
}

View File

@@ -1,53 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 * as runtime from '../runtime';
/**
*
*/
export class StartApi extends runtime.BaseAPI {
/**
* Get Start Time
*/
async getStartTimeApiStartTimePostRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<any>> {
const queryParameters: any = {};
const headerParameters: runtime.HTTPHeaders = {};
const response = await this.request({
path: `/api/start_time`,
method: 'POST',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
if (this.isJsonMime(response.headers.get('content-type'))) {
return new runtime.JSONApiResponse<any>(response);
} else {
return new runtime.TextApiResponse(response) as any;
}
}
/**
* Get Start Time
*/
async getStartTimeApiStartTimePost(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<any> {
const response = await this.getStartTimeApiStartTimePostRaw(initOverrides);
return await response.value();
}
}

View File

@@ -1,5 +0,0 @@
/* tslint:disable */
/* eslint-disable */
export * from './ConfigApi';
export * from './MtaDataApi';
export * from './StartApi';

View File

@@ -0,0 +1,72 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 type { Configuration } from './configuration';
// Some imports not used depending on template conditions
// @ts-ignore
import type { AxiosPromise, AxiosInstance, AxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
/**
*
* @export
*/
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
/**
*
* @export
* @interface RequestArgs
*/
export interface RequestArgs {
url: string;
options: AxiosRequestConfig;
}
/**
*
* @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 {
constructor(public field: string, msg?: string) {
super(msg);
this.name = "RequiredError"
}
}

View File

@@ -0,0 +1,150 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 type { Configuration } from "./configuration";
import type { RequestArgs } from "./base";
import type { AxiosInstance, AxiosResponse } from 'axios';
import { RequiredError } from "./base";
/**
*
* @export
*/
export const DUMMY_BASE_URL = 'https://example.com'
/**
*
* @throws {RequiredError}
* @export
*/
export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) {
if (paramValue === null || paramValue === undefined) {
throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
}
}
/**
*
* @export
*/
export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) {
if (configuration && configuration.apiKey) {
const localVarApiKeyValue = typeof configuration.apiKey === 'function'
? await configuration.apiKey(keyParamName)
: await configuration.apiKey;
object[keyParamName] = localVarApiKeyValue;
}
}
/**
*
* @export
*/
export const setBasicAuthToObject = function (object: any, configuration?: Configuration) {
if (configuration && (configuration.username || configuration.password)) {
object["auth"] = { username: configuration.username, password: configuration.password };
}
}
/**
*
* @export
*/
export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const accessToken = typeof configuration.accessToken === 'function'
? await configuration.accessToken()
: await configuration.accessToken;
object["Authorization"] = "Bearer " + accessToken;
}
}
/**
*
* @export
*/
export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) {
if (configuration && configuration.accessToken) {
const localVarAccessTokenValue = typeof configuration.accessToken === 'function'
? await configuration.accessToken(name, scopes)
: await configuration.accessToken;
object["Authorization"] = "Bearer " + localVarAccessTokenValue;
}
}
function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void {
if (parameter == null) return;
if (typeof parameter === "object") {
if (Array.isArray(parameter)) {
(parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
}
else {
Object.keys(parameter).forEach(currentKey =>
setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`)
);
}
}
else {
if (urlSearchParams.has(key)) {
urlSearchParams.append(key, parameter);
}
else {
urlSearchParams.set(key, parameter);
}
}
}
/**
*
* @export
*/
export const setSearchParams = function (url: URL, ...objects: any[]) {
const searchParams = new URLSearchParams(url.search);
setFlattenedQueryParams(searchParams, objects);
url.search = searchParams.toString();
}
/**
*
* @export
*/
export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) {
const nonString = typeof value !== 'string';
const needsSerialization = nonString && configuration && configuration.isJsonMime
? configuration.isJsonMime(requestOptions.headers['Content-Type'])
: nonString;
return needsSerialization
? JSON.stringify(value !== undefined ? value : {})
: (value || "");
}
/**
*
* @export
*/
export const toPathString = function (url: URL) {
return url.pathname + url.search + url.hash
}
/**
*
* @export
*/
export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) {
return <T = unknown, R = AxiosResponse<T>>(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
const axiosRequestArgs = {...axiosArgs.options, url: (configuration?.basePath || basePath) + axiosArgs.url};
return axios.request<T, R>(axiosRequestArgs);
};
}

View File

@@ -0,0 +1,101 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 | Promise<string> | ((name: string) => string) | ((name: string) => Promise<string>);
username?: string;
password?: string;
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
basePath?: string;
baseOptions?: any;
formDataCtor?: new () => any;
}
export class Configuration {
/**
* parameter for apiKey security
* @param name security name
* @memberof Configuration
*/
apiKey?: string | Promise<string> | ((name: string) => string) | ((name: string) => Promise<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 | Promise<string> | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise<string>);
/**
* override base path
*
* @type {string}
* @memberof Configuration
*/
basePath?: string;
/**
* base options for axios calls
*
* @type {any}
* @memberof Configuration
*/
baseOptions?: any;
/**
* The FormData constructor that will be used to create multipart form data
* requests. You can inject this here so that execution environments that
* do not support the FormData class can still run the generated client.
*
* @type {new () => FormData}
*/
formDataCtor?: new () => 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;
this.formDataCtor = param.formDataCtor;
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
public isJsonMime(mime: string): boolean {
const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
}
}

View File

@@ -0,0 +1,57 @@
#!/bin/sh
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
#
# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com"
git_user_id=$1
git_repo_id=$2
release_note=$3
git_host=$4
if [ "$git_host" = "" ]; then
git_host="github.com"
echo "[INFO] No command line input provided. Set \$git_host to $git_host"
fi
if [ "$git_user_id" = "" ]; then
git_user_id="GIT_USER_ID"
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
fi
if [ "$git_repo_id" = "" ]; then
git_repo_id="GIT_REPO_ID"
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
fi
if [ "$release_note" = "" ]; then
release_note="Minor update"
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
fi
# Initialize the local directory as a Git repository
git init
# Adds the files in the local repository and stages them for commit.
git add .
# Commits the tracked changes and prepares them to be pushed to a remote repository.
git commit -m "$release_note"
# Sets the new remote
git_remote=$(git remote)
if [ "$git_remote" = "" ]; then # git remote not defined
if [ "$GIT_TOKEN" = "" ]; then
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git
else
git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git
fi
fi
git pull origin master
# Pushes (Forces) the changes in the local repository up to the remote repository
echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git"
git push origin master 2>&1 | grep -v 'To https'

View File

@@ -1,5 +1,18 @@
/* tslint:disable */
/* eslint-disable */
export * from './runtime';
export * from './apis';
export * from './models';
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 * from "./api";
export * from "./configuration";

View File

@@ -1,73 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 { exists, mapValues } from '../runtime';
import type { StationResponse } from './StationResponse';
import {
StationResponseFromJSON,
StationResponseFromJSONTyped,
StationResponseToJSON,
} from './StationResponse';
/**
*
* @export
* @interface AllStationModel
*/
export interface AllStationModel {
/**
*
* @type {{ [key: string]: StationResponse; }}
* @memberof AllStationModel
*/
stations: { [key: string]: StationResponse; } | null;
}
/**
* Check if a given object implements the AllStationModel interface.
*/
export function instanceOfAllStationModel(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "stations" in value;
return isInstance;
}
export function AllStationModelFromJSON(json: any): AllStationModel {
return AllStationModelFromJSONTyped(json, false);
}
export function AllStationModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): AllStationModel {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'stations': { [key: string]: StationResponse; }FromJSON(json['stations']),
};
}
export function AllStationModelToJSON(value?: AllStationModel | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'stations': { [key: string]: StationResponse; }ToJSON(value.stations),
};
}

View File

@@ -1,65 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface HTTPValidationError
*/
export interface HTTPValidationError {
/**
*
* @type {any}
* @memberof HTTPValidationError
*/
detail?: any | null;
}
/**
* Check if a given object implements the HTTPValidationError interface.
*/
export function instanceOfHTTPValidationError(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function HTTPValidationErrorFromJSON(json: any): HTTPValidationError {
return HTTPValidationErrorFromJSONTyped(json, false);
}
export function HTTPValidationErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): HTTPValidationError {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'detail': !exists(json, 'detail') ? undefined : json['detail'],
};
}
export function HTTPValidationErrorToJSON(value?: HTTPValidationError | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'detail': value.detail,
};
}

View File

@@ -1,44 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 { exists, mapValues } from '../runtime';
/**
* An enumeration.
* @export
* @interface Route
*/
export interface Route {
}
/**
* Check if a given object implements the Route interface.
*/
export function instanceOfRoute(value: object): boolean {
let isInstance = true;
return isInstance;
}
export function RouteFromJSON(json: any): Route {
return RouteFromJSONTyped(json, false);
}
export function RouteFromJSONTyped(json: any, ignoreDiscriminator: boolean): Route {
return json;
}
export function RouteToJSON(value?: Route | null): any {
return value;
}

View File

@@ -1,66 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface RouteResponse
*/
export interface RouteResponse {
/**
*
* @type {any}
* @memberof RouteResponse
*/
arrivalTimes: any | null;
}
/**
* Check if a given object implements the RouteResponse interface.
*/
export function instanceOfRouteResponse(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "arrivalTimes" in value;
return isInstance;
}
export function RouteResponseFromJSON(json: any): RouteResponse {
return RouteResponseFromJSONTyped(json, false);
}
export function RouteResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): RouteResponse {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'arrivalTimes': json['arrival_times'],
};
}
export function RouteResponseToJSON(value?: RouteResponse | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'arrival_times': value.arrivalTimes,
};
}

View File

@@ -1,73 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 { exists, mapValues } from '../runtime';
import type { RouteResponse } from './RouteResponse';
import {
RouteResponseFromJSON,
RouteResponseFromJSONTyped,
RouteResponseToJSON,
} from './RouteResponse';
/**
*
* @export
* @interface StationResponse
*/
export interface StationResponse {
/**
*
* @type {{ [key: string]: RouteResponse; }}
* @memberof StationResponse
*/
routes: { [key: string]: RouteResponse; } | null;
}
/**
* Check if a given object implements the StationResponse interface.
*/
export function instanceOfStationResponse(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "routes" in value;
return isInstance;
}
export function StationResponseFromJSON(json: any): StationResponse {
return StationResponseFromJSONTyped(json, false);
}
export function StationResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): StationResponse {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'routes': { [key: string]: RouteResponse; }FromJSON(json['routes']),
};
}
export function StationResponseToJSON(value?: StationResponse | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'routes': { [key: string]: RouteResponse; }ToJSON(value.routes),
};
}

View File

@@ -1,84 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 { exists, mapValues } from '../runtime';
/**
*
* @export
* @interface ValidationError
*/
export interface ValidationError {
/**
*
* @type {any}
* @memberof ValidationError
*/
loc: any | null;
/**
*
* @type {any}
* @memberof ValidationError
*/
msg: any | null;
/**
*
* @type {any}
* @memberof ValidationError
*/
type: any | null;
}
/**
* Check if a given object implements the ValidationError interface.
*/
export function instanceOfValidationError(value: object): boolean {
let isInstance = true;
isInstance = isInstance && "loc" in value;
isInstance = isInstance && "msg" in value;
isInstance = isInstance && "type" in value;
return isInstance;
}
export function ValidationErrorFromJSON(json: any): ValidationError {
return ValidationErrorFromJSONTyped(json, false);
}
export function ValidationErrorFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValidationError {
if ((json === undefined) || (json === null)) {
return json;
}
return {
'loc': json['loc'],
'msg': json['msg'],
'type': json['type'],
};
}
export function ValidationErrorToJSON(value?: ValidationError | null): any {
if (value === undefined) {
return undefined;
}
if (value === null) {
return null;
}
return {
'loc': value.loc,
'msg': value.msg,
'type': value.type,
};
}

View File

@@ -1,8 +0,0 @@
/* tslint:disable */
/* eslint-disable */
export * from './AllStationModel';
export * from './HTTPValidationError';
export * from './Route';
export * from './RouteResponse';
export * from './StationResponse';
export * from './ValidationError';

View File

@@ -1,287 +1 @@
{
"openapi": "3.1.0",
"info": {
"title": "FastAPI",
"version": "0.1.0"
},
"paths": {
"/api/start_time": {
"post": {
"tags": [
"start"
],
"summary": "Get Start Time",
"operationId": "get_start_time_api_start_time_post",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
},
"/api/mta/{stop_id}/{route}": {
"post": {
"tags": [
"mta-data"
],
"summary": "Get Route",
"operationId": "get_route_api_mta__stop_id___route__post",
"parameters": [
{
"required": true,
"schema": {
"type": "string",
"title": "Stop Id"
},
"name": "stop_id",
"in": "path"
},
{
"required": true,
"schema": {
"$ref": "#/components/schemas/Route"
},
"name": "route",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RouteResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/mta/{stop_id}": {
"post": {
"tags": [
"mta-data"
],
"summary": "Get Station",
"operationId": "get_station_api_mta__stop_id__post",
"parameters": [
{
"required": true,
"schema": {
"type": "string",
"title": "Stop Id"
},
"name": "stop_id",
"in": "path"
}
],
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/StationResponse"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
}
}
},
"/api/mta": {
"post": {
"tags": [
"mta-data"
],
"summary": "Get All",
"operationId": "get_all_api_mta_post",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AllStationModel"
}
}
}
}
}
}
},
"/api/config": {
"get": {
"tags": [
"config"
],
"summary": "Get All",
"operationId": "get_all_api_config_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {}
}
}
}
}
}
}
},
"components": {
"schemas": {
"AllStationModel": {
"properties": {
"stations": {
"additionalProperties": {
"$ref": "#/components/schemas/StationResponse"
},
"type": "object",
"title": "Stations"
}
},
"type": "object",
"required": [
"stations"
],
"title": "AllStationModel"
},
"HTTPValidationError": {
"properties": {
"detail": {
"items": {
"$ref": "#/components/schemas/ValidationError"
},
"type": "array",
"title": "Detail"
}
},
"type": "object",
"title": "HTTPValidationError"
},
"Route": {
"enum": [
"A",
"C",
"E",
"B",
"D",
"F",
"M",
"G",
"J",
"Z",
"N",
"Q",
"R",
"W",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"L",
"SIR"
],
"title": "Route",
"description": "An enumeration."
},
"RouteResponse": {
"properties": {
"arrival_times": {
"items": {
"type": "integer"
},
"type": "array",
"title": "Arrival Times"
}
},
"type": "object",
"required": [
"arrival_times"
],
"title": "RouteResponse"
},
"StationResponse": {
"properties": {
"routes": {
"additionalProperties": {
"$ref": "#/components/schemas/RouteResponse"
},
"type": "object",
"title": "Routes"
}
},
"type": "object",
"required": [
"routes"
],
"title": "StationResponse"
},
"ValidationError": {
"properties": {
"loc": {
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
},
"type": "array",
"title": "Location"
},
"msg": {
"type": "string",
"title": "Message"
},
"type": {
"type": "string",
"title": "Error Type"
}
},
"type": "object",
"required": [
"loc",
"msg",
"type"
],
"title": "ValidationError"
}
}
}
}
{"openapi":"3.1.0","info":{"title":"FastAPI","version":"0.1.0"},"paths":{"/api/start_time":{"post":{"tags":["start"],"summary":"Get Start Time","operationId":"get_start_time_api_start_time_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/mta/{stop_id}/{route}":{"post":{"tags":["mta-data"],"summary":"Get Route","operationId":"get_route_api_mta__stop_id___route__post","parameters":[{"required":true,"schema":{"type":"string","title":"Stop Id"},"name":"stop_id","in":"path"},{"required":true,"schema":{"$ref":"#/components/schemas/Route"},"name":"route","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mta/{stop_id}":{"post":{"tags":["mta-data"],"summary":"Get Station","operationId":"get_station_api_mta__stop_id__post","parameters":[{"required":true,"schema":{"type":"string","title":"Stop Id"},"name":"stop_id","in":"path"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mta":{"post":{"tags":["mta-data"],"summary":"Get All","operationId":"get_all_api_mta_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AllStationModel"}}}}}}},"/api/config":{"get":{"tags":["config"],"summary":"Get All","operationId":"get_all_api_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AllStationModel":{"properties":{"stations":{"additionalProperties":{"$ref":"#/components/schemas/StationResponse"},"type":"object","title":"Stations"}},"type":"object","required":["stations"],"title":"AllStationModel"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"Route":{"enum":["A","C","E","B","D","F","M","G","J","Z","N","Q","R","W","1","2","3","4","5","6","7","L","SIR"],"title":"Route","description":"An enumeration."},"RouteResponse":{"properties":{"arrival_times":{"items":{"type":"integer"},"type":"array","title":"Arrival Times"}},"type":"object","required":["arrival_times"],"title":"RouteResponse"},"StationResponse":{"properties":{"routes":{"additionalProperties":{"$ref":"#/components/schemas/RouteResponse"},"type":"object","title":"Routes"}},"type":"object","required":["routes"],"title":"StationResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"}}}}

View File

@@ -1,425 +0,0 @@
/* tslint:disable */
/* eslint-disable */
/**
* FastAPI
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 0.1.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 const BASE_PATH = "http://localhost".replace(/\/+$/, "");
export interface ConfigurationParameters {
basePath?: string; // override base path
fetchApi?: FetchAPI; // override for fetch implementation
middleware?: Middleware[]; // middleware to apply before/after fetch requests
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | ((name: string) => string); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
}
export class Configuration {
constructor(private configuration: ConfigurationParameters = {}) {}
set config(configuration: Configuration) {
this.configuration = configuration;
}
get basePath(): string {
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
}
get fetchApi(): FetchAPI | undefined {
return this.configuration.fetchApi;
}
get middleware(): Middleware[] {
return this.configuration.middleware || [];
}
get queryParamsStringify(): (params: HTTPQuery) => string {
return this.configuration.queryParamsStringify || querystring;
}
get username(): string | undefined {
return this.configuration.username;
}
get password(): string | undefined {
return this.configuration.password;
}
get apiKey(): ((name: string) => string) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
}
return undefined;
}
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
const accessToken = this.configuration.accessToken;
if (accessToken) {
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
}
return undefined;
}
get headers(): HTTPHeaders | undefined {
return this.configuration.headers;
}
get credentials(): RequestCredentials | undefined {
return this.configuration.credentials;
}
}
export const DefaultConfig = new Configuration();
/**
* This is the base class for all generated API classes.
*/
export class BaseAPI {
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
private middleware: Middleware[];
constructor(protected configuration = DefaultConfig) {
this.middleware = configuration.middleware;
}
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
const next = this.clone<T>();
next.middleware = next.middleware.concat(...middlewares);
return next;
}
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
const middlewares = preMiddlewares.map((pre) => ({ pre }));
return this.withMiddleware<T>(...middlewares);
}
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
const middlewares = postMiddlewares.map((post) => ({ post }));
return this.withMiddleware<T>(...middlewares);
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
protected isJsonMime(mime: string | null | undefined): boolean {
if (!mime) {
return false;
}
return BaseAPI.jsonRegex.test(mime);
}
protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response> {
const { url, init } = await this.createFetchParams(context, initOverrides);
const response = await this.fetchApi(url, init);
if (response && (response.status >= 200 && response.status < 300)) {
return response;
}
throw new ResponseError(response, 'Response returned an error code');
}
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
let url = this.configuration.basePath + context.path;
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
// only add the querystring to the URL if there are query parameters.
// this is done to avoid urls ending with a "?" character which buggy webservers
// do not handle correctly sometimes.
url += '?' + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
const initOverrideFn =
typeof initOverrides === "function"
? initOverrides
: async () => initOverrides;
const initParams = {
method: context.method,
headers,
body: context.body,
credentials: this.configuration.credentials,
};
const overriddenInit: RequestInit = {
...initParams,
...(await initOverrideFn({
init: initParams,
context,
}))
};
const init: RequestInit = {
...overriddenInit,
body:
isFormData(overriddenInit.body) ||
overriddenInit.body instanceof URLSearchParams ||
isBlob(overriddenInit.body)
? overriddenInit.body
: JSON.stringify(overriddenInit.body),
};
return { url, init };
}
private fetchApi = async (url: string, init: RequestInit) => {
let fetchParams = { url, init };
for (const middleware of this.middleware) {
if (middleware.pre) {
fetchParams = await middleware.pre({
fetch: this.fetchApi,
...fetchParams,
}) || fetchParams;
}
}
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {
for (const middleware of this.middleware) {
if (middleware.onError) {
response = await middleware.onError({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
error: e,
response: response ? response.clone() : undefined,
}) || response;
}
}
if (response === undefined) {
if (e instanceof Error) {
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
} else {
throw e;
}
}
}
for (const middleware of this.middleware) {
if (middleware.post) {
response = await middleware.post({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
response: response.clone(),
}) || response;
}
}
return response;
}
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
private clone<T extends BaseAPI>(this: T): T {
const constructor = this.constructor as any;
const next = new constructor(this.configuration);
next.middleware = this.middleware.slice();
return next;
}
};
function isBlob(value: any): value is Blob {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
function isFormData(value: any): value is FormData {
return typeof FormData !== "undefined" && value instanceof FormData;
}
export class ResponseError extends Error {
override name: "ResponseError" = "ResponseError";
constructor(public response: Response, msg?: string) {
super(msg);
}
}
export class FetchError extends Error {
override name: "FetchError" = "FetchError";
constructor(public cause: Error, msg?: string) {
super(msg);
}
}
export class RequiredError extends Error {
override name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
export type HTTPHeaders = { [key: string]: string };
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery };
export type HTTPBody = Json | FormData | URLSearchParams;
export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody };
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
export interface FetchParams {
url: string;
init: RequestInit;
}
export interface RequestOpts {
path: string;
method: HTTPMethod;
headers: HTTPHeaders;
query?: HTTPQuery;
body?: HTTPBody;
}
export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}
export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
.map(key => querystringSingleKey(key, params[key], prefix))
.filter(part => part.length > 0)
.join('&');
}
function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery, keyPrefix: string = ''): string {
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
if (value instanceof Array) {
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
.join(`&${encodeURIComponent(fullKey)}=`);
return `${encodeURIComponent(fullKey)}=${multiValue}`;
}
if (value instanceof Set) {
const valueAsArray = Array.from(value);
return querystringSingleKey(key, valueAsArray, keyPrefix);
}
if (value instanceof Date) {
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
}
if (value instanceof Object) {
return querystring(value as HTTPQuery, fullKey);
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
}
export function mapValues(data: any, fn: (item: any) => any) {
return Object.keys(data).reduce(
(acc, key) => ({ ...acc, [key]: fn(data[key]) }),
{}
);
}
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
export interface Consume {
contentType: string;
}
export interface RequestContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
}
export interface ResponseContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
response: Response;
}
export interface ErrorContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
error: unknown;
response?: Response;
}
export interface Middleware {
pre?(context: RequestContext): Promise<FetchParams | void>;
post?(context: ResponseContext): Promise<Response | void>;
onError?(context: ErrorContext): Promise<Response | void>;
}
export interface ApiResponse<T> {
raw: Response;
value(): Promise<T>;
}
export interface ResponseTransformer<T> {
(json: any): T;
}
export class JSONApiResponse<T> {
constructor(public raw: Response, private transformer: ResponseTransformer<T> = (jsonValue: any) => jsonValue) {}
async value(): Promise<T> {
return this.transformer(await this.raw.json());
}
}
export class VoidApiResponse {
constructor(public raw: Response) {}
async value(): Promise<void> {
return undefined;
}
}
export class BlobApiResponse {
constructor(public raw: Response) {}
async value(): Promise<Blob> {
return await this.raw.blob();
};
}
export class TextApiResponse {
constructor(public raw: Response) {}
async value(): Promise<string> {
return await this.raw.text();
};
}