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

Module hex_repo

Function Index

get_names/1 Gets names resource from the repository.
get_package/2 Gets package resource from the repository.
get_tarball/3 Gets tarball from the repository.
get_versions/1 Gets versions resource from the repository.

Function Details

get_names/1

get_names(Config) -> any()

Gets names resource from the repository.

Examples:

  > hex_repo:get_names(hex_core:default_config()).
  {ok, {200, ...,
      [
          #{name => <<"package1">>},
          #{name => <<"package2">>},
      ]}}

get_package/2

get_package(Config, Name) -> any()

Gets package resource from the repository.

Examples:

  > hex_repo:get_package(hex_core:default_config(), <<"package1">>).
  {ok, {200, ...,
      {
          #{checksum => ..., version => <<"0.5.0">>, dependencies => []},
          #{checksum => ..., version => <<"1.0.0">>, dependencies => [
              #{package => <<"package2">>, optional => true, requirement => <<"~> 0.1">>}
          ]},
      ]}}

get_tarball/3

get_tarball(Config, Name, Version) -> any()

Gets tarball from the repository.

Examples:

  > {ok, {200, _, Tarball}} = hex_repo:get_tarball(<<"package1">>, <<"1.0.0">>, hex_core:default_config()),
  > {ok, #{metadata := Metadata}} = hex_tarball:unpack(Tarball, memory).

get_versions/1

get_versions(Config) -> any()

Gets versions resource from the repository.

Examples:

  > hex_repo:get_versions(Config).
  {ok, {200, ...,
      [
          #{name => <<"package1">>, retired => [],
            versions => [<<"1.0.0">>]},
          #{name => <<"package2">>, retired => [<<"0.5.0>>"],
            versions => [<<"0.5.0">>, <<"1.0.0">>]},
      ]}}