Documentation
¶
Index ¶
- Constants
- func GetImage(c *Client, entity string) (imageUrl string, err error)
- func IsItem(entity string) bool
- func IsProperty(entity string) bool
- type AliasList
- type Basics
- type Claim
- type Client
- type DataValueObj
- type Entity
- type EntityID
- type ImageClaim
- type Property
- type Reference
- type Snak
- type StringValue
Constants ¶
View Source
const ( LangEnglish = "en" QueryIDs = "ids" QueryProps = "props" ActionGetEntities = "wbgetentities" BasicsProps = "labels|descriptions|info|aliases" )
* wbgetentities API https://www.wikidata.org/w/api.php?action=help&modules=wbgetentities * @params props: * info, sitelinks, sitelinks/urls, aliases, labels, descriptions, claims, datatype * (default: info|sitelinks|aliases|labels|descriptions|claims|datatype)
View Source
const ( ActionGetClaims = "wbgetclaims" PropertyImage = "P18" ImgEndpoint = "https://upload.wikimedia.org/wikipedia/commons" )
wbgetclaims API
View Source
const ( Endpoint = "https://www.wikidata.org/w/api.php" FormatJson = "json" )
Variables ¶
This section is empty.
Functions ¶
func GetImage ¶
Follow the trick @ http://stackoverflow.com/questions/34393884/how-to-get-image-url-property-from-wikidata-item-by-api
func IsProperty ¶
Types ¶
type AliasList ¶
type AliasList []StringValue
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(cl utils.HTTPRequester) *Client
type DataValueObj ¶
type DataValueObj struct { Value json.RawMessage `json:"value"` Type string `json:"type"` }
type Entity ¶
type Entity struct { Pageid int `json:"pageid"` Ns int `json:"ns"` Title string `json:"title"` Lastrevid int `json:"lastrevid"` Modified time.Time `json:"modified"` Type string `json:"type"` ID string `json:"id"` Labels map[string]StringValue `json:"labels"` Descriptions map[string]StringValue `json:"descriptions"` Aliases map[string]AliasList `json:"aliases"` }
type ImageClaim ¶
type ImageClaim struct { Claims struct { P18 Claim `json:"P18"` } `json:"claims"` }
type Snak ¶
type Snak struct { Snaktype string `json:"snaktype"` Property string `json:"property"` DataValue DataValueObj `json:"datavalue"` Datatype string `json:"datatype"` }
type StringValue ¶
Click to show internal directories.
Click to hide internal directories.