Package addon provides an API for Ponzu addons to interface with the system



    View Source
    const (
    	// StatusEnabled defines string status for Addon enabled state
    	StatusEnabled = "enabled"
    	// StatusDisabled defines string status for Addon disabled state
    	StatusDisabled = "disabled"


    View Source
    var (
    	// Types is a record of addons, like content types, of addon_reverse_dns:interface{}
    	Types = make(map[string]func() interface{})


    func ContentAll

    func ContentAll(namespace string) []byte

      ContentAll retrives all items from the HTTP API within the provided namespace

      func Deregister

      func Deregister(key string) error

        Deregister removes an addon from the system. `key` is the addon_reverse_dns

        func Disable

        func Disable(key string) error

          Disable sets the addon status to `disabled`. `key` is the addon_reverse_dns

          func Enable

          func Enable(key string) error

            Enable sets the addon status to `enabled`. `key` is the addon_reverse_dns

            func Get

            func Get(endpoint string) ([]byte, error)

              Get is a helper function to make a HTTP call from an addon

              func KeyFromMeta

              func KeyFromMeta(meta Meta) (string, error)

                KeyFromMeta creates a unique string identifier for an addon based on its url and name

                func Manage

                func Manage(data []byte, reverseDNS string) ([]byte, error)

                  Manage ...

                  func Query

                  func Query(namespace string, opts QueryOptions) []byte

                    Query retrieves a set of content from the HTTP API based on options and returns the total number of content in the namespace and the content


                    type Addon

                    type Addon struct {

                      Addon contains information about a provided addon to the system

                      func Register

                      func Register(m Meta, fn func() interface{}) Addon

                        Register constructs a new addon and registers it with the system. Meta is a addon.Meta and fn is a closure returning a pointer to your own addon type

                        func (*Addon) String

                        func (a *Addon) String() string

                          String returns the addon name and overrides the item String() method in item.Identifiable interface

                          type Meta

                          type Meta struct {
                          	PonzuAddonName       string `json:"addon_name"`
                          	PonzuAddonAuthor     string `json:"addon_author"`
                          	PonzuAddonAuthorURL  string `json:"addon_author_url"`
                          	PonzuAddonVersion    string `json:"addon_version"`
                          	PonzuAddonReverseDNS string `json:"addon_reverse_dns"`
                          	PonzuAddonStatus     string `json:"addon_status"`

                            Meta contains the basic information about the addon

                            type QueryOptions

                            type QueryOptions db.QueryOptions

                              QueryOptions is a mirror of the same struct in db package and are re-declared here only to make the API simpler for the caller