diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-13 08:40:26 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-13 08:40:26 +0800 |
commit | daf858c02db1a5a12151d142ce55dfe9fbb2b715 (patch) | |
tree | d6343c4f8b7ef9bad9e3a17264b201f6b8012791 /icclient | |
parent | 0a6e2943843ca894abc562ba98bcbf3399769481 (diff) |
Merge catalog and product to client
Diffstat (limited to 'icclient')
-rw-r--r-- | icclient/catalog.h | 19 | ||||
-rw-r--r-- | icclient/client.h | 27 | ||||
-rw-r--r-- | icclient/product.h | 32 |
3 files changed, 24 insertions, 54 deletions
diff --git a/icclient/catalog.h b/icclient/catalog.h deleted file mode 100644 index 32dc33e..0000000 --- a/icclient/catalog.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef ICCLIENT_CATALOG_H -#define ICCLIENT_CATALOG_H - -struct icclient_catalog { - size_t length; - struct icclient_product *products[]; -}; - -#ifdef __cplusplus -extern "C" { -#endif - - void icclient_catalog_free(struct icclient_catalog *catalog); - -#ifdef __cplusplus -} -#endif - -#endif 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 diff --git a/icclient/product.h b/icclient/product.h deleted file mode 100644 index 8fa6bc3..0000000 --- a/icclient/product.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef ICCLIENT_PRODUCT_H -#define ICCLIENT_PRODUCT_H - -struct icclient_product_crosssell { - size_t length; - char *skus[]; -}; - -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 *crosssell; -}; - -#ifdef __cplusplus -extern "C" { -#endif - - void icclient_product_free(struct icclient_product *product); - -#ifdef __cplusplus -} -#endif - -#endif |