api

package
v0.3.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TpixServer          = "https://tpix.typstify.com"
	TpixClientUserAgent = "tpix-client/v1.0.0"
)

Variables

This section is empty.

Functions

func DownloadPackage

func DownloadPackage(namespace, name, version string) error

DownloadPackage downloads a package, extracts it to the cache directory, and optionally saves the archive to output path.

Types

type DeviceCodeResponse

type DeviceCodeResponse struct {
	DeviceCode      string `json:"device_code"`
	UserCode        string `json:"user_code"`
	VerificationURI string `json:"verification_uri"`
	ExpiresIn       int    `json:"expires_in"`
}

type ErrorResponse

type ErrorResponse struct {
	Error       string `json:"error"`
	Description string `json:"description"`
}

ErrorResponse represents a standard error response

type PackageResponse

type PackageResponse struct {
	ID            string               `json:"id"`
	Name          string               `json:"name"`
	Namespace     string               `json:"namespace"`
	Description   string               `json:"description"`
	HomepageURL   string               `json:"homepage_url"`
	RepositoryURL string               `json:"repository_url"`
	License       string               `json:"license"`
	CreatedAt     *time.Time           `json:"created_at"`
	UpdatedAt     *time.Time           `json:"updated_at"`
	LatestVersion PackageVersionInfo   `json:"latest_version"`
	Versions      []PackageVersionInfo `json:"versions"`
}

PackageResponse represents a package details response

func FetchPackage

func FetchPackage(namespace, name string) (*PackageResponse, error)

FetchPackage fetches package details from the TPIX server.

type PackageVersionInfo

type PackageVersionInfo struct {
	Version      string     `json:"version"`
	TypstVersion string     `json:"typst_version"`
	SHA256       string     `json:"sha256"`
	PublishedAt  *time.Time `json:"published_at"`
}

PackageVersionInfo represents package version information

type PackageVersionsResponse

type PackageVersionsResponse struct {
	Versions []PackageVersionInfo `json:"versions"`
}

PackageVersionsResponse represents the response from the versions endpoint

type SearchResponse

type SearchResponse struct {
	Query   string         `json:"query"`
	Count   int            `json:"count"`
	Results []SearchResult `json:"results"`
}

func SearchPackages

func SearchPackages(query, namespace string, limit int) (*SearchResponse, error)

SearchPackages fetches packages matching a query from the TPIX server.

type SearchResult

type SearchResult struct {
	Namespace   string `json:"namespace"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type TokenResponse

type TokenResponse struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token,omitempty"`
}

func DeviceLogin

func DeviceLogin() (*TokenResponse, error)

type UploadResponse

type UploadResponse struct {
	SHA256         string   `json:"sha256"`
	Namespace      string   `json:"namespace"`
	Package        string   `json:"package"`
	Version        string   `json:"version"`
	Size           int64    `json:"size"`
	ValidateReport []string `json:"report"`
}

UploadResponse represents an upload response. When the package validation does not pass, only ValidateReport is returned.

func UploadPackage

func UploadPackage(packagePath, namespace string) (*UploadResponse, error)

UploadPackage uploads a package to the TPIX server.

Jump to

Keyboard shortcuts

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