Skip to content

Commit

Permalink
add name query param to wearable collections from builder
Browse files Browse the repository at this point in the history
  • Loading branch information
lorux0 committed Dec 3, 2024
1 parent eebd86e commit 5245b88
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public interface IWearablesCatalogService : IService
UniTask<WearableItem> RequestWearableAsync(string wearableId, CancellationToken ct);
UniTask<WearableItem> RequestWearableFromBuilderAsync(string wearableId, CancellationToken ct);
UniTask<IReadOnlyList<WearableItem>> RequestWearableCollection(IEnumerable<string> collectionIds, CancellationToken cancellationToken, List<WearableItem> collectionBuffer = null);
UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBuilder(IEnumerable<string> collectionIds, CancellationToken cancellationToken, List<WearableItem> collectionBuffer = null);
UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBuilder(IEnumerable<string> collectionIds, CancellationToken cancellationToken, List<WearableItem> collectionBuffer = null, string nameFilter = null);

void AddWearablesToCatalog(IEnumerable<WearableItem> wearableItems);
void RemoveWearablesFromCatalog(IEnumerable<string> wearableIds);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,22 +347,26 @@ public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollection(IEnu
}

public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBuilder(IEnumerable<string> collectionIds,
CancellationToken cancellationToken, List<WearableItem> collectionBuffer = null)
CancellationToken cancellationToken, List<WearableItem> collectionBuffer = null, string nameFilter = null)
{
string domain = GetBuilderDomainUrl();
var wearables = collectionBuffer ?? new List<WearableItem>();

var queryParams = new[]
{
("page", "1"),
("limit", "5000"),
// TODO: we should properly calculate pagination from the ui instead of requesting all at once
("limit", "15000"),
};

foreach (string collectionId in collectionIds)
{
var url = $"{domain}/collections/{collectionId}/items/";
var templateUrl = $"{domain}/collections/:collectionId/items/";

if (!string.IsNullOrEmpty(nameFilter))
url += $"?name={nameFilter}";

(WearableCollectionResponseFromBuilder response, bool success) = await lambdasService.GetFromSpecificUrl<WearableCollectionResponseFromBuilder>(
templateUrl, url,
isSigned: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollection(IEnu
}

public async UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBuilder(IEnumerable<string> collectionIds,
CancellationToken cancellationToken, List<WearableItem> wearableBuffer = null)
CancellationToken cancellationToken, List<WearableItem> wearableBuffer = null, string nameFilter = null)
{
if (!isInitialized)
await UniTask.WaitUntil(() => isInitialized, cancellationToken: cancellationToken);

return await lambdasWearablesCatalogService.RequestWearableCollectionInBuilder(collectionIds, cancellationToken, wearableBuffer);
return await lambdasWearablesCatalogService.RequestWearableCollectionInBuilder(collectionIds, cancellationToken, wearableBuffer, nameFilter);
}

public void AddWearablesToCatalog(IEnumerable<WearableItem> wearableItems) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public UniTask<IReadOnlyList<WearableItem>> RequestWearableCollection(IEnumerabl
throw new NotImplementedException("Supported by LambdasWearablesCatalogService");

public UniTask<IReadOnlyList<WearableItem>> RequestWearableCollectionInBuilder(IEnumerable<string> collectionIds,
CancellationToken cancellationToken, List<WearableItem> wearableBuffer = null) =>
CancellationToken cancellationToken, List<WearableItem> wearableBuffer = null, string nameFilter = null) =>
throw new NotImplementedException("Supported by LambdasWearablesCatalogService");

private async UniTask<IReadOnlyList<WearableItem>> RequestWearablesByContextAsync(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private async UniTask FetchCustomWearableCollections(
}

await UniTask.WhenAll(wearablesCatalogService.RequestWearableCollection(publishedCollections, cancellationToken, wearableBuffer),
wearablesCatalogService.RequestWearableCollectionInBuilder(collectionsInBuilder, cancellationToken, wearableBuffer));
wearablesCatalogService.RequestWearableCollectionInBuilder(collectionsInBuilder, cancellationToken, wearableBuffer, nameFilter));

HashSetPool<string>.Release(publishedCollections);
HashSetPool<string>.Release(collectionsInBuilder);
Expand Down

0 comments on commit 5245b88

Please sign in to comment.