customerapi

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package customerapi provides an authenticated HTTP client for the XenForo Customer API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is an authenticated HTTP client for the XenForo Customer API. Concurrent refreshes are serialized within a client, and a refresh is skipped if another request has already replaced the stale token.

func NewClient

func NewClient() (*Client, error)

NewClient creates a new API client with authentication.

func (*Client) GetAccessToken

func (c *Client) GetAccessToken() (string, error)

GetAccessToken retrieves the current access token.

func (*Client) GetDownloadInfo

func (c *Client) GetDownloadInfo(ctx context.Context, licenseKey string, downloadID string, versionID int) (*DownloadInfo, error)

GetDownloadInfo retrieves download information for a specific version.

func (*Client) GetDownloadURL

func (c *Client) GetDownloadURL(licenseKey string, downloadID string, versionID int) string

GetDownloadURL returns the URL to download a specific version.

func (*Client) GetLicenseDownloadables

func (c *Client) GetLicenseDownloadables(ctx context.Context, licenseKey string) (*LicenseDownloadables, error)

GetLicenseDownloadables retrieves the downloadable products for a license.

func (*Client) GetLicenseVersions

func (c *Client) GetLicenseVersions(ctx context.Context, licenseKey string, downloadID string) (*LicenseVersions, error)

GetLicenseVersions retrieves the available versions for a product.

func (*Client) GetLicenses

func (c *Client) GetLicenses(ctx context.Context) ([]License, error)

GetLicenses retrieves all licenses for the authenticated user.

type DownloadInfo

type DownloadInfo struct {
	VersionString string `json:"version_string"`
	Filename      string `json:"filename"`
}

DownloadInfo represents information about a downloadable file.

type License

type License struct {
	LicenseKey     string         `json:"license_key"`
	ProductID      string         `json:"product_id"`
	ProductTitle   string         `json:"product_title"`
	IsValid        bool           `json:"is_valid"`
	IsActive       bool           `json:"is_active"`
	StartDate      unixTime       `json:"start_date"`
	ExpirationDate unixTime       `json:"expiration_date"`
	SiteURL        string         `json:"site_url,omitempty"`
	SiteTitle      string         `json:"site_title,omitempty"`
	CanDownload    bool           `json:"can_download"`
	Extras         []LicenseExtra `json:"extras,omitempty"`
}

License represents a XenForo customer license.

type LicenseDownloadables

type LicenseDownloadables struct {
	Downloadables []downloadable `json:"downloadables"`
}

LicenseDownloadables represents the downloadables available for a license.

type LicenseExtra

type LicenseExtra struct {
	ExtraID        string `json:"extra_id"`
	Name           string `json:"name"`
	IsDownloadable bool   `json:"is_downloadable"`
}

LicenseExtra represents an extra (add-on product) associated with a license.

type LicenseVersions

type LicenseVersions struct {
	Versions []Version `json:"versions"`
}

LicenseVersions represents the versions available for a license/download.

type Version

type Version struct {
	VersionID   int      `json:"version_id"`
	VersionStr  string   `json:"version_string"`
	ReleaseDate unixTime `json:"release_date"`
	Stable      bool     `json:"stable"`
}

Version represents a downloadable version.

Jump to

Keyboard shortcuts

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