hex_repo (hex_core v0.7.1) View Source

Repo API.

Link to this section Summary

Functions

Gets names resource from the repository.

Gets package resource from the repository.

Gets tarball from the repository.

Gets versions resource from the repository.

Link to this section Functions

Gets names resource from the repository.

Examples:

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

get_package(Config, Name)

View Source

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">>}
          ]},
      ]}}
Link to this function

get_tarball(Config, Name, Version)

View Source

Gets tarball from the repository.

Examples:

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

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">>]},
      ]}}