Documentation ¶
Index ¶
Constants ¶
const DB_TYPE = "sqlite3"
const ExtensionGetterName = "GetExtension"
ExtensionGetterName defines the function that the extension build system looks for to create new extensions. If the top level of an Extension source file does not define this function or doesn't return an Extension, then none will be loaded.
This constant is not for direct use when implementing Extension, but is only used by the core extension build system.
const Version = "0.1.0"
Please update the version when you make changes to this api package and remember to maintain the changelog.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connection ¶
type Connection interface {
HangUp() error
}
Connection is an interface for things you can hang up on when you don't care about them anymore. Extensions should never need to directly use this.
type DatabaseConnection ¶
DatabaseConnection represents the local sqlite3 database interface
func ConnectToDatabase ¶
func ConnectToDatabase(path string) (DatabaseConnection, error)
func (DatabaseConnection) HangUp ¶
func (dc DatabaseConnection) HangUp() error
func (DatabaseConnection) Init ¶
func (dc DatabaseConnection) Init()
type Extension ¶
type Extension interface { // Inject is called once per Extension when it is loaded. Extensions: // - MAY Hold onto Connections passed in the Injection // - After which they may be accessed by Callbacks // - MAY return a CallbakMap of CTCP codes mapped to Extension methods // - Extension methods MUST implement Callback // - Callbacks can only access irc.Events and whatever member variables // the specific Extension defines (such as the Injection). // - MAY return initialization errors // - If errors are returned from Inject, the Extension's callbacks will not // be registered, and will not run. Inject(Injection) (CallbackMap, []error) // Kill is called on Extensions when rebuilding Extensions or when the program closes. // It may also happen at any time whatsoever. Any Callbacks registered are unregistered // prior to calling Kill. Kill() []error // Version should return a string that represents the Extension version for debugging // and administration purposes. Human readable versions are preferred. Version() string }
Extension defines the API for jazz extensions
type FileConnection ¶
FileConnection represents the local filesystem interface
func ConnectToFile ¶
func ConnectToFile(path string) (FileConnection, error)
func (FileConnection) HangUp ¶
func (fc FileConnection) HangUp() error
type HTTPClient ¶
HTTPClient represents the HTTP interface
func ConnectToHTTP ¶
func ConnectToHTTP() (HTTPClient, error)
func (HTTPClient) HangUp ¶
func (hc HTTPClient) HangUp() error
type IRCConnection ¶
type IRCConnection struct{ *irc.Connection }
IRCConnection represents the IRC interface
func ConnectToIRC ¶
func ConnectToIRC(nick, user, server string) (IRCConnection, error)
func (IRCConnection) HangUp ¶
func (ic IRCConnection) HangUp() error
type Injection ¶
type Injection struct { FileConnection DatabaseConnection IRCConnection HTTPClient }
Injection is the struct provided to Extensions that allow them to interact with Connections. The Injection is only given to Extensions one time on initialization via the Inject method. It's up to Extensions to persist the Connections that will be used in Callbacks, or to persist the Injection entirely.