exportApiLogs method

Future<(String?, UEmptyResponse?, String?)> exportApiLogs({
  1. required UApiLogReadParams p,
  2. required dynamic onOk(
    1. String e
    )?,
  3. required VoidCallback? onError,
  4. required dynamic onException(
    1. String e
    )?,
})

Implementation

Future<(String?, UEmptyResponse?, String?)> exportApiLogs({
  required UApiLogReadParams p,
  required Function(String csv)? onOk,
  required VoidCallback? onError,
  required Function(String e)? onException,
}) async {
  (String?, UEmptyResponse?, String?) result = (null, null, null);
  await UHttpClient.send(
    method: "POST",
    endpoint: "${U.baseUrl}/dashboard/ApiLogExport",
    body: p.toMap().add("apiKey", U.apiKey).add("token", ULocalStorage.getToken()),
    onSuccess: (Response r) {
      final String ok = r.body;
      result = (ok, null, null);
      onOk?.call(ok);
    },
    onError: (Response r) {
      final UEmptyResponse err = UEmptyResponse.fromJson(r.body);
      result = (null, err, null);
      onError?.call();
    },
    onException: (String e) {
      result = (null, null, e);
      onException?.call(e);
    },
  );
  return result;
}