From daf858c02db1a5a12151d142ce55dfe9fbb2b715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=EA=A6=AB=EA=A6=B6=EA=A6=8F=EA=A7=80=EA=A6=A6?= =?UTF-8?q?=EA=A6=BF=EA=A6=A7=EA=A6=AE=EA=A6=91=EA=A6=A9=EA=A6=AD=EA=A7=80?= Date: Sun, 13 Jun 2021 08:40:26 +0800 Subject: Merge catalog and product to client --- icclient/client.h | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) (limited to 'icclient/client.h') diff --git a/icclient/client.h b/icclient/client.h index ae2a766..bcf8170 100644 --- a/icclient/client.h +++ b/icclient/client.h @@ -3,8 +3,24 @@ #define icclient_allproducts(callback, handler) icclient_results("All-Products", callback, handler) -struct icclient_product; -struct icclient_catalog; +struct icclient_catalog { + size_t length; + struct icclient_product { + char *sku; + char *description; + char *comment; + char *thumb; + char *image; + double price; + char *prod_group; + double weight; + char *author; + struct icclient_product_crosssell { + size_t length; + char *skus[]; + } *crosssell; + } *products[]; +}; #ifdef __cplusplus extern "C" { @@ -16,7 +32,7 @@ extern "C" { * \param certificate Path to the CA certificate file. * \return True if the initialisation works, false otherwise. */ -bool icclient_init(const char *url, const char *certificate); +void icclient_init(const char *url, const char *certificate); /*! * \brief For fetching data about products that belong a specific group. @@ -35,6 +51,11 @@ void icclient_results(const char *prod_group, void (*callback)(struct icclient_c void icclient_flypage(const char *sku, icclient_handler handler, struct icclient_product **productptr); void icclient_page(const char *path, icclient_handler handler, void **dataptr); + +void icclient_free_product(struct icclient_product *product); + +void icclient_free_catalog(struct icclient_catalog *catalog); + void icclient_cleanup(); #ifdef __cplusplus -- cgit v1.2.3