docs: update to 1.15
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
5cced6f9fa
commit
c3db870e59
190
README.md
190
README.md
|
@ -229,19 +229,19 @@ go get -u -v github.com/appleboy/gorush
|
||||||
On linux
|
On linux
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/appleboy/gorush/releases/download/v1.14.0/gorush-v1.14.0-linux-amd64 -O gorush
|
wget https://github.com/appleboy/gorush/releases/download/v1.15.0/gorush-v1.15.0-linux-amd64 -O gorush
|
||||||
```
|
```
|
||||||
|
|
||||||
On OS X
|
On OS X
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/appleboy/gorush/releases/download/v1.14.0/gorush-v1.14.0-darwin-amd64 -O gorush
|
wget https://github.com/appleboy/gorush/releases/download/v1.15.0/gorush-v1.15.0-darwin-amd64 -O gorush
|
||||||
```
|
```
|
||||||
|
|
||||||
On Windows
|
On Windows
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
wget https://github.com/appleboy/gorush/releases/download/v1.14.0/gorush-v1.14.0-windows-amd64.exe -O gorush.exe
|
wget https://github.com/appleboy/gorush/releases/download/v1.15.0/gorush-v1.15.0-windows-amd64.exe -O gorush.exe
|
||||||
```
|
```
|
||||||
|
|
||||||
On macOS, use Homebrew.
|
On macOS, use Homebrew.
|
||||||
|
@ -1038,62 +1038,62 @@ The following example code to send single notification in Go.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/appleboy/gorush/rpc/proto"
|
"github.com/appleboy/gorush/rpc/proto"
|
||||||
|
|
||||||
structpb "github.com/golang/protobuf/ptypes/struct"
|
structpb "github.com/golang/protobuf/ptypes/struct"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
address = "localhost:9000"
|
address = "localhost:9000"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Set up a connection to the server.
|
// Set up a connection to the server.
|
||||||
conn, err := grpc.Dial(address, grpc.WithInsecure())
|
conn, err := grpc.Dial(address, grpc.WithInsecure())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("did not connect: %v", err)
|
log.Fatalf("did not connect: %v", err)
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
c := proto.NewGorushClient(conn)
|
c := proto.NewGorushClient(conn)
|
||||||
|
|
||||||
r, err := c.Send(context.Background(), &proto.NotificationRequest{
|
r, err := c.Send(context.Background(), &proto.NotificationRequest{
|
||||||
Platform: 2,
|
Platform: 2,
|
||||||
Tokens: []string{"1234567890"},
|
Tokens: []string{"1234567890"},
|
||||||
Message: "test message",
|
Message: "test message",
|
||||||
Badge: 1,
|
Badge: 1,
|
||||||
Category: "test",
|
Category: "test",
|
||||||
Sound: "test",
|
Sound: "test",
|
||||||
Priority: proto.NotificationRequest_HIGH,
|
Priority: proto.NotificationRequest_HIGH,
|
||||||
Alert: &proto.Alert{
|
Alert: &proto.Alert{
|
||||||
Title: "Test Title",
|
Title: "Test Title",
|
||||||
Body: "Test Alert Body",
|
Body: "Test Alert Body",
|
||||||
Subtitle: "Test Alert Sub Title",
|
Subtitle: "Test Alert Sub Title",
|
||||||
LocKey: "Test loc key",
|
LocKey: "Test loc key",
|
||||||
LocArgs: []string{"test", "test"},
|
LocArgs: []string{"test", "test"},
|
||||||
},
|
},
|
||||||
Data: &structpb.Struct{
|
Data: &structpb.Struct{
|
||||||
Fields: map[string]*structpb.Value{
|
Fields: map[string]*structpb.Value{
|
||||||
"key1": {
|
"key1": {
|
||||||
Kind: &structpb.Value_StringValue{StringValue: "welcome"},
|
Kind: &structpb.Value_StringValue{StringValue: "welcome"},
|
||||||
},
|
},
|
||||||
"key2": {
|
"key2": {
|
||||||
Kind: &structpb.Value_NumberValue{NumberValue: 2},
|
Kind: &structpb.Value_NumberValue{NumberValue: 2},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("could not greet: ", err)
|
log.Println("could not greet: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if r != nil {
|
if r != nil {
|
||||||
log.Printf("Success: %t\n", r.Success)
|
log.Printf("Success: %t\n", r.Success)
|
||||||
log.Printf("Count: %d\n", r.Counts)
|
log.Printf("Count: %d\n", r.Counts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1143,62 +1143,62 @@ GRPC Health Checking example: See [document](https://github.com/grpc/grpc/blob/m
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/appleboy/gorush/rpc/proto"
|
"github.com/appleboy/gorush/rpc/proto"
|
||||||
|
|
||||||
structpb "github.com/golang/protobuf/ptypes/struct"
|
structpb "github.com/golang/protobuf/ptypes/struct"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
address = "localhost:9000"
|
address = "localhost:9000"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Set up a connection to the server.
|
// Set up a connection to the server.
|
||||||
conn, err := grpc.Dial(address, grpc.WithInsecure())
|
conn, err := grpc.Dial(address, grpc.WithInsecure())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("did not connect: %v", err)
|
log.Fatalf("did not connect: %v", err)
|
||||||
}
|
}
|
||||||
defer conn.Close()
|
defer conn.Close()
|
||||||
c := proto.NewGorushClient(conn)
|
c := proto.NewGorushClient(conn)
|
||||||
|
|
||||||
r, err := c.Send(context.Background(), &proto.NotificationRequest{
|
r, err := c.Send(context.Background(), &proto.NotificationRequest{
|
||||||
Platform: 2,
|
Platform: 2,
|
||||||
Tokens: []string{"1234567890"},
|
Tokens: []string{"1234567890"},
|
||||||
Message: "test message",
|
Message: "test message",
|
||||||
Badge: 1,
|
Badge: 1,
|
||||||
Category: "test",
|
Category: "test",
|
||||||
Sound: "test",
|
Sound: "test",
|
||||||
Priority: proto.NotificationRequest_HIGH,
|
Priority: proto.NotificationRequest_HIGH,
|
||||||
Alert: &proto.Alert{
|
Alert: &proto.Alert{
|
||||||
Title: "Test Title",
|
Title: "Test Title",
|
||||||
Body: "Test Alert Body",
|
Body: "Test Alert Body",
|
||||||
Subtitle: "Test Alert Sub Title",
|
Subtitle: "Test Alert Sub Title",
|
||||||
LocKey: "Test loc key",
|
LocKey: "Test loc key",
|
||||||
LocArgs: []string{"test", "test"},
|
LocArgs: []string{"test", "test"},
|
||||||
},
|
},
|
||||||
Data: &structpb.Struct{
|
Data: &structpb.Struct{
|
||||||
Fields: map[string]*structpb.Value{
|
Fields: map[string]*structpb.Value{
|
||||||
"key1": {
|
"key1": {
|
||||||
Kind: &structpb.Value_StringValue{StringValue: "welcome"},
|
Kind: &structpb.Value_StringValue{StringValue: "welcome"},
|
||||||
},
|
},
|
||||||
"key2": {
|
"key2": {
|
||||||
Kind: &structpb.Value_NumberValue{NumberValue: 2},
|
Kind: &structpb.Value_NumberValue{NumberValue: 2},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("could not greet: ", err)
|
log.Println("could not greet: ", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if r != nil {
|
if r != nil {
|
||||||
log.Printf("Success: %t\n", r.Success)
|
log.Printf("Success: %t\n", r.Success)
|
||||||
log.Printf("Count: %d\n", r.Counts)
|
log.Printf("Count: %d\n", r.Counts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue