Add a small, tested base for all three clients, and Gitea CI/release workflows

internal/client (new): a typed Go HTTP client for the API - login,
register, logout, me, and full CRUD for games/platforms - shared by the
TUI and the Fyne GUI so request-building, auth and error handling (an
APIError with the HTTP status) live in one tested place instead of being
duplicated. 8 tests against an httptest server covering success, 401, 403
and that the token is stored/cleared at the right times.

cmd/tui (rewrite): drops the old unauthenticated read-only viewer. Now a
login screen (bubbles/textinput) -> a scrollable games table
(bubbles/table) with 'r' to refresh, built as an explicit state machine
(screenLogin/screenLoading/screenGames) so Update's transitions are
testable without a real terminal. 9 tests driving Update() directly.

cmd/gui (rewrite): drops raylib for Fyne. Same shape as the TUI - a login
form, then a games table, with networking on a goroutine and fyne.Do for
the UI updates. The table-cell and login-validation logic are plain
functions with no Fyne/display dependency, so they're tested directly (7
tests) rather than needing Fyne's headless test driver.

internal/api: tagged every operation (Auth/Platforms/Games/Misc) so the
generated OpenAPI spec groups into named services instead of one bucket;
api/openapi.json regenerated. Added CORS middleware (wildcard origin, no
credentials needed since clients use a bearer token, not the cookie) -
needed for the new web client's browser requests to the API's a different
origin.

web/ (new): an Angular 22 + Material app, API client generated from
api/openapi.json via ng-openapi-gen (services: true for per-resource
classes - AuthService/GamesService/PlatformsService - instead of one
generic Api facade). A Session service holds the token/user as signals,
persists the token to localStorage, and is the only thing that calls the
generated AuthService; an HttpInterceptorFn attaches the bearer token to
every request; a CanActivateFn guard protects /games. Login and Games are
standalone, lazy-loaded route components. 21 tests (Vitest, Angular's new
default - no browser/Karma needed) covering the service, interceptor,
guard and both components, run via `npm test` exactly as CI will call it.

Justfile: fixed run-tui/run-gui, which used `go run .../main.go` - broken
now that both packages span multiple files, since that only compiles the
one named file. Added web-install/web-dev/web-build/web-test.

