CyberwaresController - xEdziu/RPG-Handy-Helper GitHub Wiki

CpRedCyberwaresController

This page contains documentation for the CpRedCyberwaresController, which manages cyberware items in the Cyberpunk Red.

Basic Information

Base Path: /api/v1/authorized
Package: dev.goral.rpghandyhelper.rpgSystems.cpRed.manual.cyberwares

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

Field Descriptions

Request Body Fields (CyberwareDto)

  • name (String): Name of the cyberware. Required.
  • mountPlace (String): Body part where the cyberware is mounted. Required. Possible values: FASHIONWARE, NEURALWARE, CYBEROPTIC, CYBERAUDIO, INTERNAL_BODY_CYBERWARE, EXTERNAL_BODY_CYBERWARE, CYBERLIMB, BORGWARE.
  • requirements (String): Requirements for using the cyberware. Required.
  • humanityLoss (Integer): Humanity loss associated with the cyberware. Required.
  • size (Integer): Size of the cyberware. Required.
  • installationPlace (String): Place where the cyberware is installing. Required. Possible values: MALL, CLINIC, HOSPITAL.
  • price (Integer): Price for cyberware 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 cyberware. Required.

Response Fields

  • message (String): Describes the result of the operation.
  • error (Integer): HTTP status code.
  • timestamp (String): Time the response was generated.
  • cyberware (Object): A single cyberware object (if applicable).
  • cyberwareList (Array): List of cyberwares (if applicable).

Endpoint Details

Get All Cyberwares

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

Response

{
  "cyberwares": [
    {
      "name": "smart eye",
      "mountPlace": "CYBEROPTIC",
      "requirements": "none",
      "humanityLoss": "3 (2K6)",
      "size": 10,
      "installationPlace": "MALL",
      "price": 1000,
      "availability": "CHEAP",
      "description": "smart eye with laser"
    }
  ],
  "message": "Pobrano wszystkie wszczepy.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 401 Unauthorized: User is not logged in.

Get Cyberware by ID

Method: GET
Path: /rpgSystems/cpRed/cyberwares/{cyberwareId}

Response

{
  "cyberware": {
    "name": "smart eye",
    "mountPlace": "CYBEROPTIC",
    "requirements": "none",
    "humanityLoss": "3 (2K6)",
    "size": 10,
    "installationPlace": "MALL",
    "price": 1000,
    "availability": "CHEAP",
    "description": "smart eye with laser"
  },
  "message": "Pobrano wszczep o id 1",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Get All Cyberwares with Admin Data

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

Response

{
  "cyberwares": [
    {
      "id": 1,
      "name": "smart eye",
      "mountPlace": "CYBEROPTIC",
      "requirements": "none",
      "humanityLoss": "3 (2K6)",
      "size": 10,
      "installationPlace": "MALL",
      "price": 1000,
      "availability": "CHEAP",
      "description": "smart eye with laser"
    }
  ],
  "message": "Pobrano wszystkie wszczepy.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

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

Add New Cyberware

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

Request

{
  "name": "smart eye",
  "mountPlace": "CYBEROPTIC",
  "requirements": "none",
  "humanityLoss": "3 (2K6)",
  "size": 10,
  "installationPlace": "MALL",
  "price": 1000,
  "availability": "CHEAP",
  "description": "smart eye with laser"
}

Response

{
  "message": "Wszczep został dodany.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: User not authenticated.
  • 401 Unauthorized: User not logged in.
  • 403 Forbidden: User is not an admin.
  • 404 Not Found: Invalid cyberware data.

Update Cyberware

Method: PUT
Path: /admin/rpgSystems/cpRed/cyberwares/update/{cyberwareId}

Request

{
  "name": "CYBEROPTIC",
  "mountPlace": "CYBEROPTIC",
  "requirements": "none",
  "humanityLoss": "2 (2K6)",
  "size": 2,
  "installationPlace": "CLINIC",
  "price": 1500,
  "availability": "CHEAP",
  "description": "smart eye with laser, but better"
}

Response

{
  "message": "Wszczep został zaktualizowany.",
  "error": 200,
  "timestamp": "..."
}

Possible Errors

  • 400 Bad Request: Invalid cyberware ID or data.
  • 401 Unauthorized: User not logged in.
  • 403 Forbidden: User is not an admin.
  • 404 Not Found: Cyberware 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** ⚠️