Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

46 řádky
1.1 KiB

  1. %% Vendored from hex_core v0.5.1, do not edit manually
  2. -module(r3_hex_api_user).
  3. -export([
  4. create/4,
  5. get/2,
  6. me/1,
  7. reset_password/2
  8. ]).
  9. me(Config) when is_map(Config) ->
  10. r3_hex_api:get(Config, ["users", "me"]).
  11. create(Config, Username, Password, Email) ->
  12. Params = #{
  13. <<"username">> => Username,
  14. <<"password">> => Password,
  15. <<"email">> => Email
  16. },
  17. r3_hex_api:post(Config, ["users"], Params).
  18. reset_password(Username, Config) when is_binary(Username) and is_map(Config) ->
  19. r3_hex_api:post(Config, ["users", Username, "reset"], #{}).
  20. %% @doc
  21. %% Gets user.
  22. %%
  23. %% Examples:
  24. %%
  25. %% ```
  26. %% > r3_hex_api_user:get(<<"user">>, r3_hex_core:default_config()).
  27. %% {ok, {200, ..., #{
  28. %% <<"username">> => <<"user">>,
  29. %% <<"packages">> => [
  30. %% #{
  31. %% <<"name">> => ...,
  32. %% <<"url">> => ...,
  33. %% ...
  34. %% },
  35. %% ...
  36. %% ],
  37. %% ...}}}
  38. %% '''
  39. %% @end
  40. get(Config, Username) when is_binary(Username) and is_map(Config) ->
  41. r3_hex_api:get(Config, ["users", Username]).