Exemplo n.º 1
0
        public async void Can_Get_Photo_Info(string photoId)
        {
            var photoInfo = await _flickrSearchService.GetPhotoInfoAsync(photoId);

            foreach (var tag in photoInfo.Tags)
            {
                _output.WriteLine($"IsMachineTag{tag.IsMachineTag}");
            }

            Assert.NotNull(photoInfo);
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Post([FromBody] string id)  //[FromBody]string photoId, string size
        {
            var photoId = "9250911801";
            var size    = "n";

            var token = await _tokenProvider.RequestResourceOwnerPasswordAsync(_settings.Login, _settings.Password, _settings.Api);

            var photoInfo = await _flickrSearchService.GetPhotoInfoAsync(photoId);

            if (photoInfo == null)
            {
                return(NotFound());
            }

            var photo = await _flickrDownloadService.GetFlickrImageAsync(photoInfo.GetPhotoUrl(size));

            var image = new ImageForCreation
            {
                Title      = photoInfo.Title,
                Bytes      = photo,
                PhotoId    = long.Parse(photoInfo.PhotoId),
                Category   = "API Post",
                DataSource = "Flickr"
            };

            //var cancellationToken = new CancellationToken();
            //await _imageGalleryCommandService.PostImageGalleryApi(token, image, cancellationToken);

            return(Ok(photoInfo));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Get()
        {
            _trace.Record(Annotations.ClientSend());
            _trace.Record(Annotations.ServiceName("FlickrSearch:PhotoInfo"));
            _trace.Record(Annotations.Rpc("GET"));

            var result = await _flickrSearchService.GetPhotoInfoAsync("7012518889");

            _trace.Record(Annotations.ClientRecv());

            return(Ok(result));
        }