示例#1
0
/**
 * flickcurl_photos_notes_delete:
 * @fc: flickcurl context
 * @note_id: The id of the note to delete
 * 
 * Delete a note from a photo.
 *
 * Implements flickr.photos.notes.delete (0.12)
 * 
 * Return value: non-0 on failure
 **/
int
flickcurl_photos_notes_delete(flickcurl* fc, const char* note_id)
{
  xmlDocPtr doc = NULL;
  int result = 1;
  
  flickcurl_init_params(fc);

  if(!note_id)
    return 1;

  flickcurl_add_param(fc, "note_id", note_id);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.photos.notes.delete"))
    goto tidy;

  flickcurl_set_write(fc, 1);
  flickcurl_set_data(fc, (void*)"", 0);

  doc = flickcurl_invoke(fc);
  if(!doc)
    goto tidy;

  result = 0;

  tidy:
  if(fc->failed)
    result = 1;

  return result;
}
示例#2
0
/**
 * flickcurl_photosets_delete:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to delete. Must be owned by the calling user.
 *
 * Delete a photoset.
 *
 * Implements flickr.photosets.delete (0.13)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_delete(flickcurl* fc, const char* photoset_id)
{
    xmlDocPtr doc = NULL;

    flickcurl_init_params(fc);

    if(!photoset_id)
        return 1;

    flickcurl_add_param(fc, "photoset_id", photoset_id);

    flickcurl_end_params(fc);

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

tidy:

    return fc->failed;
}
示例#3
0
/**
 * flickcurl_photosets_delete:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to delete. Must be owned by the calling user.
 *
 * Delete a photoset.
 *
 * Implements flickr.photosets.delete (0.13)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_delete(flickcurl* fc, const char* photoset_id)
{
    const char* parameters[8][2];
    int count = 0;
    xmlDocPtr doc = NULL;

    if(!photoset_id)
        return 1;

    parameters[count][0]  = "photoset_id";
    parameters[count++][1]= photoset_id;

    parameters[count][0]  = NULL;

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

tidy:

    return fc->failed;
}
示例#4
0
/**
 * flickcurl_photosets_setPrimaryPhoto:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to set primary photo to.
 * @photo_id: The id of the photo to set as primary.
 *
 * Set photoset primary photo
 *
 * Implements flickr.photosets.setPrimaryPhoto (1.19)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_setPrimaryPhoto(flickcurl* fc, const char* photoset_id,
                                    const char* photo_id)
{
    xmlDocPtr doc = NULL;
    int result = 1;

    flickcurl_init_params(fc);

    if(!photoset_id || !photo_id)
        return 1;

    flickcurl_add_param(fc, "photoset_id", photoset_id);
    flickcurl_add_param(fc, "photo_id", photo_id);

    flickcurl_end_params(fc);

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    result = 0;

tidy:
    if(fc->failed)
        result = 1;

    return result;
}
示例#5
0
/**
 * flickcurl_photos_notes_add:
 * @fc: flickcurl context
 * @photo_id: The id of the photo to add a note to
 * @note_x: The left coordinate of the note
 * @note_y: The top coordinate of the note
 * @note_w: The width of the note
 * @note_h: The height of the note
 * @note_text: The description of the note
 * 
 * Add a note to a photo.
 *
 * Coordinates and sizes are in pixels, based on the 500px image size
 * shown on individual photo pages.
 *
 * Implements flickr.photos.notes.add (0.12)
 * 
 * Return value: note ID or NULL on failure
 **/
