public Account Get(string email)
        {
            var response = ApiHelpers.DoGet(Constants.Api.Accounts.Get + $"/{email}");
            var json     = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();

            return(JsonSerializer.Deserialize <Account>(json));
        }
Example #2
0
        public IList <Review> GetAllByReviewer(string email)
        {
            var response = ApiHelpers.DoGet(Constants.Api.Reviews.GetAllByReviewer + "/" + email);
            var json     = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();

            return(response.IsSuccessStatusCode ? JsonSerializer.Deserialize <List <Review> >(json) : null);
        }
        public List <Trip> GetFiltered(TripFilter filter)
        {
            var response = ApiHelpers.DoGet(Api.Trips.GetFiltered + $"" +
                                            $"?driverEmail={filter.DriverEmail}" +
                                            $"&passengerEmail={filter.PassengerEmail}" +
                                            $"&minimumArrivalTime={filter.MinimumArrivalDate}" +
                                            $"&maximumArrivalTime={filter.MaximumArrivalDate}" +
                                            $"&pickupAddress={filter.PickupAddress}" +
                                            $"&dropoffAddress={filter.DropoffAddress}");

            if (!response.IsSuccessStatusCode)
            {
                return(null);
            }

            return(JsonSerializer.Deserialize <List <Trip> >(
                       response.Content.ReadAsStringAsync().GetAwaiter().GetResult()));
        }