Modules

hex_api hex_api_key hex_api_package hex_api_package_owner hex_api_release hex_api_user hex_core hex_http hex_http_httpc hex_pb_names hex_pb_package hex_pb_signed hex_pb_versions hex_registry hex_repo hex_tarball safe_erl_term

hex_core

Build Status

Reference implementation of Hex specifications: https://github.com/hexpm/specifications.

Usage

Let's use default config for now. See "Configuration" section below for customization.

Repository

Get all package names:

Get all package versions from repository:

Get package releases from repository:

API

For a full list of all parameters and returned objects for the API, check out the API docs: https://github.com/hexpm/specifications/blob/master/http_api.md.

Get package from HTTP API:

Get package tarball:

Publish package tarball:

Package tarballs

Unpack package tarball:

Create package tarball:

Configuration

The default configuration, provided by hex_core:default_config/0, uses built-in httpc-based adapter and Hex.pm APIs: https://hex.pm/api and https://repo.hex.pm.

Organizations on Hex.pm (or any compatible server) can be configured as following:

HTTP client configuration can be overriden as follows:

Wrapper Module

It's recommended to write a wrapper module because a lot of decisions are left to the user, e.g.: where to get configuration from, how to handle caching, failures etc.

For a sample, see: examples/myapp_hex.erl. Here's an excerpt:

Installation

Rebar3

Add to rebar.config:

Mix

Add to mix.exs:

Development

  • Run rebar3 as dev compile to re-generate protobuf files
  • Run rebar3 as test proper for property-based tests
  • Run rebar3 as docs edoc to generate documentation