View Source hex_api_package (hex_core v0.10.3)

Hex HTTP API - Packages.

Summary

Functions

get(Config, Name)

-spec get(hex_core:config(), binary()) -> hex_api:response().

Gets a package.

Examples:

  > hex_api_package:get(hex_core:default_config(), <<"package">>).
  {ok, {200, ..., #{
      <<"name">> => <<"package1">>,
      <<"meta">> => #{
          <<"description">> => ...,
          <<"licenses">> => ...,
          <<"links">> => ...,
          <<"maintainers">> => ...
      },
      ...,
      <<"releases">> => [
          #{<<"url">> => ..., <<"version">> => <<"0.5.0">>}],
          #{<<"url">> => ..., <<"version">> => <<"1.0.0">>}],
          ...
      ]}}}

search(Config, Query, SearchParams)

-spec search(hex_core:config(), binary(), [{term(), term()}]) -> hex_api:response().

Searches packages.

Examples:

  > hex_api_package:search(hex_core:default_config(), <<"package">>, [{page, 1}]).
  {ok, {200, ..., [
      #{<<"name">> => <<"package1">>, ...},
      ...
  ]}}