feat: add Items and Item Templates support - #489
Closed
kirre-bylund wants to merge 1 commit into
Closed
kirre-bylund wants to merge 1 commit into
kirre-bylund wants to merge 1 commit into
Conversation
Adds SDK support for the new inventory system (internally "Assets 2.0"),
publicly named Items and Item Templates.
Game API endpoints (base player/inventory/v1):
- GET / ListItemTemplates
- GET /my ListPlayerItems
- GET /{id} GetPlayerItem
- DELETE /{id} DeletePlayerItem
- POST /{id}/consume ConsumePlayerItem
- POST /{id}/split SplitPlayerItemStack
- POST /merge MergePlayerItemStacks
Notes:
- List responses use LootLockerExtendedPagination (the backend returns an
extended offset pagination shape, not the simple page/per_page/total).
- metadata is typed as LootLockerMetadataEntry[].
- consumable is a nullable bool so "no filter" remains reachable; the backend
only applies the filter when the query value is non-empty.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Address pagination defaults, request serialization and validation issues, and add the required metadata and test coverage.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 2
Open (4)
What changed in this PR
Adds Unity SDK support for Items and Item Templates through new inventory endpoints and APIs.
Changes:
- Added item/template DTOs and request implementations.
- Added list, retrieval, deletion, consume, split, and merge APIs.
- Added inventory endpoint definitions and pagination support.
| File | Description |
|---|---|
Runtime/Game/Requests/ItemRequest.cs |
Item models and request implementations |
Runtime/Game/LootLockerSDKManager.cs |
Public Items API methods |
Runtime/Client/LootLockerEndPoints.cs |
Item endpoint definitions |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+334
to
+335
| string getVariable = endPoint.WithPathParameter(inventoryId); | ||
| string json = LootLockerJson.SerializeObject(data); |
| EndPointClass endPoint = LootLockerEndPoints.consumePlayerItem; | ||
|
|
||
| string getVariable = endPoint.WithPathParameter(inventoryId); | ||
| string json = LootLockerJson.SerializeObject(data); |
| /// <param name="perPage">The number of item templates to return per page. Defaults to 25.</param> | ||
| /// <param name="onComplete">Delegate for handling the server response</param> | ||
| /// <param name="forPlayerWithUlid">Optional : Execute the request for the specified player. If not supplied, the default player will be used.</param> | ||
| public static void ListItemTemplates(int page, int perPage, Action<LootLockerListItemTemplatesResponse> onComplete, string forPlayerWithUlid = null) |
Comment on lines
+189
to
+207
| public class LootLockerListItemTemplatesResponse : LootLockerResponse | ||
| { | ||
| /// <summary>The list of visible item templates.</summary> | ||
| public LootLockerItemTemplate[] items { get; set; } | ||
|
|
||
| /// <summary>Pagination details for the response.</summary> | ||
| public LootLockerExtendedPagination pagination { get; set; } | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Response containing a paginated list of the player's inventory items. | ||
| /// </summary> | ||
| public class LootLockerListPlayerItemsResponse : LootLockerResponse | ||
| { | ||
| /// <summary>The list of the player's inventory items.</summary> | ||
| public LootLockerItem[] items { get; set; } | ||
|
|
||
| /// <summary>Pagination details for the response.</summary> | ||
| public LootLockerExtendedPagination pagination { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
Adds SDK support for the new inventory system (internally "Assets 2.0"), publicly named Items and Item Templates.
Endpoints added (base
player/inventory/v1)/ListItemTemplates/myListPlayerItems/{id}GetPlayerItem/{id}DeletePlayerItem/{id}/consumeConsumePlayerItem/{id}/splitSplitPlayerItemStack/mergeMergePlayerItemStacksNomenclature
Template/item_template_id).Inventory/inventory_id).Public SDK names use "Item"/"Item Template" to avoid colliding with the legacy Inventory/Asset APIs. Wire field names are preserved in the DTOs.
Implementation notes
LootLockerExtendedPagination. The backend returns an extended offset shape (per_page, offset, total, last_page, current_page, next_page, prev_page, errors), not the simplepage/per_page/total.LootLockerMetadataEntry[](the wire shape is an array of{key, value, type, access, tags}).consumablefilter: exposed asbool?so "no filter" remains reachable. The backend only applies the filter when the query value is non-empty, so always sendingtrue/falsewould silently force a filter.granted[]on consume matches the backendGrantResultshape:{source_id, count, type, name, code}.Verification
go-backendsource rather than the ApiDog spec, which was stale for several of these endpoints.Related