readDormBedInvoice method
Future<(UResponse<List<UDormBedInvoiceResponse> > ?, UResponse?, String?)>
readDormBedInvoice({
- required UDormBedInvoiceReadParams p,
- required dynamic onOk()?,
- required dynamic onError()?,
- required dynamic onException(
- String e
Implementation
Future<(UResponse<List<UDormBedInvoiceResponse>>?, UResponse<dynamic>?, String?)> readDormBedInvoice({
required UDormBedInvoiceReadParams p,
required Function(UResponse<List<UDormBedInvoiceResponse>> r)? onOk,
required Function(UResponse<dynamic> e)? onError,
required Function(String e)? onException,
}) async {
(UResponse<List<UDormBedInvoiceResponse>>?, UResponse<dynamic>?, String?) result = (null, null, null);
await UHttpClient.send(
method: "POST",
endpoint: "${U.baseUrl}/Hotel/DormBedInvoice/Read",
body: p.toMap().add("apiKey", U.apiKey).add("token", ULocalStorage.getToken()).add("locale", ULocalStorage.getLocale()),
onSuccess: (Response r) {
final UResponse<List<UDormBedInvoiceResponse>> ok = UResponse<List<UDormBedInvoiceResponse>>.fromJson(
r.body,
(dynamic i) => List<UDormBedInvoiceResponse>.from((i as List<dynamic>).map((dynamic x) => UDormBedInvoiceResponse.fromMap(x))),
);
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;
}