char*
flickcurl_photos_notes_add(flickcurl* fc, const char* photo_id,
                           int note_x, int note_y, int note_w, int note_h,
                           const char* note_text)
{
  xmlDocPtr doc = NULL;
  xmlXPathContextPtr xpathCtx = NULL; 
  char *id = NULL;
  char note_x_s[10];
  char note_y_s[10];
  char note_w_s[10];
  char note_h_s[10];
  
  flickcurl_init_params(fc);

  if(!photo_id || !note_text)
    return NULL;

  flickcurl_add_param(fc, "photo_id", photo_id);
  sprintf(note_x_s, "%d", note_x);
  flickcurl_add_param(fc, "note_x", note_x_s);
  sprintf(note_y_s, "%d", note_y);
  flickcurl_add_param(fc, "note_y", note_y_s);
  sprintf(note_w_s, "%d", note_w);
  flickcurl_add_param(fc, "note_w", note_w_s);
  sprintf(note_h_s, "%d", note_h);
  flickcurl_add_param(fc, "note_h", note_h_s);
  flickcurl_add_param(fc, "note_text", note_text);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.photos.notes.add"))
    goto tidy;

  flickcurl_set_write(fc, 1);
  flickcurl_set_data(fc, (void*)"", 0);

  doc = flickcurl_invoke(fc);
  if(!doc)
    goto tidy;


  xpathCtx = xmlXPathNewContext(doc);
  if(!xpathCtx) {
    flickcurl_error(fc, "Failed to create XPath context for document");
    fc->failed = 1;
    goto tidy;
  }

  id = flickcurl_xpath_eval(fc, xpathCtx, (const xmlChar*)"/rsp/note/@id");

  tidy:
  if(xpathCtx)
    xmlXPathFreeContext(xpathCtx);

  if(fc->failed)
    id = NULL;

  return id;
}
示例#6
0
/**
 * flickcurl_groups_pools_add:
 * @fc: flickcurl context
 * @photo_id: The id of the photo to add to the group pool.
 * @group_id: The NSID of the group who's pool the photo is to be added to.
 * 
 * Add a photo to a group's pool.
 *
 * Implements flickr.groups.pools.add (0.12)
 * 
 * Return value: non-0 on failure
 **/
int
flickcurl_groups_pools_add(flickcurl* fc, const char* photo_id,
                           const char* group_id)
{
  xmlDocPtr doc = NULL;
  int result = 1;
  
  flickcurl_init_params(fc);

  if(!photo_id || !group_id)
    return 1;

  flickcurl_add_param(fc, "photo_id", photo_id);
  flickcurl_add_param(fc, "group_id", group_id);

  flickcurl_end_params(fc);

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

  flickcurl_set_write(fc, 1);
  flickcurl_set_data(fc, (void*)"", 0);

  doc = flickcurl_invoke(fc);
  if(!doc)
    goto tidy;

  result = 0;

  tidy:
  if(fc->failed)
    result = 1;

  return result;
}
示例#7
0
/**
 * flickcurl_galleries_create:
 * @fc: flickcurl context
 * @title: The name of the gallery
 * @description: A short description for the gallery
 * @primary_photo_id: The first photo to add to your gallery (or NULL)
 * @gallery_url_p: pointer to variable to store new gallery URL (or NULL)
 *
 * Create a new gallery for the calling user.
 *
 * Implements flickr.galleries.create (1.18)
 *
 * Announced 2010-04-08
 * http://code.flickr.com/blog/2010/04/08/galleries-apis/
 *
 * Return value: gallery ID or NULL on failure
 **/
char*
flickcurl_galleries_create(flickcurl* fc,
                           const char* title,
                           const char* description,
                           const char* primary_photo_id,
                           char** gallery_url_p)
{
    xmlDocPtr doc = NULL;
    xmlXPathContextPtr xpathCtx = NULL;
    char* gallery_id = NULL;

    flickcurl_init_params(fc);

    if(!title || !description)
        return NULL;

    flickcurl_add_param(fc, "title", title);
    flickcurl_add_param(fc, "description", description);
    if(primary_photo_id) {
        flickcurl_add_param(fc, "primary_photo_id", primary_photo_id);
    }

    flickcurl_end_params(fc);

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    xpathCtx = xmlXPathNewContext(doc);
    if(!xpathCtx) {
        flickcurl_error(fc, "Failed to create XPath context for document");
        fc->failed = 1;
        goto tidy;
    }

    gallery_id = flickcurl_xpath_eval(fc, xpathCtx,
                                      (const xmlChar*)"/rsp/gallery/@id");
    if(gallery_url_p) {
        *gallery_url_p = flickcurl_xpath_eval(fc, xpathCtx,
                                              (const xmlChar*)"/rsp/gallery/@url");
    }

tidy:
    if(xpathCtx)
        xmlXPathFreeContext(xpathCtx);

    if(fc->failed)
        gallery_id = NULL;

    return gallery_id;
}
示例#8
0
/**
 * flickcurl_photosets_create:
 * @fc: flickcurl context
 * @title: A title for the photoset.
 * @description: A description of the photoset which may contain limited html (or NULL)
 * @primary_photo_id: The id of the photo to represent this set. The photo must belong to the calling user.
 * @photoset_url_p: pointer to variable to store new photoset URL (or NULL)
 *
 * Create a new photoset for the calling user.
 *
 * Implements flickr.photosets.create (0.13)
 *
 * Return value: photoset ID or NULL on failure
 **/
