def upload(self, *args, **kwargs):
return self.hub.upload(*args, **kwargs)
+ def delete_upload(self, *args, **kwargs):
+ return self.hub.delete_upload(*args, **kwargs)
+
class _ClientObject(object):
def __init__(self, client, id):
query_args = urllib.parse.urlencode(kwargs)
# Add query arguments
- if method in ("GET", "PUT"):
+ if method in ("GET", "PUT", "DELETE"):
url = "%s?%s" % (url, query_args)
# Add any arguments to the body
# Return the upload ID
return response.get("id")
+ async def delete_upload(self, upload_id):
+ await self._request("DELETE", "/uploads", id=upload_id)
+
@staticmethod
def _stream_file(path, size, p, write):
# Start the progressbar
help=_("Filename"))
upload.set_defaults(func=self._upload)
+ # delete-upload
+ upload_delete = subparsers.add_parser("delete-upload",
+ help=_("Delete an upload"))
+ upload_delete.add_argument("upload_id", metavar="ID", nargs="+",
+ help=_("One or multiple IDs"))
+ upload_delete.set_defaults(func=self._delete_upload)
+
# watch-build
watch_build = subparsers.add_parser("watch-build",
help=_("Watch the status of a build"))
except KeyError:
pass
+ # Uploads
+
async def _upload(self, client, ns):
for file in ns.file:
upload_id = await client.upload(file)
}
)
+ async def _delete_upload(self, client, ns):
+ """
+ Delete uploads
+ """
+ for upload_id in ns.upload_id:
+ await client.delete_upload(upload_id)
+
+ print(_("Deleted upload %s") % upload_id)
+
async def _watch_build(self, client, ns):
build = client.get_build(ns.id[0])