amo

package
v0.0.0-...-5389757 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2015 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package amo implements a client for the addons.mozilla.org (AMO) API.

Index

Constants

View Source
const (
	APIURL     = "https://services.addons.mozilla.org/api" // AMO API URL
	APIVersion = "1.5"                                     // AMO API version
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AMOClient

type AMOClient struct {
	URL     string
	Version string
}

AMOClient represents an AMO API client.

func NewAMOClient

func NewAMOClient() *AMOClient

NewAMOClient constructs a new AMOClient using the constant URL and versions defined in this package.

func (*AMOClient) Addon

func (c *AMOClient) Addon(id uint) (*Addon, error)

Addon requests an addon description from the AMO API, parses the data, and returns a pointer to the Addon object.

func (*AMOClient) AddonByIdOrName

func (c *AMOClient) AddonByIdOrName(s string) (addon *Addon, err error)

AddonByIdOrName searches for an addon by numeric ID or name, and returns a pointer to the best match Addon object.

func (*AMOClient) Search

func (c *AMOClient) Search(s string) ([]Addon, error)

Search searches the AMO API for addons matching a particular string, and returns a slice of Addons.

type Addon

type Addon struct {
	XMLName  xml.Name `xml:"addon"   json:"-"`
	ID       uint     `xml:"id,attr" json:"id"`
	GUID     string   `xml:"guid"    json:"guid"`
	Name     string   `xml:"name"    json:"name"`
	Version  string   `xml:"version" json:"version"`
	URL      string   `xml:"install" json:"url"`
	Homepage string   `xml:"homepage" json:"homepage"`
	Summary  string   `xml:"summary" json:"summary"`
}

Addon represents a Mozilla addon.

func (*Addon) Fetch

func (a *Addon) Fetch() ([]byte, error)

Jump to

Keyboard shortcuts

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