-
Notifications
You must be signed in to change notification settings - Fork 1
/
chromeWeb.go
77 lines (60 loc) · 1.74 KB
/
chromeWeb.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package configureservice
import (
"fmt"
"github.com/IBM/push-notifications-go-sdk/pushservicev1"
)
// GetChromewebConfiguration gets chrome web configuration
func GetChromewebConfiguration(appID string, app *pushservicev1.PushServiceV1) {
result, response, err := app.GetChromeWebConf(&pushservicev1.GetChromeWebConfOptions{
ApplicationID: &appID,
})
if err != nil {
fmt.Println(err)
}
if response.StatusCode == 200 {
fmt.Println(*result.ApiKey)
fmt.Println(*result.WebSiteURL)
}
}
// SaveChromewebConfiguration saves chrome web configuration
func SaveChromewebConfiguration(appID string, app *pushservicev1.PushServiceV1) {
apiKey := ""
webSiteURL := ""
result, response, err := app.SaveChromeWebConf(&pushservicev1.SaveChromeWebConfOptions{
ApplicationID: &appID,
ApiKey: &apiKey,
WebSiteURL: &webSiteURL,
})
if err != nil {
fmt.Println(err)
}
if response.StatusCode == 200 {
fmt.Println(*result.ApiKey)
fmt.Println(*result.WebSiteURL)
}
}
// DeleteChromewebConfiguration delete chrome web configuration
func DeleteChromewebConfiguration(appID string, app *pushservicev1.PushServiceV1) {
response, err := app.DeleteChromeWebConf(&pushservicev1.DeleteChromeWebConfOptions{
ApplicationID: &appID,
})
if err != nil {
fmt.Println(err)
}
if response.StatusCode == 204 {
fmt.Println("Deleted")
}
}
// GetWebPushServerKey gets web push server key
func GetWebPushServerKey(appID string, clientSecret string, app *pushservicev1.PushServiceV1) {
result, response, err := app.GetWebpushServerKey(&pushservicev1.GetWebpushServerKeyOptions{
ApplicationID: &appID,
ClientSecret: &clientSecret,
})
if err != nil {
fmt.Println(err)
}
if response.StatusCode == 200 {
fmt.Println(*result.WebpushServerKey)
}
}