core

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticationRequest

type AuthenticationRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

AuthenticationRequest is a request to authenticate

type AuthenticationResponse

type AuthenticationResponse struct {
	Token      string
	ValidUntil time.Time
}

AuthenticationResponse is the response to our AuthenticationRequest

type ConnectLinkAPI

type ConnectLinkAPI struct {
	ServerURL  string
	APIVersion string
	APIPath    string
	Username   string
	Password   string
	// contains filtered or unexported fields
}

ConnectLinkAPI encapsulates all API related code

func NewConnectLinkAPI

func NewConnectLinkAPI(serverURL, username, password string) *ConnectLinkAPI

NewConnectLinkAPI instance with the specified server and credentials

func (*ConnectLinkAPI) Authenticate

func (api *ConnectLinkAPI) Authenticate() (*AuthenticationResponse, error)

Authenticate with Connect Link to retrieve a new token

func (*ConnectLinkAPI) CreateWebhook

func (api *ConnectLinkAPI) CreateWebhook(installationID int, endpoint, token string) (string, error)

CreateWebhook creates a new webhook

func (*ConnectLinkAPI) DeleteWebhook

func (api *ConnectLinkAPI) DeleteWebhook(installationID, webhookID int) (string, error)

DeleteWebhook deletes the specified webhook

func (*ConnectLinkAPI) FetchAlerts

func (api *ConnectLinkAPI) FetchAlerts(installationID int) (string, error)

FetchAlerts fetches an up-to-date list of alerts for the specified installationID

func (*ConnectLinkAPI) FetchElements

func (api *ConnectLinkAPI) FetchElements(installationID, zoneID int) (string, error)

FetchElements fetches an up-to-date list of elements for the specified installationID and zoneID

func (*ConnectLinkAPI) FetchInstallations

func (api *ConnectLinkAPI) FetchInstallations() (string, error)

FetchInstallations fetches an up-to-date list of installations

func (*ConnectLinkAPI) FetchWebhook

func (api *ConnectLinkAPI) FetchWebhook(installationID, webhookID int) (string, error)

FetchWebhook fetches info about a specific webhook

func (*ConnectLinkAPI) FetchWebhooks

func (api *ConnectLinkAPI) FetchWebhooks(installationID int) (string, error)

FetchWebhooks fetches an up-to-date list of your webhooks for the installation

func (*ConnectLinkAPI) FetchZones

func (api *ConnectLinkAPI) FetchZones(installationID int) (string, error)

FetchZones fetches an up-to-date list of zones for the specified installationID

func (*ConnectLinkAPI) Ping

func (api *ConnectLinkAPI) Ping() (string, error)

Ping the server and validate authentication is working properly

func (*ConnectLinkAPI) RefreshToken

func (api *ConnectLinkAPI) RefreshToken() error

RefreshToken generates a new token with Connect Link when necessary

func (*ConnectLinkAPI) TestWebhook

func (api *ConnectLinkAPI) TestWebhook(installationID, webhookID int) (string, error)

TestWebhook requests a test event to be fired for this webhook

type PingResponse

type PingResponse struct {
	Response string
}

PingResponse containing, hopefully, a PONG

type WebhookRequest

type WebhookRequest struct {
	Endpoint string `json:"endpoint"`
	Token    string `json:"token"`
}

WebhookRequest is used when creating a new webhook

Jump to

Keyboard shortcuts

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