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

28 lines
672 B
Go
Raw Normal View History

package kavenegarnotification
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.Client().Message.Send(a.adapter.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))
}
}
}