Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiPageCategory ¶
type ApiPageSection ¶
type ApiParse ¶
type ApiParse struct {
PageId int `json:"pageid"`
Title string `json:"title"`
Categories []ApiPageCategory `json:"categories"`
Sections []ApiPageSection `json:"sections"`
}
type ApiQuery ¶
type ApiQuery struct {
Pages map[string]ApiPage `json:"pages"`
Search []ApiSearch `json:"search"`
SearchInfo ApiSearchInfo `json:"searchinfo"`
}
type ApiQueryContinue ¶
type ApiQueryContinue struct {
Search ApiQueryContinueSearch `json:"search"`
}
type ApiQueryContinueSearch ¶
type ApiQueryContinueSearch struct {
SrOffset int `json:"sroffset"`
}
type ApiResponse ¶
type ApiResponse struct {
Query ApiQuery `json:"query"`
QueryContinue ApiQueryContinue `json:"query-continue"`
Parse ApiParse `json:"parse"`
}
A Wikimedia API response
func (*ApiResponse) StripHtml ¶
func (a *ApiResponse) StripHtml()
Strip all HTML tags from the response
type ApiSearchInfo ¶
type ApiSearchInfo struct {
Totalhits int `json:"totalhits"`
}
type Wikimedia ¶
type Wikimedia struct {
// Full URL of the Wikimedia API, e.g. url.Parse("http://en.wikipedia.org/w/api.php")
Url *url.URL
// Automatically strip HTML tags from API responses
StripHtml bool
// HTTP client to use (defaults to http.DefaultClient)
Client *http.Client
// User-Agent header to provide
UserAgent string
// contains filtered or unexported fields
}
A Wikimedia API client
func New ¶
Set up a client that queries the specified API, e.g. http://en.wikipedia.org/w/api.php or http://da.wiktionary.org/w/api.php. Returns an error if the URL is invalid.
func (*Wikimedia) Query ¶
func (w *Wikimedia) Query(vals url.Values) (*ApiResponse, error)
Queries the Wikimedia API using the specified values, and returns an ApiResponse. See http://en.wikipedia.org/w/api.php for a reference.
Click to show internal directories.
Click to hide internal directories.