Skip to content

Commit

Permalink
Merge pull request #129 from fireblocks/feat-added-get-paged-exchange…
Browse files Browse the repository at this point in the history
…-accounts

feat: added get paged exchange-accounts
  • Loading branch information
NoamRodrik authored Oct 30, 2023
2 parents 58f3f93 + 8187f76 commit 21ad342
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
18 changes: 18 additions & 0 deletions fireblocks_sdk/api_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,24 @@ def __init__(self, name_prefix=None, name_suffix=None, min_amount_threshold=None
self.before = before
self.after = after

class PagedExchangeAccountRequestFilters(object):
""" Optional filters to apply for request
Args
limit (number, optional): Results page size
before (string, optional): cursor string received from previous request
after (string, optional): cursor string received from previous request
Constraints
- You should only insert 'before' or 'after' (or none of them), but not both
- For default and max 'limit' values please see: https://docs.fireblocks.com/api/swagger-ui/#/
"""

def __init__(self, limit=None, before=None, after=None):
self.limit = limit
self.before = before
self.after = after

class GetAssetWalletsFilters(object):
""" Optional filters to apply for request
Expand Down
30 changes: 30 additions & 0 deletions fireblocks_sdk/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
GetSmartTransferFilters,
NFTsWalletTypeValues,
NFTOwnershipStatusUpdatedPayload,
PagedExchangeAccountRequestFilters,
)
from .sdk_token_provider import SdkTokenProvider

Expand Down Expand Up @@ -726,6 +727,35 @@ def get_exchange_accounts(self):

return self._get_request("/v1/exchange_accounts")

def get_exchange_accounts_paged(self, paged_exchange_accounts_request_filters: PagedExchangeAccountRequestFilters):
"""Gets a page of vault accounts for your tenant according to filters given
Args:
paged_exchange_accounts_request_filters (object, optional): Possible filters to apply for request
"""

url = f"/v1/exchange_accounts/paged"
limit, before, after = \
attrgetter('limit', 'before', 'after')(
paged_exchange_accounts_request_filters)

params = {}


if limit is not None:
params['limit'] = limit

if before is not None:
params['before'] = before

if after is not None:
params['after'] = after

if params:
url = url + "?" + urllib.parse.urlencode(params)

return self._get_request(url)

def get_exchange_account(self, exchange_account_id):
"""Gets an exchange account for your tenant
Args:
Expand Down

0 comments on commit 21ad342

Please sign in to comment.