api

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// ReleasePageURL is the URL users can visit to download
	ReleasePageURL = "https://github.com/shinokada/tera/releases/latest"
)

Variables

This section is empty.

Functions

func CompareVersions added in v1.1.0

func CompareVersions(v1, v2 string) int

CompareVersions compares two version strings Returns: -1 if v1 < v2, 0 if v1 == v2, 1 if v1 > v2

func IsNewerVersion added in v1.1.0

func IsNewerVersion(currentVersion, latestVersion string) bool

IsNewerVersion checks if latestVersion is newer than currentVersion

Types

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Search

func (c *Client) Search(ctx context.Context, params SearchParams) ([]Station, error)

Search performs a search based on the given parameters

func (*Client) SearchAdvanced

func (c *Client) SearchAdvanced(ctx context.Context, params SearchParams) ([]Station, error)

SearchAdvanced performs an advanced search with multiple criteria

func (*Client) SearchByCountry

func (c *Client) SearchByCountry(ctx context.Context, country string) ([]Station, error)

SearchByCountry searches for stations by country code

func (*Client) SearchByLanguage

func (c *Client) SearchByLanguage(ctx context.Context, language string) ([]Station, error)

SearchByLanguage searches for stations by language

func (*Client) SearchByName

func (c *Client) SearchByName(ctx context.Context, name string) ([]Station, error)

SearchByName searches for stations by name

func (*Client) SearchByState

func (c *Client) SearchByState(ctx context.Context, state string) ([]Station, error)

SearchByState searches for stations by state

func (*Client) SearchByTag

func (c *Client) SearchByTag(ctx context.Context, tag string) ([]Station, error)

func (*Client) Vote

func (c *Client) Vote(ctx context.Context, stationUUID string) (*VoteResult, error)

Vote increases the vote count for a station by one Note: Can only vote once per IP per station every 10 minutes

type InstallInfo added in v1.3.0

type InstallInfo struct {
	Method        InstallMethod
	UpdateCommand string
	Description   string
}

InstallInfo contains information about the installation

func DetectInstallMethod added in v1.3.0

func DetectInstallMethod() InstallInfo

DetectInstallMethod detects how tera was installed

type InstallMethod added in v1.3.0

type InstallMethod int

InstallMethod represents how tera was installed

const (
	InstallMethodUnknown InstallMethod = iota
	InstallMethodHomebrew
	InstallMethodGo
	InstallMethodScoop
	InstallMethodWinget
	InstallMethodAPT
	InstallMethodRPM
	InstallMethodManual
)

type ReleaseInfo added in v1.1.0

type ReleaseInfo struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	HTMLURL     string    `json:"html_url"`
	PublishedAt time.Time `json:"published_at"`
	Body        string    `json:"body"`
}

ReleaseInfo contains information about a GitHub release

type SearchParams

type SearchParams struct {
	Tag         string
	Name        string
	Language    string
	Country     string
	CountryCode string
	State       string
	// Advanced search can combine multiple parameters
	TagExact   bool
	NameExact  bool
	Order      string // votes, clickcount, bitrate, name
	Reverse    bool
	Limit      int
	Offset     int
	HideBroken bool
}

SearchParams holds parameters for search requests

type SearchType

type SearchType int

SearchType represents the type of search query

const (
	SearchByTag SearchType = iota
	SearchByName
	SearchByLanguage
	SearchByCountry
	SearchByState
	SearchAdvanced
)

type Station

type Station struct {
	StationUUID string `json:"stationuuid"`
	Name        string `json:"name"`
	URLResolved string `json:"url_resolved"`
	Tags        string `json:"tags"`
	Country     string `json:"country"`
	CountryCode string `json:"countrycode"`
	State       string `json:"state"`
	Language    string `json:"language"`
	Votes       int    `json:"votes"`
	Codec       string `json:"codec"`
	Bitrate     int    `json:"bitrate"`
	Volume      *int   `json:"volume,omitempty"` // Per-station volume (0-100), nil means use default
}

Station represents a radio station from Radio Browser API

func (*Station) GetVolume added in v1.1.0

func (s *Station) GetVolume() int

GetVolume returns the station's volume or -1 if not set

func (*Station) SetVolume added in v1.1.0

func (s *Station) SetVolume(vol int)

SetVolume sets the station's volume (0-100)

func (*Station) TrimName

func (s *Station) TrimName() string

TrimName returns station name with whitespace trimmed

type VersionChecker added in v1.1.0

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

VersionChecker checks for new versions on GitHub

func NewVersionChecker added in v1.1.0

func NewVersionChecker() *VersionChecker

NewVersionChecker creates a new version checker

func (*VersionChecker) GetLatestRelease added in v1.1.0

func (vc *VersionChecker) GetLatestRelease(ctx context.Context) (*ReleaseInfo, error)

GetLatestRelease fetches the latest release info from GitHub

type VoteResult

type VoteResult struct {
	OK      bool   `json:"ok"`
	Message string `json:"message"`
}

VoteResult represents the response from voting for a station

Jump to

Keyboard shortcuts

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