pushbullet

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RESTAddress = url.URL{
	Scheme: "https",
	Host:   "api.pushbullet.com",
	Path:   "v2",
}
View Source
var StreamAddress = url.URL{
	Scheme: "wss",
	Host:   "stream.pushbullet.com",
	Path:   "/websocket",
}

Functions

This section is empty.

Types

type Channel

type Channel struct {
	Iden string `json:"iden"`
	Tag  string `json:"tag"`
	Name string `json:"name"`
}

type MessageHandler

type MessageHandler func(Pushbullet, string, Push)

type Push

type Push struct {
	Iden                    string   `json:"iden"`
	Active                  bool     `json:"active"`
	Created                 float32  `json:"created"`
	Modified                float32  `json:"modified"`
	Type                    PushType `json:"type"`
	Dismissed               bool     `json:"dismissed"`
	GUID                    string   `json:"guid"`
	Direction               string   `json:"direction"`
	SenderIden              string   `json:"sender_iden"`
	SenderEmail             string   `json:"sender_email"`
	SenderEmailNormalized   string   `json:"sender_email_normalized"`
	SenderName              string   `json:"sender_name"`
	ReceiverIden            string   `json:"receiver_iden"`
	ReceiverEmail           string   `json:"receiver_email"`
	ReceiverEmailNormalized string   `json:"receiver_email_normalized"`
	TargetDeviceIden        string   `json:"target_device_iden"`
	SourceDeviceIden        string   `json:"source_device_iden"`
	Body                    string   `json:"body,omitempty"`
	Title                   string   `json:"title,omitempty"`
	URL                     string   `json:"url,omitempty"`
	ChannelID               string   `json:"channel_iden,omitempty"`
	// contains filtered or unexported fields
}

func (*Push) GeneratePayload

func (push *Push) GeneratePayload() error

func (*Push) Payload

func (push *Push) Payload() string

type PushAndTag

type PushAndTag struct {
	Push
	Tag string
}

type PushType

type PushType string
const (
	PushTypeNote PushType = "note"
	PushTypeLink PushType = "link"
)

type Pushbullet

type Pushbullet struct {
	MessageHandler MessageHandler
	// contains filtered or unexported fields
}

func New

func New(apiToken string) (*Pushbullet, error)

func (*Pushbullet) Close

func (pb *Pushbullet) Close() error

func (*Pushbullet) GetChannelById

func (pb *Pushbullet) GetChannelById(id string) (*Channel, error)

func (*Pushbullet) Pushes

func (pb *Pushbullet) Pushes() ([]PushAndTag, error)

This is unlikely to receive more than one push, but not impossible which is why we return a slice

func (*Pushbullet) SetHandler

func (pb *Pushbullet) SetHandler(handler MessageHandler) *Pushbullet

type Pushes

type Pushes struct {
	Pushes []Push `json:"pushes"`
}

type StreamEvent

type StreamEvent struct {
	Type    StreamEventType    `json:"type"`
	SubType StreamEventSubtype `json:"subtype,omitempty"`
}

type StreamEventSubtype

type StreamEventSubtype string
const (
	StreamEventSubtypePush   StreamEventSubtype = "push"   // A change to the /v2/pushes resources
	StreamEventSubtypeDevice StreamEventSubtype = "device" // A change to the /v2/devices resources - not supported
)

type StreamEventType

type StreamEventType string
const (
	StreamEventTypeNOP    StreamEventType = "nop"
	StreamEventTypeTickle StreamEventType = "tickle"
	StreamEventTypePush   StreamEventType = "push"
)

type Subscription

type Subscription struct {
	Iden     string  `json:"iden"`
	Active   bool    `json:"active"`
	Created  float32 `json:"created"`
	Modified float32 `json:"modified"`
	Channel  Channel `json:"channel,omitempty"`
}

type Subscriptions

type Subscriptions struct {
	Subscriptions []Subscription `json:"subscriptions"`
}

Jump to

Keyboard shortcuts

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