Skip to content

feat: add Items and Item Templates support - #489

Closed
kirre-bylund wants to merge 1 commit into
release/v8.2.0from
feature/items-item-templates
Closed

kirre-bylund wants to merge 1 commit into
release/v8.2.0from
feature/items-item-templates

Conversation

@kirre-bylund

Copy link
Copy Markdown
Contributor

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)

Method Path SDK method
GET / ListItemTemplates
GET /my ListPlayerItems
GET /{id} GetPlayerItem
DELETE /{id} DeletePlayerItem
POST /{id}/consume ConsumePlayerItem
POST /{id}/split SplitPlayerItemStack
POST /merge MergePlayerItemStacks

Nomenclature

  • Item Template — the conceptual base definition (wire: Template / item_template_id).
  • Item — an instantiation of an Item Template held by a player (wire: 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

  • Pagination: list responses use LootLockerExtendedPagination. The backend returns an extended offset shape (per_page, offset, total, last_page, current_page, next_page, prev_page, errors), not the simple page/per_page/total.
  • Metadata: typed as LootLockerMetadataEntry[] (the wire shape is an array of {key, value, type, access, tags}).
  • consumable filter: exposed as bool? so "no filter" remains reachable. The backend only applies the filter when the query value is non-empty, so always sending true/false would silently force a filter.
  • granted[] on consume matches the backend GrantResult shape: {source_id, count, type, name, code}.

Verification

  • Static verification passed (no headless Unity compiler available in this environment).
  • DTO shapes verified against the authoritative go-backend source rather than the ApiDog spec, which was stale for several of these endpoints.

Related

  • Tracking issue: lootlocker/index#1359
  • Companion PRs: lootlocker/unreal-sdk, lootlocker/unreal-server-sdk

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>
Copilot AI lite review requested due to automatic review settings September 25, 2026 08:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Medium severity · 2 Low severity

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; }
@kirre-bylund
kirre-bylund deleted the feature/items-item-templates branch September 25, 2026 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants