Skip to content

Commit

Permalink
feat: Adds continuation parameter to NFTs of Contract Feature at .Set…
Browse files Browse the repository at this point in the history
…Continuation()
  • Loading branch information
saszer committed Jul 18, 2022
1 parent 26f4729 commit cee68e0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Runtime/Mint_File.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
21 changes: 20 additions & 1 deletion Runtime/NFTs_OfAContract.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand Down Expand Up @@ -146,6 +149,17 @@ public NFTs_OfAContract OnComplete(UnityAction<NFTs_model> action)
return this;
}


/// <summary>
/// Set Continuation
/// </summary>
///<param name="continuation"> as string.</param>
public NFTs_OfAContract SetContinuation(string continuation)
{
this.continuation = continuation;
return this;
}

/// <summary>
/// Action on Error
/// </summary>
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit cee68e0

Please sign in to comment.