CharacterClassesController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedCharacterClassesController

This page contains documentation for the CpRedCharacterClassesController class, which handles character classes management for Cyberpunk Red.

Basic Information

Base Path: /api/v1/authorized
Package: dev.goral.rpgSystems.cpRed.characters.characterClasses

Authentication

All requests to this controller require an XSRF token to be included in the headers.
Example:

headers: {
  "X-XSRF-TOKEN": "<csrfToken>"
}

Endpoint Summary

HTTP Method Path Description
GET /games/cpRed/characters/classes/{characterId} Returns detailed information about a specific character class by characterID
POST /games/cpRed/characters/classes/create Adds a new connection between class type and character to the system
PUT /games/cpRed/characters/classes/update/{characterClassId} Update character class data
DELETE /games/cpRed/characters/classes/delete/{characterClassId} Delete character class data
GET /admin/games/cpRed/characters/classes/all Returns a full list of character class type with administrative data

Field Descriptions

Request Body Fields (CharacterClassesDto)

  • Id (Long): Unique identifier for the character class. Required.
  • classLevel (Short): Level of the character class. Required.
  • CharacterId (Long): Unique identifier for the character. Required.
  • classId (Long): Unique identifier for the class type. Required.

Response Fields

  • message (String): Describes the result of the operation.
  • error (Integer): HTTP status code.
  • timestamp (String): Time the response was generated.
  • characterClass (Object): A single character class object (if applicable).
  • characterClassList (Array): List of character classes (if applicable).

Endpoint Details

Get Class by Character ID

Method: GET
Path: /games/cpRed/characters/classes/{characterId}

Response

{
  "characterClass": [],
  "message": "Klasy postaci pobrane pomyślnie",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid Character ID.
  • 401 Unauthorized: User is not logged in.
  • 404 Not Found: Character with the specified ID does not exist.

Add New Character Class

Method: POST
Path: /games/cpRed/characters/classes/create

Request

{
  "classLevel": 1,
  "characterId": 1,
  "classId": 1
}

Response

{
  "message": "Klasa postaci została pomyślnie utworzona",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: User not authenticated.
  • 401 Unauthorized: User not logged in.
  • 404 Not Found: Invalid character class data.

Update Class

Method: PUT
Path: /games/cpRed/characters/classes/update/{characterClassId}

Request

{
  "classLevel": 5
}

Response

{
  "message": "Klasa postaci została pomyślnie zaktualizowana",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid character class ID or data.
  • 401 Unauthorized: User not logged in.
  • 404 Not Found: Character class with the specified ID does not exist.

Delete Character Class

Method: DELETE Path: /games/cpRed/characters/classes/delete/{characterClassId}

Response

{
  "message": "Klasa postaci została pomyślnie usunięta",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid character class ID.
  • 401 Unauthorized: User not logged in.
  • 404 Not Found: Character class with the specified ID does not exist.

Get All Character Class with Admin Data

Method: GET
Path: /admin/games/cpRed/characters/classes/all

Response

{
  "characterClass": [],
  "message": "Wszystkie klasy każdej postaci pobrane pomyślnie",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.
  • 403 Forbidden: User is not an admin.

Common Troubleshooting Tips

  • 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.
⚠️ **GitHub.com Fallback** ⚠️