Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added get paged exchange-accounts #129

Merged
merged 7 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
31 changes: 30 additions & 1 deletion fireblocks_sdk/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
DestinationTransferPeerPath, TransferTicketTerm, TRANSACTION_TRANSFER, SIGNING_ALGORITHM, UnsignedMessage, \
FEE_LEVEL, PagedVaultAccountsRequestFilters, TransactionDestination, NFTOwnershipStatusValues, IssueTokenRequest, \
GetAssetWalletsFilters, TimePeriod, GetOwnedCollectionsSortValue, GetOwnedNftsSortValues, GetNftsSortValues, OrderValues, \
GetOwnedAssetsSortValues, PolicyRule, GetSmartTransferFilters
GetOwnedAssetsSortValues, PolicyRule, GetSmartTransferFilters, PagedExchangeAccountRequestFilters
from .sdk_token_provider import SdkTokenProvider


Expand Down Expand Up @@ -586,6 +586,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
Loading