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 ¶
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 StartLogin ¶
StartLogin calls the ilink API to generate a new QR code for WeChat login.
func TakeSession ¶
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).
Click to show internal directories.
Click to hide internal directories.