summaryrefslogtreecommitdiff
path: root/src/r3_hex_api_key.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/r3_hex_api_key.erl')
-rw-r--r--src/r3_hex_api_key.erl31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/r3_hex_api_key.erl b/src/r3_hex_api_key.erl
new file mode 100644
index 0000000..68c0b13
--- /dev/null
+++ b/src/r3_hex_api_key.erl
@@ -0,0 +1,31 @@
+%% Vendored from hex_core v0.5.0, do not edit manually
+
+-module(r3_hex_api_key).
+-export([
+ list/1,
+ get/2,
+ add/3,
+ delete/2,
+ delete_all/1
+]).
+
+list(Config) when is_map(Config) ->
+ Path = r3_hex_api:build_organization_path(Config, ["keys"]),
+ r3_hex_api:get(Config, Path).
+
+get(Config, Name) when is_map(Config) ->
+ Path = r3_hex_api:build_organization_path(Config, ["keys", Name]),
+ r3_hex_api:get(Config, Path).
+
+add(Config, Name, Permissions) when is_map(Config) ->
+ Path = r3_hex_api:build_organization_path(Config, ["keys"]),
+ Params = #{<<"name">> => Name, <<"permissions">> => Permissions},
+ r3_hex_api:post(Config, Path, Params).
+
+delete(Config, Name) when is_map(Config) ->
+ Path = r3_hex_api:build_organization_path(Config, ["keys", Name]),
+ r3_hex_api:delete(Config, Path).
+
+delete_all(Config) when is_map(Config) ->
+ Path = r3_hex_api:build_organization_path(Config, ["keys"]),
+ r3_hex_api:delete(Config, Path).