26 lines
456 B
Go
26 lines
456 B
Go
package smsc
|
|
|
|
const (
|
|
UrlSMS = "https://smsc.ru/rest/send/"
|
|
)
|
|
|
|
type RequestSMS struct {
|
|
ApiKey string `json:"apikey"`
|
|
Phone string `json:"phones"`
|
|
Message string `json:"mes"`
|
|
Sender string `json:"sender,omitempty"`
|
|
}
|
|
|
|
type ResponseSMS struct {
|
|
Response
|
|
ID int `json:"id"`
|
|
Cnt int `json:"cnt"`
|
|
}
|
|
|
|
func SendSMS(req RequestSMS) (resp ResponseSMS) {
|
|
if err := requestPost(UrlSMS, req, &resp); err != nil {
|
|
resp.Error = err.Error()
|
|
}
|
|
return
|
|
}
|