From cee68e0e2bba0ff949bfdad43acfbba37187e1cc Mon Sep 17 00:00:00 2001 From: "sz.sahaj" <43649755+saszer@users.noreply.github.com> Date: Tue, 19 Jul 2022 01:35:20 +1000 Subject: [PATCH] feat: Adds continuation parameter to NFTs of Contract Feature at .SetContinuation() --- Runtime/Mint_File.cs | 2 +- Runtime/NFTs_OfAContract.cs | 21 ++++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Runtime/Mint_File.cs b/Runtime/Mint_File.cs index 327cc54..b3f1711 100644 --- a/Runtime/Mint_File.cs +++ b/Runtime/Mint_File.cs @@ -211,7 +211,7 @@ void FileLocate(string path) string BuildUrl() { - https: //api.nftport.xyz/v0/mints/easy/files?chain=polygon&name=s&description=sss&mint_to_address=s + //https: //api.nftport.xyz/v0/mints/easy/files?chain=polygon&name=s&description=sss&mint_to_address=s RequestURL = "?chain=" + _chain.ToString().ToLower() + "&name=" + _name + "&description=" + _description + "&mint_to_address=" + _mintToAddress; WEB_URL = RequestUriInit + RequestURL; diff --git a/Runtime/NFTs_OfAContract.cs b/Runtime/NFTs_OfAContract.cs index 6b480dc..3a151f1 100644 --- a/Runtime/NFTs_OfAContract.cs +++ b/Runtime/NFTs_OfAContract.cs @@ -46,6 +46,9 @@ public enum Includes [Tooltip("default is the default response, metadata includes NFT metadata and cached_file_url, and all includes extra information like file_information and mint_date in Retrieve NFT details.")] [SerializeField] Includes include = Includes.all; + + [Tooltip("One API call might not be able to provide all NFTs in one go if user holds a lot of NFTs and not filtered, this string is passed in API call which can be used in next one to continue from last query")] + public string continuation; private string RequestUriInit = "https://api.nftport.xyz/v0/nfts/"; @@ -146,6 +149,17 @@ public NFTs_OfAContract OnComplete(UnityAction action) return this; } + + /// + /// Set Continuation + /// + /// as string. + public NFTs_OfAContract SetContinuation(string continuation) + { + this.continuation = continuation; + return this; + } + /// /// Action on Error /// @@ -174,7 +188,12 @@ public NFTs_model Run() string BuildUrl() { - WEB_URL = RequestUriInit + contract_address + "?chain=" + chain.ToString().ToLower() + "&include=" + include.ToString().ToLower(); + WEB_URL = RequestUriInit + contract_address + "?chain=" + chain.ToString().ToLower(); + if (continuation != "") + { + WEB_URL = WEB_URL + "&continuation=" + continuation; + } + WEB_URL = WEB_URL + "&include=" + include.ToString().ToLower(); return WEB_URL; }