Documentation ¶
Overview ¶
Package golfram provides a go interface with the wolfram alpha api
Index ¶
Constants ¶
const (
DefaultURL string = "http://api.wolframalpha.com/v2/query"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Assumption ¶
type Client ¶
type Client struct { AppID string Results []*Queryresult WolframURL string // contains filtered or unexported fields }
Client that connects to the wolfram api
func (*Client) GetImage ¶
func (c *Client) GetImage(result *Queryresult, title string, subpod int, filename string) (string, error)
Downloads image from subpod at given index of pod in given result with given title Most cases will want to use result.GetPlot instead
type Img ¶
type Img struct { Src string `xml:"src,attr"` Width string `xml:"width,attr"` Height string `xml:"height,attr"` }
Image in subpod Src: Url of image
type Pod ¶
type Pod struct { Error string `xml:"error,attr"` Id string `xml:"id,attr"` Title string `xml:"title,attr"` Numsubpods int `xml:"numsubpods,attr"` Subpod []*Subpod `xml:"subpod"` }
Pod generated by wolfram for the query Contains subpods, and title of the pod
type Queryresult ¶
type Queryresult struct { Input string Success string `xml:"success,attr"` Error string `xml:"error,attr"` Numpods int `xml:"numpods,attr"` Datatypes string `xml:"datatypes,attr"` Pod []*Pod `xml:"pod"` Podtitles []string Assumptions []*Assumption `xml:"assumptions>assumption"` Sources []*Source `xml:"sources>source"` }
Result of query Input: query string Success Error Datatypes: types of pods returned Pod[]: array of pods returned Podtitles[]: array of titles of pods(not to be used externally instead use result.GetPodByTitle(title)
func (*Queryresult) GenerateTitles ¶
func (r *Queryresult) GenerateTitles() *Queryresult
Not to be used externally called when result is being unmarshalled in NewQuery Generates the Podtitles array of the Queryresult
func (*Queryresult) GetPodByTitle ¶
func (r *Queryresult) GetPodByTitle(title string) (*Pod, error)
Returns pod with given title Used to find which pod contains plots
func (*Queryresult) String ¶
func (r *Queryresult) String() string