Documentation
¶
Index ¶
- Constants
- func SaveRateLimitState(state *RateLimitState) error
- type CacheReader
- func (r *CacheReader) Close() error
- func (r *CacheReader) GetNexusFileInfo(gameDomain string, modID int64, fileID int64) (*dbc.GetNexusFileInfoRow, error)
- func (r *CacheReader) GetNexusFileInfoFetchedAt(gameDomain string, modID int64) (string, error)
- func (r *CacheReader) GetNexusFileUpdateChain(gameDomain string, modID int64) ([]dbc.GetNexusFileUpdateChainRow, error)
- func (r *CacheReader) GetNexusModInfo(gameDomain string, modID int64) (*dbc.NexusModInfo, error)
- type Client
- func (c *Client) GetMod(gameDomain string, modID int) (*ModInfo, error)
- func (c *Client) GetModCached(gameDomain string, modID int) (*ModInfo, error)
- func (c *Client) GetModFiles(gameDomain string, modID int) (*ModFilesResponse, error)
- func (c *Client) GetModFilesCached(gameDomain string, modID int) (*ModFilesResponse, error)
- func (c *Client) RateLimitState() (*RateLimitState, error)
- type FileUpdateInfo
- type ModFileInfo
- type ModFilesResponse
- type ModInfo
- type RateLimitState
Constants ¶
View Source
const ( ModInfoTTL = 7 * 24 * time.Hour ModFilesTTL = 24 * time.Hour )
Variables ¶
This section is empty.
Functions ¶
func SaveRateLimitState ¶
func SaveRateLimitState(state *RateLimitState) error
Types ¶
type CacheReader ¶
type CacheReader struct {
// contains filtered or unexported fields
}
CacheReader provides read-only access to the Nexus cache DB. Use this when you need cache data but don't need to make API calls.
func NewCacheReader ¶
func (*CacheReader) Close ¶
func (r *CacheReader) Close() error
func (*CacheReader) GetNexusFileInfo ¶
func (r *CacheReader) GetNexusFileInfo(gameDomain string, modID int64, fileID int64) (*dbc.GetNexusFileInfoRow, error)
func (*CacheReader) GetNexusFileInfoFetchedAt ¶
func (r *CacheReader) GetNexusFileInfoFetchedAt(gameDomain string, modID int64) (string, error)
func (*CacheReader) GetNexusFileUpdateChain ¶
func (r *CacheReader) GetNexusFileUpdateChain(gameDomain string, modID int64) ([]dbc.GetNexusFileUpdateChainRow, error)
func (*CacheReader) GetNexusModInfo ¶
func (r *CacheReader) GetNexusModInfo(gameDomain string, modID int64) (*dbc.NexusModInfo, error)
type Client ¶
type Client struct {
CacheReader
// contains filtered or unexported fields
}
func (*Client) GetModCached ¶
func (*Client) GetModFiles ¶
func (c *Client) GetModFiles(gameDomain string, modID int) (*ModFilesResponse, error)
func (*Client) GetModFilesCached ¶
func (c *Client) GetModFilesCached(gameDomain string, modID int) (*ModFilesResponse, error)
func (*Client) RateLimitState ¶
func (c *Client) RateLimitState() (*RateLimitState, error)
type FileUpdateInfo ¶
type ModFileInfo ¶
type ModFileInfo struct {
FileID int `json:"file_id"`
Name string `json:"name"`
Version string `json:"version"`
CategoryName string `json:"category_name"`
IsPrimary bool `json:"is_primary"`
FileName string `json:"file_name"`
SizeInBytes int64 `json:"size_in_bytes"`
UploadedTimestamp int64 `json:"uploaded_timestamp"`
}
type ModFilesResponse ¶
type ModFilesResponse struct {
Files []ModFileInfo `json:"files"`
FileUpdates []FileUpdateInfo `json:"file_updates"`
RawJSON []byte `json:"-"`
}
ModFilesResponse represents the fields we care about from /v1/games/{domain}/mods/{id}/files.json
type ModInfo ¶
type ModInfo struct {
ModID int `json:"mod_id"`
Name string `json:"name"`
Summary string `json:"summary"`
Author string `json:"author"`
DomainName string `json:"domain_name"`
Version string `json:"version"`
IsAvailable bool `json:"available"`
RawJSON []byte `json:"-"`
}
ModInfo represents the fields we care about from /v1/games/{domain}/mods/{id}.json
type RateLimitState ¶
type RateLimitState struct {
HourlyLimit int `json:"hourly_limit"`
HourlyRemaining int `json:"hourly_remaining"`
HourlyReset time.Time `json:"hourly_reset"`
DailyLimit int `json:"daily_limit"`
DailyRemaining int `json:"daily_remaining"`
DailyReset time.Time `json:"daily_reset"`
}
func LoadRateLimitState ¶
func LoadRateLimitState() (*RateLimitState, error)
func (*RateLimitState) EffectiveRemaining ¶
func (r *RateLimitState) EffectiveRemaining() (hourly, daily int)
EffectiveRemaining returns the remaining counts, treating expired windows as fully refreshed
Click to show internal directories.
Click to hide internal directories.