{"id":22783120,"url":"https://github.com/frontmage/xinge","last_synced_at":"2025-04-15T18:26:15.407Z","repository":{"id":57483916,"uuid":"139103033","full_name":"FrontMage/xinge","owner":"FrontMage","description":"腾讯信鸽push Golang lib","archived":false,"fork":false,"pushed_at":"2018-09-28T04:52:31.000Z","size":15,"stargazers_count":26,"open_issues_count":5,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T23:33:07.793Z","etag":null,"topics":["push","push-notifications","tencent","xinge"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FrontMage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-29T05:03:40.000Z","updated_at":"2022-10-09T13:02:33.000Z","dependencies_parsed_at":"2022-08-28T17:01:18.615Z","dependency_job_id":null,"html_url":"https://github.com/FrontMage/xinge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrontMage%2Fxinge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrontMage%2Fxinge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrontMage%2Fxinge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FrontMage%2Fxinge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FrontMage","download_url":"https://codeload.github.com/FrontMage/xinge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249127711,"owners_count":21217023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["push","push-notifications","tencent","xinge"],"created_at":"2024-12-11T22:07:05.507Z","updated_at":"2025-04-15T18:26:15.388Z","avatar_url":"https://github.com/FrontMage.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xinge\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/FrontMage/xinge)](https://goreportcard.com/report/github.com/FrontMage/xinge) \n[![GoDoc](https://godoc.org/github.com/FrontMage/xinge?status.svg)](https://godoc.org/github.com/FrontMage/xinge)\n\n腾讯信鸽push Golang lib\n\n`信鸽v3版API的简单封装`\n\n## 用法\n\n### 安装\n`$ go get github.com/FrontMage/xinge`\n\n### 安卓单账号push\n```go\nimport (\n    \"net/http\"\n    \"io/ioutil\"\n    \"encoding/json\"\n    \"fmt\"\n    \"github.com/FrontMage/xinge\"\n    \"github.com/FrontMage/xinge/req\"\n    \"github.com/FrontMage/xinge/auth\"\n)\n\nfunc main() {\n    auther := auth.Auther{AppID: \"AppID\", SecretKey: \"SecretKey\"}\n    pushReq, _ := req.NewSingleAndroidAccountPush(\"account\", \"title\", \"content\")\n    auther.Auth(pushReq)\n\n    c := \u0026http.Client{}\n    rsp, _ := c.Do(pushReq)\n    defer rsp.Body.Close()\n    body, _ := ioutil.ReadAll(rsp.Body)\n\n    r := \u0026xinge.CommonRsp{}\n    json.Unmarshal(body, r)\n    fmt.Printf(\"%+v\", r)\n}\n```\n\n### 苹果单账号push\n```go\nimport (\n    \"net/http\"\n    \"io/ioutil\"\n    \"encoding/json\"\n    \"fmt\"\n    \"github.com/FrontMage/xinge/req\"\n    \"github.com/FrontMage/xinge/auth\"\n)\n\nfunc main() {\n    auther := auth.Auther{AppID: \"AppID\", SecretKey: \"SecretKey\"}\n    pushReq, _ := req.NewSingleIOSAccountPush(\"account\", \"title\", \"content\")\n    auther.Auth(pushReq)\n\n    c := \u0026http.Client{}\n    rsp, _ := c.Do(pushReq)\n    defer rsp.Body.Close()\n    body, _ := ioutil.ReadAll(rsp.Body)\n\n    r := \u0026xinge.CommonRsp{}\n    json.Unmarshal(body, r)\n    fmt.Printf(\"%+v\", r)\n}\n```\n\n### 安卓多账号push\n```go\nauther := auth.Auther{AppID: \"AppID\", SecretKey: \"SecretKey\"}\npushReq, _ := req.NewPushReq(\n    \u0026xinge.Request{},\n    req.Platform(xinge.PlatformAndroid),\n    req.AudienceType(xinge.AdAccountList),\n    req.MessageType(xinge.MsgTypeNotify),\n    req.AccountList([]string{\"10000031\", \"10000034\"}),\n    req.PushID(\"0\"),\n    req.Message(xinge.Message{\n        Title:   \"haha\",\n        Content: \"hehe\",\n    }),\n)\nauther.Auth(pushReq)\n\nc := \u0026http.Client{}\nrsp, _ := c.Do(pushReq)\ndefer rsp.Body.Close()\nbody, _ := ioutil.ReadAll(rsp.Body)\n\nr := \u0026xinge.CommonRsp{}\njson.Unmarshal(body, r)\nfmt.Printf(\"%+v\", r)\n```\n\n### iOS多账号push\n```go\nauther := auth.Auther{AppID: \"AppID\", SecretKey: \"SecretKey\"}\npushReq, _ := req.NewPushReq(\n    \u0026xinge.Request{},\n\treq.Platform(xinge.PlatformiOS),\n\treq.EnvDev(),\n    req.AudienceType(xinge.AdAccountList),\n    req.MessageType(xinge.MsgTypeNotify),\n    req.AccountList([]string{\"10000031\", \"10000034\"}),\n    req.PushID(\"0\"),\n    req.Message(xinge.Message{\n        Title:   \"haha\",\n        Content: \"hehe\",\n    }),\n)\nauther.Auth(pushReq)\n\nc := \u0026http.Client{}\nrsp, _ := c.Do(pushReq)\ndefer rsp.Body.Close()\nbody, _ := ioutil.ReadAll(rsp.Body)\n\nr := \u0026xinge.CommonRsp{}\njson.Unmarshal(body, r)\nfmt.Printf(\"%+v\", r)\n```\n\n### 单设备push\n```go\nauther := auth.Auther{AppID: \"AppID\", SecretKey: \"SecretKey\"}\npushReq, _ := req.NewPushReq(\n    \u0026xinge.Request{},\n    req.Platform(xinge.PlatformiOS),\n    req.EnvDev(),\n    req.AudienceType(xinge.AdToken),\n    req.MessageType(xinge.MsgTypeNotify),\n    req.TokenList([]string{\"10000031\", \"10000034\"}),\n    req.PushID(\"0\"),\n    req.Message(xinge.Message{\n        Title:   \"haha\",\n        Content: \"hehe\",\n    }),\n)\nauther.Auth(pushReq)\n\nc := \u0026http.Client{}\nrsp, _ := c.Do(pushReq)\ndefer rsp.Body.Close()\nbody, _ := ioutil.ReadAll(rsp.Body)\n\nr := \u0026xinge.CommonRsp{}\njson.Unmarshal(body, r)\nfmt.Printf(\"%+v\", r)\nif r.RetCode != 0 {\n    t.Errorf(\"Failed rsp=%+v\", r)\n}\n```\n\n### 多设备push\n```go\nauther := auth.Auther{AppID: \"AppID\", SecretKey: \"SecretKey\"}\npushReq, _ := req.NewPushReq(\n    \u0026xinge.Request{},\n    req.Platform(xinge.PlatformiOS),\n    req.EnvDev(),\n    req.AudienceType(xinge.AdTokenList),\n    req.MessageType(xinge.MsgTypeNotify),\n    req.TokenList([]string{\"10000031\", \"10000034\"}),\n    req.PushID(\"0\"),\n    req.Message(xinge.Message{\n        Title:   \"haha\",\n        Content: \"hehe\",\n    }),\n)\nauther.Auth(pushReq)\n\nc := \u0026http.Client{}\nrsp, _ := c.Do(pushReq)\ndefer rsp.Body.Close()\nbody, _ := ioutil.ReadAll(rsp.Body)\n\nr := \u0026xinge.CommonRsp{}\njson.Unmarshal(body, r)\nfmt.Printf(\"%+v\", r)\nif r.RetCode != 0 {\n    t.Errorf(\"Failed rsp=%+v\", r)\n}\n```\n\n### 标签push\n```go\nauther := auth.Auther{AppID: \"AppID\", SecretKey: \"SecretKey\"}\npushReq, _ := req.NewPushReq(\n    \u0026xinge.Request{},\n    req.Platform(xinge.PlatformiOS),\n    req.EnvDev(),\n    req.AudienceType(xinge.AdTag),\n    req.MessageType(xinge.MsgTypeNotify),\n    req.TagList(\u0026xinge.TagList{\n        Tags:      []string{\"new\", \"active\"},\n        Operation: xinge.TagListOpAnd,\n    }),\n    req.PushID(\"0\"),\n    req.Message(xinge.Message{\n        Title:   \"haha\",\n        Content: \"hehe\",\n    }),\n)\nauther.Auth(pushReq)\n\nc := \u0026http.Client{}\nrsp, _ := c.Do(pushReq)\ndefer rsp.Body.Close()\nbody, _ := ioutil.ReadAll(rsp.Body)\n\nr := \u0026xinge.CommonRsp{}\njson.Unmarshal(body, r)\nfmt.Printf(\"%+v\", r)\nif r.RetCode != 0 {\n    t.Errorf(\"Failed rsp=%+v\", r)\n}\n```\n\n## 贡献代码指南\n目前的设计是通过`ReqOpt`函数来扩展各种请求参数，尽量请保持代码风格一致，使用`gofmt`来格式化代码。\n\n贡献代码时可先从项目中的`TODO`开始，同时也欢迎提交新feature的PR和bug issue。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrontmage%2Fxinge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrontmage%2Fxinge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrontmage%2Fxinge/lists"}