Skip to content

Commit

Permalink
added onesignal stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-Nava authored Mar 8, 2024
1 parent 02b9de7 commit a0c59ef
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions lib/onesignal.go
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

View workflow job for this annotation

GitHub Actions / build (1.20.x)

missing return

Check failure on line 31 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

missing return

Check failure on line 31 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

missing return

Check failure on line 31 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

missing return


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

View workflow job for this annotation

GitHub Actions / build (1.20.x)

undefined: pinpointCfg

Check failure on line 45 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

undefined: pinpointCfg

Check failure on line 45 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

undefined: pinpointCfg

Check failure on line 45 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

undefined: pinpointCfg
if err := json.Unmarshal(cfg, &c); err != nil {

Check failure on line 46 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

undefined: json

Check failure on line 46 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.20.x)

undefined: json

Check failure on line 46 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

undefined: json

Check failure on line 46 in lib/onesignal.go

View workflow job for this annotation

GitHub Actions / build (1.21.x)

undefined: json
return nil, err
}
//
return onesignalMessenger{
cfg: c,
logger: l,
}, nil
}

0 comments on commit a0c59ef

Please sign in to comment.