Esempio n. 1
0
/**
 * flickcurl_people_getPhotosOf_params:
 * @fc: flickcurl context
 * @user_id: The NSID of the user who's photo to search. A value of "me" will search against the calling user's photos for authenticated calls.
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 * 
 * Returns a list of photos containing a particular Flickr member.
 *
 * Announced 2010-01-21
 * http://code.flickr.com/blog/2010/01/21/people-in-photos-the-api-methods/
 * 
 * Return value: photos list or NULL on failure
 **/
flickcurl_photos_list*
flickcurl_people_getPhotosOf_params(flickcurl* fc, const char* user_id,
                                    flickcurl_photos_list_params* list_params)
{
  flickcurl_photos_list* photos_list = NULL;
  const char* format = NULL;
  
  flickcurl_init_params(fc, 0);

  if(!user_id)
    return photos_list;

  flickcurl_add_param(fc, "user_id", user_id);

  /* Photos List parameters */
  flickcurl_append_photos_list_params(fc, list_params, &format);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.people.getPhotosOf"))
    goto tidy;

  photos_list = flickcurl_invoke_photos_list(fc,
                                             (const xmlChar*)"/rsp/photos",
                                             format);

  tidy:
  if(fc->failed) {
    if(photos_list)
      flickcurl_free_photos_list(photos_list);
    photos_list = NULL;
  }

  return photos_list;
}
Esempio n. 2
0
/**
 * flickcurl_interestingness_getList_params:
 * @fc: flickcurl context
 * @date: A specific date, formatted as YYYY-MM-DD, to return interesting photos for. (or NULL)
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 * 
 * Returns the list of interesting photos for the most recent day or a user-specified date.
 *
 * Optional extra type 'media' that will return an extra media = VALUE
 * for VALUE "photo" or "video".  API addition 2008-04-07.
 *
 * Return value: non-0 on failure
 **/
flickcurl_photos_list*
flickcurl_interestingness_getList_params(flickcurl* fc, const char* date,
                                         flickcurl_photos_list_params* list_params)
{
  flickcurl_photos_list* photos_list = NULL;
  const char* format = NULL;

  flickcurl_init_params(fc);

  /* API parameters */
  if(date) {
    flickcurl_add_param(fc, "date", date);
  }

  /* Photos List parameters */
  flickcurl_append_photos_list_params(fc, list_params, &format);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.interestingness.getList"))
    goto tidy;

  photos_list = flickcurl_invoke_photos_list(fc,
                                             (const xmlChar*)"/rsp/photos",
                                             format);

  tidy:
  if(fc->failed) {
    if(photos_list)
      flickcurl_free_photos_list(photos_list);
    photos_list = NULL;
  }

  return photos_list;
}
Esempio n. 3
0
/**
 * flickcurl_photos_geo_photosForLocation_params:
 * @fc: flickcurl context
 * @location: The location (lat, long, accuracy) of the photos
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 * 
 * Get a list of photos for a user at a specific location (latitude, longitude
 * and accuracy)
 *
 * Return value: list of photos or NULL on failure
 **/
