Exemplo n.º 1
0
        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged()
        //{
        //    return PhotosGetUntagged(0, 0, PhotoSearchExtras.Tags);
        //}

        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="extras">A comma-delimited list of extra information to fetch for each returned record.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(PhotoSearchExtras extras)
        //{
        //    return PhotosGetUntagged(0, 0, extras);
        //}

        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(int page, int perPage)
        //{
        //    return PhotosGetUntagged(page, perPage, PhotoSearchExtras.Tags);
        //}

        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="extras">A comma-delimited list of extra information to fetch for each returned record.</param>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(int page, int perPage, PhotoSearchExtras extras)
        //{
        //    PartialSearchOptions o = new PartialSearchOptions();
        //    o.Page = page;
        //    o.PerPage = perPage;
        //    o.Extras = extras;

        //    return PhotosGetUntagged(o);
        //}

        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="options">The <see cref="PartialSearchOptions"/> containing the list of options supported by this method.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(PartialSearchOptions options)
        //{
        //    CheckRequiresAuthentication();

        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.getUntagged");

        //    Helper.PartialOptionsIntoArray(options, parameters);

        //    return GetResponse<PhotoCollection>(parameters);
        //}

        ///// <summary>
        ///// Gets a list of photos not in sets. Defaults to include all extra fields.
        ///// </summary>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet()
        //{
        //    return PhotosGetNotInSet(new PartialSearchOptions());
        //}

        ///// <summary>
        ///// Gets a specific page of the list of photos which are not in sets.
        ///// Defaults to include all extra fields.
        ///// </summary>
        ///// <param name="page">The page number to return.</param>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet(int page)
        //{
        //    return PhotosGetNotInSet(page, 0, PhotoSearchExtras.None);
        //}

        ///// <summary>
        ///// Gets a specific page of the list of photos which are not in sets.
        ///// Defaults to include all extra fields.
        ///// </summary>
        ///// <param name="perPage">Number of photos per page.</param>
        ///// <param name="page">The page number to return.</param>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet(int page, int perPage)
        //{
        //    return PhotosGetNotInSet(page, perPage, PhotoSearchExtras.None);
        //}

        ///// <summary>
        ///// Gets a list of a users photos which are not in a set.
        ///// </summary>
        ///// <param name="perPage">Number of photos per page.</param>
        ///// <param name="page">The page number to return.</param>
        ///// <param name="extras"><see cref="PhotoSearchExtras"/> enumeration.</param>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet(int page, int perPage, PhotoSearchExtras extras)
        //{
        //    PartialSearchOptions options = new PartialSearchOptions();
        //    options.PerPage = perPage;
        //    options.Page = page;
        //    options.Extras = extras;

        //    return PhotosGetNotInSet(options);
        //}

        ///// <summary>
        ///// Gets a list of the authenticated users photos which are not in a set.
        ///// </summary>
        ///// <param name="options">A selection of options to filter/sort by.</param>
        ///// <returns>A collection of photos in the <see cref="PhotoCollection"/> class.</returns>
        //public PhotoCollection PhotosGetNotInSet(PartialSearchOptions options)
        //{
        //    CheckRequiresAuthentication();

        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.getNotInSet");
        //    Helper.PartialOptionsIntoArray(options, parameters);

        //    return GetResponse<PhotoCollection>(parameters);
        //}

        ///// <summary>
        ///// Gets a list of all current licenses.
        ///// </summary>
        ///// <returns><see cref="LicenseCollection"/> instance.</returns>
        //public LicenseCollection PhotosLicensesGetInfo()
        //{
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.licenses.getInfo");
        //    parameters.Add("api_key", apiKey);

        //    return GetResponse<LicenseCollection>(parameters);
        //}

        ///// <summary>
        ///// Sets the license for a photo.
        ///// </summary>
        ///// <param name="photoId">The photo to update the license for.</param>
        ///// <param name="license">The license to apply, or <see cref="LicenseType.AllRightsReserved"/> (0) to remove the current license. Note : as of this writing the <see cref="LicenseType.NoKnownCopyrightRestrictions"/> license (7) is not a valid argument.</param>
        //public void PhotosLicensesSetLicense(string photoId, LicenseType license)
        //{
        //    CheckRequiresAuthentication();

        //    Dictionary<string, string> parameters = new Dictionary<string, string>();

        //    parameters.Add("method", "flickr.photos.licenses.setLicense");
        //    parameters.Add("photo_id", photoId);
        //    parameters.Add("license_id", license.ToString("d"));

        //    GetResponse<NoResponse>(parameters);
        //}

        ///// <summary>
        ///// Remove an existing tag.
        ///// </summary>
        ///// <param name="tagId">The id of the tag, as returned by <see cref="Flickr.PhotosGetInfo(string)"/> or similar method.</param>
        ///// <returns>True if the tag was removed.</returns>
        //public void PhotosRemoveTag(string tagId)
        //{
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.removeTag");
        //    parameters.Add("tag_id", tagId);

        //    GetResponse<NoResponse>(parameters);
        //}

        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <param name="extras">A list of extra information to fetch for each returned record.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate, PhotoSearchExtras extras)
        //{
        //    return PhotosRecentlyUpdated(minDate, extras, 0, 0);
        //}

        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate, int page, int perPage)
        //{
        //    return PhotosRecentlyUpdated(minDate, PhotoSearchExtras.None, page, perPage);
        //}

        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate)
        //{
        //    return PhotosRecentlyUpdated(minDate, PhotoSearchExtras.None, 0, 0);
        //}

        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <param name="extras">A list of extra information to fetch for each returned record.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate, PhotoSearchExtras extras, int page, int perPage)
        //{
        //    CheckRequiresAuthentication();

        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.recentlyUpdated");
        //    parameters.Add("min_date", Helper.DateToUnixTimestamp(minDate));
        //    if (extras != PhotoSearchExtras.None) parameters.Add("extras", Helper.ExtrasToString(extras));
        //    if (perPage > 0) parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
        //    if (page > 0) parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));

        //    return GetResponse<PhotoCollection>(parameters);
        //}

        /// <summary>
        /// Search for a set of photos, based on the value of the <see cref="PhotoSearchOptions"/> parameters.
        /// </summary>
        /// <param name="options">The parameters to search for.</param>
        /// <returns>A collection of photos contained within a <see cref="PhotoCollection"/> object.</returns>
        public PhotoCollection PhotosSearch(PhotoSearchOptions options)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.search");

            options.AddToDictionary(parameters);

            return(GetResponse <PhotoCollection>(parameters));
        }
        public PhotoCollection GetPhoto_ByHashCode(string hashCode)
        {
            Flickr flickr = new Flickr();

            var op = new PhotoSearchOptions();
            op.Tags = string.Format("MD5:{0}", hashCode);

            var l = flickr.PhotosSearch(op);

            return l;
        }
        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged()
        //{
        //    return PhotosGetUntagged(0, 0, PhotoSearchExtras.Tags);
        //}
        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="extras">A comma-delimited list of extra information to fetch for each returned record.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(PhotoSearchExtras extras)
        //{
        //    return PhotosGetUntagged(0, 0, extras);
        //}
        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(int page, int perPage)
        //{
        //    return PhotosGetUntagged(page, perPage, PhotoSearchExtras.Tags);
        //}
        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="extras">A comma-delimited list of extra information to fetch for each returned record.</param>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(int page, int perPage, PhotoSearchExtras extras)
        //{
        //    PartialSearchOptions o = new PartialSearchOptions();
        //    o.Page = page;
        //    o.PerPage = perPage;
        //    o.Extras = extras;
        //    return PhotosGetUntagged(o);
        //}
        ///// <summary>
        ///// Returns a list of your photos with no tags.
        ///// </summary>
        ///// <param name="options">The <see cref="PartialSearchOptions"/> containing the list of options supported by this method.</param>
        ///// <returns>A <see cref="PhotoCollection"/> class containing the list of photos.</returns>
        //public PhotoCollection PhotosGetUntagged(PartialSearchOptions options)
        //{
        //    CheckRequiresAuthentication();
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.getUntagged");
        //    Helper.PartialOptionsIntoArray(options, parameters);
        //    return GetResponse<PhotoCollection>(parameters);
        //}
        ///// <summary>
        ///// Gets a list of photos not in sets. Defaults to include all extra fields.
        ///// </summary>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet()
        //{
        //    return PhotosGetNotInSet(new PartialSearchOptions());
        //}
        ///// <summary>
        ///// Gets a specific page of the list of photos which are not in sets.
        ///// Defaults to include all extra fields.
        ///// </summary>
        ///// <param name="page">The page number to return.</param>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet(int page)
        //{
        //    return PhotosGetNotInSet(page, 0, PhotoSearchExtras.None);
        //}
        ///// <summary>
        ///// Gets a specific page of the list of photos which are not in sets.
        ///// Defaults to include all extra fields.
        ///// </summary>
        ///// <param name="perPage">Number of photos per page.</param>
        ///// <param name="page">The page number to return.</param>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet(int page, int perPage)
        //{
        //    return PhotosGetNotInSet(page, perPage, PhotoSearchExtras.None);
        //}
        ///// <summary>
        ///// Gets a list of a users photos which are not in a set.
        ///// </summary>
        ///// <param name="perPage">Number of photos per page.</param>
        ///// <param name="page">The page number to return.</param>
        ///// <param name="extras"><see cref="PhotoSearchExtras"/> enumeration.</param>
        ///// <returns><see cref="PhotoCollection"/> instance containing list of photos.</returns>
        //public PhotoCollection PhotosGetNotInSet(int page, int perPage, PhotoSearchExtras extras)
        //{
        //    PartialSearchOptions options = new PartialSearchOptions();
        //    options.PerPage = perPage;
        //    options.Page = page;
        //    options.Extras = extras;
        //    return PhotosGetNotInSet(options);
        //}
        ///// <summary>
        ///// Gets a list of the authenticated users photos which are not in a set.
        ///// </summary>
        ///// <param name="options">A selection of options to filter/sort by.</param>
        ///// <returns>A collection of photos in the <see cref="PhotoCollection"/> class.</returns>
        //public PhotoCollection PhotosGetNotInSet(PartialSearchOptions options)
        //{
        //    CheckRequiresAuthentication();
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.getNotInSet");
        //    Helper.PartialOptionsIntoArray(options, parameters);
        //    return GetResponse<PhotoCollection>(parameters);
        //}
        ///// <summary>
        ///// Gets a list of all current licenses.
        ///// </summary>
        ///// <returns><see cref="LicenseCollection"/> instance.</returns>
        //public LicenseCollection PhotosLicensesGetInfo()
        //{
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.licenses.getInfo");
        //    parameters.Add("api_key", apiKey);
        //    return GetResponse<LicenseCollection>(parameters);
        //}
        ///// <summary>
        ///// Sets the license for a photo.
        ///// </summary>
        ///// <param name="photoId">The photo to update the license for.</param>
        ///// <param name="license">The license to apply, or <see cref="LicenseType.AllRightsReserved"/> (0) to remove the current license. Note : as of this writing the <see cref="LicenseType.NoKnownCopyrightRestrictions"/> license (7) is not a valid argument.</param>
        //public void PhotosLicensesSetLicense(string photoId, LicenseType license)
        //{
        //    CheckRequiresAuthentication();
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.licenses.setLicense");
        //    parameters.Add("photo_id", photoId);
        //    parameters.Add("license_id", license.ToString("d"));
        //    GetResponse<NoResponse>(parameters);
        //}
        ///// <summary>
        ///// Remove an existing tag.
        ///// </summary>
        ///// <param name="tagId">The id of the tag, as returned by <see cref="Flickr.PhotosGetInfo(string)"/> or similar method.</param>
        ///// <returns>True if the tag was removed.</returns>
        //public void PhotosRemoveTag(string tagId)
        //{
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.removeTag");
        //    parameters.Add("tag_id", tagId);
        //    GetResponse<NoResponse>(parameters);
        //}
        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <param name="extras">A list of extra information to fetch for each returned record.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate, PhotoSearchExtras extras)
        //{
        //    return PhotosRecentlyUpdated(minDate, extras, 0, 0);
        //}
        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate, int page, int perPage)
        //{
        //    return PhotosRecentlyUpdated(minDate, PhotoSearchExtras.None, page, perPage);
        //}
        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate)
        //{
        //    return PhotosRecentlyUpdated(minDate, PhotoSearchExtras.None, 0, 0);
        //}
        ///// <summary>
        ///// Return a list of your photos that have been recently created or which have been recently modified.
        ///// Recently modified may mean that the photo's metadata (title, description, tags)
        ///// may have been changed or a comment has been added (or just modified somehow :-)
        ///// </summary>
        ///// <param name="minDate">The date from which modifications should be compared.</param>
        ///// <param name="extras">A list of extra information to fetch for each returned record.</param>
        ///// <param name="perPage">Number of photos to return per page. If this argument is omitted, it defaults to 100. The maximum allowed value is 500.</param>
        ///// <param name="page">The page of results to return. If this argument is omitted, it defaults to 1.</param>
        ///// <returns>Returns a <see cref="PhotoCollection"/> instance containing the list of photos.</returns>
        //public PhotoCollection PhotosRecentlyUpdated(DateTime minDate, PhotoSearchExtras extras, int page, int perPage)
        //{
        //    CheckRequiresAuthentication();
        //    Dictionary<string, string> parameters = new Dictionary<string, string>();
        //    parameters.Add("method", "flickr.photos.recentlyUpdated");
        //    parameters.Add("min_date", Helper.DateToUnixTimestamp(minDate));
        //    if (extras != PhotoSearchExtras.None) parameters.Add("extras", Helper.ExtrasToString(extras));
        //    if (perPage > 0) parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
        //    if (page > 0) parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
        //    return GetResponse<PhotoCollection>(parameters);
        //}
        /// <summary>
        /// Search for a set of photos, based on the value of the <see cref="PhotoSearchOptions"/> parameters.
        /// </summary>
        /// <param name="options">The parameters to search for.</param>
        /// <returns>A collection of photos contained within a <see cref="PhotoCollection"/> object.</returns>
        public PhotoCollection PhotosSearch(PhotoSearchOptions options)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.photos.search");

            options.AddToDictionary(parameters);

            return GetResponse<PhotoCollection>(parameters);
        }