summaryrefslogtreecommitdiff
path: root/icclient
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-10 13:01:01 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2021-06-10 13:01:01 +0800
commit06bea8ae54dd3cd714b231b3d8a8deef77136613 (patch)
tree2c74bb8708f3a4cd395a0af25f3c7a60e7b139b8 /icclient
parent751d72c5d5c7983e10f0105b95536fc5aac35569 (diff)
The client now takes an "on success" callback argument
Diffstat (limited to 'icclient')
-rw-r--r--icclient/catalog.h3
-rw-r--r--icclient/client.h19
2 files changed, 10 insertions, 12 deletions
diff --git a/icclient/catalog.h b/icclient/catalog.h
index ee65c1e..677d691 100644
--- a/icclient/catalog.h
+++ b/icclient/catalog.h
@@ -10,10 +10,11 @@ struct icclient_catalog {
extern "C" {
#endif
+ void icclient_catalog_init();
void icclient_catalog_free(struct icclient_catalog *catalog);
#ifdef __cplusplus
}
#endif
-#endif // ICCLIENT_CATALOG_H
+#endif
diff --git a/icclient/client.h b/icclient/client.h
index 00f9445..5c0541b 100644
--- a/icclient/client.h
+++ b/icclient/client.h
@@ -19,17 +19,12 @@ extern "C" {
/*!
* \brief For fetching data about products that belong a specific group.
* \param prod_group The name of the product group.
- * \param handler A pointer to a cURL write function callback.
- * \param catalogptr A pointer to pointer to the catalog to store the data.
+ * \param callback A pointer to the function that needs to be called after the catalog is ready.
+ * \param catalog A pointer to pointer to the catalog to store the data.
+ * \param handler A pointer to the function when a custom handler is needed to arrange the data into the catalog.
*/
- void icclient_results(const char *prod_group, icclient_handler handler, struct icclient_catalog **catalogptr);
-
- /*!
- * \brief For fetching data about all active products.
- * \param handler A pointer to a cURL write function callback.
- * \param catalogptr A pointer to pointer to the catalog to store the data.
- */
- void icclient_allproducts(icclient_handler handler, struct icclient_catalog **catalogptr);
+ void icclient_results(const char *prod_group, void (*callback)(struct icclient_catalog *),
+ struct icclient_catalog **catalog, icclient_handler handler);
/*!
* \brief For fetching data about a specific product.
@@ -46,4 +41,6 @@ extern "C" {
}
#endif
-#endif // ICCLIENT_CLIENT_H
+#define icclient_allproducts(callback, catalog, handler) icclient_results("All-Products", callback, catalog, handler)
+
+#endif