kgsearch

package
v0.0.0-...-5d1b9c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2019 License: BSD-3-Clause Imports: 13 Imported by: 0

Documentation

Overview

Package kgsearch provides access to the Knowledge Graph Search API.

See https://developers.google.com/knowledge-graph/

Usage example:

import "github.com/zippoxer/google-api-go-client/kgsearch/v1"
...
kgsearchService, err := kgsearch.New(oauthHttpClient)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EntitiesSearchCall

type EntitiesSearchCall struct {
	// contains filtered or unexported fields
}

func (*EntitiesSearchCall) Context

Context sets the context to be used in this call's Do method. Any pending HTTP request will be aborted if the provided context is canceled.

func (*EntitiesSearchCall) Do

Do executes the "kgsearch.entities.search" call. Exactly one of *SearchResponse or error will be non-nil. Any non-2xx status code is an error. Response headers are in either *SearchResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.

func (*EntitiesSearchCall) Fields

Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more information.

func (*EntitiesSearchCall) Ids

Ids sets the optional parameter "ids": The list of entity id to be used for search instead of query string.

func (*EntitiesSearchCall) IfNoneMatch

func (c *EntitiesSearchCall) IfNoneMatch(entityTag string) *EntitiesSearchCall

IfNoneMatch sets the optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request. Use googleapi.IsNotModified to check whether the response error from Do is the result of In-None-Match.

func (*EntitiesSearchCall) Indent

func (c *EntitiesSearchCall) Indent(indent bool) *EntitiesSearchCall

Indent sets the optional parameter "indent": Enables indenting of json results.

func (*EntitiesSearchCall) Languages

func (c *EntitiesSearchCall) Languages(languages ...string) *EntitiesSearchCall

Languages sets the optional parameter "languages": The list of language codes (defined in ISO 693) to run the query with, e.g. 'en'.

func (*EntitiesSearchCall) Limit

func (c *EntitiesSearchCall) Limit(limit int64) *EntitiesSearchCall

Limit sets the optional parameter "limit": Limits the number of entities to be returned.

func (*EntitiesSearchCall) Prefix

func (c *EntitiesSearchCall) Prefix(prefix bool) *EntitiesSearchCall

Prefix sets the optional parameter "prefix": Enables prefix match against names and aliases of entities

func (*EntitiesSearchCall) Query

func (c *EntitiesSearchCall) Query(query string) *EntitiesSearchCall

Query sets the optional parameter "query": The literal query string for search.

func (*EntitiesSearchCall) QuotaUser

func (c *EntitiesSearchCall) QuotaUser(quotaUser string) *EntitiesSearchCall

QuotaUser sets the optional parameter "quotaUser": Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters.

func (*EntitiesSearchCall) Types

func (c *EntitiesSearchCall) Types(types ...string) *EntitiesSearchCall

Types sets the optional parameter "types": Restricts returned entities with these types, e.g. Person (as defined in http://schema.org/Person).

type EntitiesService

type EntitiesService struct {
	// contains filtered or unexported fields
}

func NewEntitiesService

func NewEntitiesService(s *Service) *EntitiesService

func (*EntitiesService) Search

func (r *EntitiesService) Search() *EntitiesSearchCall

Search: Searches Knowledge Graph for entities that match the constraints. A list of matched entities will be returned in response, which will be in JSON-LD format and compatible with http://schema.org

type SearchResponse

type SearchResponse struct {
	// Context: The local context applicable for the response. See more
	// details at http://www.w3.org/TR/json-ld/#context-definitions.
	Context interface{} `json:"context,omitempty"`

	// ItemListElement: The item list of search results.
	ItemListElement []interface{} `json:"itemListElement,omitempty"`

	// Type: The schema type of top-level JSON-LD object, e.g. ItemList.
	Type interface{} `json:"type,omitempty"`

	// ServerResponse contains the HTTP response code and headers from the
	// server.
	googleapi.ServerResponse `json:"-"`

	// ForceSendFields is a list of field names (e.g. "Context") to
	// unconditionally include in API requests. By default, fields with
	// empty values are omitted from API requests. However, any non-pointer,
	// non-interface field appearing in ForceSendFields will be sent to the
	// server regardless of whether the field is empty or not. This may be
	// used to include empty fields in Patch requests.
	ForceSendFields []string `json:"-"`
}

SearchResponse: Response message includes the context and a list of matching results which contain the detail of associated entities.

func (*SearchResponse) MarshalJSON

func (s *SearchResponse) MarshalJSON() ([]byte, error)

type Service

type Service struct {
	BasePath  string // API endpoint base URL
	UserAgent string // optional additional User-Agent fragment

	Entities *EntitiesService
	// contains filtered or unexported fields
}

func New

func New(client *http.Client) (*Service, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL