Beispiel #1
0
 public static ThingResult ConvertToThingResult(this _ThingResult thing)
 {
     return(new ThingResult
     {
         StatusCode = (int)HttpStatusCode.OK
     });
 }
Beispiel #2
0
        public async Task <ThingResult> GetThingsAsync(ThingRequest request)
        {
            string uri = EndpointsV2.THING_URI;

            string queryString = request.ConvertToQueryString(thingParamConversion);

            if (!string.IsNullOrEmpty(queryString))
            {
                uri = $"{uri}?{queryString}";
            }

            HttpResponseMessage resp = await xmlRestClient.GetAsync(uri);

            if (!resp.IsSuccessStatusCode)
            {
                return(new ThingResult {
                    StatusCode = (int)resp.StatusCode
                });
            }

            _ThingResult result = await resp.Content.DeserializeXml <_ThingResult>();

            return(result.ConvertToThingResult());
        }