Skip to content

Conversation

@henrique021
Copy link
Contributor

Pagination support added for the two following methods:

List findByOwner(@nonnull AccountId ownerId)

List findByOwnerAndType(@nonnull AccountId ownerId, @nonnull TokenId tokenId)

Copy link
Member

@hendrikebbers hendrikebbers left a comment

Choose a reason for hiding this comment

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

Hey, thank you very much for this great contribution. I worked yesterday on the implementation of the MirrorNodeClient and did some simpolification for the uri handling. It would be good if you can update your branch and do the fix as described in the comments.

if you have any questions or need help please ping me.

Objects.requireNonNull(accountId, "newAccountId must not be null");
final JsonNode jsonNode = doGetCall("/api/v1/accounts/" + accountId + "/nfts");
return jsonNodeToNftList(jsonNode);
final URI uri = URI.create(
Copy link
Member

Choose a reason for hiding this comment

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

Can you please update your branch with current main branch. I did some updates on the implementation that makes uri handling way more easy.

With that update I assume this method looks like this:

final String path = /api/v1/accounts/" + accountId + "/nfts";
        final Function<JsonNode, List<Nft>> dataExtractionFunction = node -> getNfts(node);
        return new RestBasedPage<>(objectMapper, restClient.mutate().clone(), path, dataExtractionFunction);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i refactored the methods, please let me know if i did something wrong.


//when
final List<Nft> result = nftRepository.findByOwner(newOwner);
final Page<Nft> slice = nftRepository.findByOwner(newOwner);
Copy link
Member

Choose a reason for hiding this comment

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

I updated the tests for the current methods that support pagination and added some tests that checks a return count that is bigger than the size of 1 page. By doing so we can directly check if the pagination works. Can you please add such tests, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tests added. Took me while to figure it out.

Copy link
Member

@hendrikebbers hendrikebbers left a comment

Choose a reason for hiding this comment

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

That looks great. I will run the tests and merge if all fits.

@hendrikebbers
Copy link
Member

@henrique021 sorry for the delay. The contribution is great and I'm really happy for that.

@hendrikebbers hendrikebbers merged commit e4621ab into OpenElements:main Sep 26, 2024
@hendrikebbers hendrikebbers added the hacktoberfest-accepted Reserved for PRs that are accepted for Hacktoberfest (see https://hacktoberfest.com) 🚀👾🧑🏽‍💻 label Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hacktoberfest-accepted Reserved for PRs that are accepted for Hacktoberfest (see https://hacktoberfest.com) 🚀👾🧑🏽‍💻

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants