gleam/hexpm

Types

Information on a package from Hex’s /api/packages endpoint.

pub type Package {
  Package(
    name: String,
    html_url: Option(String),
    docs_html_url: Option(String),
    meta: PackageMeta,
    downloads: Dict(String, Int),
    owners: Option(List(PackageOwner)),
    releases: List(PackageRelease),
    inserted_at: Time,
    updated_at: Time,
  )
}

Constructors

  • Package(
      name: String,
      html_url: Option(String),
      docs_html_url: Option(String),
      meta: PackageMeta,
      downloads: Dict(String, Int),
      owners: Option(List(PackageOwner)),
      releases: List(PackageRelease),
      inserted_at: Time,
      updated_at: Time,
    )
pub type PackageMeta {
  PackageMeta(
    links: Dict(String, String),
    licenses: List(String),
    description: Option(String),
  )
}

Constructors

  • PackageMeta(
      links: Dict(String, String),
      licenses: List(String),
      description: Option(String),
    )
pub type PackageOwner {
  PackageOwner(
    username: String,
    email: Option(String),
    url: String,
  )
}

Constructors

  • PackageOwner(
      username: String,
      email: Option(String),
      url: String,
    )
pub type PackageRelease {
  PackageRelease(version: String, url: String, inserted_at: Time)
}

Constructors

  • PackageRelease(version: String, url: String, inserted_at: Time)

Information on a release from Hex’s /api/packages/:name/releases/:version endpoint.

pub type Release {
  Release(
    version: String,
    url: String,
    checksum: String,
    downloads: Int,
    publisher: Option(PackageOwner),
    meta: ReleaseMeta,
    retirement: Option(ReleaseRetirement),
    inserted_at: Time,
    updated_at: Time,
  )
}

Constructors

  • Release(
      version: String,
      url: String,
      checksum: String,
      downloads: Int,
      publisher: Option(PackageOwner),
      meta: ReleaseMeta,
      retirement: Option(ReleaseRetirement),
      inserted_at: Time,
      updated_at: Time,
    )

Meta for a hex release

pub type ReleaseMeta {
  ReleaseMeta(app: Option(String), build_tools: List(String))
}

Constructors

  • ReleaseMeta(app: Option(String), build_tools: List(String))
pub type ReleaseRetirement {
  ReleaseRetirement(
    reason: RetirementReason,
    message: Option(String),
  )
}

Constructors

  • ReleaseRetirement(
      reason: RetirementReason,
      message: Option(String),
    )
pub type RetirementReason {
  OtherReason
  Invalid
  Security
  Deprecated
  Renamed
}

Constructors

  • OtherReason
  • Invalid
  • Security
  • Deprecated
  • Renamed

Functions

pub fn decode_package(
  data: Dynamic,
) -> Result(Package, List(DecodeError))
pub fn decode_release(
  data: Dynamic,
) -> Result(Release, List(DecodeError))
pub fn decode_retirement_reason(
  data: Dynamic,
) -> Result(RetirementReason, List(DecodeError))
pub fn retirement_reason_to_string(
  reason: RetirementReason,
) -> String
Search Document