forked from ebhomengo/niki
1
0
Fork 0
niki/adapter/kavenegar/send.go

28 lines
640 B
Go

package kavenegar
import (
"fmt"
"github.com/kavenegar/kavenegar-go"
)
func (a Adapter) Send(phoneNumber, message string) {
const op = "kavenegarnotification.Send"
var params *kavenegar.MessageSendParam
if _, err := a.adapter.Message.Send(a.config.Sender, []string{phoneNumber}, message, params); err != nil {
//nolint
switch err := err.(type) {
case *kavenegar.APIError:
// log error
fmt.Println(fmt.Errorf("error(%s):%w", op, err))
case *kavenegar.HTTPError:
// log error
fmt.Println(fmt.Errorf("error(%s):%w", op, err))
default:
// log error
fmt.Println(fmt.Errorf("error(%s):%w", op, err))
}
}
}