From 08683a6b9ee95503c903f86c2aeb4f2b006357b9 Mon Sep 17 00:00:00 2001 From: allan Date: Wed, 28 Aug 2024 14:12:35 +0200 Subject: [PATCH] added launch for vscode --- .gitignore | 2 ++ .vscode/launch.json | 15 +++++++++++++++ lib/onesignal.go | 22 ++++++++++------------ 3 files changed, 27 insertions(+), 12 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.gitignore b/.gitignore index 3b735ec..f332dd8 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,5 @@ # Go workspace file go.work + +config.toml \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..608d3c6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,15 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Launch Package", + "type": "go", + "request": "launch", + "mode": "auto", + "program": "${fileDirname}" + } + ] +} \ No newline at end of file diff --git a/lib/onesignal.go b/lib/onesignal.go index ba59498..2d53719 100644 --- a/lib/onesignal.go +++ b/lib/onesignal.go @@ -3,19 +3,20 @@ package lib import ( "encoding/json" "fmt" + "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"` + AppID string `json:"app_id"` + RestAppKey string `json:"rest_api_key"` + Log bool `json:"log"` } type onesignalMessenger struct { - cfg onesignalCfg + cfg onesignalCfg logger *onelog.Logger } @@ -24,14 +25,12 @@ func (o onesignalMessenger) Name() string { return "onesignal" } - // Push sends the sms through onesignal API. func (p onesignalMessenger) Push(msg Message) error { - return nil + return nil } - func (p onesignalMessenger) Flush() error { return nil } @@ -40,10 +39,9 @@ func (p onesignalMessenger) Close() error { return nil } - // NewOneSignal creates new instance of pinpoint func NewOneSignal(cfg []byte, l *onelog.Logger) (Messenger, error) { - var c onesignalCfg + var c onesignalCfg if err := json.Unmarshal(cfg, &c); err != nil { return nil, err } @@ -51,9 +49,9 @@ func NewOneSignal(cfg []byte, l *onelog.Logger) (Messenger, error) { if c.AppID == "" { return nil, fmt.Errorf("invalid app_id") } - // - return onesignalMessenger{ + // + return onesignalMessenger{ cfg: c, logger: l, }, nil -} \ No newline at end of file +}