aboutsummaryrefslogtreecommitdiffstats
path: root/python/fatcat_util.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/fatcat_util.py')
-rwxr-xr-xpython/fatcat_util.py26
1 files changed, 24 insertions, 2 deletions
diff --git a/python/fatcat_util.py b/python/fatcat_util.py
index 48e4465c..70a2a2df 100755
--- a/python/fatcat_util.py
+++ b/python/fatcat_util.py
@@ -3,6 +3,8 @@
"""
TODO:
- roll 'shell' stuff into this command
+- create, submit, accept editgroups
+- create entity from JSON (?)
"""
import sys
@@ -13,7 +15,7 @@ import fatcat_client
from fatcat_client.rest import ApiException
from fatcat_client import ReleaseEntity, ContainerEntity, ChangelogEntry
from fatcat_tools import uuid2fcid, fcid2uuid, entity_from_json, \
- entity_to_dict, public_api
+ entity_to_dict, public_api, authenticated_api
def run_uuid2fcid(args):
@@ -22,6 +24,16 @@ def run_uuid2fcid(args):
def run_fcid2uuid(args):
print(fcid2uuid(args.fcid))
+def run_editgroup_accept(args):
+ print(fcid2uuid(args.fcid))
+
+def run_editgroup_accept(args):
+ args.api.accept_editgroup(args.editgroup_id)
+
+def run_editgroup_submit(args):
+ eg = args.api.get_editgroup(args.editgroup_id)
+ args.api.update_editgroup(args.editgroup_id, eg, submit=True)
+
def main():
parser = argparse.ArgumentParser()
parser.add_argument('--debug',
@@ -42,12 +54,22 @@ def main():
sub_fcid2uuid.add_argument('fcid',
help="FCID to transform (into UUID)")
+ sub_editgroup_accept = subparsers.add_parser('editgroup-accept')
+ sub_editgroup_accept.set_defaults(func=run_editgroup_accept)
+ sub_editgroup_accept.add_argument('editgroup_id',
+ help="editgroup to accept")
+
+ sub_editgroup_submit = subparsers.add_parser('editgroup-submit')
+ sub_editgroup_submit.set_defaults(func=run_editgroup_submit)
+ sub_editgroup_submit.add_argument('editgroup_id',
+ help="editgroup to submit")
+
args = parser.parse_args()
if not args.__dict__.get("func"):
print("tell me what to do!")
sys.exit(-1)
- args.api = public_api(args.host_url)
+ args.api = authenticated_api(args.host_url)
args.func(args)
if __name__ == '__main__':