Пример #1
0
        /// <summary>
        /// Call API to get an object by id, or get a list of all objects.
        /// </summary>
        /// <typeparam name="T">Type of object to get</typeparam>
        /// <param name="requestUri">URI of the controller and rest of route (could also include object id if single item is desired)</param>
        /// <returns>Object from the API</returns>
        public async Task <T> ReadAsync <T>(string requestUri)
        {
            var httpResponseMessage = await _restHttpClient.GetAsync(requestUri);

            if (!httpResponseMessage.IsSuccessStatusCode)
            {
                if (httpResponseMessage.StatusCode == System.Net.HttpStatusCode.NotFound)
                {
                    return(default);