Пример #1
0
        public async Task <Stats> GetPhotoStatsAsync(string id)
        {
            var uri = new GetPhotoStatsRequest(id).Uri;
            HttpResponseMessage response = await netClient.GetAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync <Stats>(response).ConfigureAwait(false));
        }
Пример #2
0
        public async Task <Stats> GetPhotoStatsAsync(GetPhotoStatsRequest request)
        {
            var uri = request == null?Request.GetDefaultRequest <GetPhotoStatsRequest>().Uri : request.Uri;

            HttpResponseMessage response = await netClient.GetAsync(uri).ConfigureAwait(false);

            return(await ParseResponseAsync <Stats>(response).ConfigureAwait(false));
        }
Пример #3
0
        public void GetPhotoStatsRequest_Arguments_ProducesAnExpectedURI()
        {
            var  id         = "123";
            var  resolution = StatsResolution.DAYS;
            uint quantity   = 5;
            var  request    = new GetPhotoStatsRequest(id, resolution, quantity);

            Assert.Matches($"/{id}", request.Uri.AbsoluteUri);
            Assert.Matches($"&resolution={resolution.Describe()}" +
                           $"&quantity={quantity}",
                           request.Uri.AbsoluteUri);
        }