CustomEquipmentsController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedCustomEquipmentsController

This page contains documentation for the CpRedCustomArmorsController class, which handles custom equipments management for Cyberpunk Red.

Basic Information

Base Path: /api/v1/authorized
Package: dev.goral.rpghandyhelper.rpgSystems.cpRed.custom.customEquipments

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 /rpgSystems/cpRed/customEquipments/all Returns basic info about all available custom equipments
GET /rpgSystems/cpRed/customEquipments/{equipmentId} Returns detailed information about a specific custom equipment by ID
GET /rpgSystems/cpRed/customEquipments/game/{gameId} Returns basic info about all available custom equipments by game ID
GET /admin/rpgSystems/cpRed/customEquipments/all Returns a full list of all custom equipments types with administrative data
POST /rpgSystems/cpRed/customEquipments/add Adds a new custom equipment type to the system
PUT /rpgSystems/cpRed/customEquipments/update/{equipmentId} Update custom equipment data

Field Descriptions

Request Body Fields (CustomArmorsDto)

  • gameId (Long): ID of the game this custom Equipment belongs to. Required.
  • name (String): Name of the equipment. Required.
  • price (Integer): Price for equipment in eurodollars. Required.
  • availability (String): Availability status. Required. Possible values: CHEAP, EVERYDAY, COSTLY, PREMIUM, EXPENSIVE, VERY_EXPENSIVE, LUXURY, SUPER_LUXURY.
  • -description (String): Description of the equipment. Required.

Response Fields

  • message (String): Describes the result of the operation.
  • error (Integer): HTTP status code.
  • timestamp (String): Time the response was generated.
  • customEquipment (Object): A single custom Equipment object (if applicable).
  • customArmorList (Array): List of custom Equipments (if applicable).

Endpoint Details

Get All Custom Equipments

Method: GET
Path: /rpgSystems/cpRed/customEquipments/all

Response

{
  "customEquipments": [
    {
      "gameId": 1,
      "name": "Customowy zestaw narzędzi",
      "price": 200,
      "availability": "COSTLY",
      "description": "Customowy zestaw narzędzi zawierający zaawansowane narzędzia do modyfikacji sprzętu."
    },
    {
      "gameId": 1,
      "name": "Customowa apteczka",
      "price": 150,
      "availability": "EXPENSIVE",
      "description": "Customowa apteczka zawierająca zaawansowane materiały medyczne do leczenia ran i kontuzji."
    }
  ],
  "message": "Customowe wyposażenie  zostały pobrane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.

Get Custom Equipment by ID

Method: GET
Path: /rpgSystems/cpRed/customEquipments/{ArmorId}

Response

{
  "customEquipments": {
    "gameId": 1,
    "name": "Customowy zestaw narzędzi",
    "price": 200,
    "availability": "COSTLY",
    "description": "Customowy zestaw narzędzi zawierający zaawansowane narzędzia do modyfikacji sprzętu."
  },
  "message": "Customowe wyposażenie zostały pobrane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Get Custom Equipments by Game ID

Method: GET
Path: /rpgSystems/cpRed/customEquipments/game/{gameId}

Response

{
  "customEquipments": [
    {
      "gameId": 1,
      "name": "Customowy zestaw narzędzi",
      "price": 200,
      "availability": "COSTLY",
      "description": "Customowy zestaw narzędzi zawierający zaawansowane narzędzia do modyfikacji sprzętu."
    },
    {
      "gameId": 1,
      "name": "Customowa apteczka",
      "price": 150,
      "availability": "EXPENSIVE",
      "description": "Customowa apteczka zawierająca zaawansowane materiały medyczne do leczenia ran i kontuzji."
    }
  ],
  "message": "Customowe wyposażenie do gry zostało pobrane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Get All Custom Equipments with Admin Data

Method: GET
Path: admin/rpgSystems/cpRed/customEquipments/all

Response

{
  "customEquipments": [
    {
      "id": 1,
      "gameId": {
        "id": 1,
        "name": "Night City Adventures",
        "description": "A thrilling adventure in the heart of Night City.",
        "owner": {
          "id": 1,
          "username": "zuber",
          "firstName": "Mateusz",
          "surname": "Zubrzycki",
          "email": "[email protected]",
          "token": null,
          "password": "$2a$10$Xg1TSDI6Erl.RcfpAPPuLOrnnskoLJ7wWPrC5QJU1e2h.cNd05JRO",
          "role": "ROLE_ADMIN",
          "locked": false,
          "enabled": true,
          "createdAt": "2025-06-25T08:25:00.517+00:00",
          "userPhotoPath": "/img/profilePics/defaultProfilePic.png",
          "accountNonLocked": true,
          "oauthProvider": null,
          "credentialsNonExpired": true,
          "accountNonExpired": true,
          "oauthId": null,
          "authorities": [
            {
              "authority": "ROLE_ADMIN"
            }
          ]
        },
        "rpgSystem": {
          "id": 1,
          "name": "Cyberpunk 2077",
          "description": "A futuristic role-playing game set in the dystopian Night City."
        },
        "status": "ACTIVE"
      },
      "name": "Customowy zestaw narzędzi",
      "price": 200,
      "availability": "COSTLY",
      "description": "Customowy zestaw narzędzi zawierający zaawansowane narzędzia do modyfikacji sprzętu."
    },
    {
      "id": 2,
      "gameId": {
        "id": 1,
        "name": "Night City Adventures",
        "description": "A thrilling adventure in the heart of Night City.",
        "owner": 1,
        "rpgSystem": {
          "id": 1,
          "name": "Cyberpunk 2077",
          "description": "A futuristic role-playing game set in the dystopian Night City."
        },
        "status": "ACTIVE"
      },
      "name": "Customowa apteczka",
      "price": 150,
      "availability": "EXPENSIVE",
      "description": "Customowa apteczka zawierająca zaawansowane materiały medyczne do leczenia ran i kontuzji."
    }
  ],
  "message": "Customowe wyposażenie zostało pobrane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Add New Custom Equipment

Method: POST
Path: /admin/rpgSystems/cpRed/customEquipments/add

Request

{
  "gameId": 1,
  "name": "mały sprzęt",
  "price": 100,
  "availability": "CHEAP",
  "description": "sprzęt"
}

Response

{
  "message": "Customowe wyposażenie zostało dodane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Update Custom Equipments

Method: PUT
Path: /admin/rpgSystems/cpRed/customEquipments/update/{ArmorsId}

Request

{
  "gameId": 1,
  "name": "duży sprzęt",
  "price": 150,
  "availability": "CHEAP",
  "description": "większy"
}

Response

{
  "message": "Customowe wyposażenie zostało zmodyfikowane.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

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** ⚠️