char*
flickcurl_photosets_create(flickcurl* fc, const char* title,
                           const char* description,
                           const char* primary_photo_id,
                           char** photoset_url_p)
{
    const char* parameters[10][2];
    int count = 0;
    xmlDocPtr doc = NULL;
    xmlXPathContextPtr xpathCtx = NULL;
    char* photoset_id = NULL;

    if(!title || !primary_photo_id)
        return NULL;

    parameters[count][0]  = "title";
    parameters[count++][1]= title;
    if(description) {
        parameters[count][0]  = "description";
        parameters[count++][1]= description;
    }
    parameters[count][0]  = "primary_photo_id";
    parameters[count++][1]= primary_photo_id;

    parameters[count][0]  = NULL;

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    xpathCtx = xmlXPathNewContext(doc);
    if(!xpathCtx) {
        flickcurl_error(fc, "Failed to create XPath context for document");
        fc->failed = 1;
        goto tidy;
    }

    photoset_id = flickcurl_xpath_eval(fc, xpathCtx, (const xmlChar*)"/rsp/photoset/@id");
    if(photoset_url_p) {
        *photoset_url_p = flickcurl_xpath_eval(fc, xpathCtx, (const xmlChar*)"/rsp/photoset/@url");
    }

tidy:
    if(xpathCtx)
        xmlXPathFreeContext(xpathCtx);

    if(fc->failed)
        photoset_id = NULL;

    return photoset_id;
}
示例#9
0
/**
 * flickcurl_galleries_addPhoto:
 * @fc: flickcurl context
 * @gallery_id: The ID of the gallery to add a photo to as returned by flickcurl_galleries_getList() and flickcurl_galleries_getListForPhoto().
 * @photo_id: The photo ID to add to the gallery.
 * @comment_text: A short comment or story to accompany the photo (or NULL).
 *
 * Add a photo to a gallery.
 *
 * Implements flickr.galleries.addPhoto (1.17)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_galleries_addPhoto(flickcurl* fc, const char* gallery_id,
                             const char* photo_id, const char* comment_text)
{
    xmlDocPtr doc = NULL;
    xmlXPathContextPtr xpathCtx = NULL;
    void* result = NULL;

    flickcurl_init_params(fc);

    if(!gallery_id || !photo_id)
        return 1;

    flickcurl_add_param(fc, "gallery_id", gallery_id);
    flickcurl_add_param(fc, "photo_id", photo_id);
    if(comment_text) {
        flickcurl_add_param(fc, "comment", comment_text);
    }

    flickcurl_end_params(fc);

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;


    xpathCtx = xmlXPathNewContext(doc);
    if(!xpathCtx) {
        flickcurl_error(fc, "Failed to create XPath context for document");
        fc->failed = 1;
        goto tidy;
    }

    result = NULL; /* your code here */

tidy:
    if(xpathCtx)
        xmlXPathFreeContext(xpathCtx);

    if(fc->failed)
        result = NULL;

    return (result == NULL);
}
示例#10
0
/**
 * flickcurl_photos_notes_edit:
 * @fc: flickcurl context
 * @note_id: The id of the note to edit
 * @note_x: The left coordinate of the note
 * @note_y: The top coordinate of the note
 * @note_w: The width of the note
 * @note_h: The height of the note
 * @note_text: The description of the note
 * 
 * Edit a note on a photo. Coordinates and sizes are in pixels, based on the 500px image size shown on individual photo pages.

 *
 * Implements flickr.photos.notes.edit (0.12)
 * 
 * Return value: non-0 on failure
 **/