flickcurl_photos_list*
flickcurl_photos_geo_photosForLocation_params(flickcurl* fc,
                                              flickcurl_location* location,
                                              flickcurl_photos_list_params* list_params)
{
  flickcurl_photos_list* photos_list = NULL;
  char latitude_s[50];
  char longitude_s[50];
  char accuracy_s[50];
  const char* format = NULL;

  flickcurl_init_params(fc, 0);

  if(!location)
    return NULL;
  
  if(location->latitude < -90.0)
    location->latitude= -90.0;
  if(location->latitude > 90.0)
    location->latitude= 90.0;
  if(location->longitude < -180.0)
    location->longitude= -180.0;
  if(location->longitude > 180.0)
    location->longitude= 180.0;
  if(location->accuracy < 1 || location->accuracy > 16)
    location->accuracy = 0;
  

  sprintf(latitude_s, "%f", location->latitude);
  flickcurl_add_param(fc, "lat", latitude_s);
  sprintf(longitude_s, "%f", location->longitude);
  flickcurl_add_param(fc, "lon", longitude_s);
  sprintf(accuracy_s, "%d", location->accuracy);
  flickcurl_add_param(fc, "accuracy", accuracy_s);

  /* Photos List parameters */
  flickcurl_append_photos_list_params(fc, list_params, &format);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.photos.geo.photosForLocation"))
    goto tidy;

  photos_list = flickcurl_invoke_photos_list(fc,
                                             (const xmlChar*)"/rsp/photos",
                                             format);

  tidy:
  if(fc->failed) {
    if(photos_list)
      flickcurl_free_photos_list(photos_list);
    photos_list = NULL;
  }

  return photos_list;
}
Esempio n. 4
0
/**
 * flickcurl_groups_pools_getPhotos_params:
 * @fc: flickcurl context
 * @group_id: The id of the group who's pool you which to get the photo list for.
 * @tags: A tag to filter the pool with. At the moment only one tag at a time is supported. (or NULL)
 * @user_id: The nsid of a user (or NULL).  If given, retrieves only photos that the user has contributed to the group pool.
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 * 
 * Returns a list of pool photos for a given group.
 *
 * Currently supported extra fields are: license, date_upload,
 * date_taken, owner_name, icon_server, original_format,
 * last_update, geo, tags, machine_tags.
 *
 * Optional extra type 'media' that will return an extra media=VALUE
 * for VALUE "photo" or "video".  API addition 2008-04-07.
 *
 * Return value: non-0 on failure
 **/
flickcurl_photos_list*
flickcurl_groups_pools_getPhotos_params(flickcurl* fc, const char* group_id,
                                        const char* tags, const char* user_id,
                                        flickcurl_photos_list_params* list_params)
{
  const char* parameters[14][2];
  int count=0;
  flickcurl_photos_list* photos_list=NULL;
  const char* format=NULL;
  
  if(!group_id)
    return NULL;

  /* API parameters */
  parameters[count][0]  = "group_id";
  parameters[count++][1]= group_id;
  if(tags) {
    parameters[count][0]  = "tags";
    parameters[count++][1]= tags;
  }
  if(user_id) {
    parameters[count][0]  = "user_id";
    parameters[count++][1]= user_id;
  }

  /* Photos List parameters */
  flickcurl_append_photos_list_params(list_params, parameters, &count, &format);
  
  parameters[count][0]  = NULL;

  if(flickcurl_prepare(fc, "flickr.groups.pools.getPhotos", parameters, count))
    goto tidy;

  photos_list=flickcurl_invoke_photos_list(fc,
                                           (const xmlChar*)"/rsp/photos/photo",
                                           format);

  tidy:
  if(fc->failed) {
    if(photos_list)
      flickcurl_free_photos_list(photos_list);
    photos_list=NULL;
  }

  return photos_list;
}
Esempio n. 5
0
/**
 * flickcurl_photosets_getPhotos_params:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to return the photos for.
 * @privacy_filter: Return photos only matching a certain privacy level 1-5 (or <0)
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 *
 * Get the list of photos in a set.
 *
 * Currently supported extra fields are: license, date_upload,
 * date_taken, owner_name, icon_server, original_format,
 * last_update.
 *
 * Optional extra type 'media' that will return an extra media = VALUE
 * for VALUE "photo" or "video".  API addition 2008-04-07.
 *
 * Return value: list of photos or NULL on failure
 **/
