Skip to content
/ jpush Public

极光推送go客户端,支持定时推送,推送,设备标签别名更改等

Notifications You must be signed in to change notification settings

zwczou/jpush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

极光推送Golang客户端

目前支持

  • Push API v3
  • Schedule API v3
  • Device API v3

安装

go get github.com/zwczou/jpush

使用

  1. 初始化客户端
    client := jpush.New("key", "secret")
  1. 获取推送唯一标识符 cid
    cidList, err = client.PushCid(1, "push")
  1. 推送消息
    payload := &jpush.Payload{
        Platform: jpush.NewPlatform().All(),
        Audience: jpush.NewAudience().All().SetTag("abc", "ef").SetTagAnd("filmtest"),
        Notification: &jpush.Notification{
            Alert: "test",
        },
        Options: &jpush.Options{
             TimeLive:       60,
             ApnsProduction: false,
        },
    }
    msgId, err = client.Push(payload)
    // msgId, err = client.PushValidate(payload)
  1. 创建计划任务
    client.ScheduleCreate
  1. 方便扩展

如果库没有实现你想使用的方法,可以使用client.Do扩展

// 获取任务的所有msg_id
var out struct {
  MsgIds []struct {
    MsgId string `json:"msg_id"`
  } `json:"msgids"`
}
err := client.Do(http.MethodGet, "/schedules/"+scheduleId+"/msg_ids", nil, &out)

About

极光推送go客户端,支持定时推送,推送,设备标签别名更改等

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy