Skip to content

Commit

Permalink
added launch for vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
allan committed Aug 28, 2024
1 parent cc4ff6b commit 08683a6
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@

# Go workspace file
go.work

config.toml
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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}"
}
]
}
22 changes: 10 additions & 12 deletions lib/onesignal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -40,20 +39,19 @@ 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
}

if c.AppID == "" {
return nil, fmt.Errorf("invalid app_id")
}
//
return onesignalMessenger{
//
return onesignalMessenger{
cfg: c,
logger: l,
}, nil
}
}

0 comments on commit 08683a6

Please sign in to comment.