/**
 * flickcurl_photosets_getInfo:
 * @fc: flickcurl context
 * @photoset_id: The ID of the photoset to fetch information for.
 *
 * Gets information about a photoset.
 *
 * Implements flickr.photosets.getInfo (0.13)
 *
 * Return value: non-0 on failure
 **/
flickcurl_photoset*
flickcurl_photosets_getInfo(flickcurl* fc, const char* photoset_id)
{
    const char* parameters[8][2];
    int count = 0;
    xmlDocPtr doc = NULL;
    xmlXPathContextPtr xpathCtx = NULL;
    flickcurl_photoset* photoset = NULL;

    if(!photoset_id)
        return NULL;

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

    parameters[count][0]  = NULL;

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

    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 = flickcurl_build_photoset(fc, xpathCtx);

tidy:
    if(xpathCtx)
        xmlXPathFreeContext(xpathCtx);

    if(fc->failed)
        photoset = NULL;

    return photoset;
}
Exemple #2
0
/**
 * flickcurl_photosets_getInfo:
 * @fc: flickcurl context
 * @photoset_id: The ID of the photoset to fetch information for.
 *
 * Gets information about a photoset.
 *
 * Implements flickr.photosets.getInfo (0.13)
 *
 * Return value: non-0 on failure
 **/
flickcurl_photoset*
flickcurl_photosets_getInfo(flickcurl* fc, const char* photoset_id)
{
    xmlDocPtr doc = NULL;
    xmlXPathContextPtr xpathCtx = NULL;
    flickcurl_photoset* photoset = NULL;

    flickcurl_init_params(fc);

    if(!photoset_id)
        return NULL;

    flickcurl_add_param(fc, "photoset_id", photoset_id);

    flickcurl_end_params(fc);

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

    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 = flickcurl_build_photoset(fc, xpathCtx);

tidy:
    if(xpathCtx)
        xmlXPathFreeContext(xpathCtx);

    if(fc->failed)
        photoset = NULL;

    return photoset;
}