View Source hex_repo (hex_core v0.10.3)

Repo API.

Summary

Functions

Gets docs tarball from the repository.

Gets names resource from the repository.

Gets package resource from the repository.

Gets the public key from the repository.

Gets tarball from the repository.

Gets versions resource from the repository.

Functions

Link to this function

get_docs(Config, Name, Version)

View Source

Gets docs tarball from the repository.

Examples:

  > {ok, {200, _, Docs}} = hex_repo:get_docs(hex_core:default_config(), <<"package1">>, <<"1.0.0">>),
  > hex_tarball:unpack_docs(Docs, memory)
  {ok, [{"index.html", <<"<!doctype>">>}, ...]}

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

Gets the public key from the repository.

Examples:

  > hex_repo:get_public_key(hex_core:default_config())
  {ok, {200, _, PublicKey}}
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">>]},
      ]}}