コード例 #1
0
        public GetEventResultResponse GetEventInfo(GetEventsRequestBody searchBody, string token)
        {
            var requestHeader = new RequestHeader();
            requestHeader.Token = token ?? string.Empty;

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

            var responseBody = PostData("http://connect.gettyimages.com/v1/search/GetEventDetails", postData);
            return JsonConvert.DeserializeObject<GetEventResultResponse>(responseBody);
        }
コード例 #2
0
        public void GetEvent_Test()
        {
            var session = operations.CreateSession();

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

            var searchResponse = operations.SearchImages(searchQuery, session.TokenResponse.Token);
            var eventId = searchResponse.SearchForImagesResult.Images.Where(s => s.EventIds != null && s.EventIds.Count > 0).First().EventIds.First();

            var geteventRequest = new GetEventsRequestBody();
            geteventRequest.EventIds = new List<int>() { eventId };

            var eventResponse = operations.GetEventInfo(geteventRequest, session.TokenResponse.Token);

            Assert.IsTrue(eventResponse != null && eventResponse.ResponseHeader.Status.Equals("success"));
            Assert.IsTrue(eventResponse.GetEventsResult.Events.First().EventId == eventId);
            Assert.IsTrue(!string.IsNullOrEmpty(eventResponse.GetEventsResult.Events.First().EventName));
        }