Skip to content

feat: add catalog support (ListCatalogs, ListCatalogItemsByKey) (#1172)#131

Open
kirre-bylund wants to merge 1 commit into
devfrom
feat/1172-add-catalog-support
Open

feat: add catalog support (ListCatalogs, ListCatalogItemsByKey) (#1172)#131
kirre-bylund wants to merge 1 commit into
devfrom
feat/1172-add-catalog-support

Conversation

@kirre-bylund
Copy link
Copy Markdown
Contributor

Summary

Adds full catalog listing support to the Unreal Server SDK, implementing issue #1172. Includes ListCatalogs and ListCatalogItemsByKey with cursor-based pagination, exposed via both C++ and Blueprint facades.

Changes

New files

  • Public/ServerAPI/LootLockerServerCatalogRequest.h — All catalog data types and request/response structs
  • Private/ServerAPI/LootLockerServerCatalogRequest.cpp — Implementation of ListCatalogs and ListCatalogItemsByKey

Modified files

  • Public/LootLockerServerEndpoints.h / Private/LootLockerServerEndpoints.cpp — Added ListCatalogs and ListCatalogItemsByKey endpoint definitions
  • Public/LootLockerServerForCpp.h / Private/LootLockerServerForCpp.cpp — Exposed both methods for C++ consumers
  • Public/LootLockerServerForBlueprints.h / Private/LootLockerServerForBlueprints.cpp — Exposed both methods as UFUNCTIONs for Blueprint consumers

API

// List all catalogs for the game
ULootLockerServerForCpp::ListCatalogs(FLootLockerServerListCatalogsResponseDelegate OnComplete);

// List items in a catalog by key with cursor-based pagination
ULootLockerServerForCpp::ListCatalogItemsByKey(
    FString CatalogKey,
    int Count,          // 0 = use default
    FString After,      // empty = start from beginning
    FLootLockerServerListCatalogPricesResponseDelegate OnComplete
);

Blueprint equivalents available via ULootLockerServerForBlueprints.

Notes

  • non_refundable is included on FLootLockerServerCatalogEntry (relevant to #1420)
  • Compile verified locally: Editor + Game Development + Game Shipping all pass

Related

Closes #1172 (tracked via lootlocker/index#1172)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new ServerAPI request and facade wiring to support listing catalog items (entries with prices) by catalog key, including cursor-based pagination, exposed to both the C++ and Blueprint facades.

Changes:

  • Added ULootLockerServerCatalogRequest::ListCatalogItemsByKey with per_page + cursor query params and a new FLootLockerServerListCatalogPricesResponse data model.
  • Exposed ListCatalogItemsByKey through ULootLockerServerForCpp and ULootLockerServerForBlueprints (including a BP response delegate).
  • Registered a new ULootLockerServerEndpoints::ListCatalogItemsByKey endpoint.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
LootLockerServerSDK/Source/LootLockerServerSDK/Public/ServerAPI/LootLockerServerCatalogRequest.h New catalog request/response/data type definitions + C++ delegate + request method declaration.
LootLockerServerSDK/Source/LootLockerServerSDK/Private/ServerAPI/LootLockerServerCatalogRequest.cpp Implements ListCatalogItemsByKey request with pagination query params and endpoint invocation.
LootLockerServerSDK/Source/LootLockerServerSDK/Public/LootLockerServerEndpoints.h Adds endpoint declaration for ListCatalogItemsByKey.
LootLockerServerSDK/Source/LootLockerServerSDK/Private/LootLockerServerEndpoints.cpp Adds endpoint initialization for ListCatalogItemsByKey.
LootLockerServerSDK/Source/LootLockerServerSDK/Public/LootLockerServerForCpp.h Adds C++ facade declaration for ListCatalogItemsByKey.
LootLockerServerSDK/Source/LootLockerServerSDK/Private/LootLockerServerForCpp.cpp Adds C++ facade forwarding implementation to the ServerAPI request.
LootLockerServerSDK/Source/LootLockerServerSDK/Public/LootLockerServerForBlueprints.h Adds BP delegate + BP facade declaration for ListCatalogItemsByKey.
LootLockerServerSDK/Source/LootLockerServerSDK/Private/LootLockerServerForBlueprints.cpp Adds BP facade implementation forwarding to the C++ facade.

Comment on lines +573 to +592
UCLASS()
class LOOTLOCKERSERVERSDK_API ULootLockerServerCatalogRequest : public UObject
{
GENERATED_BODY()
public:
ULootLockerServerCatalogRequest();

/**
* List catalog items (entries with prices) for the catalog identified by the given key.
*
* Use Count and After for cursor-based pagination. Pass After = "" and Count = 0 to get the
* first page with the default page size.
*
* @param CatalogKey The unique key of the catalog to list items for
* @param Count Optional: number of items to return per page (0 = server default)
* @param After Optional: cursor from a previous response's Pagination.Next_cursor to get the next page
* @param OnResponseCompleted Delegate for handling the response
*/
static FString ListCatalogItemsByKey(const FString& CatalogKey, int Count, const FString& After, const FLootLockerServerListCatalogPricesResponseDelegate& OnResponseCompleted);
};
Comment on lines +166 to +168
// Catalogs
static FLootLockerServerEndPoint ListCatalogItemsByKey;

Comment on lines +1428 to +1448
//==================================================
// Catalogs
//==================================================
/// @addtogroup Catalogs
/// @{

/**
List catalog items (entries with prices) for the catalog identified by the given key.

Use Count and After for cursor-based pagination. Pass After = "" and Count = 0 to get the
first page with the default page size.

@param CatalogKey The unique key of the catalog to list items for
@param Count Optional: number of items to return per page (0 = server default, typically 50)
@param After Optional: cursor from a previous response's Pagination.Next_cursor to get the next page; pass empty string for the first page
@param OnCompletedRequest Delegate for handling the server response

@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
static FString ListCatalogItemsByKey(const FString& CatalogKey, int Count, const FString& After, const FLootLockerServerListCatalogPricesResponseDelegate& OnCompletedRequest);


@return A unique id for this request, use this to match callbacks to requests when you have multiple simultaneous requests outbound
*/
UFUNCTION(BlueprintCallable, Category = "LootLockerServer Methods | Catalogs", meta = (AdvancedDisplay = "Count, After", Count = 0))
Comment on lines +11 to +21
FString ULootLockerServerCatalogRequest::ListCatalogItemsByKey(const FString& CatalogKey, int Count, const FString& After, const FLootLockerServerListCatalogPricesResponseDelegate& OnResponseCompleted)
{
TMultiMap<FString, FString> QueryParams;
if (Count > 0)
{
QueryParams.Add("per_page", FString::FromInt(Count));
}
if (!After.IsEmpty())
{
QueryParams.Add("cursor", After);
}
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