Skip to content

API Reference

Complete API reference for updater.zig.

Modules

ModuleDescription
Core TypesFundamental types and abstractions
ProvidersBuilt-in Git hosting providers
VersionVersion parsing and comparison
Build IntegrationBuild-time update checking
RuntimeRuntime update checking

Quick Reference

Main Entry Points

zig
const updater = @import("updater");

// Quick checks
const result = try updater.checkGitHub(allocator, owner, repo, version);
const result = try updater.checkGitLab(allocator, owner, repo, version);
const result = try updater.checkCodeberg(allocator, owner, repo, version);

// Full configuration
const result = try updater.checkForUpdates(allocator, config);

// Background checking
const checker = try updater.startBackgroundChecker(allocator, config);
defer checker.stop();

// Environment checks
const disabled = updater.isGloballyDisabled();
const in_ci = updater.isCI();

Type Overview

zig
// Configuration
updater.UpdateConfig      // Runtime configuration
updater.GitProvider       // Provider abstraction
updater.HttpHeader        // HTTP header key-value

// Results
updater.UpdateResult      // Check result
updater.ReleaseInfo       // Release information
updater.SkipReason        // Why a check was skipped

// Version comparison
updater.VersionComparator // Comparison strategy
updater.VersionRelation   // Comparison result

Providers

zig
updater.providers.github    // GitHub API
updater.providers.gitlab    // GitLab API
updater.providers.codeberg  // Codeberg/Gitea API

// Self-hosted
updater.providers.gitea(base_url)
updater.providers.selfHostedGitlab(base_url)

// Fully custom
updater.providers.custom(name, build_fn, parse_fn, headers)

Version Comparators

zig
updater.version.semantic    // Semantic versioning
updater.version.numeric     // Numeric comparison
updater.version.lexical     // String comparison
updater.version.date_based  // Calendar versioning

Constants

Library Version

zig
pub const VERSION = "0.0.1";

Error Types

UpdateError

zig
pub const UpdateError = error{
    GloballyDisabled,
    BackgroundCheckingDisabled,
    NetworkError,
    Timeout,
    ProviderError,
    ParseError,
    RateLimited,
    InvalidConfig,
    OutOfMemory,
    TlsError,
    ConnectionRefused,
    DnsError,
};

GitProvider.ParseError

zig
pub const ParseError = error{
    InvalidJson,
    MissingField,
    InvalidFormat,
    OutOfMemory,
};

VersionComparator.ParseError

zig
pub const ParseError = error{
    InvalidFormat,
    OutOfMemory,
};

See Also

Released under the MIT License.