int
flickcurl_photos_notes_edit(flickcurl* fc,
                            const char* note_id,
                            int note_x, int note_y, int note_w, int note_h,
                            const char* note_text)
{
  xmlDocPtr doc = NULL;
  int result = 1;
  char note_x_s[10];
  char note_y_s[10];
  char note_w_s[10];
  char note_h_s[10];
  
  flickcurl_init_params(fc);

  if(!note_id || !note_text)
    return 1;

  flickcurl_add_param(fc, "note_id", note_id);
  sprintf(note_x_s, "%d", note_x);
  flickcurl_add_param(fc, "note_x", note_x_s);
  sprintf(note_y_s, "%d", note_y);
  flickcurl_add_param(fc, "note_y", note_y_s);
  sprintf(note_w_s, "%d", note_w);
  flickcurl_add_param(fc, "note_w", note_w_s);
  sprintf(note_h_s, "%d", note_h);
  flickcurl_add_param(fc, "note_h", note_h_s);
  flickcurl_add_param(fc, "note_text", note_text);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.photos.notes.edit"))
    goto tidy;

  flickcurl_set_write(fc, 1);
  flickcurl_set_data(fc, (void*)"", 0);

  doc = flickcurl_invoke(fc);
  if(!doc)
    goto tidy;

  result = 0;

  tidy:
  if(fc->failed)
    result = 1;

  return result;
}
示例#11
0
/**
 * flickcurl_photosets_editPhotos:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to modify. Must belong to the calling user.
 * @primary_photo_id: The id of the photo to use as the 'primary' photo for the set. This id must also be passed along in photo_ids list argument.
 * @photo_ids_array: Array of photo ids to include in the set. They will appear in the set in the order sent. This list MUST contain the primary photo id. All photos must belong to the owner of the set. This list of photos replaces the existing list. Call flickr.photosets.addPhoto to append a photo to a set.
 *
 * Modify the photos in a photoset.
 *
 * Use this method to add, remove and re-order photos.
 *
 * Implements flickr.photosets.editPhotos (0.13)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_editPhotos(flickcurl* fc, const char* photoset_id,
                               const char* primary_photo_id,
                               const char** photo_ids_array)
{
    const char* parameters[10][2];
    int count = 0;
    xmlDocPtr doc = NULL;
    int result = 1;
    char* photo_ids = NULL;

    if(!photoset_id || !primary_photo_id || !photo_ids_array)
        return 1;

    parameters[count][0]  = "photoset_id";
    parameters[count++][1]= photoset_id;
    parameters[count][0]  = "primary_photo_id";
    parameters[count++][1]= primary_photo_id;
    photo_ids = flickcurl_array_join(photo_ids_array, ',');
    parameters[count][0]  = "photo_ids";
    parameters[count++][1]= photo_ids;

    parameters[count][0]  = NULL;

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    result = 0;

tidy:
    if(fc->failed)
        result = 1;
    if(photo_ids)
        free(photo_ids);

    return result;
}
示例#12
0
/**
 * flickcurl_galleries_editPhotos:
 * @fc: flickcurl context
 * @gallery_id: The id of the gallery to modify. The gallery must belong to the calling user.
 * @primary_photo_id: The id of the photo to use as the 'primary' photo for the gallery. This id must also be passed along in photo_ids list argument.
 * @photo_ids_array: Array of photo ids to include in the gallery. They will appear in the set in the order sent. This list MUST contain the primary photo id. This list of photos replaces the existing list.
 *
 * Modify the photos in a gallery. Use this method to add, remove and re-order photos.
 *
 * Implements flickr.galleries.editPhotos (1.18)
 *
 * Announced 2010-04-08
 * http://code.flickr.com/blog/2010/04/08/galleries-apis/
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_galleries_editPhotos(flickcurl* fc, const char* gallery_id,
                               const char* primary_photo_id,
                               const char** photo_ids_array)
{
    xmlDocPtr doc = NULL;
    int result = 1;
    char* photo_ids = NULL;

    flickcurl_init_params(fc);

    if(!gallery_id || !primary_photo_id || !photo_ids_array)
        return 1;

    flickcurl_add_param(fc, "gallery_id", gallery_id);
    flickcurl_add_param(fc, "primary_photo_id", primary_photo_id);
    photo_ids = flickcurl_array_join(photo_ids_array, ',');
    flickcurl_add_param(fc, "photo_ids", photo_ids);

    flickcurl_end_params(fc);

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;


    result = 0;

tidy:
    if(photo_ids)
        free(photo_ids);

    if(fc->failed)
        result = 1;

    return result;
}
示例#13
0
/**
 * flickcurl_photosets_editMeta:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to modify.
 * @title: The new title for the photoset.
 * @description: A description of the photoset which may contain limited html (or NULL)
 *
 * Modify the meta-data for a photoset.
 *
 * Implements flickr.photosets.editMeta (0.13)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_editMeta(flickcurl* fc, const char* photoset_id,
                             const char* title, const char* description)
{
    const char* parameters[10][2];
    int count = 0;
    xmlDocPtr doc = NULL;
    int result = 1;

    if(!photoset_id || !title)
        return 1;

    parameters[count][0]  = "photoset_id";
    parameters[count++][1]= photoset_id;
    parameters[count][0]  = "title";
    parameters[count++][1]= title;
    if(description) {
        parameters[count][0]  = "description";
        parameters[count++][1]= description;
    }

    parameters[count][0]  = NULL;

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    result = 0;

tidy:
    if(fc->failed)
        result = 1;

    return result;
}
示例#14
0
/**
 * flickcurl_photos_licenses_setLicense:
 * @fc: flickcurl context
 * @photo_id: The photo to update the license for.
 * @license_id: The license to apply, or 0 (zero) to remove the current license.
 * 
 * Sets the license for a photo.
 *
 * Implements flickr.photos.licenses.setLicense (0.12)
 * 
 * Return value: non-0 on failure
 **/
