Skip to content

Commit 7496dd0

Browse files
committed
feature: Expose metadata operations through Manager
1 parent da79591 commit 7496dd0

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

Runtime/Game/LootLockerSDKManager.cs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using LootLocker.LootLockerEnums;
77
using System.Linq;
88
using System.Security.Cryptography;
9+
using static UnityEngine.UIElements.UxmlAttributeDescription;
910
#if LOOTLOCKER_USE_NEWTONSOFTJSON
1011
using Newtonsoft.Json;
1112
using Newtonsoft.Json.Linq;
@@ -5860,7 +5861,7 @@ public static void ListMetadataWithTags(LootLockerMetadataSources Source, string
58605861
/// Get Metadata for the specified source with the given key
58615862
/// </summary>
58625863
/// <param name="Source"> The source type for which to request metadata</param>
5863-
/// <param name="SourceID"> The specific source id for which to request metadata</param>
5864+
/// <param name="SourceID"> The specific source id for which to request metadata, note that if the source is self then this too should be set to "self"</param>
58645865
/// <param name="Key"> The key of the metadata to fetch, use this to fetch metadata for a specific key for the specified source.</param>
58655866
/// <param name="onComplete">Delegate for handling the server response</param>
58665867
/// <param name="IgnoreFiles"> Optional: Base64 values will be set to content_type "application/x-redacted" and the content will be an empty String. Use this to avoid accidentally fetching large data files.</param>
@@ -5886,15 +5887,34 @@ public static void GetMetadata(LootLockerMetadataSources Source, string SourceID
58865887
/// <param name="SourcesAndKeysToGet"> The combination of sources to get keys for, and the keys to get for those sources </param>
58875888
/// <param name="onComplete">Delegate for handling the server response</param>
58885889
/// <param name="IgnoreFiles"> Optional: Base64 values will be set to content_type "application/x-redacted" and the content will be an empty String. Use this to avoid accidentally fetching large data files.</param>
5889-
public static void GetMultisourceMetadata(LootLockerMetadataSourceAndKeys[] SourcesAndKeysToGet, Action<LootLockerGetMultisourceMetadataResponse> onComplete, bool ignoreFiles = false)
5890+
public static void GetMultisourceMetadata(LootLockerMetadataSourceAndKeys[] SourcesAndKeysToGet, Action<LootLockerGetMultisourceMetadataResponse> onComplete, bool IgnoreFiles = false)
58905891
{
58915892
if (!CheckInitialized())
58925893
{
58935894
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerGetMultisourceMetadataResponse>());
58945895
return;
58955896
}
58965897

5897-
LootLockerAPIManager.GetMultisourceMetadata(SourcesAndKeysToGet, ignoreFiles, onComplete);
5898+
LootLockerAPIManager.GetMultisourceMetadata(SourcesAndKeysToGet, IgnoreFiles, onComplete);
5899+
}
5900+
5901+
/// <summary>
5902+
/// Perform the specified metadata operations for the specified source
5903+
/// Note that a subset of the specified operations can fail without the full request failing. Make sure to check the errors array in the response.
5904+
/// </summary>
5905+
/// <param name="Source"> The source type that the source id refers to </param>
5906+
/// <param name="SourceID"> The specific source id for which to set metadata, note that if the source is self then this too should be set to "self" </param>
5907+
/// <param name="OperationsToPerform"> List of operations to perform for the given source </param>
5908+
/// <param name="onComplete">Delegate for handling the server response</param>
5909+
public static void PerformMetadataOperations(LootLockerMetadataSources Source, string SourceID, List<LootLockerMetadataOperation> OperationsToPerform, Action<LootLockerMetadataOperationsResponse> onComplete)
5910+
{
5911+
if (!CheckInitialized())
5912+
{
5913+
onComplete?.Invoke(LootLockerResponseFactory.SDKNotInitializedError<LootLockerMetadataOperationsResponse>());
5914+
return;
5915+
}
5916+
5917+
LootLockerAPIManager.PerformMetadataOperations(Source, SourceID, OperationsToPerform, onComplete);
58985918
}
58995919
#endregion
59005920

Runtime/Game/Requests/MetadataRequests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,13 +453,13 @@ public static void GetMultisourceMetadata(LootLockerMetadataSourceAndKeys[] Sour
453453
});
454454
}
455455

456-
public static void PerformMetadataOperations(LootLockerMetadataSources Source, string SourceID, List<LootLockerMetadataOperation> operationsToPerform, Action<LootLockerMetadataOperationsResponse> onComplete)
456+
public static void PerformMetadataOperations(LootLockerMetadataSources Source, string SourceID, List<LootLockerMetadataOperation> OperationsToPerform, Action<LootLockerMetadataOperationsResponse> onComplete)
457457
{
458458
if (Source == LootLockerMetadataSources.self)
459459
{
460460
SourceID = "self";
461461
}
462-
if (string.IsNullOrEmpty(SourceID) || operationsToPerform.Count == 0)
462+
if (string.IsNullOrEmpty(SourceID) || OperationsToPerform.Count == 0)
463463
{
464464
onComplete?.Invoke(LootLockerResponseFactory.InputUnserializableError<LootLockerMetadataOperationsResponse>());
465465
return;
@@ -470,7 +470,7 @@ public static void PerformMetadataOperations(LootLockerMetadataSources Source, s
470470
self = Source == LootLockerMetadataSources.self,
471471
source = Source.ToString().ToLower(),
472472
source_id = SourceID,
473-
entries = operationsToPerform.ToArray()
473+
entries = OperationsToPerform.ToArray()
474474
};
475475

476476
string json = LootLockerJson.SerializeObject(request);

0 commit comments

Comments
 (0)