Skip to content

xiaoge200/getui

Repository files navigation

getui

getui v2 api sdk

example

package main

import (
	"context"
	"fmt"
	"strings"

	"github.com/google/uuid"
)

func main() {
	cid := "xxx" // clientId
	appid := "xxx"
	appKey := "xxx"
	masterSecret := "xxx"

	sdk := NewClient(GetuiConfig{
		AppId:        appid,
		AppKey:       appKey,
		MasterSecret: masterSecret,
	})

	ctx := context.Background()
	body := Push{
		RequestId: strings.Replace(uuid.NewString(), "-", "", -1),
		Audience: Audience{
			Cid: []string{cid},
		},
		Message: Message{
			PushMessage: PushMessage{
				Notification: &Notification{
					Title:     "title",
					Body:      "body",
					ClickType: ClickType_None,
				},
			},
		},
	}
	result, err := sdk.SinglePushByCid(ctx, body)
	if err != nil {
		panic(err)
	}
	fmt.Printf("%+v\n", result)
}

About

getui v2 api sdk

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages