From a0c59ef2455898272d500d590bd971941bd03c67 Mon Sep 17 00:00:00 2001 From: Allan Nava Date: Fri, 8 Mar 2024 16:55:21 +0100 Subject: [PATCH] added onesignal stuff --- lib/onesignal.go | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/lib/onesignal.go b/lib/onesignal.go index 906f59b..706a547 100644 --- a/lib/onesignal.go +++ b/lib/onesignal.go @@ -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 { + + +} + + +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 + if err := json.Unmarshal(cfg, &c); err != nil { + return nil, err + } + // + return onesignalMessenger{ + cfg: c, + logger: l, + }, nil } \ No newline at end of file