return 0;
}
+static int response_callback(struct pakfire_xfer* xfer, pakfire_xfer_error_code_t code,
+ int status, struct json_object* response, void* data) {
+ switch (code) {
+ case PAKFIRE_XFER_OK:
+ return cli_dump_json(response);
+
+ default:
+ return code;
+ }
+}
+
static int ready_callback(struct pakfire_client* client, void* data) {
- const struct cli_local_args* local_args = data;
+ struct cli_local_args* local_args = data;
// Delete the repository
return pakfire_client_delete_repo(client,
- local_args->distro, local_args->name);
+ local_args->distro, local_args->name, response_callback, local_args);
}
int cli_repo_delete(void* data, int argc, char* argv[]) {
return r;
}
-int pakfire_client_delete_repo(struct pakfire_client* self,
- const char* distro, const char* name) {
+int pakfire_client_delete_repo(struct pakfire_client* self, const char* distro,
+ const char* name, pakfire_xfer_response_callback callback, void* data) {
struct pakfire_xfer* xfer = NULL;
int r;
if (r < 0)
goto ERROR;
- // XXX This needs a callback
+ // Set the callback
+ r = pakfire_xfer_set_response_callback(xfer, callback, data);
+ if (r < 0)
+ goto ERROR;
// Enqueue the transfer
r = pakfire_httpclient_enqueue(self->httpclient, xfer);
const char* distro, const char* name);
int pakfire_client_create_repo(struct pakfire_client* client,
const char* distro, const char* name, const char* description);
-int pakfire_client_delete_repo(struct pakfire_client* client,
- const char* distro, const char* name);
+int pakfire_client_delete_repo(struct pakfire_client* client, const char* distro,
+ const char* name, pakfire_xfer_response_callback callback, void* data);
// Jobs