https://github.com/icecream78/go-hms-push
HUAWEI Push Kit client library for Golang
https://github.com/icecream78/go-hms-push
golang hms huawei push push-notification-android push-notification-server push-notifications sendmessage
Last synced: 4 months ago
JSON representation
HUAWEI Push Kit client library for Golang
- Host: GitHub
- URL: https://github.com/icecream78/go-hms-push
- Owner: icecream78
- License: mit
- Created: 2020-08-25T17:38:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-10-15T17:29:38.000Z (over 3 years ago)
- Last Synced: 2024-11-14T21:13:07.735Z (over 1 year ago)
- Topics: golang, hms, huawei, push, push-notification-android, push-notification-server, push-notifications, sendmessage
- Language: Go
- Homepage:
- Size: 60.5 KB
- Stars: 6
- Watchers: 3
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-hms-push
[](https://godoc.org/github.com/icecream78/go-hms-push)
This project was reworked version of [Huawei demo pack](https://github.com/HMS-Core/hms-push-serverdemo-go).
Golang client library for APIs of the HUAWEI Push Kit server. Implemented only [HTTP client](https://developer.huawei.com/consumer/en/doc/development/HMS-References/push-sendapi#h1-1576155232538).
More information on [Huawei HMS Core](https://developer.huawei.com/consumer/en/doc/overview/HMS-4-0)
## Getting Started
To install go-hms-push, use `go get`:
```bash
go get github.com/icecream78/go-hms-push
```
## Sample Usage
Here is a simple example illustrating how to use HMS push library:
```go
package main
import (
"context"
"log"
hms "github.com/icecream78/go-hms-push"
)
const (
appId string = "xxxxxx"
appSecret string = "xxxxxx"
clientToken string = "xxxxxx"
)
func main() {
client, err := hms.NewHuaweiClient(appId, appSecret)
if err != nil {
log.Fatal(err)
}
msg := hms.GetDefaultAndroidNotificationMessage([]string{clientToken})
resp, err := client.SendMessage(context.Background(), msg)
if err != nil {
log.Fatal(err)
}
log.Printf("%#v\n", resp)
}
```