m8ty_client_custodyaccount
Package overview
Section titled “Package overview”m8ty_client_custodyaccount solves this by exposing custody accounts, positions, overviews, and transactions through typed APIs, enabling transparent custody and investment reporting in the app.
Custody Account information service covers all the aspects of custody accounts, transactions, and positions.
Before you start
Section titled “Before you start”Check the documentation of the m8ty_client_custodyaccount library to get an idea about the available models and their properties.
Import all needed libraries
Section titled “Import all needed libraries” import 'package:dio/dio.dart'; import 'package:m8ty_client_custodyaccount/m8ty_client_custodyaccount.dart'; import 'package:m8ty_client_common/m8ty_client_common.dart'; import 'package:built_collection/built_collection.dart';Client Setup
Section titled “Client Setup”final client = M8tyClientCustodyaccount();client.setOAuthToken('ApiOAuth2', oauthToken);API Surface
Section titled “API Surface”CustodyAccountsApi
Section titled “CustodyAccountsApi”| Method | Description |
|---|---|
searchCustodyAccounts |
Search for the user’s custody accounts |
fetchCustodyAccountById |
Retrieve a specific custody account |
CustodyPositionsApi
Section titled “CustodyPositionsApi”| Method | Description |
|---|---|
searchCustodyPositions |
Search for all positions of a custody account |
fetchCustodyPositionById |
Get a specific custody account position |
getCustodyPositionsOverview |
Get positions overview for a single custody account |
CustodyTransactionsApi
Section titled “CustodyTransactionsApi”| Method | Description |
|---|---|
searchCustodyTransactions |
Search for all transactions of a custody account |
fetchCustodyTransactionById |
Get a specific custody account transaction |
How to perform different tasks
Section titled “How to perform different tasks”Here some examples how the dart client can be used
Get list of all custody accounts
Section titled “Get list of all custody accounts” final client = M8tyClientCustodyaccount(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyAccountsApi(); final custodyAccountSearchRequestModel = CustodyAccountSearchRequestModel((b) => b ..customerId = "1234" ..portfolioId = "78");
final Response<CustodyAccountSearchResponseModel> response = await api.searchCustodyAccounts( custodyAccountSearchRequestModel: custodyAccountSearchRequestModel, page: 1, size: 100, );Fetch custody account by id
Section titled “Fetch custody account by id” final client = M8tyClientCustodyaccount(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyAccountsApi();
try { final Response<CustodyAccountModel> response = await api.fetchCustodyAccountById( custodyAccountId: "1234", ); } on DioException catch (e) { throw Exception( 'Request failed (status: ${e.response?.statusCode}): ${e.response?.data}', ); }Get list of all positions
Section titled “Get list of all positions” final client = M8tyClientCustodyaccount(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyPositionsApi(); final Response<CustodyPositionsSearchResponseModel> response = await api.searchCustodyPositions( custodyAccountId: "123", custodyPositionsSearchRequestModel: custodyPositionsSearchRequestModel, );Get a position by id
Section titled “Get a position by id” final client = M8tyClientCustodyaccount(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyPositionsApi(); final Response<CustodyPositionModel> response = await api.fetchCustodyPositionById( custodyAccountId: "123", custodyAccountTransactionId: "789", );Get list of all transactions
Section titled “Get list of all transactions” final custodyTransactionSearchRequestModel = CustodyTransactionSearchRequestModel((b) => b ..orderId = "123" ..positionId = "789", );
final client = M8tyClientCustodyaccount(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyTransactionsApi(); final Response<CustodyTransactionSearchResponseModel> response = await api.searchCustodyTransactions( custodyAccountId: "123", custodyTransactionSearchRequestModel: custodyTransactionSearchRequestModel, page: 1, size: 100, );Fetch custody transaction by id
Section titled “Fetch custody transaction by id” final client = M8tyClientCustodyaccount(); client.setOAuthToken('ApiOAuth2', oauthToken);
final api = client.getCustodyTransactionsApi(); final Response<CustodyPositionModel> response = await api.fetchCustodyTransactionById( custodyAccountId: "123", custodyAccountTransactionId: "789", );© m8ty GmbH 2023 · m8ty.eu
