getPrices static method
Future<MaybeError<GetPricesResult> >
getPrices(
- GetPricesParameters parameters, {
- UriProductHelper uriHelper = uriHelperFoodProd,
- String? bearerToken,
Implementation
static Future<MaybeError<GetPricesResult>> getPrices(
final GetPricesParameters parameters, {
final UriProductHelper uriHelper = uriHelperFoodProd,
final String? bearerToken,
}) async {
final Uri uri = uriHelper.getUri(
path: '/api/v1/prices',
queryParameters: parameters.getQueryParameters(),
forcedHost: _getHost(uriHelper),
);
final Response response = await HttpHelper().doGetRequest(
uri,
uriHelper: uriHelper,
bearerToken: bearerToken,
);
if (response.statusCode == 200) {
try {
final dynamic decodedResponse = HttpHelper().jsonDecodeUtf8(response);
return MaybeError<GetPricesResult>.value(
GetPricesResult.fromJson(decodedResponse),
);
} catch (e) {
//
}
}
return MaybeError<GetPricesResult>.responseError(response);
}