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