Core

## Core Core — Core library functions |

## Synopsis

    typedef             flickcurl;
    void                (*flickcurl_message_handler)        (void *user_data,
                                                             const char *message);
    int                 flickcurl_init                      (void);
    void                flickcurl_finish                    (void);
    flickcurl*          flickcurl_new                       (void);
    void                flickcurl_free                      (flickcurl *fc);
    const char*         flickcurl_get_api_key               (flickcurl *fc);
    const char*         flickcurl_get_auth_token            (flickcurl *fc);
    void                flickcurl_set_api_key               (flickcurl *fc,
                                                             const char *api_key);
    void                flickcurl_set_auth_token            (flickcurl *fc,
                                                             const char *auth_token);
    void                flickcurl_set_data                  (flickcurl *fc,
                                                             void *data,
                                                             size_t data_length);
    void                flickcurl_set_error_handler         (flickcurl *fc,
                                                             flickcurl_message_handler error_handler,
                                                             void *error_data);
    void                flickcurl_set_http_accept           (flickcurl *fc,
                                                             const char *value);
    void                flickcurl_set_proxy                 (flickcurl *fc,
                                                             const char *proxy);
    void                flickcurl_set_request_delay         (flickcurl *fc,
                                                             long delay_msec );
    void                flickcurl_set_shared_secret         (flickcurl *fc,
                                                             const char *secret);
    void                flickcurl_set_sign                  (flickcurl *fc);
    void                flickcurl_set_tag_handler           (flickcurl *fc,
                                                             flickcurl_tag_handler tag_handler,
                                                             void *tag_data);
    void                flickcurl_set_user_agent            (flickcurl *fc,
                                                             const char *user_agent);
    void                flickcurl_set_write                 (flickcurl *fc,
                                                             int is_write);
    void                flickcurl_set_xml_data              (flickcurl *fc,
                                                             xmlDocPtr doc);

## Description

Core library functions

## Details

### flickcurl

    typedef struct flickcurl_s flickcurl;

Flickcurl session object created by `flickcurl_new()` and destroyed by `flickcurl_free()`

### flickcurl_message_handler ()

    void                (*flickcurl_message_handler)        (void *user_data,
                                                             const char *message);

Flickcurl Message handler callback.

`user_data` : | user data pointer
`message` : | error message

### flickcurl_init ()

    int                 flickcurl_init                      (void);

Initialise Flickcurl library.

Returns : | non-0 on failure

### flickcurl_finish ()

    void                flickcurl_finish                    (void);

Terminate Flickcurl library.

### flickcurl_new ()

    flickcurl*          flickcurl_new                       (void);

Create a Flickcurl sesssion

Returns : | new flickcurl object or NULL on fialure

### flickcurl_free ()

    void                flickcurl_free                      (flickcurl *fc);

Destroy flickcurl session

`fc` : | flickcurl object

### flickcurl_get_api_key ()

    const char*         flickcurl_get_api_key               (flickcurl *fc);

Get current application API Key

`fc` : | flickcurl object
Returns : | API key or NULL if none set

### flickcurl_get_auth_token ()

    const char*         flickcurl_get_auth_token            (flickcurl *fc);

Get current auth token

`fc` : | flickcurl object
Returns : | auth token or NULL if none set

### flickcurl_set_api_key ()

    void                flickcurl_set_api_key               (flickcurl *fc,
                                                             const char *api_key);

Set application API Key for flickcurl requests

`fc` : | flickcurl object
`api_key` : | API Key

### flickcurl_set_auth_token ()

    void                flickcurl_set_auth_token            (flickcurl *fc,
                                                             const char *auth_token);

Set Auth Token for flickcurl requests

`fc` : | flickcurl object
`auth_token` : | auth token

### flickcurl_set_data ()

    void                flickcurl_set_data                  (flickcurl *fc,
                                                             void *data,
                                                             size_t data_length);

Set web service request content data.

`fc` : | flickcurl object
`data` : | data pointer
`data_length` : | data length

### flickcurl_set_error_handler ()

    void                flickcurl_set_error_handler         (flickcurl *fc,
                                                             flickcurl_message_handler error_handler,
                                                             void *error_data);

Set Flickcurl error handler.

`fc` : | flickcurl object
`error_handler` : | error handler function
`error_data` : | error handler data

### flickcurl_set_http_accept ()

    void                flickcurl_set_http_accept           (flickcurl *fc,
                                                             const char *value);

Set HTTP accept header value for flickcurl requests

`fc` : | flickcurl object
`value` : | HTTP Accept header value

### flickcurl_set_proxy ()

    void                flickcurl_set_proxy                 (flickcurl *fc,
                                                             const char *proxy);

Set HTTP proxy for flickcurl requests

`fc` : | flickcurl object
`proxy` : | HTTP proxy string

### flickcurl_set_request_delay ()

    void                flickcurl_set_request_delay         (flickcurl *fc,
                                                             long delay_msec );

Set web service request delay

`fc` : | flickcurl object
`Param2` : |

### flickcurl_set_shared_secret ()

    void                flickcurl_set_shared_secret         (flickcurl *fc,
                                                             const char *secret);

Set Shared Secret for flickcurl requests

`fc` : | flickcurl object
`secret` : | shared secret

### flickcurl_set_sign ()

    void                flickcurl_set_sign                  (flickcurl *fc);

Make the next request signed.

`fc` : | flickcurl object

### flickcurl_set_tag_handler ()

    void                flickcurl_set_tag_handler           (flickcurl *fc,
                                                             flickcurl_tag_handler tag_handler,
                                                             void *tag_data);

Set Flickcurl tag handler.

`fc` : | flickcurl object
`tag_handler` : | tag handler function
`tag_data` : | tag handler data

### flickcurl_set_user_agent ()

    void                flickcurl_set_user_agent            (flickcurl *fc,
                                                             const char *user_agent);

Set Flickcurl HTTP user agent string

`fc` : | flickcurl object
`user_agent` : | user agent string

### flickcurl_set_write ()

    void                flickcurl_set_write                 (flickcurl *fc,
                                                             int is_write);

Set writeable flag.

`fc` : | flickcurl object
`is_write` : | writeable flag

### flickcurl_set_xml_data ()

    void                flickcurl_set_xml_data              (flickcurl *fc,
                                                             xmlDocPtr doc);

Set web service request content data from XML DOM.

`fc` : | flickcurl object
`doc` : | XML dom