getTokens function
GET request to the /tokens endpoint. Returns a list of token data @param {int[]} tokenIds - An array of token IDs @returns {object} Response data with the list of tokens
Implementation
Future<TokensResponse> getTokens(
{List<int>? tokenIds,
int fromItem = 0,
order = PaginationOrder.ASC,
limit = DEFAULT_PAGE_SIZE}) async {
Map<String, String> params = {};
if (tokenIds != null && tokenIds.isNotEmpty)
params.putIfAbsent(
'ids', () => tokenIds.isNotEmpty ? tokenIds.join(',') : '');
params.addAll(getPageData(fromItem, order, limit));
final response = await extractJSON(
await get(baseApiUrl, TOKENS_URL, queryParameters: params));
final TokensResponse tokensResponse =
TokensResponse.fromJson(json.decode(response));
return tokensResponse;
}