forked from ebhomengo/niki
28 lines
672 B
Go
28 lines
672 B
Go
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))
|
|
}
|
|
}
|
|
}
|