api
This commit is contained in:
12
README.md
Normal file
12
README.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Meine API-Dokumentation
|
||||||
|
|
||||||
|
Diese Repository enthält eine interaktive API-Dokumentation mit Redoc für Gitea Pages.
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
1. Repository auf Gitea erstellen.
|
||||||
|
2. Dateien (`index.html` + `openapi.yaml`) hochladen.
|
||||||
|
3. Gitea Pages aktivieren:
|
||||||
|
- Branch: `main`
|
||||||
|
- Ordner: `/` (Root)
|
||||||
|
4. URL aufrufen: https://<dein-gitea-domain>/<repo>/pages/
|
||||||
18
index.html
Normal file
18
index.html
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Meine API-Dokumentation</title>
|
||||||
|
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
|
||||||
|
<style>
|
||||||
|
body { margin: 0; padding: 0; font-family: Arial, sans-serif; }
|
||||||
|
header { background-color: #4a90e2; color: white; padding: 1rem; text-align: center; }
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<h1>Meine API-Dokumentation</h1>
|
||||||
|
</header>
|
||||||
|
<redoc spec-url="openapi.yaml"></redoc>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
221
openapi.yaml
Normal file
221
openapi.yaml
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
openapi: 3.0.3
|
||||||
|
info:
|
||||||
|
title: Example API
|
||||||
|
version: 1.0.0
|
||||||
|
description: API für Auth, News und Attractions
|
||||||
|
|
||||||
|
servers:
|
||||||
|
- url: http://localhost:8080
|
||||||
|
|
||||||
|
components:
|
||||||
|
securitySchemes:
|
||||||
|
bearerAuth:
|
||||||
|
type: http
|
||||||
|
scheme: bearer
|
||||||
|
bearerFormat: JWT
|
||||||
|
|
||||||
|
schemas:
|
||||||
|
LoginRequest:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- email
|
||||||
|
- password
|
||||||
|
properties:
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
example: user@example.com
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
example: password123
|
||||||
|
|
||||||
|
RegisterRequest:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- email
|
||||||
|
- password
|
||||||
|
- nickname
|
||||||
|
properties:
|
||||||
|
email:
|
||||||
|
type: string
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
nickname:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
LoginResponse:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
token:
|
||||||
|
type: string
|
||||||
|
example: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
|
||||||
|
|
||||||
|
NewsDto:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
example: 1
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
example: Neue Attraktion eröffnet
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
example: Beschreibung der News
|
||||||
|
releaseDate:
|
||||||
|
type: string
|
||||||
|
format: date-time
|
||||||
|
picture:
|
||||||
|
type: string
|
||||||
|
example: https://example.com/image.jpg
|
||||||
|
author:
|
||||||
|
type: string
|
||||||
|
example: Admin
|
||||||
|
category:
|
||||||
|
type: string
|
||||||
|
example: Update
|
||||||
|
|
||||||
|
AttractionDto:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: integer
|
||||||
|
example: 1
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
example: Achterbahn X
|
||||||
|
description:
|
||||||
|
type: string
|
||||||
|
example: Schnellste Achterbahn
|
||||||
|
pictures:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
example: Parkstraße 1
|
||||||
|
|
||||||
|
paths:
|
||||||
|
|
||||||
|
/auth/login:
|
||||||
|
post:
|
||||||
|
summary: Login
|
||||||
|
description: Gibt ein Bearer Token zurück
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/LoginRequest'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Erfolgreicher Login
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/LoginResponse'
|
||||||
|
|
||||||
|
/auth/register:
|
||||||
|
post:
|
||||||
|
summary: Registrierung
|
||||||
|
description: Erstellt einen neuen Benutzer
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/RegisterRequest'
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Registrierung erfolgreich
|
||||||
|
|
||||||
|
/public:
|
||||||
|
get:
|
||||||
|
summary: Public Endpoint
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
|
||||||
|
/public/news:
|
||||||
|
get:
|
||||||
|
summary: Alle News
|
||||||
|
description: Liefert alle News zurück (Vorsicht bei vielen Einträgen)
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Liste aller News
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/NewsDto'
|
||||||
|
|
||||||
|
/public/news/{id}:
|
||||||
|
get:
|
||||||
|
summary: News nach ID
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: News gefunden
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/NewsDto'
|
||||||
|
"404":
|
||||||
|
description: News nicht gefunden
|
||||||
|
|
||||||
|
/public/news/newest/{amount}:
|
||||||
|
get:
|
||||||
|
summary: Neueste News
|
||||||
|
parameters:
|
||||||
|
- name: amount
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
example: 5
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Liste der neuesten News
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/NewsDto'
|
||||||
|
|
||||||
|
/public/attraction:
|
||||||
|
get:
|
||||||
|
summary: Alle Attractions
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Liste aller Attractions
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '#/components/schemas/AttractionDto'
|
||||||
|
|
||||||
|
/public/attraction/{id}:
|
||||||
|
get:
|
||||||
|
summary: Attraction nach ID
|
||||||
|
parameters:
|
||||||
|
- name: id
|
||||||
|
in: path
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: integer
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: Attraction gefunden
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/AttractionDto'
|
||||||
|
"404":
|
||||||
|
description: Attraction nicht gefunden
|
||||||
Reference in New Issue
Block a user