createReport method
Create a report
Generates a report. Reports are either for past account history or past fills on either all accounts or one product's account.
https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_postreports
Implementation
Future<http.Response> createReport({
DateTime? startDate,
DateTime? endDate,
required ReportTypeEnum type,
DateTime? year,
ReportFormatEnum? format,
String? productId,
String? accountId,
String? email,
String? profileId,
}) async {
Map<String, dynamic> body = {'type': type.reportType()};
if (startDate != null) body['start_date'] = startDate.toIso8601String();
if (endDate != null) body['end_date'] = endDate.toIso8601String();
if (year != null) body['year'] = year.year.toString();
if (format != null) body['format'] = format.reportFormat();
if (productId != null) body['product_id'] = productId;
if (accountId != null) body['account_id'] = accountId;
if (email != null) body['email'] = email;
if (profileId != null) body['profile_id'] = profileId;
return post(
path: '/reports',
body: body,
);
}