public GetImageDetailsResponse GetImageDetail(GetImageDetailsRequestBody searchBody, string token)
        {
            var requestHeader = new RequestHeader();
            requestHeader.Token = token ?? string.Empty;

            var requestBody = new { RequestHeader = requestHeader, GetImageDetailsRequestBody = searchBody };
            var postData = JsonConvert.SerializeObject(requestBody);

            var responseBody = PostData("http://connect.gettyimages.com/v1/search/GetImageDetails", postData);
            return JsonConvert.DeserializeObject<GetImageDetailsResponse>(responseBody);
        }
示例#2
0
        public void ImageDetail_Test()
        {
            var session = operations.CreateSession();

            var searchQuery = new SearchForImages2RequestBody();
            searchQuery.Query = new Query();
            searchQuery.Query.SpecificPersons = new List<string> { "Jennifer Lopez" };
            searchQuery.ResultOptions = new ResultOptions();
            searchQuery.ResultOptions.ItemCount = 5;

            var searchResponse = operations.SearchImages(searchQuery, session.TokenResponse.Token);

            var imageIds = searchResponse.SearchForImagesResult.Images.Select(s => s.ImageId).ToList();

            var imageDetailRequest = new GetImageDetailsRequestBody();
            imageDetailRequest.ImageIds = imageIds;

            var imgDetailSrchResponse = operations.GetImageDetail(imageDetailRequest, session.TokenResponse.Token);

            Assert.IsTrue(imgDetailSrchResponse != null && imgDetailSrchResponse.ResponseHeader.Status.Equals("success"));
            Assert.IsTrue(imgDetailSrchResponse.GetImageDetailsResult.Images.Count == 5);
        }