From 2782dce6f11f31c54a103c2d01fb55f07a9f0c5b 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:50:40 +0800 Subject: Move icclient/client.h to icclient.h --- Makefile.am | 2 +- client.c | 3 +-- icclient.h | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ icclient/client.h | 65 ------------------------------------------------------- 4 files changed, 67 insertions(+), 68 deletions(-) create mode 100644 icclient.h delete mode 100644 icclient/client.h diff --git a/Makefile.am b/Makefile.am index c376466..49e3061 100644 --- a/Makefile.am +++ b/Makefile.am @@ -18,7 +18,7 @@ if IOS libicclient_la_LDFLAGS += -static endif pkginclude_HEADERS = \ - icclient/client.h \ + icclient.h \ icclient/typedefs.h \ icclient/ord.h \ icclient/member.h \ diff --git a/client.c b/client.c index 62d4163..aa2a1cc 100644 --- a/client.c +++ b/client.c @@ -1,7 +1,6 @@ -#include #include #include "request.h" -#include "icclient/client.h" +#include "icclient.h" #ifdef __EMSCRIPTEN__ extern void icclient_catalog_results(emscripten_fetch_t *); diff --git a/icclient.h b/icclient.h new file mode 100644 index 0000000..bcf8170 --- /dev/null +++ b/icclient.h @@ -0,0 +1,65 @@ +#ifndef ICCLIENT_CLIENT_H +#define ICCLIENT_CLIENT_H + +#define icclient_allproducts(callback, handler) icclient_results("All-Products", callback, handler) + +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" { +#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. + */ +void 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_free_product(struct icclient_product *product); + +void icclient_free_catalog(struct icclient_catalog *catalog); + +void icclient_cleanup(); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/icclient/client.h b/icclient/client.h deleted file mode 100644 index bcf8170..0000000 --- a/icclient/client.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef ICCLIENT_CLIENT_H -#define ICCLIENT_CLIENT_H - -#define icclient_allproducts(callback, handler) icclient_results("All-Products", callback, handler) - -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" { -#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. - */ -void 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_free_product(struct icclient_product *product); - -void icclient_free_catalog(struct icclient_catalog *catalog); - -void icclient_cleanup(); - -#ifdef __cplusplus -} -#endif - -#endif -- cgit v1.2.3