drivingLicenceNegativePoint method

Future<(UResponse<UDrivingLicenceNegativePointResponse>?, UEmptyResponse?, String?)> drivingLicenceNegativePoint({
  1. required UDrivingLicenceNegativePointParams p,
  2. required dynamic onOk(
    1. UResponse<UDrivingLicenceNegativePointResponse> r
    )?,
  3. required dynamic onError(
    1. UEmptyResponse e
    )?,
  4. required dynamic onException(
    1. String e
    )?,
})

Implementation

Future<(UResponse<UDrivingLicenceNegativePointResponse>?, UEmptyResponse?, String?)> drivingLicenceNegativePoint({
  required UDrivingLicenceNegativePointParams p,
  required Function(UResponse<UDrivingLicenceNegativePointResponse> r)? onOk,
  required Function(UEmptyResponse e)? onError,
  required Function(String e)? onException,
}) async {
  (UResponse<UDrivingLicenceNegativePointResponse>?, UEmptyResponse?, String?) result = (null, null, null);
  await UHttpClient.send(
    method: "POST",
    endpoint: "${U.baseUrl}/inquiry/DrivingLicenceNegativePoint",
    body: p.toMap().add("apiKey", U.apiKey).add("token", ULocalStorage.getToken()),
    onSuccess: (Response r) {
      final UResponse<UDrivingLicenceNegativePointResponse> ok = UResponse<UDrivingLicenceNegativePointResponse>.fromJson(
        r.body,
        (dynamic i) => UDrivingLicenceNegativePointResponse.fromMap(i),
      );
      result = (ok, null, null);
      onOk?.call(ok);
    },
    onError: (Response r) {
      final UEmptyResponse err = UEmptyResponse.fromJson(r.body);
      result = (null, err, null);
      onError?.call(err);
    },
    onException: (String e) {
      result = (null, null, e);
      onException?.call(e);
    },
  );
  return result;
}