GameNoteController - xEdziu/RPG-Handy-Helper GitHub Wiki
This page contains documentation for the GameNoteController
class, which handles note management for games.
Base Path: /api/v1/authorized/gameNotes
Package: dev.goral.rpghandyhelper.notes
All requests to this controller require an XSRF token to be included in the headers.
Example:
headers: {
"X-XSRF-TOKEN": "<csrfToken>"
}
HTTP Method | Path | Description |
---|---|---|
POST | /add |
Adds a new note for the current user |
GET | / |
Retrieves all notes for the current user |
GET | /{gameNoteId} |
Retrieves a specific note by ID |
GET | /game/{gameId} |
Retrieves notes for a specific game |
PUT | /update/{gameNoteId} |
Updates an existing note |
DELETE | /delete/{gameNoteId} |
Deletes a note by ID |
- gameId (Long): ID of the game the note is associated with. Required.
- userId (Long): ID of the note author (must match logged-in user). Required.
- title (String): Note title. Must be unique per user-game pair. Required.
- content (String): Main body of the note. Required.
- message (String): Describes the result of the operation.
- error (Integer): HTTP status code.
- timestamp (String): Time the response was generated.
- gameNote (Object): A single note object (if applicable).
- gameNotes (Array): List of notes (if applicable).
{
"title": "Moja notatka",
"content": "Zawartość notatki",
"createdAt": "2025-05-22T12:00:00.000+00:00",
"updatedAt": "2025-05-22T12:00:00.000+00:00"
}
Method: POST
Path: /add
{
"gameId": 1,
"userId": 2,
"title": "Moja pierwsza notatka",
"content": "Treść notatki do kampanii."
}
{
"message": "Notatka została dodana",
"error": 200,
"timestamp": "2025-05-22T12:00:00.000+00:00"
}
-
400 Bad Request
: Missing or invalid fields in the request body. -
403 Forbidden
: User does not have permission to add notes for another user. -
404 Not Found
: Game or user with the specified ID does not exist.
Method: GET
Path: /
{
"message": "Notatki zostały pobrane",
"error": 200,
"timestamp": "2025-05-22T12:00:00.000+00:00",
"gameNotes": [
{
"title": "Moja notatka",
"content": "Zawartość notatki",
"createdAt": "...",
"updatedAt": "..."
}
]
}
-
400 Bad Request
: User is not authenticated.
Method: GET
Path: /{gameNoteId}
{
"message": "Notatka została pobrana",
"error": 200,
"timestamp": "2025-05-22T12:00:00.000+00:00",
"gameNote": {
"title": "Moja notatka",
"content": "Zawartość notatki",
"createdAt": "...",
"updatedAt": "..."
}
}
-
400 Bad Request
: User is not authenticated. -
403 Forbidden
: User does not have permission to access the note. -
404 Not Found
: Note with the specified ID does not exist.
Method: GET
Path: /game/{gameId}
{
"message": "Notatki zostały pobrane",
"error": 200,
"timestamp": "2025-05-22T12:00:00.000+00:00",
"gameNotes": [
{
"title": "Moja notatka",
"content": "Zawartość notatki",
"createdAt": "...",
"updatedAt": "..."
}
]
}
-
400 Bad Request
: User is not authenticated. -
403 Forbidden
: User does not have permission to access notes for the game. -
404 Not Found
: Game with the specified ID does not exist.
Method: PUT
Path: /update/{gameNoteId}
{
"gameId": 1,
"userId": 2,
"title": "Zaktualizowany tytuł",
"content": "Zmieniona treść notatki."
}
{
"message": "Notatka została zaktualizowana",
"error": 200,
"timestamp": "2025-05-22T12:00:00.000+00:00"
}
-
400 Bad Request
: Missing or invalid fields in the request body. -
403 Forbidden
: User does not have permission to update the note. -
404 Not Found
: Note, game, or user with the specified ID does not exist.
Method: DELETE
Path: /delete/{gameNoteId}
{
"message": "Notatka została usunięta",
"error": 200,
"timestamp": "2025-05-22T12:00:00.000+00:00"
}
-
400 Bad Request
: User is not authenticated. -
403 Forbidden
: User does not have permission to delete the note. -
404 Not Found
: Note with the specified ID does not exist.
-
Missing XSRF Token: Ensure the
X-XSRF-TOKEN
header is included in every request. - Invalid Fields: Double-check the request body for missing or invalid fields.
- Permission Issues: Verify that the user has the necessary permissions for the requested operation.