getui v2 api sdk
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)
}