weixin

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAPIBaseURL = "https://ilinkai.weixin.qq.com"
)

Variables

This section is empty.

Functions

func ClearSession

func ClearSession(sandboxID string)

func SetSession

func SetSession(sandboxID string, s *Session)

Types

type Session

type Session struct {
	QRCode    string // opaque qrcode string for status polling
	QRCodeURL string // image URL for frontend rendering
	StartedAt time.Time
}

Session holds the state of an in-progress QR login for a single sandbox.

func GetSession

func GetSession(sandboxID string) *Session

func StartLogin

func StartLogin(ctx context.Context, apiBaseURL string) (*Session, error)

StartLogin calls the ilink API to generate a new QR code for WeChat login.

func TakeSession

func TakeSession(sandboxID string) *Session

TakeSession atomically returns and removes the session (used on confirmed).

type StatusResult

type StatusResult struct {
	Status  string `json:"status"` // "wait", "scaned", "confirmed", "expired"
	Token   string `json:"bot_token,omitempty"`
	BotID   string `json:"ilink_bot_id,omitempty"`
	BaseURL string `json:"baseurl,omitempty"`
	UserID  string `json:"ilink_user_id,omitempty"`
}

StatusResult is the parsed response from get_qrcode_status.

func PollLoginStatus

func PollLoginStatus(ctx context.Context, apiBaseURL, qrcode string) (*StatusResult, error)

PollLoginStatus long-polls the ilink API for QR code scan status. Blocks for up to ~35 seconds (server-side long-poll).

Jump to

Keyboard shortcuts

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