Module r3_hex_repo

Repo API.

Description

Repo API.

Function Index

get_docs/3 Gets docs tarball from the repository.
get_hex_installs/1 Gets Hex installation versions CSV from repository.
get_names/1 Gets names resource from the repository.
get_package/2 Gets package resource from the repository.
get_public_key/1 Gets the public key from the repository.
get_tarball/3 Gets tarball from the repository.
get_versions/1 Gets versions resource from the repository.

Function Details

get_docs/3

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

Gets docs tarball from the repository.

Examples:

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

get_hex_installs/1

get_hex_installs(Config) -> any()

Gets Hex installation versions CSV from repository.

Examples:

  > r3_hex_repo:get_hex_installs(r3_hex_core:default_config()).
  {ok, {200, ..., <<"1.0.0,abc123,1.13.0\n1.1.0,def456,1.14.0\n...">>}}

get_names/1

get_names(Config) -> any()

Gets names resource from the repository.

Examples:

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

get_package/2

get_package(Config, Name) -> any()

Gets package resource from the repository.

Examples:

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

get_public_key/1

get_public_key(Config) -> any()

Gets the public key from the repository.

Examples:

  > r3_hex_repo:get_public_key(r3_hex_core:default_config())
  {ok, {200, _, PublicKey}}

get_tarball/3

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

Gets tarball from the repository.

Examples:

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

get_versions/1

get_versions(Config) -> any()

Gets versions resource from the repository.

Examples:

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


Generated by EDoc