-
Notifications
You must be signed in to change notification settings - Fork 0
/
dto.go
59 lines (47 loc) · 1.04 KB
/
dto.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package rucaptcha
import "fmt"
type SolveIn interface {
Method() string
}
type SolveOut struct {
ID string
Answer string
}
type YandexSmartCaptchaIn struct {
SiteKey string `url:"sitekey" validate:"required"`
PageURL string `url:"pageurl" validate:"required"`
AccessControlAllowOrigin bool `url:"header_acao,omitempty"`
UserAgent string `url:"userAgent,omitempty"`
Proxy string `url:"proxy,omitempty"`
ProxyType string `url:"proxytype,omitempty"`
}
func (in *YandexSmartCaptchaIn) Method() string {
return "yandex"
}
type resIn interface {
action() string
}
type resGetIn struct {
ID string `url:"id"`
}
func (in *resGetIn) action() string {
return "get"
}
type resReportIn struct {
ID string `url:"id"`
ok bool
}
func (in *resReportIn) action() string {
if in.ok {
return "reportgood"
} else {
return "reportbad"
}
}
type Error struct {
Code string
Text string
}
func (e Error) Error() string {
return fmt.Sprintf("%s: %s", e.Code, e.Text)
}