Skip to content

Commit 118acab

Browse files
authored
fix: blockchain and asset listing filters (#204)
* feat: changed scope property to upper-case * feat: blockchain and asset listing endpoints GA * fix: blockchain and assets listing filters
1 parent a1bdc57 commit 118acab

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

fireblocks_sdk/sdk.py

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1420,20 +1420,27 @@ def list_assets(
14201420
"""
14211421

14221422
url = "/v1/assets"
1423+
1424+
params = {}
1425+
14231426
if blockchain_id:
1424-
url += f"?blockchainId={blockchain_id}"
1427+
params["blockchainId"] = blockchain_id
14251428
if asset_class:
1426-
url += f"&assetClass={asset_class.value}"
1429+
params["assetClass"] = asset_class.value
14271430
if symbol:
1428-
url += f"?symbol={symbol}"
1431+
params["symbol"] = symbol
14291432
if scope:
1430-
url += f"&scope={scope.value}"
1433+
params["scope"] = scope.value
14311434
if deprecated is not None:
1432-
url += f"&deprecated={deprecated}"
1435+
params["deprecated"] = "true" if deprecated is True else "false"
14331436
if page_cursor:
1434-
url += f"?pageCursor={page_cursor}"
1437+
params["pageCursor"] = page_cursor
14351438
if page_size:
1436-
url += f"?pageSize={page_size}"
1439+
params["pageSize"] = page_size
1440+
1441+
if params:
1442+
url = url + "?" + urllib.parse.urlencode(params)
1443+
14371444
return self._get_request(url)
14381445

14391446
def get_asset_by_id(self, asset_id: str):
@@ -1466,16 +1473,23 @@ def list_blockchains(
14661473
"""
14671474

14681475
url = "/v1/blockchains"
1476+
1477+
params = {}
1478+
14691479
if protocol:
1470-
url += f"?protocol={protocol}"
1480+
params["protocol"] = protocol
14711481
if deprecated is not None:
1472-
url += f"&deprecated={deprecated}"
1482+
params["deprecated"] = "true" if deprecated is True else "false"
14731483
if test is not None:
1474-
url += f"&test={test}"
1484+
params["test"] = "true" if test is True else "false"
14751485
if page_cursor:
1476-
url += f"?pageCursor={page_cursor}"
1486+
params["pageCursor"] = page_cursor
14771487
if page_size:
1478-
url += f"?pageSize={page_size}"
1488+
params["pageSize"] = page_size
1489+
1490+
if params:
1491+
url = url + "?" + urllib.parse.urlencode(params)
1492+
14791493
return self._get_request(url)
14801494

14811495
def get_blockchain_by_id(self, blockchain_id: str):

0 commit comments

Comments
 (0)