diff options
author | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-12 20:07:47 +0800 |
---|---|---|
committer | ꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id> | 2021-06-12 20:07:47 +0800 |
commit | ee87c46227c838961250bb8d50edca57ac154462 (patch) | |
tree | 99a522cb793b29e2e9e2253b2a7fae843ff61a2e /icclient | |
parent | b94e7d2e3e33490d5b94da3c5406d4fe2e143edd (diff) |
Further simplify icclient_results function
Diffstat (limited to 'icclient')
-rw-r--r-- | icclient/catalog.h | 5 | ||||
-rw-r--r-- | icclient/client.h | 56 |
2 files changed, 27 insertions, 34 deletions
diff --git a/icclient/catalog.h b/icclient/catalog.h index 9d15a1a..677d691 100644 --- a/icclient/catalog.h +++ b/icclient/catalog.h @@ -6,11 +6,6 @@ struct icclient_catalog { struct icclient_product *products[]; }; -struct icclient_catalog_callback { - struct icclient_catalog **catalog; - void (*callback)(struct icclient_catalog *); -}; - #ifdef __cplusplus extern "C" { #endif diff --git a/icclient/client.h b/icclient/client.h index 5e0f01b..ae2a766 100644 --- a/icclient/client.h +++ b/icclient/client.h @@ -1,7 +1,7 @@ #ifndef ICCLIENT_CLIENT_H #define ICCLIENT_CLIENT_H -#define icclient_allproducts(callback, catalog, handler) icclient_results("All-Products", callback, catalog, handler) +#define icclient_allproducts(callback, handler) icclient_results("All-Products", callback, handler) struct icclient_product; struct icclient_catalog; @@ -10,34 +10,32 @@ struct icclient_catalog; extern "C" { #endif - /*! - * \brief A function that needs to be run first. - * \param url Server root URL. - * \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); - - /*! - * \brief For fetching data about products that belong a specific group. - * \param prod_group The name of the product group. - * \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, void (*callback)(struct icclient_catalog *), - struct icclient_catalog **catalog, icclient_handler handler); - - /*! - * \brief For fetching data about a specific product. - * \param sku The SKU of the product. - * \param handler A pointer to a cURL write function callback. - * \param productptr A pointer to pointer to the product to store the data. - */ - 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_cleanup(); +/*! + * \brief A function that needs to be run first. + * \param url Server root URL. + * \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); + +/*! + * \brief For fetching data about products that belong a specific group. + * \param prod_group The name of the product group. + * \param callback A pointer to the function that needs to be called after the catalog is ready. + * \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, void (*callback)(struct icclient_catalog *), icclient_handler handler); + +/*! + * \brief For fetching data about a specific product. + * \param sku The SKU of the product. + * \param handler A pointer to a cURL write function callback. + * \param productptr A pointer to pointer to the product to store the data. + */ +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_cleanup(); #ifdef __cplusplus } |