anitya

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultBaseURL is the base URL for the release-monitoring.org API
	DefaultBaseURL = "https://release-monitoring.org/api/v2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a client for the release-monitoring.org API

func New

func New(httpClient *http.Client) *Client

New creates a new anitya client with a custom HTTP client The httpClient parameter is required and should be obtained from httpclient.NewHTTPClient()

func (*Client) GetLatestVersion

func (c *Client) GetLatestVersion(ctx context.Context, id int) (string, error)

GetLatestVersion returns the latest version for a project by ID

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, id int) (*Project, error)

GetProject fetches a project by its ID

func (*Client) GetStableVersions

func (c *Client) GetStableVersions(ctx context.Context, id int) ([]string, error)

GetStableVersions returns all stable versions for a project by ID

func (*Client) IsAuthenticated

func (c *Client) IsAuthenticated() bool

IsAuthenticated checks if the client is using authentication

type Project

type Project struct {
	ID             int      `json:"id"`
	Name           string   `json:"name"`
	Backend        string   `json:"backend"`
	Ecosystem      string   `json:"ecosystem"`
	Homepage       string   `json:"homepage"`
	CreatedOn      UnixTime `json:"created_on"`
	UpdatedOn      UnixTime `json:"updated_on"`
	Version        string   `json:"version"`
	StableVersions []string `json:"stable_versions"`
	Versions       []string `json:"versions"`
}

Project represents a project from the release-monitoring.org API

type ProjectResponse

type ProjectResponse struct {
	Items      []Project `json:"items"`
	Page       int       `json:"page"`
	ItemsCount int       `json:"items_count"`
	Total      int       `json:"total"`
}

ProjectResponse represents the API response structure

type UnixTime

type UnixTime time.Time

UnixTime represents a Unix timestamp that can be unmarshaled from JSON

func (UnixTime) Time

func (ut UnixTime) Time() time.Time

Time returns the time.Time representation

func (*UnixTime) UnmarshalJSON

func (ut *UnixTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for UnixTime

Jump to

Keyboard shortcuts

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