Skip to content

Commit

Permalink
Sma 24 add automatic client generation on frontend (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
ivamach authored Feb 3, 2024
1 parent 210a1f7 commit 8506e26
Show file tree
Hide file tree
Showing 15 changed files with 903 additions and 1 deletion.
174 changes: 174 additions & 0 deletions frontend/sportsmatch-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion frontend/sportsmatch-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"preview": "vite preview",
"test": "vitest",
"format": "prettier --check ./src",
"format:fix": "prettier --write ./src"
"format:fix": "prettier --write ./src",
"generate": "openapi --input http://localhost:8080/v3/api-docs --output ./src/generated/api"
},
"dependencies": {
"bootstrap": "^5.3.2",
Expand Down Expand Up @@ -44,6 +45,7 @@
"husky": "^9.0.6",
"jsdom": "^24.0.0",
"lint-staged": "^15.2.0",
"openapi-typescript-codegen": "^0.27.0",
"prettier": "^3.2.4",
"typescript": "^5.2.2",
"vite": "^5.0.8",
Expand Down
25 changes: 25 additions & 0 deletions frontend/sportsmatch-app/src/generated/api/core/ApiError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { ApiRequestOptions } from './ApiRequestOptions';
import type { ApiResult } from './ApiResult';

export class ApiError extends Error {
public readonly url: string;
public readonly status: number;
public readonly statusText: string;
public readonly body: any;
public readonly request: ApiRequestOptions;

constructor(request: ApiRequestOptions, response: ApiResult, message: string) {
super(message);

this.name = 'ApiError';
this.url = response.url;
this.status = response.status;
this.statusText = response.statusText;
this.body = response.body;
this.request = request;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ApiRequestOptions = {
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
readonly url: string;
readonly path?: Record<string, any>;
readonly cookies?: Record<string, any>;
readonly headers?: Record<string, any>;
readonly query?: Record<string, any>;
readonly formData?: Record<string, any>;
readonly body?: any;
readonly mediaType?: string;
readonly responseHeader?: string;
readonly errors?: Record<number, string>;
};
11 changes: 11 additions & 0 deletions frontend/sportsmatch-app/src/generated/api/core/ApiResult.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ApiResult = {
readonly url: string;
readonly ok: boolean;
readonly status: number;
readonly statusText: string;
readonly body: any;
};
Loading

0 comments on commit 8506e26

Please sign in to comment.