Module r3_hex_api_user

Hex HTTP API - Users.

Description

Hex HTTP API - Users.

Function Index

create/4 Creates a new user account.
get/2 Gets a user.
me/1 Gets the authenticated user.
reset_password/2 Resets the user's password.

Function Details

create/4

create(Config::r3_hex_core:config(), Username::binary(), Password::binary(), Email::binary()) -> r3_hex_api:response()

Creates a new user account.

Examples:

  > r3_hex_api_user:create(r3_hex_core:default_config(), <<"user">>, <<"hunter42">>, <<"user@example.com">>).
  {ok, {201, ..., #{
       <<"email">> => <<"user@example.com">>,
       <<"full_name">> => <<"John Doe">>,
       <<"handles">> => #{...},
       <<"inserted_at">> => <<"2014-04-21T17:20:12Z">>,
       <<"level">> => <<"full">>,
       <<"updated_at">> => <<"2019-08-04T19:28:05Z">>,
       <<"url">> => <<"https://hex.pm/api/users/user">>,
       <<"username">> => <<"user">>
       }}}

get/2

get(Config::r3_hex_core:config(), Username::binary()) -> r3_hex_api:response()

Gets a user.

Examples:

  > r3_hex_api_user:get(r3_hex_core:default_config()).
  {ok, {200, ..., #{
       <<"email">> => <<"user@example.com">>,
       <<"full_name">> => <<"John Doe">>,
       <<"handles">> => #{...},
       <<"inserted_at">> => <<"2014-04-21T17:20:12Z">>,
       <<"level">> => <<"full">>,
       <<"updated_at">> => <<"2019-08-04T19:28:05Z">>,
       <<"url">> => <<"https://hex.pm/api/users/user">>,
       <<"username">> => <<"user">>
       }}}

me/1

me(Config::r3_hex_core:config()) -> r3_hex_api:response()

Gets the authenticated user.

Examples:

  > r3_hex_api_user:me(r3_hex_core:default_config()).
  {ok, {200, ..., #{
       <<"email">> => <<"user@example.com">>,
       <<"full_name">> => <<"John Doe">>,
       <<"handles">> => #{...},
       <<"inserted_at">> => <<"2014-04-21T17:20:12Z">>,
       <<"level">> => <<"full">>,
       <<"updated_at">> => <<"2019-08-04T19:28:05Z">>,
       <<"url">> => <<"https://hex.pm/api/users/user">>,
       <<"username">> => <<"user">>
       }}}

reset_password/2

reset_password(Config::r3_hex_core:config(), Username::binary()) -> r3_hex_api:response()

Resets the user's password.

Examples:

  > r3_hex_api_user:reset_password(r3_hex_core:default_config(), <<"user">>).
  {ok, {204, ..., nil}}


Generated by EDoc