int
flickcurl_photos_licenses_setLicense(flickcurl* fc, const char* photo_id,
                                     int license_id)
{
  const char* parameters[9][2];
  int count=0;
  xmlDocPtr doc=NULL;
  int result=1;
  char license_id_s[5];
  
  if(!photo_id)
    return 1;

  parameters[count][0]  = "photo_id";
  parameters[count++][1]= photo_id;
  parameters[count][0]  = "license_id";
  sprintf(license_id_s, "%d", license_id);
  parameters[count++][1]= license_id_s;

  parameters[count][0]  = NULL;

  if(flickcurl_prepare(fc, "flickr.photos.licenses.setLicense", parameters,
                       count))
    goto tidy;

  flickcurl_set_write(fc, 1);
  flickcurl_set_data(fc, (void*)"", 0);

  doc=flickcurl_invoke(fc);
  if(!doc)
    goto tidy;

  result=0;

  tidy:
  if(fc->failed)
    result=1;

  return result;
}
示例#15
0
/**
 * flickcurl_galleries_editMeta:
 * @fc: flickcurl context
 * @gallery_id: The gallery ID to update.
 * @title: The new title for the gallery.
 * @description: The new description for the gallery. (or NULL)
 *
 * Modify the meta-data for a gallery.
 *
 * Implements flickr.galleries.editMeta (1.18)
 *
 * Announced 2010-04-08
 * http://code.flickr.com/blog/2010/04/08/galleries-apis/
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_galleries_editMeta(flickcurl* fc,
                             const char* gallery_id,
                             const char* title, const char* description)
{
    xmlDocPtr doc = NULL;
    int result = 1;

    flickcurl_init_params(fc);

    if(!gallery_id || !title)
        return 1;

    flickcurl_add_param(fc, "gallery_id", gallery_id);
    flickcurl_add_param(fc, "title", title);
    if(description) {
        flickcurl_add_param(fc, "description", description);
    }

    flickcurl_end_params(fc);

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    result = 0;

tidy:
    if(fc->failed)
        result = 1;

    return result;
}
示例#16
0
/**
 * flickcurl_photosets_setPrimaryPhoto:
 * @fc: flickcurl context
 * @photoset_id: The id of the photoset to set primary photo to.
 * @photo_id: The id of the photo to set as primary.
 *
 * Set photoset primary photo
 *
 * Implements flickr.photosets.setPrimaryPhoto (1.19)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_setPrimaryPhoto(flickcurl* fc, const char* photoset_id,
                                    const char* photo_id)
{
    const char* parameters[9][2];
    int count = 0;
    xmlDocPtr doc = NULL;
    int result = 1;

    if(!photoset_id || !photo_id)
        return 1;

    parameters[count][0]  = "photoset_id";
    parameters[count++][1]= photoset_id;
    parameters[count][0]  = "photo_id";
    parameters[count++][1]= photo_id;

    parameters[count][0]  = NULL;

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    result = 0;

tidy:
    if(fc->failed)
        result = 1;

    return result;
}
示例#17
0
/**
 * flickcurl_groups_pools_add:
 * @fc: flickcurl context
 * @photo_id: The id of the photo to add to the group pool.
 * @group_id: The NSID of the group who's pool the photo is to be added to.
 * 
 * Add a photo to a group's pool.
 *
 * Implements flickr.groups.pools.add (0.12)
 * 
 * Return value: non-0 on failure
 **/
