summaryrefslogtreecommitdiff
path: root/product.c
diff options
context:
space:
mode:
authorꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-16 20:43:28 +0800
committerꦌ ꦫꦶ ꦏ꧀ꦦꦿ ꦧ ꦮ ꦑ ꦩ ꦭ꧀ <erik@darapsa.co.id>2019-09-16 20:43:28 +0800
commite405b28efceb0865910c3821d92f6f3cb9a6f0be (patch)
treeb0d44ce408d8f22052e3450bc8fc066c55f2b20c /product.c
parent47be7ba91f07acb7bf88b66fc706ee6b4add69bd (diff)
Product related structures and functions
Diffstat (limited to 'product.c')
-rw-r--r--product.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/product.c b/product.c
new file mode 100644
index 0000000..d5d9bbe
--- /dev/null
+++ b/product.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+#include "icclient/request.h"
+#include "icclient/product.h"
+
+void icclient_product_all(struct ic_catalog **catalogptr
+ , size_t (*callback)(void *, size_t, size_t, void *))
+{
+ request("All-Products", callback, (void *)catalogptr, NULL);
+}
+
+void rtclient_product_freecatalog(struct ic_catalog *catalog)
+{
+ for (unsigned short i = 0; i < catalog->length; i++) {
+ struct ic_product *product = catalog->products[i];
+ free(product->image);
+ free(product->comment);
+ free(product->description);
+ free(product->sku);
+ free(product);
+ }
+ free(catalog);
+ catalog = NULL;
+}