sati-go/tasks.go

54 lines
888 B
Go
Raw Normal View History

2023-06-28 13:56:39 +03:00
package sati
type AnyTask interface {
serialize() task
Result() any
2023-06-28 13:56:39 +03:00
}
type task struct {
Type string `json:"type"`
Data any `json:"data"`
}
type TurnstileTask struct {
SiteKey string `json:"siteKey"`
PageUrl string `json:"pageUrl"`
CData *string `json:"cData,omitempty"`
Action *string `json:"action,omitempty"`
}
func (t *TurnstileTask) serialize() task {
return task{
Type: "Turnstile",
Data: t,
}
}
func (t *TurnstileTask) Result() any {
return &TurnstileResult{}
}
2023-06-28 13:56:39 +03:00
type TurnstileResult struct {
Token string `json:"token"`
}
type ReCaptcha2Task struct {
SiteKey string `json:"siteKey"`
PageUrl string `json:"pageUrl"`
}
func (t *ReCaptcha2Task) serialize() task {
return task{
Type: "ReCaptcha2",
Data: t,
}
}
func (t *ReCaptcha2Task) Result() any {
return &ReCaptcha2Result{}
}
2023-06-28 13:56:39 +03:00
type ReCaptcha2Result struct {
Token string `json:"token"`
}