flickcurl_photos_list*
flickcurl_photosets_getPhotos_params(flickcurl* fc, const char* photoset_id,
                                     int privacy_filter,
                                     flickcurl_photos_list_params* list_params)
{
    const char* parameters[13][2];
    int count = 0;
    flickcurl_photos_list* photos_list = NULL;
    char privacy_filter_str[2];
    const char* format = NULL;

    if(!photoset_id)
        return NULL;

    /* API parameters */
    parameters[count][0]  = "photoset_id";
    parameters[count++][1]= photoset_id;
    if(privacy_filter >= 1 && privacy_filter <= 5) {
        parameters[count][0]  = "privacy_filter";
        sprintf(privacy_filter_str, "%d", privacy_filter);
        parameters[count++][1]= privacy_filter_str;
    }

    /* Photos List parameters */
    flickcurl_append_photos_list_params(list_params, parameters, &count, &format);

    parameters[count][0]  = NULL;

    if(flickcurl_prepare(fc, "flickr.photosets.getPhotos", parameters, count))
        goto tidy;

    photos_list = flickcurl_invoke_photos_list(fc,
                  (const xmlChar*)"/rsp/photoset/photo",
                  format);

tidy:
    if(fc->failed) {
        if(photos_list)
            flickcurl_free_photos_list(photos_list);
        photos_list = NULL;
    }

    return photos_list;
}
Esempio n. 6
0
/**
 * flickcurl_groups_pools_getPhotos_params:
 * @fc: flickcurl context
 * @group_id: The id of the group who's pool you which to get the photo list for.
 * @tags: A tag to filter the pool with. At the moment only one tag at a time is supported. (or NULL)
 * @user_id: The nsid of a user (or NULL).  If given, retrieves only photos that the user has contributed to the group pool.
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 * 
 * Returns a list of pool photos for a given group.
 *
 * Currently supported extra fields are: license, date_upload,
 * date_taken, owner_name, icon_server, original_format,
 * last_update, geo, tags, machine_tags.
 *
 * Optional extra type 'media' that will return an extra media = VALUE
 * for VALUE "photo" or "video".  API addition 2008-04-07.
 *
 * Return value: non-0 on failure
 **/
flickcurl_photos_list*
flickcurl_groups_pools_getPhotos_params(flickcurl* fc, const char* group_id,
                                        const char* tags, const char* user_id,
                                        flickcurl_photos_list_params* list_params)
{
  flickcurl_photos_list* photos_list = NULL;
  const char* format = NULL;
  
  flickcurl_init_params(fc);

  if(!group_id)
    return NULL;

  /* API parameters */
  flickcurl_add_param(fc, "group_id", group_id);
  if(tags) {
    flickcurl_add_param(fc, "tags", tags);
  }
  if(user_id) {
    flickcurl_add_param(fc, "user_id", user_id);
  }

  /* Photos List parameters */
  flickcurl_append_photos_list_params(fc, list_params, &format);
  
  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.groups.pools.getPhotos"))
    goto tidy;

  photos_list = flickcurl_invoke_photos_list(fc,
                                             (const xmlChar*)"/rsp/photos",
                                             format);

  tidy:
  if(fc->failed) {
    if(photos_list)
      flickcurl_free_photos_list(photos_list);
    photos_list = NULL;
  }

  return photos_list;
}
Esempio n. 7
0
/**
 * flickcurl_photosets_getPhotos_params:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to return the photos for.
 * @privacy_filter: Return photos only matching a certain privacy level 1-5 (or <0)
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 *
 * Get the list of photos in a set.
 *
 * Currently supported extra fields are: license, date_upload,
 * date_taken, owner_name, icon_server, original_format,
 * last_update.
 *
 * Optional extra type 'media' that will return an extra media = VALUE
 * for VALUE "photo" or "video".  API addition 2008-04-07.
 *
 * Return value: list of photos or NULL on failure
 **/
