Module hex_api_user
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::hex_core:config(), Username::binary(), Password::binary(), Email::binary()) -> hex_api:response()
Creates a new user account.
Examples:
> hex_api_user:create(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::hex_core:config(), Username::binary()) -> hex_api:response()
Gets a user.
Examples:
> hex_api_user:get(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::hex_core:config()) -> hex_api:response()
Gets the authenticated user.
Examples:
> hex_api_user:me(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::hex_core:config(), Username::binary()) -> hex_api:response()
Resets the user's password.
Examples:
> hex_api_user:reset_password(hex_core:default_config(), <<"user">>).
{ok, {204, ..., nil}}