config

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package config provides cached access to WeChat iLink bot config.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIOpts

type APIOpts struct {
	BaseURL string
	Token   string
	Client  Provider
}

APIOpts holds the parameters needed to call getConfig.

type Cache

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

Cache provides per-user getConfig caching with TTL and exponential backoff.

func NewCache

func NewCache(opts APIOpts) *Cache

NewCache creates a new config cache.

func (*Cache) Clear

func (c *Cache) Clear()

Clear removes all cached entries.

func (*Cache) GetForUser

func (c *Cache) GetForUser(ctx context.Context, userID, contextToken string) (CachedConfig, error)

GetForUser returns the cached config for a user, fetching if necessary.

type CachedConfig

type CachedConfig struct {
	TypingTicket string
}

CachedConfig is the subset of getconfig fields we cache.

type Provider

type Provider interface {
	GetConfig(ctx context.Context, baseURL, token, userID, contextToken string) (*protocol.GetConfigResponse, error)
}

Provider describes the minimal API surface needed to fetch config.

Jump to

Keyboard shortcuts

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