AmmunitionController - xEdziu/RPG-Handy-Helper GitHub Wiki
This page contains documentation for the CpRedAmmunitionController
class, which handles ammunition management for Cyberpunk Red.
Base Path: /api/v1/authorized
Package: dev.goral.rpghandyhelper.rpgSystems.cpRed.manual.ammunition
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 |
---|---|---|
GET | /rpgSystems/cpRed/ammunition/all |
Returns basic info about all available ammunition |
GET | /rpgSystems/cpRed/ammunition/{ammunitionId} |
Returns detailed information about a specific ammunition by ID |
GET | /admin/rpgSystems/cpRed/ammunition/all |
Returns a full list of all ammunition types with administrative data |
POST | /admin/rpgSystems/cpRed/ammunition/add |
Adds a new ammunition type to the system |
PUT | /admin/rpgSystems/cpRed/ammunition/update/{ammunitionId} |
Update ammunition data |
- name (String): Name of the ammunition. Required.
- description (String): Description of the ammunition. Required.
- pricePerBullet (Integer): Price per bullet. Required.
-
availability (String): Availability status. Required. Possible values:
CHEAP
,EVERYDAY
,COSTLY
,PREMIUM
,EXPENSIVE
,VERY_EXPENSIVE
,LUXURY
,SUPER_LUXURY
.
- message (String): Describes the result of the operation.
- error (Integer): HTTP status code.
- timestamp (String): Time the response was generated.
- ammunition (Object): A single ammunition object (if applicable).
- ammunitionList (Array): List of ammunition (if applicable).
Method: GET
Path: /rpgSystems/cpRed/ammunition/all
{
"ammunition": [
{
"name": "Explosive Ammo",
"description": "For heavy weapons",
"pricePerBullet": 50,
"availability": "PREMIUM"
}
],
"message": "Amunicja została pobrana.",
"error": 200,
"timestamp": "..."
}
-
401 Unauthorized
: User is not logged in.
Method: GET
Path: /rpgSystems/cpRed/ammunition/{ammunitionId}
{
"ammunition": {
"name": "Explosive Ammo",
"description": "For heavy weapons",
"pricePerBullet": 50,
"availability": "PREMIUM"
},
"message": "Amunicja została pobrana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Invalid ammunition ID. -
401 Unauthorized
: User is not logged in. -
404 Not Found
: Ammunition with the specified ID does not exist.
Method: GET
Path: admin/rpgSystems/cpRed/ammunition/all
{
"ammunition": [
{
"id": 1,
"name": "Explosive Ammo",
"description": "For heavy weapons",
"pricePerBullet": 50,
"availability": "PREMIUM"
}
],
"message": "Amunicja została pobrana dla administratora.",
"error": 200,
"timestamp": "..."
}
-
401 Unauthorized
: User is not logged in. -
403 Forbidden
: User is not an admin.
Method: POST
Path: /admin/rpgSystems/cpRed/ammunition/add
{
"name": "Incendiary Ammo",
"description": "12 gauge shotgun, 20mm penetration",
"pricePerBullet": 10,
"availability": "PREMIUM"
}
{
"message": "Amunicja została dodana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: User not authenticated. -
401 Unauthorized
: User not logged in. -
403 Forbidden
: User is not an admin. -
404 Not Found
: Invalid ammunition data.
Method: PUT
Path: /admin/rpgSystems/cpRed/ammunition/update/{ammunitionId}
{
"name": "Explosive Ammo 2.0",
"description": "Updated description",
"pricePerBullet": 60,
"availability": "LUXURY"
}
{
"message": "Amunicja została zmodyfikowana.",
"error": 200,
"timestamp": "..."
}
-
400 Bad Request
: Invalid ammunition ID or data. -
401 Unauthorized
: User not logged in. -
403 Forbidden
: User is not an admin. -
404 Not Found
: Ammunition 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.