@@ -8,6 +8,7 @@ import 'package:path/path.dart';
8
8
import 'prices/currency.dart' ;
9
9
import 'prices/maybe_error.dart' ;
10
10
import 'prices/price.dart' ;
11
+ import 'prices/price_user.dart' ;
11
12
import 'prices/proof.dart' ;
12
13
import 'prices/get_locations_parameters.dart' ;
13
14
import 'prices/get_locations_result.dart' ;
@@ -63,6 +64,28 @@ class OpenPricesAPIClient {
63
64
addUserAgentParameters: addUserAgentParameters,
64
65
);
65
66
67
+ static Future <MaybeError <PriceUser >> getUserProfile (
68
+ final String userId,
69
+ ) async {
70
+ final Uri uri = OpenPricesAPIClient .getUri (
71
+ path: '/api/v1/users/$userId ' ,
72
+ );
73
+
74
+ final http.Response response =
75
+ await HttpHelper ().doGetRequest (uri, uriHelper: uriHelperFoodProd);
76
+ try {
77
+ if (response.statusCode == 200 ) {
78
+ final dynamic decodedResponse = HttpHelper ().jsonDecodeUtf8 (response);
79
+ return MaybeError <PriceUser >.value (
80
+ PriceUser .fromJson (decodedResponse),
81
+ );
82
+ }
83
+ } catch (e) {
84
+ //
85
+ }
86
+ return MaybeError <PriceUser >.responseError (response);
87
+ }
88
+
66
89
static Future <MaybeError <GetPricesResult >> getPrices (
67
90
final GetPricesParameters parameters, {
68
91
final UriProductHelper uriHelper = uriHelperFoodProd,
0 commit comments