createHotelReservation method
Future<(UResponse<String> ?, UResponse?, String?)>
createHotelReservation({
- required UHotelReservationCreateParams p,
- required dynamic onOk()?,
- required dynamic onError()?,
- required dynamic onException(
- String e
Implementation
Future<(UResponse<String>?, UResponse<dynamic>?, String?)> createHotelReservation({
required UHotelReservationCreateParams p,
required Function(UResponse<String> r)? onOk,
required Function(UResponse<dynamic> e)? onError,
required Function(String e)? onException,
}) async {
(UResponse<String>?, UResponse<dynamic>?, String?) result = (null, null, null);
await UHttpClient.send(
method: "POST",
endpoint: "${U.baseUrl}/Hotel/HotelReservation/Create",
body: p.toMap().add("apiKey", U.apiKey).add("token", ULocalStorage.getToken()).add("locale", ULocalStorage.getLocale()),
onSuccess: (Response r) {
final UResponse<String> ok = UResponse<String>.fromJson(r.body, (dynamic i) => i);
result = (ok, null, null);
onOk?.call(ok);
},
onError: (Response r) {
final UResponse<dynamic> err = UResponse<dynamic>.fromJson(r.body, (dynamic i) => i);
result = (null, err, null);
onError?.call(err);
},
onException: (String e) {
result = (null, null, e);
onException?.call(e);
},
);
return result;
}