public GoogleService() { SearchService = new CustomsearchService(new BaseClientService.Initializer { ApplicationName = ApplicationName, ApiKey = ApiKey }); KnowledgeGraphService = new KgsearchService(new BaseClientService.Initializer { ApplicationName = ApplicationName, ApiKey = ApiKey }); }
/// <summary> /// Searches Knowledge Graph for entities that match the constraints.A list of matched entities will be returned in response, which will be inJSON-LD format and compatible with http://schema.org /// Documentation https://developers.google.com/kgsearch/v1/reference/entities/search /// Generation Note: This does not always build corectly. Google needs to standardise things I need to figuer out which ones are wrong. /// </summary> /// <param name="service">Authenticated Kgsearch service.</param> /// <param name="optional">Optional paramaters.</param> /// <returns>SearchResponseResponse</returns> public static SearchResponse Search(KgsearchService service, EntitiesSearchOptionalParms optional = null) { try { // Initial validation. if (service == null) { throw new ArgumentNullException("service"); } // Building the initial request. var request = service.Entities.Search(); // Applying optional parameters to the request. request = (EntitiesResource.SearchRequest)SampleHelpers.ApplyOptionalParms(request, optional); // Requesting data. return(request.Execute()); } catch (Exception ex) { throw new Exception("Request Entities.Search failed.", ex); } }
public Function(ILogger <Function> logger, KgsearchService kgService, SlackRequestVerifier verifier) => (_logger, _kgService, _verifier) = (logger, kgService, verifier);