forked from mitsuse/pushbullet-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pushbullet.go
53 lines (41 loc) · 1.13 KB
/
pushbullet.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
Package "pushbullet" provides interfaces for Pushbullet HTTP API.
Pushbullet is a web service,
which makes your devices work better together by allowing you to move things between them easily.
The official url: https://www.pushbullet.com/
Currently, this package supports only "pushes" except file.
See the API documentation for the details: https://docs.pushbullet.com/#http
*/
package pushbullet
import (
"net/http"
)
type Pushbullet struct {
client *http.Client
token string
}
/*
Create a client to call Pushbullet HTTP API.
This requires the access token.
The token is found in account settings.
Account settings: https://www.pushbullet.com/account
*/
func New(token string) *Pushbullet {
return NewClient(token, http.DefaultClient)
}
/*
Create a client to call Pushbullet HTTP API.
This requires the access token and an aribitary *http.Client.
The token is found in account settings.
Account settings: https://www.pushbullet.com/account
*/
func NewClient(token string, c *http.Client) *Pushbullet {
pb := &Pushbullet{
token: token,
client: c,
}
return pb
}
func (pb *Pushbullet) Client() *http.Client {
return pb.client
}