addon

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: BSD-3-Clause Imports: 16 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

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

Index

Constants

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

Variables

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

Functions

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

Types

type Addon

type Addon struct {
	item.Item
	Meta
}

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

Jump to

Keyboard shortcuts

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