flickcurl.h   flickcurl.h 
skipping to change at line 21 skipping to change at line 21
* *
* You may not use this file except in compliance with at least one of * You may not use this file except in compliance with at least one of
* the above three licenses. * the above three licenses.
* *
* See LICENSE.html or LICENSE.txt at the top of this package for the * See LICENSE.html or LICENSE.txt at the top of this package for the
* complete terms and further detail along with the license texts for * complete terms and further detail along with the license texts for
* the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively. * the licenses in COPYING.LIB, COPYING and LICENSE-2.0.txt respectively.
* *
*/ */
#ifndef FLICKCURL_H
#define FLICKCURL_H
#ifdef __cplusplus
extern "C" {
#endif
/* needed for xmlDocPtr */
#include <libxml/tree.h>
/*
* Field data types
*/
typedef enum {
VALUE_TYPE_NONE, /* empty field */
VALUE_TYPE_PHOTO_ID, /* internal */
VALUE_TYPE_PHOTO_URI, /* internal */
VALUE_TYPE_UNIXTIME,
VALUE_TYPE_BOOLEAN,
VALUE_TYPE_DATETIME,
VALUE_TYPE_FLOAT,
VALUE_TYPE_INTEGER,
VALUE_TYPE_STRING,
VALUE_TYPE_URI,
VALUE_TYPE_PERSON_ID, /* internal */
VALUE_TYPE_LAST = VALUE_TYPE_PERSON_ID
} flickcurl_field_value_type;
/*
* Fields of a flickcurl_photo*
*/
typedef enum { typedef enum {
PHOTO_FIELD_none, PHOTO_FIELD_none,
PHOTO_FIELD_dateuploaded, PHOTO_FIELD_dateuploaded,
PHOTO_FIELD_farm, PHOTO_FIELD_farm,
PHOTO_FIELD_isfavorite, PHOTO_FIELD_isfavorite,
PHOTO_FIELD_license, PHOTO_FIELD_license,
PHOTO_FIELD_originalformat, PHOTO_FIELD_originalformat,
PHOTO_FIELD_rotation, PHOTO_FIELD_rotation,
PHOTO_FIELD_server, PHOTO_FIELD_server,
PHOTO_FIELD_dates_lastupdate, PHOTO_FIELD_dates_lastupdate,
skipping to change at line 55 skipping to change at line 86
PHOTO_FIELD_owner_nsid, PHOTO_FIELD_owner_nsid,
PHOTO_FIELD_owner_realname, PHOTO_FIELD_owner_realname,
PHOTO_FIELD_owner_username, PHOTO_FIELD_owner_username,
PHOTO_FIELD_title, PHOTO_FIELD_title,
PHOTO_FIELD_visibility_isfamily, PHOTO_FIELD_visibility_isfamily,
PHOTO_FIELD_visibility_isfriend, PHOTO_FIELD_visibility_isfriend,
PHOTO_FIELD_visibility_ispublic, PHOTO_FIELD_visibility_ispublic,
PHOTO_FIELD_secret, PHOTO_FIELD_secret,
PHOTO_FIELD_originalsecret, PHOTO_FIELD_originalsecret,
PHOTO_FIELD_LAST = PHOTO_FIELD_originalsecret PHOTO_FIELD_LAST = PHOTO_FIELD_originalsecret
} flickcurl_photo_field; } flickcurl_photo_field_type;
typedef enum {
VALUE_TYPE_NONE, /* empty field */
VALUE_TYPE_PHOTO_ID, /* internal */
VALUE_TYPE_PHOTO_URI, /* internal */
VALUE_TYPE_UNIXTIME,
VALUE_TYPE_BOOLEAN,
VALUE_TYPE_DATETIME,
VALUE_TYPE_FLOAT,
VALUE_TYPE_INTEGER,
VALUE_TYPE_STRING,
VALUE_TYPE_URI,
VALUE_TYPE_PERSON_ID, /* internal */
VALUE_TYPE_LAST = VALUE_TYPE_PERSON_ID
} flickcurl_field_value_type;
/* The main object type */
typedef struct flickcurl_s flickcurl; typedef struct flickcurl_s flickcurl;
/* Forward structure references */
struct flickcurl_s;
struct flickcurl_photo_s; struct flickcurl_photo_s;
/**
* flickcurl_tag:
*
* Most of these fields may be NULL, 0 for numbers
* but not all. Either 'raw' or 'cooked' MUST appear.
*/
typedef struct flickcurl_tag_s { typedef struct flickcurl_tag_s {
/* Associated photo object if any */
struct flickcurl_photo_s* photo; struct flickcurl_photo_s* photo;
char* id; char* id;
char* author; char* author;
char* authorname;
char* raw; char* raw;
char* cooked; char* cooked;
int machine_tag; int machine_tag;
int count;
} flickcurl_tag; } flickcurl_tag;
typedef struct {
char* string;
flickcurl_photo_field_type integer;
flickcurl_field_value_type type;
} flickcurl_photo_field;
typedef struct flickcurl_photo_s { typedef struct flickcurl_photo_s {
/* photo id */ /* photo id */
char *id; char *id;
/* photo page uri */ /* photo page uri */
char *uri; char *uri;
flickcurl_tag* tags[20]; flickcurl_tag** tags;
int tags_count; int tags_count;
struct { flickcurl_photo_field fields[PHOTO_FIELD_LAST + 1];
char* string;
int integer;
flickcurl_field_value_type type;
} fields[PHOTO_FIELD_LAST + 1];
} flickcurl_photo; } flickcurl_photo;
typedef struct { typedef struct {
/* license id */ /* license id */
int id; int id;
/* license url or NULL if none */ /* license url or NULL if none */
char *url; char *url;
/* license name */ /* license name */
char *name; char *name;
} flickcurl_license; } flickcurl_license;
/*
* Types of photo context: relationship between photo and another item
*/
typedef enum { typedef enum {
FLICKCURL_CONTEXT_NONE, FLICKCURL_CONTEXT_NONE,
FLICKCURL_CONTEXT_SET, FLICKCURL_CONTEXT_SET, /* other thing is a set */
FLICKCURL_CONTEXT_POOL, FLICKCURL_CONTEXT_POOL, /* other thing is a pool */
FLICKCURL_CONTEXT_PREV, FLICKCURL_CONTEXT_PREV, /* other thing is a previous photo */
FLICKCURL_CONTEXT_NEXT, FLICKCURL_CONTEXT_NEXT, /* other thing is a next photo */
FLICKCURL_CONTEXT_LAST = FLICKCURL_CONTEXT_NEXT FLICKCURL_CONTEXT_LAST = FLICKCURL_CONTEXT_NEXT
} flickcurl_context_type; } flickcurl_context_type;
typedef struct flickcurl_context_s { typedef struct {
flickcurl_context_type type; flickcurl_context_type type;
char* id; char* id;
char* secret; /* may be NULL */ char* secret; /* may be NULL */
int server; /* may be 0 */ int server; /* may be 0 */
int farm; /* may be 0 */ int farm; /* may be 0 */
char* title; /* may be NULL */ char* title; /* may be NULL */
char* url; /* may be NULL */ char* url; /* may be NULL */
char* thumb; /* may be NULL */ char* thumb; /* may be NULL */
} flickcurl_context; } flickcurl_context;
/*
* Fields of a flickcurl_person*
*/
typedef enum { typedef enum {
PERSON_FIELD_none, PERSON_FIELD_none,
PERSON_FIELD_isadmin, /* boolean */ PERSON_FIELD_isadmin, /* boolean */
PERSON_FIELD_ispro, /* boolean */ PERSON_FIELD_ispro, /* boolean */
PERSON_FIELD_iconserver, /* integer */ PERSON_FIELD_iconserver, /* integer */
PERSON_FIELD_iconfarm, /* integer - not in API docs */ PERSON_FIELD_iconfarm, /* integer - not in API docs */
PERSON_FIELD_username, /* string */ PERSON_FIELD_username, /* string */
PERSON_FIELD_realname, /* string */ PERSON_FIELD_realname, /* string */
PERSON_FIELD_mbox_sha1sum, /* string */ PERSON_FIELD_mbox_sha1sum, /* string */
PERSON_FIELD_location, /* string */ PERSON_FIELD_location, /* string */
PERSON_FIELD_photosurl, /* string */ PERSON_FIELD_photosurl, /* string */
PERSON_FIELD_profileurl, /* string */ PERSON_FIELD_profileurl, /* string */
PERSON_FIELD_mobileurl, /* string - not in API docs */ PERSON_FIELD_mobileurl, /* string - not in API docs */
PERSON_FIELD_photos_firstdate, /* dateTime */ PERSON_FIELD_photos_firstdate, /* dateTime */
PERSON_FIELD_photos_firstdatetaken, /* dateTime */ PERSON_FIELD_photos_firstdatetaken, /* dateTime */
PERSON_FIELD_photos_count, /* integer */ PERSON_FIELD_photos_count, /* integer */
PERSON_FIELD_LAST = PERSON_FIELD_photos_count PERSON_FIELD_photos_views, /* integer - not in API docs */
PERSON_FIELD_LAST = PERSON_FIELD_photos_views
} flickcurl_person_field_type;
typedef struct {
char* string;
flickcurl_person_field_type integer;
flickcurl_field_value_type type;
} flickcurl_person_field; } flickcurl_person_field;
typedef struct { typedef struct {
/* user nsid */ /* user nsid */
char *nsid; char *nsid;
struct { flickcurl_person_field fields[PERSON_FIELD_LAST + 1];
char* string;
int integer;
flickcurl_field_value_type type;
} fields[PERSON_FIELD_LAST + 1];
} flickcurl_person; } flickcurl_person;
/* callback handlers */
typedef void (*flickcurl_message_handler)(void *user_data, const char *mess age); typedef void (*flickcurl_message_handler)(void *user_data, const char *mess age);
typedef void (*set_config_var_handler)(void* userdata, const char* key, con
st char* value);
typedef void (*flickcurl_tag_handler)(void *user_data, flickcurl_tag* tag); typedef void (*flickcurl_tag_handler)(void *user_data, flickcurl_tag* tag);
/* library constants */
extern const char* const flickcurl_short_copyright_string; extern const char* const flickcurl_short_copyright_string;
extern const char* const flickcurl_copyright_string; extern const char* const flickcurl_copyright_string;
extern const char* const flickcurl_license_string; extern const char* const flickcurl_license_string;
extern const char* const flickcurl_home_url_string; extern const char* const flickcurl_home_url_string;
extern const char* const flickcurl_version_string; extern const char* const flickcurl_version_string;
/* constructor */ /* library init - call once before creating anything */
flickcurl* flickcurl_new(void);
/* destructor */
void flickcurl_free(flickcurl *fc);
/* library init/cleanup */
void flickcurl_init(void); void flickcurl_init(void);
/* library cleanup - call once before exit */
void flickcurl_finish(void); void flickcurl_finish(void);
/* error handler */ /* flickcurl* object constructor */
void flickcurl_set_error_handler(flickcurl* fc, flickcurl_message_handler e flickcurl* flickcurl_new(void);
rror_handler, void *error_data);
void flickcurl_set_tag_handler(flickcurl* fc, flickcurl_tag_handler tag_ha
ndler, void *tag_data);
/* set methods */ /* flickcurl* object destructor */
void flickcurl_set_user_agent(flickcurl* fc, const char *user_agent); void flickcurl_free(flickcurl *fc);
void flickcurl_set_proxy(flickcurl* fc, const char *proxy);
void flickcurl_set_http_accept(flickcurl* fc, const char *value); /* flickcurl* object set methods */
void flickcurl_set_api_key(flickcurl* fc, const char *api_key); void flickcurl_set_api_key(flickcurl* fc, const char *api_key);
void flickcurl_set_shared_secret(flickcurl* fc, const char *secret);
void flickcurl_set_auth_token(flickcurl *fc, const char* auth_token); void flickcurl_set_auth_token(flickcurl *fc, const char* auth_token);
void flickcurl_set_sig_key(flickcurl *fc, const char* sig_key); void flickcurl_set_data(flickcurl *fc, void* data, size_t data_length);
void flickcurl_set_error_handler(flickcurl* fc, flickcurl_message_handler e
rror_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_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_ha
ndler, 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);
/* get methods */ /* flickcurl* object set methods */
const char* flickcurl_get_api_key(flickcurl *fc); const char* flickcurl_get_api_key(flickcurl *fc);
const char* flickcurl_get_shared_secret(flickcurl *fc); const char* flickcurl_get_shared_secret(flickcurl *fc);
const char* flickcurl_get_auth_token(flickcurl *fc); const char* flickcurl_get_auth_token(flickcurl *fc);
const char* flickcurl_get_photo_field_label(flickcurl_photo_field field); /* other flickcurl class destructors */
const char* flickcurl_get_person_field_label(flickcurl_person_field field); void flickcurl_free_tag(flickcurl_tag *t);
const char* flickcurl_get_field_value_type_label(flickcurl_field_value_type void flickcurl_free_photo(flickcurl_photo *photo);
datatype); /* void flickcurl_free_license(flickcurl_person *license); */
const char* flickcurl_get_context_type_field_label(flickcurl_context_type t void flickcurl_free_person(flickcurl_person *person);
ype); void flickcurl_free_context(flickcurl_context *context);
void flickcurl_free_contexts(flickcurl_context** contexts);
/* utility methods */ /* utility methods */
/* get an image URL for a photo in some size */
char* flickcurl_photo_as_source_uri(flickcurl_photo *photo, const char c); char* flickcurl_photo_as_source_uri(flickcurl_photo *photo, const char c);
/* get labels for various field/types */
const char* flickcurl_get_photo_field_label(flickcurl_photo_field_type fiel
d);
const char* flickcurl_get_person_field_label(flickcurl_person_field_type fi
eld);
const char* flickcurl_get_field_value_type_label(flickcurl_field_value_type
datatype);
const char* flickcurl_get_context_type_field_label(flickcurl_context_type t
ype);
/* read a 'INI' style configuration file */
typedef void (*set_config_var_handler)(void* userdata, const char* key, con
st char* value);
int read_ini_config(const char* filename, const char* application, void* us
er_data, set_config_var_handler handler);
/* Flickr API calls */ /* Flickr API calls */
/* flickr.auth */
char* flickcurl_auth_checkToken(flickcurl* fc, const char* token);
char* flickcurl_auth_getFrob(flickcurl* fc);
char* flickcurl_auth_getFullToken(flickcurl* fc, const char* frob); char* flickcurl_auth_getFullToken(flickcurl* fc, const char* frob);
char* flickcurl_auth_getToken(flickcurl* fc, const char* frob);
/* flickr.groups */
flickcurl_context** flickcurl_groups_pools_getContext(flickcurl* fc, const char* photo_id, const char* group_id); flickcurl_context** flickcurl_groups_pools_getContext(flickcurl* fc, const char* photo_id, const char* group_id);
/* flickr.people */
char* flickcurl_people_findByEmail(flickcurl* fc, const char* email); char* flickcurl_people_findByEmail(flickcurl* fc, const char* email);
char* flickcurl_people_findByUsername(flickcurl* fc, const char* username); char* flickcurl_people_findByUsername(flickcurl* fc, const char* username);
flickcurl_person* flickcurl_people_getInfo(flickcurl* fc, const char* user_ id); flickcurl_person* flickcurl_people_getInfo(flickcurl* fc, const char* user_ id);
/* flickr.photos */
int flickcurl_photos_addTags(flickcurl* fc, const char* photo_id, const cha
r* tags);
int flickcurl_photos_delete(flickcurl* fc, const char* photo_id);
flickcurl_context** flickcurl_photos_getAllContexts(flickcurl* fc, const ch ar* photo_id); flickcurl_context** flickcurl_photos_getAllContexts(flickcurl* fc, const ch ar* photo_id);
flickcurl_context** flickcurl_photos_getContext(flickcurl* fc, const char* photo_id); flickcurl_context** flickcurl_photos_getContext(flickcurl* fc, const char* photo_id);
flickcurl_photo* flickcurl_photos_getInfo(flickcurl *fc, const char* photo_ id); flickcurl_photo* flickcurl_photos_getInfo(flickcurl *fc, const char* photo_ id);
int flickcurl_photos_removeTag(flickcurl* fc, const char* tag_id);
int flickcurl_photos_setTags(flickcurl* fc, const char* photo_id, const cha
r* tags);
/* flickr.photos.licenses */
flickcurl_license** flickcurl_photos_licenses_getInfo(flickcurl *fc); flickcurl_license** flickcurl_photos_licenses_getInfo(flickcurl *fc);
flickcurl_license* flickcurl_photos_licenses_getInfo_by_id(flickcurl *fc, i nt id); flickcurl_license* flickcurl_photos_licenses_getInfo_by_id(flickcurl *fc, i nt id);
/* flickr.photosets */
flickcurl_context** flickcurl_photosets_getContext(flickcurl* fc, const cha r* photo_id, const char* photoset_id); flickcurl_context** flickcurl_photosets_getContext(flickcurl* fc, const cha r* photo_id, const char* photoset_id);
/* flickr.tag */
flickcurl_tag** flickcurl_tags_getHotList(flickcurl* fc, const char* period
, int tag_count);
flickcurl_tag** flickcurl_tags_getListPhoto(flickcurl* fc, const char* phot
o_id);
flickcurl_tag** flickcurl_tags_getListUser(flickcurl* fc, const char* user_
id);
flickcurl_tag** flickcurl_tags_getListUserPopular(flickcurl* fc, const char
* user_id, int pop_count);
flickcurl_tag** flickcurl_tags_getListUserRaw(flickcurl* fc, const char* ta
g);
flickcurl_tag** flickcurl_tags_getRelated(flickcurl* fc, const char* tag);
/* flickr.test */
int flickcurl_test_echo(flickcurl* fc, const char* key, const char* value); int flickcurl_test_echo(flickcurl* fc, const char* key, const char* value);
/* flickr.urls */
char* flickcurl_urls_getGroup(flickcurl* fc, const char* group_id);
char* flickcurl_urls_getUserPhotos(flickcurl* fc, const char* user_id);
char* flickcurl_urls_getUserProfile(flickcurl* fc, const char* user_id);
char* flickcurl_urls_lookupGroup(flickcurl* fc, const char* url);
char* flickcurl_urls_lookupUser(flickcurl* fc, const char* url); char* flickcurl_urls_lookupUser(flickcurl* fc, const char* url);
void flickcurl_free_tag(flickcurl_tag *t); #ifdef __cplusplus
void flickcurl_free_photo(flickcurl_photo *photo); }
/* void flickcurl_free_license(flickcurl_person *license); */ #endif
void flickcurl_free_person(flickcurl_person *person);
void flickcurl_free_context(flickcurl_context *context);
void flickcurl_free_contexts(flickcurl_context** contexts);
/* config.c */ #endif
int read_ini_config(const char* filename, const char* application, void* us
er_data, set_config_var_handler handler);
 End of changes. 44 change blocks. 
81 lines changed or deleted 169 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/