Browse Source

Merge pull request #160 from matrix-org/rxl881/wikipedia

Comment struct fields (specifically map keys)
rxl881/google
Richard Lewis 8 years ago
committed by GitHub
parent
commit
6112d7e8d6
  1. 16
      src/github.com/matrix-org/go-neb/services/wikipedia/wikipedia.go

16
src/github.com/matrix-org/go-neb/services/wikipedia/wikipedia.go

@ -23,22 +23,22 @@ var httpClient = &http.Client{}
// Search results (returned by search query) // Search results (returned by search query)
type wikipediaSearchResults struct { type wikipediaSearchResults struct {
Query wikipediaQuery `json:"query"`
Query wikipediaQuery `json:"query"` // Containter for the query response
} }
// Wikipeda pages returned in search results // Wikipeda pages returned in search results
type wikipediaQuery struct { type wikipediaQuery struct {
Pages map[string]wikipediaPage `json:"pages"`
Pages map[string]wikipediaPage `json:"pages"` // Map of wikipedia page IDs to page objects
} }
// Representation of an individual wikipedia page // Representation of an individual wikipedia page
type wikipediaPage struct { type wikipediaPage struct {
PageID int64 `json:"pageid"`
NS int `json:"ns"`
Title string `json:"title"`
Touched string `json:"touched"`
LastRevID int64 `json:"lastrevid"`
Extract string `json:"extract"`
PageID int64 `json:"pageid"` // Unique ID for the wikipedia page
NS int `json:"ns"` // Namespace ID
Title string `json:"title"` // Page title text
Touched string `json:"touched"` // Date that the page was last touched / modified
LastRevID int64 `json:"lastrevid"` //
Extract string `json:"extract"` // Page extract text
} }
// Service contains the Config fields for the Wikipedia service. // Service contains the Config fields for the Wikipedia service.

Loading…
Cancel
Save