wiki

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client fetches and decodes Wikipedia page into Page

func NewClient

func NewClient(url string) *Client

NewClient initializes Wiki client with given base url url parameter must be fully qualified HTTP URL without path or query parameters, example: https://www.somepage.io

func (*Client) GetPage

func (c *Client) GetPage(pageID string) (*Page, error)

GetPage Fetches and decodes wikipedia page with given page ID Will return error when request fails or response is not Wikipedia page When err is nil, resp always contains a non-nil Page.Text

type Page

type Page struct {
	Text string `xml:"revision>text" binding:"required,max=255,min=1"`
}

Page represents 'page' xml element contents for exported Wikipedia page 'page' child elements which not required for parsing operation are omitted

Jump to

Keyboard shortcuts

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