-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.go
45 lines (38 loc) · 1.15 KB
/
options.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
45
package brandalert
import (
"time"
)
// Option adds parameters to the query.
type Option func(v *brandAlertRequest)
var _ = []Option{
OptionResponseFormat("JSON"),
OptionSinceDate(time.Time{}),
OptionWithTypos(true),
OptionPunycode(true),
}
// OptionResponseFormat sets Response output format json | xml. Default: json.
func OptionResponseFormat(outputFormat string) Option {
return func(v *brandAlertRequest) {
v.ResponseFormat = outputFormat
}
}
// OptionSinceDate results in search through activities discovered since the given date.
func OptionSinceDate(date time.Time) Option {
return func(v *brandAlertRequest) {
v.SinceDate = date.Format(dateFormat)
}
}
// OptionWithTypos sets the withTypos option.
// If true, the search terms set will be enriched with their possible typos. Default: false.
func OptionWithTypos(withTypos bool) Option {
return func(v *brandAlertRequest) {
v.WithTypos = withTypos
}
}
// OptionPunycode sets the punicode option.
// If true, domain names in the response will be encoded to Punycode. Default: true.
func OptionPunycode(punycode bool) Option {
return func(v *brandAlertRequest) {
v.Punycode = punycode
}
}