flickcurl_photos_list*
flickcurl_photosets_getPhotos_params(flickcurl* fc, const char* photoset_id,
                                     int privacy_filter,
                                     flickcurl_photos_list_params* list_params)
{
    flickcurl_photos_list* photos_list = NULL;
    char privacy_filter_str[2];
    const char* format = NULL;

    flickcurl_init_params(fc);

    if(!photoset_id)
        return NULL;

    /* API parameters */
    flickcurl_add_param(fc, "photoset_id", photoset_id);
    if(privacy_filter >= 1 && privacy_filter <= 5) {
        sprintf(privacy_filter_str, "%d", privacy_filter);
        flickcurl_add_param(fc, "privacy_filter", privacy_filter_str);
    }

    /* Photos List parameters */
    flickcurl_append_photos_list_params(fc, list_params, &format);

    flickcurl_end_params(fc);

    if(flickcurl_prepare(fc, "flickr.photosets.getPhotos"))
        goto tidy;

    photos_list = flickcurl_invoke_photos_list(fc,
                  (const xmlChar*)"/rsp/photoset",
                  format);

tidy:
    if(fc->failed) {
        if(photos_list)
            flickcurl_free_photos_list(photos_list);
        photos_list = NULL;
    }

    return photos_list;
}
Esempio n. 8
0
/**
 * flickcurl_people_getPublicPhotos_params:
 * @fc: flickcurl context
 * @user_id: The NSID of the user who's photos to return.
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 * 
 * Get a list of public photos for the given user.
 *
 * Currently supported extras fields are: license, date_upload,
 * date_taken, owner_name, icon_server, original_format,
 * last_update, geo, tags, machine_tags.
 *
 * Optional extra type 'media' that will return an extra media=VALUE
 * for VALUE "photo" or "video".  API addition 2008-04-07.
 *
 * Return value: non-0 on failure
 **/
flickcurl_photos_list*
flickcurl_people_getPublicPhotos_params(flickcurl* fc, const char* user_id, 
                                        flickcurl_photos_list_params* list_params)
{
  const char* parameters[12][2];
  int count=0;
  flickcurl_photos_list* photos_list=NULL;
  const char* format=NULL;
  
  if(!user_id)
    return NULL;

  /* API parameters */
  parameters[count][0]  = "user_id";
  parameters[count++][1]= user_id;

  /* Photos List parameters */
  flickcurl_append_photos_list_params(list_params, parameters, &count, &format);

  parameters[count][0]  = NULL;

  if(flickcurl_prepare(fc, "flickr.people.getPublicPhotos", parameters, count))
    goto tidy;

  photos_list=flickcurl_invoke_photos_list(fc,
                                           (const xmlChar*)"/rsp/photos/photo",
                                           format);

  tidy:
  if(fc->failed) {
    if(photos_list)
      flickcurl_free_photos_list(photos_list);
    photos_list=NULL;
  }

  return photos_list;
}
Esempio n. 9
0
/**
 * flickcurl_galleries_getPhotos_params:
 * @fc: flickcurl context
 * @gallery_id: The ID of the gallery of photos to return
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 *
 * Return the list of photos for a gallery
 *
 * Currently supported extras fields are: description, license,
 * date_upload, date_taken, owner_name, icon_server, original_format,
 * last_update, geo, tags, machine_tags, o_dims, views, media,
 * path_alias, url_sq, url_t, url_s, url_m, url_o
 *
 * Return value: list of people public photos or NULL on failure
 **/
