Skip to content

Commit 117fe93

Browse files
authored
fix: add v5.8.1 package updates (#102)
Channels: Current ### 🐛 Bug Fixes - fix: bump golang.org/x/oauth2 to v0.27.0; this raises the minimum Go version to 1.23
2 parents cee45ce + bfd1f47 commit 117fe93

5 files changed

Lines changed: 78 additions & 86 deletions

File tree

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com
44

55
- API version: 5.8.0
6-
- Package version: 5.8.0
6+
- Package version: 5.8.1
77

88
## Installation
99

@@ -21,7 +21,7 @@ Every SDK requires authentication via API keys. Two key types are available:
2121
> **Warning:** Store your API keys in environment variables or a secrets manager. Never commit them to source control.
2222
2323
```go
24-
import onesignal "github.com/OneSignal/onesignal-go-api"
24+
import onesignal "github.com/OneSignal/onesignal-go-api/v5"
2525

2626
restAuth := context.WithValue(
2727
context.Background(),
@@ -42,14 +42,14 @@ apiClient := onesignal.NewAPIClient(onesignal.NewConfiguration())
4242

4343
```go
4444
notification := *onesignal.NewNotification("YOUR_APP_ID")
45-
notification.SetContents(onesignal.StringMap{En: onesignal.PtrString("Hello from OneSignal!")})
46-
notification.SetHeadings(onesignal.StringMap{En: onesignal.PtrString("Push Notification")})
45+
notification.SetContents(onesignal.LanguageStringMap{En: onesignal.PtrString("Hello from OneSignal!")})
46+
notification.SetHeadings(onesignal.LanguageStringMap{En: onesignal.PtrString("Push Notification")})
4747
notification.SetIncludedSegments([]string{"Subscribed Users"})
4848

49-
response, _, err := apiClient.DefaultApi
50-
.CreateNotification(orgAuth)
51-
.Notification(notification)
52-
.Execute()
49+
response, _, err := apiClient.DefaultApi.
50+
CreateNotification(orgAuth).
51+
Notification(notification).
52+
Execute()
5353

5454
if err != nil {
5555
log.Fatal(err)
@@ -64,27 +64,27 @@ notification := *onesignal.NewNotification("YOUR_APP_ID")
6464
notification.SetEmailSubject("Important Update")
6565
notification.SetEmailBody("<h1>Hello!</h1><p>This is an HTML email.</p>")
6666
notification.SetIncludedSegments([]string{"Subscribed Users"})
67-
notification.SetChannelForExternalUserIds("email")
67+
notification.SetTargetChannel("email")
6868

69-
response, _, err := apiClient.DefaultApi
70-
.CreateNotification(orgAuth)
71-
.Notification(notification)
72-
.Execute()
69+
response, _, err := apiClient.DefaultApi.
70+
CreateNotification(orgAuth).
71+
Notification(notification).
72+
Execute()
7373
```
7474

7575
## Send an SMS
7676

7777
```go
7878
notification := *onesignal.NewNotification("YOUR_APP_ID")
79-
notification.SetContents(onesignal.StringMap{En: onesignal.PtrString("Your SMS message content here")})
79+
notification.SetContents(onesignal.LanguageStringMap{En: onesignal.PtrString("Your SMS message content here")})
8080
notification.SetIncludedSegments([]string{"Subscribed Users"})
81-
notification.SetChannelForExternalUserIds("sms")
81+
notification.SetTargetChannel("sms")
8282
notification.SetSmsFrom("+15551234567")
8383

84-
response, _, err := apiClient.DefaultApi
85-
.CreateNotification(orgAuth)
86-
.Notification(notification)
87-
.Execute()
84+
response, _, err := apiClient.DefaultApi.
85+
CreateNotification(orgAuth).
86+
Notification(notification).
87+
Execute()
8888
```
8989

9090
## Full API reference

configuration.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)