Ejemplo n.º 1
0
        public async Task <IActionResult> PostFlickrImage()
        {
            PhotoSearchOptions photoSearchOptions = new PhotoSearchOptions
            {
                // See for List of Available Machine Tags
                //https://api-attractions.navigatorglass.com/swagger/#!/MachineKey/ApiMachineKeyPredicatesGet

                MachineTags = "machine_tags => nycparks:",
                //MachineTags = "machine_tags => nychalloffame:",
                //MachineTags = "machine_tags => nycparks:m010=",
                //MachineTags = "machine_tags => nycparks:m089=",
                //MachineTags = "machine_tags => nycparks:q436=",
                // MachineTags = "machine_tags => nycparks:m010=114",
                // UserId = "",
                //PhotoSize = "q",   //150x150
                //PhotoSize = "z",   // Medium 640
                //PhotoSize = "q", //width="1024" height="768
            };

            Log.Information("Begin Zipkin Trace Here");
            _trace.Record(Annotations.ClientSend());
            _trace.Record(Annotations.ServiceName("FlickrSearch:PostFlickrImage"));
            _trace.Record(Annotations.Rpc("Post"));
            var photos = await _flickrSearchService.SearchPhotosAsync(photoSearchOptions);

            _trace.Record(Annotations.ClientRecv());
            _logger.LogInformation("Total Photos:{PhotoCount}", photos.Count);


            HttpContext.Response.Headers.Add("Access-Control-Expose-Headers", "X-InlineCount");
            HttpContext.Response.Headers.Add("X-InlineCount", photos.Count.ToString(CultureInfo.InvariantCulture));
            return(Ok(photos));
        }
Ejemplo n.º 2
0
        public async void Can_Search_Photos_by_MachineTag_Namespace(string namespaceQuery)
        {
            var photoSearchOptions = new PhotoSearchOptions()
            {
                MachineTags = namespaceQuery,
                Extras      = PhotoSearchExtras.All,
            };

            var photoCollection = await _flickrSearchService.SearchPhotosAsync(photoSearchOptions);

            Assert.NotNull(photoCollection);
        }