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).
{
"id": 1,
"gameId": 1,
"userId": 1,
"title": "title",
"content": "content",
"createdAt": "...",
"lastModifiedAt": "..."
}
Method: POST
Path: /add
{
"message": "Notatka została dodana",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Missing fields, empty title/content, or duplicate title. -
403 Forbidden
: User not authorized to add notes for another user or game is inactive. -
404 Not Found
: Game or user does not exist.
Method: GET
Path: /
{
"gameNotes": [ { ... } ],
"message": "Notatki zostały pobrane",
"error": 200,
"timestamp": "..."
}
-
401 Unauthorized
: User is not authenticated.
Method: GET
Path: /{gameNoteId}
{
"message": "Notatka została pobrana",
"error": 200,
"gameNote": { ... },
"timestamp": "..."
}
-
403 Forbidden
: User not authorized to access this note. -
404 Not Found
: Note or associated game does not exist.
Method: GET
Path: /game/{gameId}
{
"message": "Notatki zostały pobrane",
"error": 200,
"gameNotes": [ { ... } ],
"timestamp": "..."
}
-
403 Forbidden
: User does not have access to the game. -
404 Not Found
: Game does not exist.
Method: PUT
Path: /update/{gameNoteId}
{
"message": "Notatka została zaktualizowana",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Missing or invalid fields. -
403 Forbidden
: User not authorized to update the note. -
404 Not Found
: Note, game, or user does not exist.
Method: DELETE
Path: /delete/{gameNoteId}
{
"message": "Notatka została usunięta",
"error": 200,
"timestamp": "..."
}
-
403 Forbidden
: User not authorized to delete the note. -
404 Not Found
: Note 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 is the owner of the note and the game is accessible.