Documentation ¶
Index ¶
- type Authorization
- type Channel
- type Client
- func (c *Client) AuthorizeUpload(fileName, fileType string) (Authorization, error)
- func (c *Client) ChannelInfo(channelTag string) (channel Channel, err error)
- func (c *Client) CreateContact(name, email string) error
- func (c *Client) DeleteContact(contactID string) error
- func (c *Client) DeletePush(pushID string) error
- func (c *Client) DismissPush(ID string) error
- func (c *Client) GetContacts() (ContactList, error)
- func (c *Client) GetDevices() (DeviceList, error)
- func (c *Client) GetPushHistory(modifiedAfter time.Time) ([]PushMessage, error)
- func (c *Client) GetUser() (u User, err error)
- func (c *Client) ListSubscriptions() (subscriptions SubscriptionList, err error)
- func (c *Client) ListenForPushes(since time.Time, callback func(PushMessage)) error
- func (c *Client) SendAddress(title, name, address string) error
- func (c *Client) SendAddressToTarget(targetType, target, title, name, address string) error
- func (c *Client) SendChecklist(title string, items []string) error
- func (c *Client) SendChecklistToTarget(targetType, target, title string, items []string) error
- func (c *Client) SendFile(title string, items []string) error
- func (c *Client) SendFileToTarget(targetType, target, fileName, fileType, fileURL, body string, items []string) error
- func (c *Client) SendLink(title, body, url string) error
- func (c *Client) SendLinkToTarget(targetType, target, title, body, url string) error
- func (c *Client) SendNote(title string, body string, deviceID string) error
- func (c *Client) SendNoteToTarget(targetType string, target string, title string, body string, deviceID string) error
- func (c *Client) SubscribeChannel(channel string) error
- func (c *Client) UnsubscribeChannel(channelID string) error
- func (c *Client) UpdateContact(contactID, name string) error
- func (c *Client) UpdateList(pushID string, list ItemsList) error
- func (c *Client) UpdatePreferences(preferences Preferences) error
- type Contact
- type ContactList
- type Device
- type DeviceList
- type Error
- type Item
- type ItemsList
- type Preferences
- type PushList
- type PushMessage
- type Subscription
- type SubscriptionList
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authorization ¶
type Authorization struct { FileType string `json:"file_type"` FileName string `json:"file_name"` FileURL string `json:"file_url"` UploadURL string `json:"upload_url"` Data struct { Awsaccesskeyid string `json:"awsaccesskeyid"` Acl string `json:"acl"` Key string `json:"key"` Signature string `json:"signature"` Policy string `json:"policy"` ContentType string `json:"content-type"` } `json:"data"` }
Authorization describes a file upload authorization.
type Channel ¶
type Channel struct { ID string `json:"iden"` Tag string `json:"tag"` Name string `json:"name"` Description string `json:"description"` ImageURL string `json:"image_url"` }
Channel describes a channel on a subscription.
type Client ¶
type Client struct { APIKey string BaseURL string HTTPClient *http.Client // contains filtered or unexported fields }
Client a Pushbullet API client
func ClientWithKey ¶
ClientWithKey returns a pushbullet.Client pointer with API key.
func (*Client) AuthorizeUpload ¶
func (c *Client) AuthorizeUpload(fileName, fileType string) (Authorization, error)
AuthorizeUpload requests an authorization to upload a file
func (*Client) ChannelInfo ¶
ChannelInfo gets detained info for the requested channel
func (*Client) CreateContact ¶
CreateContact creates a new contact with the specified name and email
func (*Client) DeleteContact ¶
DeleteContact creates a new contact with the specified name and email
func (*Client) DeletePush ¶
DeletePush deletes a push message
func (*Client) DismissPush ¶
DismissPush allows for dismissal of a push message
func (*Client) GetContacts ¶
func (c *Client) GetContacts() (ContactList, error)
GetContacts obtains a list of your contacts
func (*Client) GetDevices ¶
func (c *Client) GetDevices() (DeviceList, error)
GetDevices obtains a list of registered devices from Pushbullet
func (*Client) GetPushHistory ¶
func (c *Client) GetPushHistory(modifiedAfter time.Time) ([]PushMessage, error)
GetPushHistory gets pushes modified after the provided timestamp
func (*Client) ListSubscriptions ¶
func (c *Client) ListSubscriptions() (subscriptions SubscriptionList, err error)
ListSubscriptions returns a list of channels to which the user is subscribed
func (*Client) ListenForPushes ¶
func (c *Client) ListenForPushes(since time.Time, callback func(PushMessage)) error
ListenForPushes Fires callback for each message since a time
func (*Client) SendAddress ¶
SendAddress simply sends an address type push to all of the users devices
func (*Client) SendAddressToTarget ¶
SendAddressToTarget sends an address type push to a specific device.
func (*Client) SendChecklist ¶
SendChecklist simply sends a checklist type push to all of the users devices
func (*Client) SendChecklistToTarget ¶
SendChecklistToTarget sends a checklist type push to a specific device.
func (*Client) SendFileToTarget ¶
func (c *Client) SendFileToTarget(targetType, target, fileName, fileType, fileURL, body string, items []string) error
SendFileToTarget sends a file type push to a specific device.
func (*Client) SendLinkToTarget ¶
SendLinkToTarget sends a link type push to a specific device.
func (*Client) SendNoteToTarget ¶
func (c *Client) SendNoteToTarget(targetType string, target string, title string, body string, deviceID string) error
SendNoteToTarget sends a note type push to a specific device.
func (*Client) SubscribeChannel ¶
SubscribeChannel subscribes use to a specified channel
func (*Client) UnsubscribeChannel ¶
UnsubscribeChannel unsubscribes from the specified channel
func (*Client) UpdateContact ¶
UpdateContact creates a new contact with the specified name and email
func (*Client) UpdateList ¶
UpdateList allows for updating a list type push
func (*Client) UpdatePreferences ¶
func (c *Client) UpdatePreferences(preferences Preferences) error
UpdatePreferences overwrites user preferences with specified ones
type Contact ¶
type Contact struct { ID string `json:"iden"` Name string `json:"name"` Created float32 `json:"created"` Modified float32 `json:"modified"` Email string `json:"email"` EmailNormalized string `json:"email_normalized"` Active bool `json:"active"` }
Contact describes a contact entry.
type ContactList ¶
type ContactList struct {
Contacts []Contact `json:"contacts"`
}
ContactList describes an array of contacts
type Device ¶
type Device struct { ID string `json:"iden"` PushToken string `json:"push_token"` AppVersion int `json:"app_version"` Fingerprint string `json:"fingerprint"` Active bool `json:"active"` Nickname string `json:"nickname"` Manufacturer string `json:"manufacturer"` Type string `json:"type"` Created float32 `json:"created"` Modified float32 `json:"modified"` Model string `json:"model"` Pushable bool `json:"pushable"` }
Device describes a registered device (phone, stream).
type DeviceList ¶
type DeviceList struct {
Devices []Device `json:"devices"`
}
DeviceList describes an array of devices
type Error ¶
type Error struct {
ErrorBody errorBody `json:"error"`
}
Error (any non-200 error code) contain information on the kind of error that happened.
type ItemsList ¶
type ItemsList struct {
// contains filtered or unexported fields
}
ItemsList describes a list of checklist items
type Preferences ¶
type Preferences struct { Onboarding struct { App bool `json:"app"` Friends bool `json:"friends"` Extension bool `json:"extension"` } `json:"onboarding"` Social bool `json:"social"` Cat string `json:"cat"` }
Preferences describes a set of user preferences.
type PushList ¶
type PushList struct {
Pushes []PushMessage `json:"pushes"`
}
PushList describes a list of push messages
type PushMessage ¶
type PushMessage struct { ID string `json:"iden"` // Target specific properties DeviceID string `json:"device_iden"` Email string `json:"email"` ChannelTag string `json:"channel_tag"` ClientID string `json:"client_iden"` // Type indicates the type of push message being sent Type string `json:"type"` // note, link, address, checklist, or file Title string `json:"title"` // Title is used within note, link, and checklist types Body string `json:"body"` // Body is used with link, note, or file types URL string `json:"url"` // URL is used for link types Name string `json:"name"` // Name of place used with address type Address string `json:"address"` // Address is used with address type Items []string `json:"items"` // Items are used with checklist types // The following are used with file types FileName string `json:"file_name"` FileType string `json:"file_type"` // MIME type of the file FileURL string `json:"file_url"` SourceDeviceID string `json:"source_device_iden"` // Properties for response messages Created float32 `json:"created"` Modified float32 `json:"modified"` Active bool `json:"active"` Dismissed bool `json:"dismissed"` SenderID string `json:"sender_iden"` SenderEmail string `json:"sender_email"` SenderEmailNormalized string `json:"sender_email_normalized"` ReceiverID string `json:"receiver_iden"` ReceiverEmail string `json:"receiver_email"` ReceiverEmailNormalized string `json:"receiver_email_normalized"` TargetDeviceID string `json:"target_device_iden"` // Properties of the event stream Subtype string `json:"subtype"` // push, device }
PushMessage describes a message to be sent via Pushbullet. Only one of the first 4 properties may be specified with a message being sent.
type Subscription ¶
type Subscription struct { ID string `json:"iden"` Created float32 `json:"created"` Modified float32 `json:"modified"` Active bool `json:"active"` Channel Channel `json:"channel"` }
Subscription describes a channel subscription.
type SubscriptionList ¶
type SubscriptionList struct {
Subscriptions []Subscription `json:"subscriptions"`
}
SubscriptionList describes a list of subscribed channels
type User ¶
type User struct { ID string `json:"iden"` Email string `json:"email"` EmailNormalized string `json:"email_normalized"` Created float32 `json:"created"` Modified float32 `json:"modified"` Name string `json:"name"` ImageURL string `json:"image_url"` Preferences Preferences `json:"preferences"` }
User describes the authenticated user.