int
flickcurl_groups_pools_add(flickcurl* fc, const char* photo_id,
                           const char* group_id)
{
  const char* parameters[9][2];
  int count=0;
  xmlDocPtr doc=NULL;
  int result=1;
  
  if(!photo_id || !group_id)
    return 1;

  parameters[count][0]  = "photo_id";
  parameters[count++][1]= photo_id;
  parameters[count][0]  = "group_id";
  parameters[count++][1]= group_id;

  parameters[count][0]  = NULL;

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

  flickcurl_set_write(fc, 1);
  flickcurl_set_data(fc, (void*)"", 0);

  doc=flickcurl_invoke(fc);
  if(!doc)
    goto tidy;

  result=0;

  tidy:
  if(fc->failed)
    result=1;

  return result;
}
示例#18
0
/**
 * flickcurl_photos_licenses_setLicense:
 * @fc: flickcurl context
 * @photo_id: The photo to update the license for.
 * @license_id: The license to apply, or 0 (zero) to remove the current license.
 * 
 * Sets the license for a photo.
 *
 * Implements flickr.photos.licenses.setLicense (0.12)
 * 
 * Return value: non-0 on failure
 **/
int
flickcurl_photos_licenses_setLicense(flickcurl* fc, const char* photo_id,
                                     int license_id)
{
  xmlDocPtr doc = NULL;
  int result = 1;
  char license_id_s[5];
  
  flickcurl_init_params(fc);

  if(!photo_id)
    return 1;

  flickcurl_add_param(fc, "photo_id", photo_id);
  sprintf(license_id_s, "%d", license_id);
  flickcurl_add_param(fc, "license_id", license_id_s);

  flickcurl_end_params(fc);

  if(flickcurl_prepare(fc, "flickr.photos.licenses.setLicense"))
    goto tidy;

  flickcurl_set_write(fc, 1);
  flickcurl_set_data(fc, (void*)"", 0);

  doc = flickcurl_invoke(fc);
  if(!doc)
    goto tidy;

  result = 0;

  tidy:
  if(fc->failed)
    result = 1;

  return result;
}
示例#19
0
/**
 * flickcurl_galleries_editPhoto:
 * @fc: flickcurl context
 * @gallery_id: The ID of the gallery to add a photo to. Note: this is the compound ID returned in methods like flickr.galleries.getList, and flickr.galleries.getListForPhoto.
 * @photo_id: The photo ID to add to the gallery.
 * @new_comment: The updated comment the photo.
 *
 * Edit the comment for a gallery photo.
 *
 * Implements flickr.galleries.editPhoto (1.18)
 *
 * Announced 2010-04-08
 * http://code.flickr.com/blog/2010/04/08/galleries-apis/
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_galleries_editPhoto(flickcurl* fc, const char* gallery_id,
                              const char* photo_id, const char* new_comment)
{
    xmlDocPtr doc = NULL;
    int result = 1;

    flickcurl_init_params(fc);

    if(!gallery_id || !photo_id || !new_comment)
        return 1;

    flickcurl_add_param(fc, "gallery_id", gallery_id);
    flickcurl_add_param(fc, "photo_id", photo_id);
    flickcurl_add_param(fc, "comment", new_comment);

    flickcurl_end_params(fc);

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

    flickcurl_set_write(fc, 1);
    flickcurl_set_data(fc, (void*)"", 0);

    doc = flickcurl_invoke(fc);
    if(!doc)
        goto tidy;

    result = 0;

tidy:
    if(fc->failed)
        result = 1;

    return result;
}