Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add name query param to wearable collections from builder #6260

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"),
lorux0 marked this conversation as resolved.
Show resolved Hide resolved
};

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

if (!string.IsNullOrEmpty(nameFilter))
url += $"?name={nameFilter}";
lorux0 marked this conversation as resolved.
Show resolved Hide resolved

(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
Loading