quota_fetcher.go 538 B

12345678910111213141516171819
  1. package service
  2. import (
  3. "context"
  4. )
  5. // QuotaFetcher 额度获取接口,各平台实现此接口
  6. type QuotaFetcher interface {
  7. // CanFetch 检查是否可以获取此账户的额度
  8. CanFetch(account *Account) bool
  9. // FetchQuota 获取账户额度信息
  10. FetchQuota(ctx context.Context, account *Account, proxyURL string) (*QuotaResult, error)
  11. }
  12. // QuotaResult 额度获取结果
  13. type QuotaResult struct {
  14. UsageInfo *UsageInfo // 转换后的使用信息
  15. Raw map[string]any // 原始响应,可存入 account.Extra
  16. }