.gitea/workflows/ci.yml (moved from .github, which Gitea doesn't read):
on push to main/develop - gofmt, go vet, go build, go test, go mod tidy
diff (with the Fyne build's system deps installed), sqlc diff, and the
web app's build+test.

.gitea/workflows/release.yml (new): on a vX.Y.Z tag, cross-compiles
api+tui for linux/darwin/windows (amd64+arm64, pure Go, no cgo), builds
the Fyne GUI for linux/amd64 only (cgo + its OpenGL/X11 link means it
can't cross-compile from one Linux runner the way api/tui do, and this
repo has no registered macOS/Windows runner to build it on natively -
documented in the workflow's comments), builds the web app, and creates a
Gitea release with all of it attached via the Gitea API. Written to
Gitea's documented GitHub-Actions-compatible syntax but not executable
from here - there's no Gitea server in this environment to run it
against, unlike everything else in this commit, which was.

Verified: every Go package builds/vets/tests clean; sqlc diff and go mod
tidy -diff are clean; the Angular app builds for production and its test
suite passes via `npm test`/`npm run build` (the exact commands CI runs),
including after a clean `npm ci` from the committed lockfile; the new CORS
config was checked with real preflight and GET requests against a running
server, not just read.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
SansanandClaude Sonnet 5 committed 2026-10-03 12:16:59 +02:00
1 parent 384c4a7217
commit 9972537b63
97 files changed
+11810 -336

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { Injectable } from '@angular/core';
/**
* Provides the ApiConfiguration configuration object with a given root URL.
*/
export function provideApiConfiguration(rootUrl: string) {
var config = new ApiConfiguration();
config.rootUrl = rootUrl;
return {
provide: ApiConfiguration,
useValue: config
};
}
/**
* Global configuration
*/
@Injectable({
providedIn: 'root',
})
export class ApiConfiguration {
rootUrl: string = '';
}
+64
View File
@@ -0,0 +1,64 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { Injectable } from '@angular/core';
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable, firstValueFrom } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { ApiConfiguration } from './api-configuration';
import { StrictHttpResponse } from './strict-http-response';
export type ApiFnOptional<P, R> = (http: HttpClient, rootUrl: string, params?: P, context?: HttpContext) => Observable<StrictHttpResponse<R>>;
export type ApiFnRequired<P, R> = (http: HttpClient, rootUrl: string, params: P, context?: HttpContext) => Observable<StrictHttpResponse<R>>;
/**
* Helper service to call API functions directly
*/
@Injectable({ providedIn: 'root' })
export class Api {
constructor(
private config: ApiConfiguration,
private http: HttpClient
) {
}
private _rootUrl?: string;
/**
* Returns the root url for API operations. If not set directly here,
* will fallback to `ApiConfiguration.rootUrl`.
*/
get rootUrl(): string {
return this._rootUrl || this.config.rootUrl;
}
/**
* Sets the root URL for API operations
*/
set rootUrl(rootUrl: string) {
this._rootUrl = rootUrl;
}
/**
* Executes an API call, returning the response body only
*/
invoke<P, R>(fn: ApiFnRequired<P, R>, params: P, context?: HttpContext): Promise<R>;
invoke<P, R>(fn: ApiFnOptional<P, R>, params?: P, context?: HttpContext): Promise<R>;
async invoke<P, R>(fn: ApiFnRequired<P, R> | ApiFnOptional<P, R>, params: P, context?: HttpContext): Promise<R> {
const resp = this.invoke$Response(fn, params, context);
return (await resp).body;
}
/**
* Executes an API call, returning the entire response
*/
invoke$Response<P, R>(fn: ApiFnRequired<P, R>, params: P, context?: HttpContext): Promise<StrictHttpResponse<R>>;
invoke$Response<P, R>(fn: ApiFnOptional<P, R>, params?: P, context?: HttpContext): Promise<StrictHttpResponse<R>>;
invoke$Response<P, R>(fn: ApiFnRequired<P, R> | ApiFnOptional<P, R>, params: P, context?: HttpContext): Promise<StrictHttpResponse<R>> {
const obs = fn(this.http, this.rootUrl, params, context)
.pipe(
filter(r => r instanceof HttpResponse),
map(r => r as StrictHttpResponse<R>));
return firstValueFrom(obs);
}
}
+35
View File
@@ -0,0 +1,35 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { ApiConfiguration } from './api-configuration';
/**
* Base class for services
*/
@Injectable()
export class BaseService {
constructor(
protected config: ApiConfiguration,
protected http: HttpClient
) {
}
private _rootUrl?: string;
/**
* Returns the root url for all operations in this service. If not set directly in this
* service, will fallback to `ApiConfiguration.rootUrl`.
*/
get rootUrl(): string {
return this._rootUrl || this.config.rootUrl;
}
/**
* Sets the root URL for API operations in this service.
*/
set rootUrl(rootUrl: string) {
this._rootUrl = rootUrl;
}
}
+30
View File
@@ -0,0 +1,30 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { User } from '../../models/user';
export interface GetMe$Params {
}
export function getMe(http: HttpClient, rootUrl: string, params?: GetMe$Params, context?: HttpContext): Observable<StrictHttpResponse<User>> {
const rb = new RequestBuilder(rootUrl, getMe.PATH, 'get');
if (params) {
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<User>;
})
);
}
getMe.PATH = '/api/auth/me';
+33
View File
@@ -0,0 +1,33 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { AuthResponse } from '../../models/auth-response';
import { LoginInput } from '../../models/login-input';
export interface Login$Params {
body: LoginInput
}
export function login(http: HttpClient, rootUrl: string, params: Login$Params, context?: HttpContext): Observable<StrictHttpResponse<AuthResponse>> {
const rb = new RequestBuilder(rootUrl, login.PATH, 'post');
if (params) {
rb.body(params.body, 'application/json');
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<AuthResponse>;
})
);
}
login.PATH = '/api/auth/login';
+29
View File
@@ -0,0 +1,29 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
export interface Logout$Params {
}
export function logout(http: HttpClient, rootUrl: string, params?: Logout$Params, context?: HttpContext): Observable<StrictHttpResponse<void>> {
const rb = new RequestBuilder(rootUrl, logout.PATH, 'post');
if (params) {
}
return http.request(
rb.build({ responseType: 'text', accept: '*/*', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return (r as HttpResponse<any>).clone({ body: undefined }) as StrictHttpResponse<void>;
})
);
}
logout.PATH = '/api/auth/logout';
+33
View File
@@ -0,0 +1,33 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { AuthResponse } from '../../models/auth-response';
import { RegisterInput } from '../../models/register-input';
export interface Register$Params {
body: RegisterInput
}
export function register(http: HttpClient, rootUrl: string, params: Register$Params, context?: HttpContext): Observable<StrictHttpResponse<AuthResponse>> {
const rb = new RequestBuilder(rootUrl, register.PATH, 'post');
if (params) {
rb.body(params.body, 'application/json');
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<AuthResponse>;
})
);
}
register.PATH = '/api/auth/register';
+33
View File
@@ -0,0 +1,33 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Game } from '../../models/game';
import { GameInput } from '../../models/game-input';
export interface CreateGame$Params {
body: GameInput
}
export function createGame(http: HttpClient, rootUrl: string, params: CreateGame$Params, context?: HttpContext): Observable<StrictHttpResponse<Game>> {
const rb = new RequestBuilder(rootUrl, createGame.PATH, 'post');
if (params) {
rb.body(params.body, 'application/json');
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Game>;
})
);
}
createGame.PATH = '/api/games';
+31
View File
@@ -0,0 +1,31 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
export interface DeleteGame$Params {
id: string;
}
export function deleteGame(http: HttpClient, rootUrl: string, params: DeleteGame$Params, context?: HttpContext): Observable<StrictHttpResponse<void>> {
const rb = new RequestBuilder(rootUrl, deleteGame.PATH, 'delete');
if (params) {
rb.path('id', params.id, {});
}
return http.request(
rb.build({ responseType: 'text', accept: '*/*', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return (r as HttpResponse<any>).clone({ body: undefined }) as StrictHttpResponse<void>;
})
);
}
deleteGame.PATH = '/api/games/{id}';
+32
View File
@@ -0,0 +1,32 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Game } from '../../models/game';
export interface GetGame$Params {
id: string;
}
export function getGame(http: HttpClient, rootUrl: string, params: GetGame$Params, context?: HttpContext): Observable<StrictHttpResponse<Game>> {
const rb = new RequestBuilder(rootUrl, getGame.PATH, 'get');
if (params) {
rb.path('id', params.id, {});
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Game>;
})
);
}
getGame.PATH = '/api/games/{id}';
+30
View File
@@ -0,0 +1,30 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Game } from '../../models/game';
export interface ListGames$Params {
}
export function listGames(http: HttpClient, rootUrl: string, params?: ListGames$Params, context?: HttpContext): Observable<StrictHttpResponse<(Array<Game> | null)>> {
const rb = new RequestBuilder(rootUrl, listGames.PATH, 'get');
if (params) {
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<(Array<Game> | null)>;
})
);
}
listGames.PATH = '/api/games';
+35
View File
@@ -0,0 +1,35 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Game } from '../../models/game';
import { GameInput } from '../../models/game-input';
export interface UpdateGame$Params {
id: string;
body: GameInput
}
export function updateGame(http: HttpClient, rootUrl: string, params: UpdateGame$Params, context?: HttpContext): Observable<StrictHttpResponse<Game>> {
const rb = new RequestBuilder(rootUrl, updateGame.PATH, 'put');
if (params) {
rb.path('id', params.id, {});
rb.body(params.body, 'application/json');
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Game>;
})
);
}
updateGame.PATH = '/api/games/{id}';
+30
View File
@@ -0,0 +1,30 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { GetHelloResponse } from '../../models/get-hello-response';
export interface GetHello$Params {
}
export function getHello(http: HttpClient, rootUrl: string, params?: GetHello$Params, context?: HttpContext): Observable<StrictHttpResponse<GetHelloResponse>> {
const rb = new RequestBuilder(rootUrl, getHello.PATH, 'get');
if (params) {
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<GetHelloResponse>;
})
);
}
getHello.PATH = '/hello';
@@ -0,0 +1,33 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Platform } from '../../models/platform';
import { PlatformInput } from '../../models/platform-input';
export interface CreatePlatform$Params {
body: PlatformInput
}
export function createPlatform(http: HttpClient, rootUrl: string, params: CreatePlatform$Params, context?: HttpContext): Observable<StrictHttpResponse<Platform>> {
const rb = new RequestBuilder(rootUrl, createPlatform.PATH, 'post');
if (params) {
rb.body(params.body, 'application/json');
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Platform>;
})
);
}
createPlatform.PATH = '/api/platforms';
@@ -0,0 +1,31 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
export interface DeletePlatform$Params {
id: string;
}
export function deletePlatform(http: HttpClient, rootUrl: string, params: DeletePlatform$Params, context?: HttpContext): Observable<StrictHttpResponse<void>> {
const rb = new RequestBuilder(rootUrl, deletePlatform.PATH, 'delete');
if (params) {
rb.path('id', params.id, {});
}
return http.request(
rb.build({ responseType: 'text', accept: '*/*', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return (r as HttpResponse<any>).clone({ body: undefined }) as StrictHttpResponse<void>;
})
);
}
deletePlatform.PATH = '/api/platforms/{id}';
@@ -0,0 +1,32 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Platform } from '../../models/platform';
export interface GetPlatform$Params {
id: string;
}
export function getPlatform(http: HttpClient, rootUrl: string, params: GetPlatform$Params, context?: HttpContext): Observable<StrictHttpResponse<Platform>> {
const rb = new RequestBuilder(rootUrl, getPlatform.PATH, 'get');
if (params) {
rb.path('id', params.id, {});
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Platform>;
})
);
}
getPlatform.PATH = '/api/platforms/{id}';
@@ -0,0 +1,30 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Platform } from '../../models/platform';
export interface ListPlatforms$Params {
}
export function listPlatforms(http: HttpClient, rootUrl: string, params?: ListPlatforms$Params, context?: HttpContext): Observable<StrictHttpResponse<(Array<Platform> | null)>> {
const rb = new RequestBuilder(rootUrl, listPlatforms.PATH, 'get');
if (params) {
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<(Array<Platform> | null)>;
})
);
}
listPlatforms.PATH = '/api/platforms';
@@ -0,0 +1,35 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { filter, map } from 'rxjs/operators';
import { StrictHttpResponse } from '../../strict-http-response';
import { RequestBuilder } from '../../request-builder';
import { Platform } from '../../models/platform';
import { PlatformInput } from '../../models/platform-input';
export interface UpdatePlatform$Params {
id: string;
body: PlatformInput
}
export function updatePlatform(http: HttpClient, rootUrl: string, params: UpdatePlatform$Params, context?: HttpContext): Observable<StrictHttpResponse<Platform>> {
const rb = new RequestBuilder(rootUrl, updatePlatform.PATH, 'put');
if (params) {
rb.path('id', params.id, {});
rb.body(params.body, 'application/json');
}
return http.request(
rb.build({ responseType: 'json', accept: 'application/json', context })
).pipe(
filter((r: any): r is HttpResponse<any> => r instanceof HttpResponse),
map((r: HttpResponse<any>) => {
return r as StrictHttpResponse<Platform>;
})
);
}
updatePlatform.PATH = '/api/platforms/{id}';
+33
View File
@@ -0,0 +1,33 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export type { Login$Params as Login$Params } from './fn/auth/login';
export { login as login } from './fn/auth/login';
export type { Logout$Params as Logout$Params } from './fn/auth/logout';
export { logout as logout } from './fn/auth/logout';
export type { GetMe$Params as GetMe$Params } from './fn/auth/get-me';
export { getMe as getMe } from './fn/auth/get-me';
export type { Register$Params as Register$Params } from './fn/auth/register';
export { register as register } from './fn/auth/register';
export type { ListGames$Params as ListGames$Params } from './fn/games/list-games';
export { listGames as listGames } from './fn/games/list-games';
export type { CreateGame$Params as CreateGame$Params } from './fn/games/create-game';
export { createGame as createGame } from './fn/games/create-game';
export type { GetGame$Params as GetGame$Params } from './fn/games/get-game';
export { getGame as getGame } from './fn/games/get-game';
export type { UpdateGame$Params as UpdateGame$Params } from './fn/games/update-game';
export { updateGame as updateGame } from './fn/games/update-game';
export type { DeleteGame$Params as DeleteGame$Params } from './fn/games/delete-game';
export { deleteGame as deleteGame } from './fn/games/delete-game';
export type { ListPlatforms$Params as ListPlatforms$Params } from './fn/platforms/list-platforms';
export { listPlatforms as listPlatforms } from './fn/platforms/list-platforms';
export type { CreatePlatform$Params as CreatePlatform$Params } from './fn/platforms/create-platform';
export { createPlatform as createPlatform } from './fn/platforms/create-platform';
export type { GetPlatform$Params as GetPlatform$Params } from './fn/platforms/get-platform';
export { getPlatform as getPlatform } from './fn/platforms/get-platform';
export type { UpdatePlatform$Params as UpdatePlatform$Params } from './fn/platforms/update-platform';
export { updatePlatform as updatePlatform } from './fn/platforms/update-platform';
export type { DeletePlatform$Params as DeletePlatform$Params } from './fn/platforms/delete-platform';
export { deletePlatform as deletePlatform } from './fn/platforms/delete-platform';
export type { GetHello$Params as GetHello$Params } from './fn/misc/get-hello';
export { getHello as getHello } from './fn/misc/get-hello';
+14
View File
@@ -0,0 +1,14 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export type { AuthResponse } from './models/auth-response';
export type { ErrorDetail } from './models/error-detail';
export type { ErrorModel } from './models/error-model';
export type { Game } from './models/game';
export type { GameInput } from './models/game-input';
export type { GetHelloResponse } from './models/get-hello-response';
export type { LoginInput } from './models/login-input';
export type { Platform } from './models/platform';
export type { PlatformInput } from './models/platform-input';
export type { RegisterInput } from './models/register-input';
export type { User } from './models/user';
+13
View File
@@ -0,0 +1,13 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { User } from '../models/user';
export interface AuthResponse {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
token: string;
user: User;
}
+20
View File
@@ -0,0 +1,20 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface ErrorDetail {
/**
* Where the error occurred, e.g. 'body.items[3].tags' or 'path.thing-id'
*/
location?: string;
/**
* Error message text
*/
message?: string;
/**
* The value at the given location
*/
value?: any;
}
+41
View File
@@ -0,0 +1,41 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { ErrorDetail } from '../models/error-detail';
export interface ErrorModel {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
/**
* A human-readable explanation specific to this occurrence of the problem.
*/
detail?: string;
/**
* Optional list of individual error details
*/
errors?: (Array<ErrorDetail> | null);
/**
* A URI reference that identifies the specific occurrence of the problem.
*/
instance?: string;
/**
* HTTP status code
*/
status?: number;
/**
* A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
*/
title?: string;
/**
* A URI reference to human-readable documentation for the error.
*/
type?: string;
}
+23
View File
@@ -0,0 +1,23 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface GameInput {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
/**
* YYYY-MM-DD (optional)
*/
finished?: string;
name: string;
platform_id: string;
/**
* YYYY-MM-DD
*/
release_date: string;
score: number;
}
+25
View File
@@ -0,0 +1,25 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface Game {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
/**
* YYYY-MM-DD (optional)
*/
finished?: string;
id: string;
name: string;
platform_id: string;
platform_name: string;
/**
* YYYY-MM-DD
*/
release_date: string;
score: number;
}
@@ -0,0 +1,11 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface GetHelloResponse {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
message: string;
}
+12
View File
@@ -0,0 +1,12 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface LoginInput {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
email: string;
password: string;
}
+15
View File
@@ -0,0 +1,15 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface PlatformInput {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
/**
* Name of the platform
*/
name: string;
}
+12
View File
@@ -0,0 +1,12 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface Platform {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
id: string;
name: string;
}
+13
View File
@@ -0,0 +1,13 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface RegisterInput {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
email: string;
name: string;
password: string;
}
+15
View File
@@ -0,0 +1,15 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export interface User {
/**
* A URL to the JSON Schema for this object.
*/
'$schema'?: string;
bio?: string;
email: string;
id: string;
is_admin: boolean;
name: string;
}
+369
View File
@@ -0,0 +1,369 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpRequest, HttpParameterCodec, HttpParams, HttpHeaders, HttpContext } from '@angular/common/http';
/**
* Custom parameter codec to correctly handle the plus sign in parameter
* values. See https://github.com/angular/angular/issues/18261
*/
class ParameterCodec implements HttpParameterCodec {
encodeKey(key: string): string {
return encodeURIComponent(key);
}
encodeValue(value: string): string {
return encodeURIComponent(value);
}
decodeKey(key: string): string {
return decodeURIComponent(key);
}
decodeValue(value: string): string {
return decodeURIComponent(value);
}
}
const ParameterCodecInstance = new ParameterCodec();
/**
* Defines the options for appending a parameter
*/
interface ParameterOptions {
style?: string;
explode?: boolean;
}
/**
* Base class for a parameter
*/
abstract class Parameter {
constructor(public name: string, public value: any, public options: ParameterOptions, defaultStyle: string, defaultExplode: boolean) {
this.options = options || {};
if (this.options.style === null || this.options.style === undefined) {
this.options.style = defaultStyle;
}
if (this.options.explode === null || this.options.explode === undefined) {
this.options.explode = defaultExplode;
}
}
serializeValue(value: any, separator = ','): string {
if (value === null || value === undefined) {
return '';
} else if (value instanceof Array) {
return value.map(v => this.serializeValue(v).split(separator).join(encodeURIComponent(separator))).join(separator);
} else if (typeof value === 'object') {
const array: string[] = [];
for (const key of Object.keys(value)) {
let propVal = value[key];
if (propVal !== null && propVal !== undefined) {
propVal = this.serializeValue(propVal).split(separator).join(encodeURIComponent(separator));
if (this.options.explode) {
array.push(`${key}=${propVal}`);
} else {
array.push(key);
array.push(propVal);
}
}
}
return array.join(separator);
} else {
return String(value);
}
}
}
/**
* A parameter in the operation path
*/
class PathParameter extends Parameter {
constructor(name: string, value: any, options: ParameterOptions) {
super(name, value, options, 'simple', false);
}
append(path: string): string {
let value = this.value;
if (value === null || value === undefined) {
value = '';
}
let prefix = this.options.style === 'label' ? '.' : '';
let separator = this.options.explode ? prefix === '' ? ',' : prefix : ',';
let alreadySerialized = false;
if (this.options.style === 'matrix') {
// The parameter name is just used as prefix, except in some cases...
prefix = `;${this.name}=`;
if (this.options.explode && typeof value === 'object') {
prefix = ';';
if (value instanceof Array) {
// For arrays we have to repeat the name for each element
value = value.map(v => `${this.name}=${this.serializeValue(v, ';')}`);
value = value.join(';');
alreadySerialized = true;
} else {
// For objects we have to put each the key / value pairs
value = this.serializeValue(value, ';');
alreadySerialized = true
}
}
}
value = prefix + (alreadySerialized ? value : this.serializeValue(value, separator));
// Replace both the plain variable and the corresponding variant taking in the prefix and explode into account
path = path.replace(`{${this.name}}`, value);
path = path.replace(`{${prefix}${this.name}${this.options.explode ? '*' : ''}}`, value);
return path;
}
// @ts-ignore
serializeValue(value: any, separator = ','): string {
var result = typeof value === 'string' ? encodeURIComponent(value) : super.serializeValue(value, separator);
result = result.replace(/%3D/g, '=');
result = result.replace(/%3B/g, ';');
result = result.replace(/%2C/g, ',');
return result;
}
}
/**
* A parameter in the query
*/
class QueryParameter extends Parameter {
constructor(name: string, value: any, options: ParameterOptions) {
super(name, value, options, 'form', true);
}
append(params: HttpParams): HttpParams {
if (this.value instanceof Array) {
// Array serialization
if (this.options.explode) {
for (const v of this.value) {
params = params.append(this.name, this.serializeValue(v));
}
} else {
const separator = this.options.style === 'spaceDelimited'
? ' ' : this.options.style === 'pipeDelimited'
? '|' : ',';
return params.append(this.name, this.serializeValue(this.value, separator));
}
} else if (this.value !== null && typeof this.value === 'object') {
// Object serialization
if (this.options.style === 'deepObject') {
// Append a parameter for each key, in the form `name[key]`
for (const key of Object.keys(this.value)) {
const propVal = this.value[key];
if (propVal !== null && propVal !== undefined) {
params = params.append(`${this.name}[${key}]`, this.serializeValue(propVal));
}
}
} else if (this.options.explode) {
// Append a parameter for each key without using the parameter name
for (const key of Object.keys(this.value)) {
const propVal = this.value[key];
if (propVal !== null && propVal !== undefined) {
params = params.append(key, this.serializeValue(propVal));
}
}
} else {
// Append a single parameter whose values are a comma-separated list of key,value,key,value...
const array: any[] = [];
for (const key of Object.keys(this.value)) {
const propVal = this.value[key];
if (propVal !== null && propVal !== undefined) {
array.push(key);
array.push(propVal);
}
}
params = params.append(this.name, this.serializeValue(array));
}
} else if (this.value !== null && this.value !== undefined) {
// Plain value
params = params.append(this.name, this.serializeValue(this.value));
}
return params;
}
}
/**
* A parameter in the HTTP request header
*/
class HeaderParameter extends Parameter {
constructor(name: string, value: any, options: ParameterOptions) {
super(name, value, options, 'simple', false);
}
append(headers: HttpHeaders): HttpHeaders {
if (this.value !== null && this.value !== undefined) {
if (this.value instanceof Array) {
for (const v of this.value) {
headers = headers.append(this.name, this.serializeValue(v));
}
} else {
headers = headers.append(this.name, this.serializeValue(this.value));
}
}
return headers;
}
}
/**
* Helper to build http requests from parameters
*/
export class RequestBuilder {
private _path = new Map<string, PathParameter>();
private _query = new Map<string, QueryParameter>();
private _header = new Map<string, HeaderParameter>();
_bodyContent: any | null;
_bodyContentType?: string;
constructor(
public rootUrl: string,
public operationPath: string,
public method: string) {
}
/**
* Sets a path parameter
*/
path(name: string, value: any, options?: ParameterOptions): void {
this._path.set(name, new PathParameter(name, value, options || {}));
}
/**
* Sets a query parameter
*/
query(name: string, value: any, options?: ParameterOptions): void {
this._query.set(name, new QueryParameter(name, value, options || {}));
}
/**
* Sets a header parameter
*/
header(name: string, value: any, options?: ParameterOptions): void {
this._header.set(name, new HeaderParameter(name, value, options || {}));
}
/**
* Sets the body content, along with the content type
*/
body(value: any, contentType = 'application/json'): void {
if (value instanceof Blob) {
this._bodyContentType = value.type;
} else {
this._bodyContentType = contentType;
}
if (this._bodyContentType === 'application/x-www-form-urlencoded' && value !== null && typeof value === 'object') {
// Handle URL-encoded data
const pairs: Array<[string, string]> = [];
for (const key of Object.keys(value)) {
let val = value[key];
if (!(val instanceof Array)) {
val = [val];
}
for (const v of val) {
const formValue = this.formDataValue(v);
if (formValue !== null) {
pairs.push([key, formValue]);
}
}
}
this._bodyContent = pairs.map(p => `${encodeURIComponent(p[0])}=${encodeURIComponent(p[1])}`).join('&');
} else if (this._bodyContentType === 'multipart/form-data') {
// Handle multipart form data
const formData = new FormData();
if (value !== null && value !== undefined) {
for (const key of Object.keys(value)) {
const val = value[key];
if (val instanceof Array) {
for (const v of val) {
const toAppend = this.formDataValue(v);
if (toAppend !== null) {
formData.append(key, toAppend);
}
}
} else {
const toAppend = this.formDataValue(val);
if (toAppend !== null) {
formData.set(key, toAppend);
}
}
}
}
this._bodyContent = formData;
} else {
// The body is the plain content
this._bodyContent = value;
}
}
private formDataValue(value: any): any {
if (value === null || value === undefined) {
return null;
}
if (value instanceof Blob) {
return value;
}
if (typeof value === 'object') {
return new Blob([JSON.stringify(value)], {type: 'application/json'})
}
return String(value);
}
/**
* Builds the request with the current set parameters
*/
build<T = any>(options?: {
/** Which content types to accept */
accept?: string;
/** The expected response type */
responseType?: 'json' | 'text' | 'blob' | 'arraybuffer';
/** Whether to report progress on uploads / downloads */
reportProgress?: boolean;
/** Allow passing HttpContext for HttpClient */
context?: HttpContext;
}): HttpRequest<T> {
options = options || {};
// Path parameters
let path = this.operationPath;
for (const pathParam of this._path.values()) {
path = pathParam.append(path);
}
const url = this.rootUrl + path;
// Query parameters
let httpParams = new HttpParams({
encoder: ParameterCodecInstance
});
for (const queryParam of this._query.values()) {
httpParams = queryParam.append(httpParams);
}
// Header parameters
let httpHeaders = new HttpHeaders();
if (options.accept) {
httpHeaders = httpHeaders.append('Accept', options.accept);
}
for (const headerParam of this._header.values()) {
httpHeaders = headerParam.append(httpHeaders);
}
// Request content headers
if (this._bodyContentType && !(this._bodyContent instanceof FormData)) {
httpHeaders = httpHeaders.set('Content-Type', this._bodyContentType);
}
// Perform the request
return new HttpRequest<T>(this.method.toUpperCase(), url, this._bodyContent, {
params: httpParams,
headers: httpHeaders,
responseType: options.responseType,
reportProgress: options.reportProgress,
context: options.context
});
}
}
+7
View File
@@ -0,0 +1,7 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
export { AuthService } from './services/auth.service';
export { GamesService } from './services/games.service';
export { PlatformsService } from './services/platforms.service';
export { MiscService } from './services/misc.service';
+161
View File
@@ -0,0 +1,161 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { firstValueFrom } from 'rxjs';
import { BaseService } from '../base-service';
import { ApiConfiguration } from '../api-configuration';
import { StrictHttpResponse } from '../strict-http-response';
import { AuthResponse } from '../models/auth-response';
import { getMe } from '../fn/auth/get-me';
import { GetMe$Params } from '../fn/auth/get-me';
import { login } from '../fn/auth/login';
import { Login$Params } from '../fn/auth/login';
import { logout } from '../fn/auth/logout';
import { Logout$Params } from '../fn/auth/logout';
import { register } from '../fn/auth/register';
import { Register$Params } from '../fn/auth/register';
import { User } from '../models/user';
@Injectable({ providedIn: 'root' })
export class AuthService extends BaseService {
constructor(config: ApiConfiguration, http: HttpClient) {
super(config, http);
}
/** Path part for operation `login()` */
static readonly LoginPath = '/api/auth/login';
/**
* Log in to an existing account.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `login()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
login$Response(params: Login$Params, context?: HttpContext): Promise<StrictHttpResponse<AuthResponse>> {
const obs = login(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Log in to an existing account.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `login$Response()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
login(params: Login$Params, context?: HttpContext): Promise<AuthResponse> {
const resp = this.login$Response(params, context);
return resp.then((r: StrictHttpResponse<AuthResponse>): AuthResponse => r.body);
}
/** Path part for operation `logout()` */
static readonly LogoutPath = '/api/auth/logout';
/**
* Log out of the current session.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `logout()` instead.
*
* This method doesn't expect any request body.
*/
logout$Response(params?: Logout$Params, context?: HttpContext): Promise<StrictHttpResponse<void>> {
const obs = logout(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Log out of the current session.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `logout$Response()` instead.
*
* This method doesn't expect any request body.
*/
logout(params?: Logout$Params, context?: HttpContext): Promise<void> {
const resp = this.logout$Response(params, context);
return resp.then((r: StrictHttpResponse<void>): void => r.body);
}
/** Path part for operation `getMe()` */
static readonly GetMePath = '/api/auth/me';
/**
* Get the current user.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `getMe()` instead.
*
* This method doesn't expect any request body.
*/
getMe$Response(params?: GetMe$Params, context?: HttpContext): Promise<StrictHttpResponse<User>> {
const obs = getMe(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Get the current user.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `getMe$Response()` instead.
*
* This method doesn't expect any request body.
*/
getMe(params?: GetMe$Params, context?: HttpContext): Promise<User> {
const resp = this.getMe$Response(params, context);
return resp.then((r: StrictHttpResponse<User>): User => r.body);
}
/** Path part for operation `register()` */
static readonly RegisterPath = '/api/auth/register';
/**
* Register a new account.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `register()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
register$Response(params: Register$Params, context?: HttpContext): Promise<StrictHttpResponse<AuthResponse>> {
const obs = register(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Register a new account.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `register$Response()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
register(params: Register$Params, context?: HttpContext): Promise<AuthResponse> {
const resp = this.register$Response(params, context);
return resp.then((r: StrictHttpResponse<AuthResponse>): AuthResponse => r.body);
}
}
+195
View File
@@ -0,0 +1,195 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { firstValueFrom } from 'rxjs';
import { BaseService } from '../base-service';
import { ApiConfiguration } from '../api-configuration';
import { StrictHttpResponse } from '../strict-http-response';
import { createGame } from '../fn/games/create-game';
import { CreateGame$Params } from '../fn/games/create-game';
import { deleteGame } from '../fn/games/delete-game';
import { DeleteGame$Params } from '../fn/games/delete-game';
import { Game } from '../models/game';
import { getGame } from '../fn/games/get-game';
import { GetGame$Params } from '../fn/games/get-game';
import { listGames } from '../fn/games/list-games';
import { ListGames$Params } from '../fn/games/list-games';
import { updateGame } from '../fn/games/update-game';
import { UpdateGame$Params } from '../fn/games/update-game';
@Injectable({ providedIn: 'root' })
export class GamesService extends BaseService {
constructor(config: ApiConfiguration, http: HttpClient) {
super(config, http);
}
/** Path part for operation `listGames()` */
static readonly ListGamesPath = '/api/games';
/**
* List Games.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `listGames()` instead.
*
* This method doesn't expect any request body.
*/
listGames$Response(params?: ListGames$Params, context?: HttpContext): Promise<StrictHttpResponse<(Array<Game> | null)>> {
const obs = listGames(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* List Games.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `listGames$Response()` instead.
*
* This method doesn't expect any request body.
*/
listGames(params?: ListGames$Params, context?: HttpContext): Promise<(Array<Game> | null)> {
const resp = this.listGames$Response(params, context);
return resp.then((r: StrictHttpResponse<(Array<Game> | null)>): (Array<Game> | null) => r.body);
}
/** Path part for operation `createGame()` */
static readonly CreateGamePath = '/api/games';
/**
* Create Game.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `createGame()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
createGame$Response(params: CreateGame$Params, context?: HttpContext): Promise<StrictHttpResponse<Game>> {
const obs = createGame(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Create Game.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `createGame$Response()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
createGame(params: CreateGame$Params, context?: HttpContext): Promise<Game> {
const resp = this.createGame$Response(params, context);
return resp.then((r: StrictHttpResponse<Game>): Game => r.body);
}
/** Path part for operation `getGame()` */
static readonly GetGamePath = '/api/games/{id}';
/**
* Get Game.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `getGame()` instead.
*
* This method doesn't expect any request body.
*/
getGame$Response(params: GetGame$Params, context?: HttpContext): Promise<StrictHttpResponse<Game>> {
const obs = getGame(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Get Game.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `getGame$Response()` instead.
*
* This method doesn't expect any request body.
*/
getGame(params: GetGame$Params, context?: HttpContext): Promise<Game> {
const resp = this.getGame$Response(params, context);
return resp.then((r: StrictHttpResponse<Game>): Game => r.body);
}
/** Path part for operation `updateGame()` */
static readonly UpdateGamePath = '/api/games/{id}';
/**
* Update Game.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `updateGame()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
updateGame$Response(params: UpdateGame$Params, context?: HttpContext): Promise<StrictHttpResponse<Game>> {
const obs = updateGame(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Update Game.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `updateGame$Response()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
updateGame(params: UpdateGame$Params, context?: HttpContext): Promise<Game> {
const resp = this.updateGame$Response(params, context);
return resp.then((r: StrictHttpResponse<Game>): Game => r.body);
}
/** Path part for operation `deleteGame()` */
static readonly DeleteGamePath = '/api/games/{id}';
/**
* Delete Game.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `deleteGame()` instead.
*
* This method doesn't expect any request body.
*/
deleteGame$Response(params: DeleteGame$Params, context?: HttpContext): Promise<StrictHttpResponse<void>> {
const obs = deleteGame(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Delete Game.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `deleteGame$Response()` instead.
*
* This method doesn't expect any request body.
*/
deleteGame(params: DeleteGame$Params, context?: HttpContext): Promise<void> {
const resp = this.deleteGame$Response(params, context);
return resp.then((r: StrictHttpResponse<void>): void => r.body);
}
}
+55
View File
@@ -0,0 +1,55 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { firstValueFrom } from 'rxjs';
import { BaseService } from '../base-service';
import { ApiConfiguration } from '../api-configuration';
import { StrictHttpResponse } from '../strict-http-response';
import { GetHelloResponse } from '../models/get-hello-response';
import { getHello } from '../fn/misc/get-hello';
import { GetHello$Params } from '../fn/misc/get-hello';
@Injectable({ providedIn: 'root' })
export class MiscService extends BaseService {
constructor(config: ApiConfiguration, http: HttpClient) {
super(config, http);
}
/** Path part for operation `getHello()` */
static readonly GetHelloPath = '/hello';
/**
* Say Hello.
*
* Returns a friendly hello message.
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `getHello()` instead.
*
* This method doesn't expect any request body.
*/
getHello$Response(params?: GetHello$Params, context?: HttpContext): Promise<StrictHttpResponse<GetHelloResponse>> {
const obs = getHello(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Say Hello.
*
* Returns a friendly hello message.
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `getHello$Response()` instead.
*
* This method doesn't expect any request body.
*/
getHello(params?: GetHello$Params, context?: HttpContext): Promise<GetHelloResponse> {
const resp = this.getHello$Response(params, context);
return resp.then((r: StrictHttpResponse<GetHelloResponse>): GetHelloResponse => r.body);
}
}
@@ -0,0 +1,195 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpClient, HttpContext } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { firstValueFrom } from 'rxjs';
import { BaseService } from '../base-service';
import { ApiConfiguration } from '../api-configuration';
import { StrictHttpResponse } from '../strict-http-response';
import { createPlatform } from '../fn/platforms/create-platform';
import { CreatePlatform$Params } from '../fn/platforms/create-platform';
import { deletePlatform } from '../fn/platforms/delete-platform';
import { DeletePlatform$Params } from '../fn/platforms/delete-platform';
import { getPlatform } from '../fn/platforms/get-platform';
import { GetPlatform$Params } from '../fn/platforms/get-platform';
import { listPlatforms } from '../fn/platforms/list-platforms';
import { ListPlatforms$Params } from '../fn/platforms/list-platforms';
import { Platform } from '../models/platform';
import { updatePlatform } from '../fn/platforms/update-platform';
import { UpdatePlatform$Params } from '../fn/platforms/update-platform';
@Injectable({ providedIn: 'root' })
export class PlatformsService extends BaseService {
constructor(config: ApiConfiguration, http: HttpClient) {
super(config, http);
}
/** Path part for operation `listPlatforms()` */
static readonly ListPlatformsPath = '/api/platforms';
/**
* List Platforms.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `listPlatforms()` instead.
*
* This method doesn't expect any request body.
*/
listPlatforms$Response(params?: ListPlatforms$Params, context?: HttpContext): Promise<StrictHttpResponse<(Array<Platform> | null)>> {
const obs = listPlatforms(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* List Platforms.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `listPlatforms$Response()` instead.
*
* This method doesn't expect any request body.
*/
listPlatforms(params?: ListPlatforms$Params, context?: HttpContext): Promise<(Array<Platform> | null)> {
const resp = this.listPlatforms$Response(params, context);
return resp.then((r: StrictHttpResponse<(Array<Platform> | null)>): (Array<Platform> | null) => r.body);
}
/** Path part for operation `createPlatform()` */
static readonly CreatePlatformPath = '/api/platforms';
/**
* Create Platform.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `createPlatform()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
createPlatform$Response(params: CreatePlatform$Params, context?: HttpContext): Promise<StrictHttpResponse<Platform>> {
const obs = createPlatform(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Create Platform.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `createPlatform$Response()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
createPlatform(params: CreatePlatform$Params, context?: HttpContext): Promise<Platform> {
const resp = this.createPlatform$Response(params, context);
return resp.then((r: StrictHttpResponse<Platform>): Platform => r.body);
}
/** Path part for operation `getPlatform()` */
static readonly GetPlatformPath = '/api/platforms/{id}';
/**
* Get Platform.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `getPlatform()` instead.
*
* This method doesn't expect any request body.
*/
getPlatform$Response(params: GetPlatform$Params, context?: HttpContext): Promise<StrictHttpResponse<Platform>> {
const obs = getPlatform(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Get Platform.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `getPlatform$Response()` instead.
*
* This method doesn't expect any request body.
*/
getPlatform(params: GetPlatform$Params, context?: HttpContext): Promise<Platform> {
const resp = this.getPlatform$Response(params, context);
return resp.then((r: StrictHttpResponse<Platform>): Platform => r.body);
}
/** Path part for operation `updatePlatform()` */
static readonly UpdatePlatformPath = '/api/platforms/{id}';
/**
* Update Platform.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `updatePlatform()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
updatePlatform$Response(params: UpdatePlatform$Params, context?: HttpContext): Promise<StrictHttpResponse<Platform>> {
const obs = updatePlatform(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Update Platform.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `updatePlatform$Response()` instead.
*
* This method sends `application/json` and handles request body of type `application/json`.
*/
updatePlatform(params: UpdatePlatform$Params, context?: HttpContext): Promise<Platform> {
const resp = this.updatePlatform$Response(params, context);
return resp.then((r: StrictHttpResponse<Platform>): Platform => r.body);
}
/** Path part for operation `deletePlatform()` */
static readonly DeletePlatformPath = '/api/platforms/{id}';
/**
* Delete Platform.
*
*
*
* This method provides access to the full `HttpResponse`, allowing access to response headers.
* To access only the response body, use `deletePlatform()` instead.
*
* This method doesn't expect any request body.
*/
deletePlatform$Response(params: DeletePlatform$Params, context?: HttpContext): Promise<StrictHttpResponse<void>> {
const obs = deletePlatform(this.http, this.rootUrl, params, context);
return firstValueFrom(obs);
}
/**
* Delete Platform.
*
*
*
* This method provides access only to the response body.
* To access the full response (for headers, for example), `deletePlatform$Response()` instead.
*
* This method doesn't expect any request body.
*/
deletePlatform(params: DeletePlatform$Params, context?: HttpContext): Promise<void> {
const resp = this.deletePlatform$Response(params, context);
return resp.then((r: StrictHttpResponse<void>): void => r.body);
}
}
+11
View File
@@ -0,0 +1,11 @@
/* eslint-disable */
/* Code generated by ng-openapi-gen DO NOT EDIT. */
import { HttpResponse } from '@angular/common/http';
/**
* Constrains the http response to not have the body defined as `T | null`, but `T` only.
*/
export type StrictHttpResponse<T> = HttpResponse<T> & {
readonly body: T;
}