-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,54 @@ | ||
package lib | ||
|
||
import ( | ||
|
||
"github.com/francoispqt/onelog" | ||
) | ||
|
||
// https://documentation.onesignal.com/reference/create-notification#sms-content | ||
|
||
type onesignalCfg struct { | ||
AppID string `json:"app_id"` | ||
RestAppKey string `json:"rest_api_key"` | ||
Log bool `json:"log"` | ||
} | ||
|
||
type onesignalMessenger struct { | ||
cfg onesignalCfg | ||
|
||
logger *onelog.Logger | ||
} | ||
|
||
func (o onesignalMessenger) Name() string { | ||
return "onesignal" | ||
} | ||
|
||
|
||
// Push sends the sms through onesignal API. | ||
func (p onesignalMessenger) Push(msg Message) error { | ||
|
||
|
||
} | ||
Check failure on line 31 in lib/onesignal.go GitHub Actions / build (1.20.x)
Check failure on line 31 in lib/onesignal.go GitHub Actions / build (1.20.x)
Check failure on line 31 in lib/onesignal.go GitHub Actions / build (1.21.x)
|
||
|
||
|
||
func (p onesignalMessenger) Flush() error { | ||
return nil | ||
} | ||
|
||
func (p onesignalMessenger) Close() error { | ||
return nil | ||
} | ||
|
||
|
||
// NewOneSignal creates new instance of pinpoint | ||
func NewOneSignal(cfg []byte, l *onelog.Logger) (Messenger, error) { | ||
var c pinpointCfg | ||
Check failure on line 45 in lib/onesignal.go GitHub Actions / build (1.20.x)
Check failure on line 45 in lib/onesignal.go GitHub Actions / build (1.20.x)
Check failure on line 45 in lib/onesignal.go GitHub Actions / build (1.21.x)
|
||
if err := json.Unmarshal(cfg, &c); err != nil { | ||
Check failure on line 46 in lib/onesignal.go GitHub Actions / build (1.20.x)
Check failure on line 46 in lib/onesignal.go GitHub Actions / build (1.20.x)
Check failure on line 46 in lib/onesignal.go GitHub Actions / build (1.21.x)
|
||
return nil, err | ||
} | ||
// | ||
return onesignalMessenger{ | ||
cfg: c, | ||
logger: l, | ||
}, nil | ||
} |