Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

34 строки
1.2 KiB

  1. %% Vendored from hex_core v0.5.1, do not edit manually
  2. -module(r3_hex_api_package_owner).
  3. -export([
  4. add/3,
  5. delete/3,
  6. get/3,
  7. list/2
  8. ]).
  9. %% Examples:
  10. %%
  11. %% ```
  12. %% > r3_hex_api_owner:list(r3_hex_core:default_config(), <<"package">>).
  13. %% {ok, {200, ..., [
  14. %% #{<<"username">> => <<"alice">>, ...},
  15. %% ...
  16. %% ]}}
  17. %% '''
  18. list(Config, PackageName) when is_binary(PackageName) and is_map(Config) ->
  19. Path = r3_hex_api:build_repository_path(Config, ["packages", PackageName, "owners"]),
  20. r3_hex_api:get(Config, Path).
  21. get(Config, PackageName, UsernameOrEmail) when is_binary(PackageName) and is_map(Config) ->
  22. Path = r3_hex_api:build_repository_path(Config, ["packages", PackageName, "owners", UsernameOrEmail]),
  23. r3_hex_api:get(Config, Path).
  24. add(Config, PackageName, UsernameOrEmail) when is_binary(PackageName) and is_map(Config) ->
  25. Path = r3_hex_api:build_repository_path(Config, ["packages", PackageName, "owners", UsernameOrEmail]),
  26. r3_hex_api:put(Config, Path, #{}).
  27. delete(Config, PackageName, UsernameOrEmail) when is_binary(PackageName) and is_map(Config) ->
  28. Path = r3_hex_api:build_repository_path(Config, ["packages", PackageName, "owners", UsernameOrEmail]),
  29. r3_hex_api:delete(Config, Path).