Documentation
¶
Overview ¶
Package pushnotifier provides primitives for interactiving with the pushnotifier.de API endpoints.
Index ¶
- type Client
- func (c *Client) GetDevices() error
- func (c *Client) Login(username, password string) error
- func (c *Client) RefreshToken() error
- func (c *Client) SendImage(contentFile string, devices []string, silent bool) error
- func (c *Client) SendNotification(content, contentURL string, devices []string, silent bool) error
- func (c *Client) SendText(content string, devices []string, silent bool) error
- func (c *Client) SendURL(contentURL string, devices []string, silent bool) error
- type Device
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct { APIToken string BaseURL *url.URL PackageName string UserName string AppToken string AppTokenExpiry int64 Devices []string // contains filtered or unexported fields }
Client represents a client interface to the pushnotifier.de API endpoint and the necessary tokens for interaction.
func NewClient ¶
A NewClient creates a new PushNotifier API client. It expects 3 arguments 1) a `http.Client` 2) an API token 3) a package name
Currently, the 1st argument will default to `http.DefaultClient` if no arguments are given. For more information on pushnotifier.de: https://api.pushnotifier.de/v2/doc/
func (*Client) GetDevices ¶
GetDevices get all devices a user has registered and that are available for sending.
func (*Client) Login ¶
Login is used to login on behalf of a user. Logging in means to obtain a so-called "Appp Token" which is used to identify your requests.
func (*Client) RefreshToken ¶
RefreshToken is used to refresh your obtain App Token.
func (*Client) SendNotification ¶
SendNotification sends a notification to all registered clients with content or URL.