diff libsci/apic.h @ 33:1d0ddf9e6efd

misc: general documentation
author David Demelier <markand@malikania.fr>
date Thu, 04 Aug 2022 16:47:10 +0200
parents lib/apic.h@dae2de19ca5d
children e52c762d8ba8
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libsci/apic.h	Thu Aug 04 16:47:10 2022 +0200
@@ -0,0 +1,68 @@
+/*
+ * apic.h -- synchronous HTTP request
+ *
+ * Copyright (c) 2021-2022 David Demelier <markand@malikania.fr>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef SCI_APIC_H
+#define SCI_APIC_H
+
+#include <jansson.h>
+
+#define APIC_ERR_MAX 128
+
+struct apic {
+	char error[APIC_ERR_MAX];
+	long status;
+};
+
+extern struct apiconf {
+	char baseurl[512];
+} apiconf /*! Global variable. */;
+
+json_t *
+apic_get(struct apic *, const char *, ...);
+
+json_t *
+apic_post(struct apic *, const json_t *, const char *, ...);
+
+int
+apic_job_add(struct apic *, json_t *);
+
+json_t *
+apic_job_todo(struct apic *, const char *);
+
+int
+apic_jobresult_add(struct apic *, json_t *);
+
+int
+apic_project_save(struct apic *, json_t *);
+
+json_t *
+apic_project_list(struct apic *);
+
+json_t *
+apic_project_find(struct apic *, const char *);
+
+int
+apic_worker_save(struct apic *, json_t *);
+
+json_t *
+apic_worker_list(struct apic *);
+
+json_t *
+apic_worker_find(struct apic *, const char *);
+
+#endif /* !SCI_APIC_H */