api

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(cookie string, timeout time.Duration, options ...ClientOption) *Client

func (*Client) CreateQRLogin added in v0.2.0

func (c *Client) CreateQRLogin(ctx context.Context) (QRLoginChallenge, error)

func (*Client) PollQRLogin added in v0.2.0

func (c *Client) PollQRLogin(ctx context.Context, token string) (QRLoginResult, error)

func (*Client) SearchGames

func (c *Client) SearchGames(ctx context.Context, query Query) (json.RawMessage, error)

func (*Client) SearchGeneral

func (c *Client) SearchGeneral(ctx context.Context, query Query) (json.RawMessage, error)

func (*Client) SearchTopics

func (c *Client) SearchTopics(ctx context.Context, query Query) (json.RawMessage, error)

type ClientOption

type ClientOption func(*Client)

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

func WithClock

func WithClock(clock func() time.Time) ClientOption

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) ClientOption

type Error

type Error struct {
	Kind       ErrorKind
	Message    string
	StatusCode int
	Cause      error
}

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorKind

type ErrorKind string
const (
	ErrorAuth         ErrorKind = "auth"
	ErrorCaptcha      ErrorKind = "captcha"
	ErrorRateLimit    ErrorKind = "rate_limit"
	ErrorNetwork      ErrorKind = "network"
	ErrorUpstream     ErrorKind = "upstream"
	ErrorIncompatible ErrorKind = "incompatible"
)

func Kind

func Kind(err error) ErrorKind

type QRLoginChallenge added in v0.2.0

type QRLoginChallenge struct {
	URL       string
	Token     string
	ExpiresIn time.Duration
}

type QRLoginResult added in v0.2.0

type QRLoginResult struct {
	State        QRLoginState
	Message      string
	HeyboxID     string
	PKey         string
	ExpireAt     string
	XXHHHeyboxID string
}

type QRLoginState added in v0.2.0

type QRLoginState string
const (
	QRLoginWaiting   QRLoginState = "waiting"
	QRLoginScanned   QRLoginState = "scanned"
	QRLoginSucceeded QRLoginState = "succeeded"
	QRLoginExpired   QRLoginState = "expired"
)

type Query

type Query struct {
	Keyword string
	Type    string
	Sort    string
	Offset  int
	Limit   int
}

type Response

type Response struct {
	Status string          `json:"status"`
	Msg    string          `json:"msg"`
	Result json.RawMessage `json:"result"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL