예제 #1
0
/**
 * flickcurl_photosets_orderSets:
 * @fc: flickcurl context
 * @photoset_ids_array: Array of photoset IDs, ordered with the set to show first, first in the list. Any set IDs not given in the list will be set to appear at the end of the list, ordered by their IDs.
 *
 * Set the order of photosets for the calling user.
 *
 * Implements flickr.photosets.orderSets (0.13)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_orderSets(flickcurl* fc, const char** photoset_ids_array)
{
    const char* parameters[8][2];
    int count = 0;
    xmlDocPtr doc = NULL;
    int result = 1;
    char* photoset_ids;

    if(!photoset_ids_array)
        return 1;

    photoset_ids = flickcurl_array_join(photoset_ids_array, ',');
    parameters[count][0]  = "photoset_ids";
    parameters[count++][1]= photoset_ids;

    parameters[count][0]  = NULL;

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

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

    result = 0;

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

    return result;
}
예제 #2
0
/**
 * flickcurl_photosets_orderSets:
 * @fc: flickcurl context
 * @photoset_ids_array: Array of photoset IDs, ordered with the set to show first, first in the list. Any set IDs not given in the list will be set to appear at the end of the list, ordered by their IDs.
 *
 * Set the order of photosets for the calling user.
 *
 * Implements flickr.photosets.orderSets (0.13)
 *
 * Return value: non-0 on failure
 **/
int
flickcurl_photosets_orderSets(flickcurl* fc, const char** photoset_ids_array)
{
    xmlDocPtr doc = NULL;
    int result = 1;
    char* photoset_ids;

    flickcurl_init_params(fc);

    if(!photoset_ids_array)
        return 1;

    photoset_ids = flickcurl_array_join(photoset_ids_array, ',');
    flickcurl_add_param(fc, "photoset_ids", photoset_ids);

    flickcurl_end_params(fc);

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

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

    result = 0;

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

    return result;
}
예제 #3
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;
}
예제 #4
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;
}