feat: add catalog support (ListCatalogs, ListCatalogItemsByKey) (#1172)#131
Open
kirre-bylund wants to merge 1 commit into
Open
feat: add catalog support (ListCatalogs, ListCatalogItemsByKey) (#1172)#131kirre-bylund wants to merge 1 commit into
kirre-bylund wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
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::ListCatalogItemsByKeywithper_page+cursorquery params and a newFLootLockerServerListCatalogPricesResponsedata model. - Exposed
ListCatalogItemsByKeythroughULootLockerServerForCppandULootLockerServerForBlueprints(including a BP response delegate). - Registered a new
ULootLockerServerEndpoints::ListCatalogItemsByKeyendpoint.
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); | ||
| } |
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 full catalog listing support to the Unreal Server SDK, implementing issue #1172. Includes
ListCatalogsandListCatalogItemsByKeywith cursor-based pagination, exposed via both C++ and Blueprint facades.Changes
New files
Public/ServerAPI/LootLockerServerCatalogRequest.h— All catalog data types and request/response structsPrivate/ServerAPI/LootLockerServerCatalogRequest.cpp— Implementation ofListCatalogsandListCatalogItemsByKeyModified files
Public/LootLockerServerEndpoints.h/Private/LootLockerServerEndpoints.cpp— AddedListCatalogsandListCatalogItemsByKeyendpoint definitionsPublic/LootLockerServerForCpp.h/Private/LootLockerServerForCpp.cpp— Exposed both methods for C++ consumersPublic/LootLockerServerForBlueprints.h/Private/LootLockerServerForBlueprints.cpp— Exposed both methods as UFUNCTIONs for Blueprint consumersAPI
Blueprint equivalents available via
ULootLockerServerForBlueprints.Notes
non_refundableis included onFLootLockerServerCatalogEntry(relevant to #1420)Related
Closes #1172 (tracked via lootlocker/index#1172)