View Source hex_api_release (hex_core v0.10.0)

Hex HTTP API - Releases.

Link to this section Summary

Functions

Deletes a package release.

Gets a package release.

Publishes a new package release.

Publishes a new package release with query parameters.

Retires a package release.

Unretires a package release.

Link to this section Types

-type publish_params() :: [{replace, boolean()}].
-type retirement_params() :: #{reason := retirement_reason(), message => binary()}.
-type retirement_reason() :: other | invalid | security | deprecated | renamed.

Link to this section Functions

Link to this function

delete(Config, Name, Version)

View Source
-spec delete(hex_core:config(), binary(), binary()) -> hex_api:response().

Deletes a package release.

Examples:

  > hex_api_release:delete(hex_core:default_config(), <<"package">>, <<"1.0.0">>).
  {ok, {204, ..., nil}}
Link to this function

get(Config, Name, Version)

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

Gets a package release.

Examples:

  > hex_api_release:get(hex_core:default_config(), <<"package">>, <<"1.0.0">>).
  {ok, {200, ..., #{
       <<"checksum">> => <<"540d210d81f56f17f64309a4896430e727972499b37bd59342dc08d61dff74d8">>,
       <<"docs_html_url">> => <<"https://hexdocs.pm/package/1.0.0/">>,
       <<"downloads">> => 740,<<"has_docs">> => true,
       <<"html_url">> => <<"https://hex.pm/packages/package/1.0.0">>,
       <<"inserted_at">> => <<"2014-12-09T18:32:03Z">>,
       <<"meta">> =>
           #{<<"app">> => <<"package">>,
             <<"build_tools">> => [<<"mix">>]},
       <<"package_url">> => <<"https://hex.pm/api/packages/package">>,
       <<"publisher">> => nil,<<"requirements">> => #{},
       <<"retirement">> => nil,
       <<"updated_at">> => <<"2019-07-28T21:12:11Z">>,
       <<"url">> => <<"https://hex.pm/api/packages/package/releases/1.0.0">>,
       <<"version">> => <<"1.0.0">>
       }}}
Link to this function

publish(Config, Tarball)

View Source
-spec publish(hex_core:config(), binary()) -> hex_api:response().

Publishes a new package release.

Examples:

  > hex_api_release:publish(hex_core:default_config(), Tarball).
  {ok, {200, ..., #{
       <<"checksum">> => <<"540d210d81f56f17f64309a4896430e727972499b37bd59342dc08d61dff74d8">>,
       <<"docs_html_url">> => <<"https://hexdocs.pm/package/1.0.0/">>,
       <<"downloads">> => 740,<<"has_docs">> => true,
       <<"html_url">> => <<"https://hex.pm/packages/package/1.0.0">>,
       <<"inserted_at">> => <<"2014-12-09T18:32:03Z">>,
       <<"meta">> =>
           #{<<"app">> => <<"package">>,
             <<"build_tools">> => [<<"mix">>]},
       <<"package_url">> => <<"https://hex.pm/api/packages/package">>,
       <<"publisher">> => nil,<<"requirements">> => #{},
       <<"retirement">> => nil,
       <<"updated_at">> => <<"2019-07-28T21:12:11Z">>,
       <<"url">> => <<"https://hex.pm/api/packages/package/releases/1.0.0">>,
       <<"version">> => <<"1.0.0">>
       }}}
Link to this function

publish(Config, Tarball, Params)

View Source
-spec publish(hex_core:config(), binary(), publish_params()) -> hex_api:response().

Publishes a new package release with query parameters.

Supported query params : - replace : boolean

Examples:

  > hex_api_release:publish(hex_core:default_config(), Tarball, [{replace, true}]).
  {ok, {201, ..., #{
       <<"checksum">> => <<"540d210d81f56f17f64309a4896430e727972499b37bd59342dc08d61dff74d8">>,
       <<"docs_html_url">> => <<"https://hexdocs.pm/package/1.0.0/">>,
       <<"downloads">> => 740,<<"has_docs">> => true,
       <<"html_url">> => <<"https://hex.pm/packages/package/1.0.0">>,
       <<"inserted_at">> => <<"2014-12-09T18:32:03Z">>,
       <<"meta">> =>
           #{<<"app">> => <<"package">>,
             <<"build_tools">> => [<<"mix">>]},
       <<"package_url">> => <<"https://hex.pm/api/packages/package">>,
       <<"publisher">> => nil,<<"requirements">> => #{},
       <<"retirement">> => nil,
       <<"updated_at">> => <<"2019-07-28T21:12:11Z">>,
       <<"url">> => <<"https://hex.pm/api/packages/package/releases/1.0.0">>,
       <<"version">> => <<"1.0.0">>
       }}}
Link to this function

retire(Config, Name, Version, Params)

View Source
-spec retire(hex_core:config(), binary(), binary(), retirement_params()) -> hex_api:response().

Retires a package release.

Examples:

  > hex_api_release:retire(hex_core:default_config(), <<"package">>, <<"1.0.0">>, Params).
  {ok, {204, ..., nil}}
Link to this function

unretire(Config, Name, Version)

View Source
-spec unretire(hex_core:config(), binary(), binary()) -> hex_api:response().

Unretires a package release.

Examples:

  > hex_api_release:unretire(hex_core:default_config(), <<"package">>, <<"1.0.0">>).
  {ok, {204, ..., nil}}