-
Notifications
You must be signed in to change notification settings - Fork 6
/
interfaces.go
44 lines (38 loc) · 1.08 KB
/
interfaces.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
//go:generate mockgen -source=interfaces.go -destination=gsms_mock.go -package=gsms
package gsms
type Gateway interface {
// Name Get gateway name
Name() string
// Send a short message
Send(to *PhoneNumber, message Message, config *Config) error
}
// Message interface.
type Message interface {
// Gateways Supported gateways.
Gateways() ([]string, error)
// Strategy Message strategy.
Strategy() (Strategy, error)
// GetContent Get message content.
GetContent(gateway Gateway) (string, error)
// GetTemplate Get message template.
GetTemplate(gateway Gateway) (string, error)
// GetData Get message data.
GetData(gateway Gateway) (map[string]string, error)
// GetType Get message type.
GetType(gateway Gateway) (string, error)
}
type Strategy interface {
// Apply the strategy and return result.
Apply(gateways []string) []string
}
// LogLevel log level
type LogLevel int
type Logger interface {
LogMode(LogLevel) Logger
Info(...interface{})
Infof(string, ...interface{})
Warn(...interface{})
Warnf(string, ...interface{})
Error(...interface{})
Errorf(string, ...interface{})
}