feat(service): add service line

pull/41/head
Nate 4 years ago
parent e34eba00b5
commit 024b150b43

@ -13,8 +13,8 @@ import (
// Line struct holds data parsed via flags for the service
type Line struct {
ChanSecret string
ChanAccessToken string
Secret string
Token string
Message string
Receivers string
Title string
@ -28,22 +28,24 @@ func Send() *cli.Command {
return &cli.Command{
Name: "line",
Usage: "Send message to line messenger",
Description: `Line messenger uses a channel secret and a channel access token to authenticate & send messages through line to various receivers. Multiple receiver IDs can be used separated by comma ','. All configuration options are also available via environment variables.`,
UsageText: "pingme line --channelsecret '123' --channelaccesstoken '123' --msg 'some message' --receivers '123,456,789'",
Description: `Line messenger uses a channel secret and
a channel access token to authenticate & send messages
through line to various receivers.`,
UsageText: "pingme line --secret '123' --token '123' --msg 'some message' --receivers '123,456,789'",
Flags: []cli.Flag{
&cli.StringFlag{
Destination: &lineOpts.ChanSecret,
Name: "channelsecret",
Destination: &lineOpts.Secret,
Name: "secret",
Required: true,
Usage: "Channel secret.",
EnvVars: []string{"LINE_CHANNELSECRET"},
EnvVars: []string{"LINE_SECRET"},
},
&cli.StringFlag{
Destination: &lineOpts.ChanAccessToken,
Name: "channelaccesstoken",
Destination: &lineOpts.Token,
Name: "token",
Required: true,
Usage: "Channel access token.",
EnvVars: []string{"LINE_CHANNELACCESSTOKEN"},
EnvVars: []string{"LINE_TOKEN"},
},
&cli.StringFlag{
Destination: &lineOpts.Message,
@ -69,7 +71,7 @@ func Send() *cli.Command {
},
Action: func(ctx *cli.Context) error {
notifier := notify.New()
lineSvc, err := line.New(lineOpts.ChanSecret, lineOpts.ChanAccessToken)
lineSvc, err := line.New(lineOpts.Secret, lineOpts.Token)
if err != nil {
return err
}

Loading…
Cancel
Save