Example #1
0
        public async Task <Service> GetServiceById(string id)
        {
            var responseString = await _httpClientAdapter.GetAsync(new Uri($"{ _ApiBaseAddress}/Services/{id}"));

            var service = JsonConvert.DeserializeObject <Service>(responseString);

            return(service);
        }
Example #2
0
        public async Task <IEnumerable <Organization> > GetPendingOrgs()
        {
            var responseString = await _httpClientAdapter.GetAsync(new Uri($"{ _ApiBaseAddress}/PendingOrganizations"));

            var organizations = JsonConvert.DeserializeObject <IEnumerable <Organization> >(responseString);

            return(organizations);
        }
Example #3
0
        public async Task <Tuple <ResponseEnum, CurrentRoadStatus> > GetApiResult(string uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException(nameof(uri));
            }

            if (uri.Length == 0)
            {
                throw new ArgumentException("Uri cannot be empty", nameof(uri));
            }

            // Get the response
            var response = await httpClient.GetAsync(uri);

            switch (response.StatusCode)
            {
            case System.Net.HttpStatusCode.OK:
                return(new Tuple <ResponseEnum, CurrentRoadStatus>(ResponseEnum.Success, await responseInterpreter.ProcessAsync(response)));

            case System.Net.HttpStatusCode.NotFound:
                return(new Tuple <ResponseEnum, CurrentRoadStatus>(ResponseEnum.NotFound, null));

            default:
                return(new Tuple <ResponseEnum, CurrentRoadStatus>(ResponseEnum.Failed, null));
            }
        }
        public async Task <Playlist> Get()
        {
            var responseString = await _httpClientAdapter.GetAsync(new Uri($"{ _ApiBaseAddress}/Playlist"));

            var playlist = JsonConvert.DeserializeObject <Playlist>(responseString);

            return(playlist);
        }
Example #5
0
        public async Task <IEnumerable <MembershipRequests> > GetAllMemebershipRequestsThatCanBeActioned()
        {
            var responseString = await _httpClientAdapter.GetAsync(new Uri($"{ _ApiBaseAddress}/OrganizationMember/my/requests"));

            var requests = JsonConvert.DeserializeObject <IEnumerable <MembershipRequests> >(responseString);

            return(requests);
        }
Example #6
0
        public async Task <IEnumerable <KeyContact> > GetAllKeyContacts()
        {
            var responseString = await _httpClientAdapter.GetAsync(new Uri($"{ _ApiBaseAddress}/KeyContact"));

            var keycontacts = JsonConvert.DeserializeObject <IEnumerable <KeyContact> >(responseString);

            return(keycontacts);
        }