flickcurl_photos_list*
flickcurl_galleries_getPhotos_params(flickcurl* fc, const char* gallery_id,
                                     flickcurl_photos_list_params* list_params)
{
    flickcurl_photos_list* photos_list = NULL;
    const char* format = NULL;

    flickcurl_init_params(fc);

    if(!gallery_id)
        return NULL;

    /* API parameters */
    flickcurl_add_param(fc, "gallery_id", gallery_id);

    /* Photos List parameters */
    flickcurl_append_photos_list_params(fc, list_params, &format);

    flickcurl_end_params(fc);

    if(flickcurl_prepare(fc, "flickr.galleries.getPhotos"))
        goto tidy;

    photos_list = flickcurl_invoke_photos_list(fc,
                  (const xmlChar*)"/rsp/gallery",
                  format);

tidy:
    if(fc->failed) {
        if(photos_list)
            flickcurl_free_photos_list(photos_list);
        photos_list = NULL;
    }

    return photos_list;
}
Esempio n. 10
0
/**
 * flickcurl_people_getPhotos_params:
 * @fc: flickcurl context
 * @user_id: The NSID of the user who's photos to return. A value of "me" will return the calling user's photos.
 * @safe_search: Safe search setting: 1 for safe, 2 for moderate, 3 for restricted. (Please note: Un-authed calls can only see Safe content.) (or < 0)
 * @min_upload_date: Minimum upload date. Photos with an upload date greater than or equal to this value will be returned. The date should be in the form of a unix timestamp. (or NULL)
 * @max_upload_date: Maximum upload date. Photos with an upload date less than or equal to this value will be returned. The date should be in the form of a unix timestamp. (or NULL)
 * @min_taken_date: Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. The date should be in the form of a mysql datetime. (or NULL)
 * @max_taken_date: Maximum taken date. Photos with an taken date less than or equal to this value will be returned. The date should be in the form of a mysql datetime. (or NULL)
 * @content_type: Content Type setting: 1 for photos only, 2 for screenshots only, 3 for 'other' only, 4 for photos and screenshots, 5 for screenshots and 'other', 6 for photos and 'other', 7 for photos, screenshots, and 'other' (all) (or < 0)
 * @privacy_filter: Return photos only matching a certain privacy level. This only applies when making an authenticated call to view photos you own. Valid values are: 1 public photos, 2 private photos visible to friends, 3 private photos visible to family, 4 private photos visible to friends & family, 5 completely private photos (or < 0)
 * @list_params: #flickcurl_photos_list_params result parameters (or NULL)
 * 
 * Get photos from the given user's photostream.
 *
 * Only photos visible to the calling user will be returned. This
 * method must be authenticated; to return public photos for a user,
 * use flickcurl_people_getPublicPhotos().
 *
 * Return value: non-0 on failure
 **/
flickcurl_photos_list*
flickcurl_people_getPhotos_params(flickcurl* fc, const char* user_id,
                                  int safe_search,
                                  const char* min_upload_date,
                                  const char* max_upload_date,
                                  const char* min_taken_date,
                                  const char* max_taken_date,
                                  int content_type,
                                  int privacy_filter,
                                  flickcurl_photos_list_params* list_params)
{
  flickcurl_photos_list* photos_list = NULL;
  const char* format = NULL;
  char safe_search_s[4];
  char content_type_s[4];
  char privacy_filter_s[4];
  
  flickcurl_init_params(fc, 0);

  if(!user_id)
    return NULL;

  flickcurl_add_param(fc, "user_id", user_id);
  if(safe_search >= 0 && safe_search < 10) {
    sprintf(safe_search_s, "%d", safe_search);
    flickcurl_add_param(fc, "safe_search", safe_search_s);
  }
  if(min_upload_date) {
    flickcurl_add_param(fc, "min_upload_date", min_upload_date);
  }
  if(max_upload_date) {
    flickcurl_add_param(fc, "max_upload_date", max_upload_date);
  }
  if(min_taken_date) {
    flickcurl_add_param(fc, "min_taken_date", min_taken_date);
  }
  if(max_taken_date) {
    flickcurl_add_param(fc, "max_taken_date", max_taken_date);
  }
  if(content_type >= 0 && content_type < 10) {
    sprintf(content_type_s, "%d", content_type);
    flickcurl_add_param(fc, "content_type", content_type_s);
  }
  if(privacy_filter >= 0 && privacy_filter < 10) {
    sprintf(privacy_filter_s, "%d", privacy_filter);
    flickcurl_add_param(fc, "privacy_filter", privacy_filter_s);
  }

  /* Photos List parameters */
  flickcurl_append_photos_list_params(fc, list_params, &format);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.people.getPhotos"))
    goto tidy;

  photos_list = flickcurl_invoke_photos_list(fc,
                                             (const xmlChar*)"/rsp/photos",
                                             format);

  tidy:
  if(fc->failed) {
    if(photos_list)
      flickcurl_free_photos_list(photos_list);
    photos_list = NULL;
  }

  return photos_list;
}