Skip to content

HUAWEI Push Kit client library for Golang

License

Notifications You must be signed in to change notification settings

eljoth/go-hms-push

 
 

Repository files navigation

go-hms-push

GoDoc

This project was reworked version of Huawei demo pack.

Golang client library for APIs of the HUAWEI Push Kit server. Implemented only HTTP client.

More information on Huawei HMS Core

Getting Started

To install go-hms-push, use go get:

go get github.com/icecream78/go-hms-push

Sample Usage

Here is a simple example illustrating how to use HMS push library:

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)
}

About

HUAWEI Push Kit client library for Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%