diff options
| -rw-r--r-- | client.c | 12 | ||||
| -rw-r--r-- | icclient/client.h | 11 | 
2 files changed, 23 insertions, 0 deletions
@@ -39,6 +39,18 @@ bool icclient_init(const char *url, const char *certificate)  	return (bool)curl;  } +void icclient_results(size_t (*handler)(void *contents, size_t size, +			size_t nmemb, void *userdata), +		struct icclient_catalog **catalogptr, const char *prodgroup) +{ +	char nonspaced[strlen(prodgroup) + 1]; +	strcpy(nonspaced, prodgroup); +	char *space = NULL; +	while (space = strchr(nonspaced, ' ')) +		*space = '-'; +	request(handler, (void *)catalogptr, NULL, "%s", nonspaced); +} +  void icclient_allproducts(size_t (*handler)(void *, size_t, size_t, void *)  		, icclient_catalog **catalogptr)  { diff --git a/icclient/client.h b/icclient/client.h index f35b9a2..684e17a 100644 --- a/icclient/client.h +++ b/icclient/client.h @@ -19,6 +19,17 @@ extern "C" {  	bool icclient_init(const char *url, const char *certificate);  	/*! +	 * \brief For fetching data about products that belong a specific group. +	 * \param handler A pointer to a cURL write function callback. +	 * \param catalogptr A pointer to pointer to the catalog to store the data. +	 * \param prodgroup The name of the product group. +	 */ +	void icclient_results(size_t (*handler)(void *contents, size_t size, +				size_t nmemb, void *userdata), +			struct icclient_catalog **catalogptr, +			const char *prodgroup); + +	/*!  	 * \brief For fetching data about all active products.  	 * \param handler A pointer to a cURL write function callback.  	 * \param catalogptr A pointer to pointer to the catalog to store the data.  |