getAllReports method

Future<Response> getAllReports({
  1. String? portfolioId,
  2. DateTime? after,
  3. int? limit,
  4. ReportTypeEnum? type,
  5. bool? ignoreExpired,
})

Get all reports

Gets a list of past fills/account reports.

https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getreports

Implementation

Future<http.Response> getAllReports({
  String? portfolioId,
  DateTime? after,
  int? limit,
  ReportTypeEnum? type,
  bool? ignoreExpired,
}) async {
  Map<String, dynamic> queryParameters = {};
  if (portfolioId != null) queryParameters['portfolio_id'] = portfolioId;
  if (after != null) queryParameters['after'] = after.toIso8601String();
  if (limit != null) queryParameters['limit'] = limit;
  if (type != null) queryParameters['type'] = type.reportType();
  if (ignoreExpired != null)
    queryParameters['ignore_expired'] = ignoreExpired;

  return get(
    path: '/reports',
    queryParameters: queryParameters,
  );
}