libinterchange
Data Structures | Macros | Functions
interchange.h File Reference
#include "interchange/typedefs.h"

Go to the source code of this file.

Data Structures

struct  interchange_product
 
struct  interchange_product::interchange_product_crosssell
 
struct  interchange_catalog
 

Macros

#define interchange_allproducts(handler, callback)   interchange_catalog("All-Products", handler, callback)
 For fetching data about all active products.
 

Functions

void interchange_init (const char *sampleurl, const char *image_dir, const char *cookie, const char *certificate)
 A function that needs to be run first.
 
void interchange_page (const char *path, void(*parser)(interchange_response *))
 Generic function for fetching data using a relative path.
 
void interchange_catalog (const char *prod_group, void(*handler)(interchange_response *), void(*callback)(struct interchange_catalog *))
 For fetching data about products that belong a specific group.
 
void interchange_product (const char *sku, void(*handler)(interchange_response *), void(*callback)(struct interchange_product *))
 For fetching data about a specific product.
 
void interchange_clear_product (struct interchange_product *product)
 
void interchange_free_catalog (struct interchange_catalog *catalog)
 
void interchange_free_response (interchange_response *response)
 
void interchange_cleanup ()
 

Macro Definition Documentation

◆ interchange_allproducts

#define interchange_allproducts (   handler,
  callback 
)    interchange_catalog("All-Products", handler, callback)

For fetching data about all active products.

Parameters
handlerA pointer to the function when a custom handler is needed to arrange the data into the catalog.
callbackA pointer to the function that needs to be called after the catalog is ready.

Function Documentation

◆ interchange_catalog()

void interchange_catalog ( const char *  prod_group,
void(*)(interchange_response *)  handler,
void(*)(struct interchange_catalog *)  callback 
)

For fetching data about products that belong a specific group.

Parameters
prod_groupThe name of the product group.
handlerA pointer to the function when a custom handler is needed to arrange the data into the catalog.
callbackA pointer to the function that needs to be called after the catalog is ready.

◆ interchange_cleanup()

void interchange_cleanup ( )

◆ interchange_clear_product()

void interchange_clear_product ( struct interchange_product product)

◆ interchange_free_catalog()

void interchange_free_catalog ( struct interchange_catalog catalog)

◆ interchange_free_response()

void interchange_free_response ( interchange_response response)

◆ interchange_init()

void interchange_init ( const char *  sampleurl,
const char *  image_dir,
const char *  cookie,
const char *  certificate 
)

A function that needs to be run first.

Parameters
sampleurlThe value of the SAMPLEURL setting in products/variable.txt.
image_dirThe value of the IMAGE_DIR setting in products/variable.txt.
cookiePath to the cookie file.
certificatePath to the CA certificate file.

◆ interchange_page()

void interchange_page ( const char *  path,
void(*)(interchange_response *)  parser 
)

Generic function for fetching data using a relative path.

Parameters
pathThe path.
parserFunction for parsing the formatted response.

◆ interchange_product()

void interchange_product ( const char *  sku,
void(*)(interchange_response *)  handler,
void(*)(struct interchange_product *)  callback 
)

For fetching data about a specific product.

Parameters
skuThe SKU of the product.
handlerA pointer to the function when a custom handler is needed to arrange the data into the product.
callbackA pointer to the function that needs to be called after the product is ready.