ExtrasToString() public static méthode

Utility method to convert the PhotoSearchExtras enum to a string.
public static ExtrasToString ( PhotoSearchExtras extras ) : string
extras PhotoSearchExtras
Résultat string
Exemple #1
0
        /// <summary>
        /// Gets a collection of photos for a photoset.
        /// </summary>
        /// <param name="photosetId">The ID of the photoset to return photos for.</param>
        /// <param name="extras">The extras to return for each photo.</param>
        /// <param name="privacyFilter">The privacy filter to search on.</param>
        /// <param name="page">The page to return, defaults to 1.</param>
        /// <param name="perPage">The number of photos to return per page.</param>
        /// <param name="media">Filter on the type of media.</param>
        /// <returns>An array of <see cref="Photo"/> instances.</returns>
        public PhotosetPhotoCollection PhotosetsGetPhotos(string photosetId, PhotoSearchExtras extras, PrivacyFilter privacyFilter, int page, int perPage, MediaType media)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photosets.getPhotos");
            parameters.Add("photoset_id", photosetId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }
            if (privacyFilter != PrivacyFilter.None)
            {
                parameters.Add("privacy_filter", privacyFilter.ToString("d"));
            }
            if (page > 0)
            {
                parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (perPage > 0)
            {
                parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (media != MediaType.None)
            {
                parameters.Add("media", (media == MediaType.All ? "all" : (media == MediaType.Photos ? "photos" : (media == MediaType.Videos ? "videos" : String.Empty))));
            }

            return(GetResponseCache <PhotosetPhotoCollection>(parameters));
        }
Exemple #2
0
        /// <summary>
        /// Gets a list of photos from the most recent interstingness list.
        /// </summary>
        /// <param name="date">The date to return the interestingness photos for.</param>
        /// <param name="extras">The extra parameters to return along with the search results.
        /// See <see cref="PhotoSearchOptions"/> for more details.</param>
        /// <param name="perPage">The number of results to return per page.</param>
        /// <param name="page">The page of the results to return.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void InterestingnessGetListAsync(DateTime date, PhotoSearchExtras extras, int page, int perPage, Action <FlickrResult <PhotoCollection> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.interestingness.getList");

            if (date > DateTime.MinValue)
            {
                parameters.Add("date", date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo));
            }
            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));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            GetResponseAsync <PhotoCollection>(parameters, callback);
        }
        /// <summary>
        /// Gets the public favourites for a specified user.
        /// </summary>
        /// <remarks>This function difers from <see cref="Flickr.FavoritesGetList(string)"/> in that the user id
        /// is not optional.</remarks>
        /// <param name="userId">The is of the user whose favourites you wish to return.</param>
        /// <param name="minFavoriteDate">Minimum date that a photo was favorited on.</param>
        /// <param name="maxFavoriteDate">Maximum date that a photo was favorited on. </param>
        /// <param name="extras">The extras to return for each photo.</param>
        /// <param name="perPage">The number of photos to return per page.</param>
        /// <param name="page">The specific page to return.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void FavoritesGetPublicListAsync(string userId, DateTime minFavoriteDate, DateTime maxFavoriteDate,
                                                PhotoSearchExtras extras, int page, int perPage,
                                                Action <FlickrResult <PhotoCollection> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.favorites.getPublicList");
            parameters.Add("user_id", userId);
            if (minFavoriteDate != DateTime.MinValue)
            {
                parameters.Add("min_fav_date", UtilityMethods.DateToUnixTimestamp(minFavoriteDate));
            }
            if (maxFavoriteDate != DateTime.MinValue)
            {
                parameters.Add("max_fav_date", UtilityMethods.DateToUnixTimestamp(maxFavoriteDate));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.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));
            }

            GetResponseAsync <PhotoCollection>(parameters, callback);
        }
Exemple #4
0
        /// <summary>
        /// Get a list of favourites for the specified user.
        /// </summary>
        /// <param name="userId">The user id of the user whose favourites you wish to retrieve.</param>
        /// <param name="minFavoriteDate">Minimum date that a photo was favorited on.</param>
        /// <param name="maxFavoriteDate">Maximum date that a photo was favorited on. </param>
        /// <param name="extras">The extras to return for each photo.</param>
        /// <param name="perPage">Number of photos to include per page.</param>
        /// <param name="page">The page to download this time.</param>
        /// <returns><see cref="PhotoCollection"/> instance containing a collection of <see cref="Photo"/> objects.</returns>
        public PhotoCollection FavoritesGetList(string userId, DateTime minFavoriteDate, DateTime maxFavoriteDate, PhotoSearchExtras extras, int page, int perPage)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.favorites.getList");
            if (userId != null)
            {
                parameters.Add("user_id", userId);
            }
            if (minFavoriteDate != DateTime.MinValue)
            {
                parameters.Add("min_fav_date", UtilityMethods.DateToUnixTimestamp(minFavoriteDate));
            }
            if (maxFavoriteDate != DateTime.MinValue)
            {
                parameters.Add("max_fav_date", UtilityMethods.DateToUnixTimestamp(maxFavoriteDate));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.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(GetResponseCache <PhotoCollection>(parameters));
        }
        /// <summary>
        /// Gets a list of photos for a given group.
        /// </summary>
        /// <param name="groupId">The group ID for the group.</param>
        /// <param name="tags">Space seperated list of tags that photos returned must have.
        /// Currently only supports 1 tag at a time.</param>
        /// <param name="userId">The group member to return photos for.</param>
        /// <param name="extras">The <see cref="PhotoSearchExtras"/> specifying which extras to return. All other overloads default to returning all extras.</param>
        /// <param name="perPage">The number of photos per page.</param>
        /// <param name="page">The page to return.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void GroupsPoolsGetPhotosAsync(string groupId, string tags, string userId, PhotoSearchExtras extras, int page, int perPage, Action <FlickrResult <PhotoCollection> > callback)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.groups.pools.getPhotos");
            parameters.Add("group_id", groupId);
            if (tags != null && tags.Length > 0)
            {
                parameters.Add("tags", tags);
            }
            if (page > 0)
            {
                parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (perPage > 0)
            {
                parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (userId != null && userId.Length > 0)
            {
                parameters.Add("user_id", userId);
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            GetResponseAsync <PhotoCollection>(parameters, callback);
        }
Exemple #6
0
        /// <summary>
        /// Gets a users public photos. Excludes private photos.
        /// </summary>
        /// <param name="userId">The user id of the user.</param>
        /// <param name="page">The page to return. Defaults to page 1.</param>
        /// <param name="perPage">The number of photos to return per page. Default is 100.</param>
        /// <param name="extras">Which (if any) extra information to return. The default is none.</param>
        /// <param name="safetyLevel">The safety level of the returned photos.
        /// Unauthenticated calls can only return Safe photos.</param>
        /// <returns>The collection of photos contained within a <see cref="Photo"/> object.</returns>
        public PhotoCollection PeopleGetPublicPhotos(string userId, int page, int perPage, SafetyLevel safetyLevel, PhotoSearchExtras extras)
        {
            if (!IsAuthenticated && safetyLevel > SafetyLevel.Safe)
            {
                throw new ArgumentException("Safety level may only be 'Safe' for unauthenticated calls", "safetyLevel");
            }

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

            parameters.Add("method", "flickr.people.getPublicPhotos");
            parameters.Add("api_key", apiKey);
            parameters.Add("user_id", userId);
            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));
            }
            if (safetyLevel != SafetyLevel.None)
            {
                parameters.Add("safety_level", safetyLevel.ToString("D"));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <PhotoCollection>(parameters));
        }
        /// <summary>
        /// Gets your contacts most recent photos.
        /// </summary>
        /// <param name="count">The number of photos to return, from between 10 and 50.</param>
        /// <param name="justFriends">If true only returns photos from contacts marked as
        /// 'friends'.</param>
        /// <param name="singlePhoto">If true only returns a single photo for each of your contacts.
        /// Ignores the count if this is true.</param>
        /// <param name="includeSelf">If true includes yourself in the group of people to
        /// return photos for.</param>
        /// <param name="extras">Optional extras that can be returned by this call.</param>
        /// <returns>An instance of the <see cref="Photo"/> class containing the photos.</returns>
        /// <exception cref="ArgumentOutOfRangeException">
        /// Throws a <see cref="ArgumentOutOfRangeException"/> exception if the cound
        /// is not between 10 and 50, or 0.</exception>
        public PhotoCollection PhotosGetContactsPhotos(int count, bool justFriends, bool singlePhoto, bool includeSelf, PhotoSearchExtras extras)
        {
            CheckRequiresAuthentication();

            if (count != 0 && (count < 10 || count > 50) && !singlePhoto)
            {
                throw new ArgumentOutOfRangeException("count", string.Format(System.Globalization.CultureInfo.InvariantCulture, "Count must be between 10 and 50. ({0})", count));
            }
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.getContactsPhotos");
            if (count > 0 && !singlePhoto)
            {
                parameters.Add("count", count.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (justFriends)
            {
                parameters.Add("just_friends", "1");
            }
            if (singlePhoto)
            {
                parameters.Add("single_photo", "1");
            }
            if (includeSelf)
            {
                parameters.Add("include_self", "1");
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <PhotoCollection>(parameters));
        }
Exemple #8
0
        /// <summary>
        /// Return a list of photos for a user at a specific latitude, longitude and accuracy.
        /// </summary>
        /// <param name="latitude">The latitude whose valid range is -90 to 90. Anything more than 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude whose valid range is -180 to 180. Anything more than 6 decimal places will be truncated.</param>
        /// <param name="accuracy">Recorded accuracy level of the location information.
        /// World level is 1, Country is ~3, Region ~6, City ~11, Street ~16. Current range is 1-16.
        /// Defaults to 16 if not specified.</param>
        /// <param name="extras"></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>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PhotosGeoPhotosForLocationAsync(double latitude, double longitude, GeoAccuracy accuracy,
                                                    PhotoSearchExtras extras, int perPage, int page,
                                                    Action <FlickrResult <PhotoCollection> > callback)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.photos.geo.photosForLocation");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("accuracy", accuracy.ToString("D"));
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.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));
            }

            GetResponseAsync <PhotoCollection>(parameters, callback);
        }
        /// <summary>
        /// Gets the public photos for given users ID's contacts.
        /// </summary>
        /// <param name="userId">The user ID whose contacts you wish to get photos for.</param>
        /// <param name="count">The number of photos to return. Defaults to 10, maximum is 50.</param>
        /// <param name="justFriends">True to just return photos from friends and family (excluding regular contacts).</param>
        /// <param name="singlePhoto">True to return just a single photo for each contact.</param>
        /// <param name="includeSelf">True to include photos from the user ID specified as well.</param>
        /// <param name="extras">A list of extra details to return for each photo.</param>
        /// <returns></returns>
        public PhotoCollection PhotosGetContactsPublicPhotos(string userId, int count, bool justFriends, bool singlePhoto, bool includeSelf, PhotoSearchExtras extras)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.getContactsPublicPhotos");
            parameters.Add("api_key", apiKey);
            parameters.Add("user_id", userId);
            if (count > 0)
            {
                parameters.Add("count", count.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (justFriends)
            {
                parameters.Add("just_friends", "1");
            }
            if (singlePhoto)
            {
                parameters.Add("single_photo", "1");
            }
            if (includeSelf)
            {
                parameters.Add("include_self", "1");
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <PhotoCollection>(parameters));
        }
Exemple #10
0
        /// <summary>
        /// Gets a list of the specified users photosets.
        /// </summary>
        /// <param name="userId">The ID of the user to return the photosets of.</param>
        /// <param name="page">The page of the results to return. Defaults to page 1.</param>
        /// <param name="perPage">The number of photosets to return per page. Defaults to 500.</param>
        /// <param name="primaryPhotoExtras">The extra information to return for the photosets primary photo.</param>
        /// <returns>A <see cref="PhotosetCollection"/> instance containing a collection of photosets.</returns>
        public PhotosetCollection PhotosetsGetList(string userId, int page, int perPage, PhotoSearchExtras primaryPhotoExtras)
        {
            var parameters = new Dictionary <string, string> {
                { "method", "flickr.photosets.getList" }
            };

            if (userId != null)
            {
                parameters.Add("user_id", userId);
            }
            if (page > 0)
            {
                parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (perPage > 0)
            {
                parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (primaryPhotoExtras != PhotoSearchExtras.None)
            {
                parameters.Add("primary_photo_extras", UtilityMethods.ExtrasToString(primaryPhotoExtras));
            }

            var photosets = GetResponseCache <PhotosetCollection>(parameters);

            foreach (var photoset in photosets)
            {
                photoset.OwnerId = userId;
            }
            return(photosets);
        }
        /// <summary>
        /// Gets a list of photos from the most recent interstingness list.
        /// </summary>
        /// <param name="date">The date to return the interestingness photos for.</param>
        /// <param name="extras">The extra parameters to return along with the search results.
        /// See <see cref="PhotoSearchOptions"/> for more details.</param>
        /// <param name="perPage">The number of results to return per page.</param>
        /// <param name="page">The page of the results to return.</param>
        /// <returns></returns>
        public PhotoCollection InterestingnessGetList(DateTime date, PhotoSearchExtras extras, int page, int perPage)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.interestingness.getList");

            if (date > DateTime.MinValue)
            {
                parameters.Add("date", date.ToString("yyyy-MM-dd", System.Globalization.DateTimeFormatInfo.InvariantInfo));
            }
            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));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <PhotoCollection>(parameters));
        }
        /// <summary>
        /// Return the list of photos belonging to your contacts that have been commented on recently.
        /// </summary>
        /// <param name="dateLastComment">Limits the resultset to photos that have been commented on since this date. The default, and maximum, offset is (1) hour.</param>
        /// <param name="contactsFilter">A list of contact NSIDs to limit the scope of the query to.</param>
        /// <param name="extras"></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></returns>
        public PhotoCollection PhotosCommentsGetRecentForContacts(DateTime dateLastComment, string[] contactsFilter, PhotoSearchExtras extras, int page, int perPage)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.photos.comments.getRecentForContacts");
            if (dateLastComment != DateTime.MinValue)
            {
                parameters.Add("date_lastcomment", UtilityMethods.DateToUnixTimestamp(dateLastComment));
            }
            if (contactsFilter != null && contactsFilter.Length > 0)
            {
                parameters.Add("contacts_filter", String.Join(",", contactsFilter));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }
            if (page > 0)
            {
                parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (perPage > 0)
            {
                parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }

            return(GetResponseCache <PhotoCollection>(parameters));
        }
        /// <summary>
        /// Return photos from the given user's photostream. Only photos visible to the calling user will be returned. This method must be authenticated;
        /// </summary>
        /// <param name="userId">The NSID of the user who's photos to return. A value of "me" will return the calling user's photos.</param>
        /// <param name="safeSearch">Safe search setting</param>
        /// <param name="minUploadDate">Minimum upload date. Photos with an upload date greater than or equal to this value will be returned.</param>
        /// <param name="maxUploadDate">Maximum upload date. Photos with an upload date less than or equal to this value will be returned.</param>
        /// <param name="minTakenDate">Minimum taken date. Photos with an taken date greater than or equal to this value will be returned. </param>
        /// <param name="maxTakenDate">Maximum taken date. Photos with an taken date less than or equal to this value will be returned. </param>
        /// <param name="contentType">Content Type setting</param>
        /// <param name="privacyFilter">Return photos only matching a certain privacy level.</param>
        /// <param name="extras">A 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>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PeopleGetPhotosAsync(string userId, SafetyLevel safeSearch, DateTime minUploadDate,
                                         DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate,
                                         ContentTypeSearch contentType, PrivacyFilter privacyFilter,
                                         PhotoSearchExtras extras, int page, int perPage,
                                         Action <FlickrResult <PhotoCollection> > callback)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.people.getPhotos");
            parameters.Add("user_id", userId ?? "me");
            if (safeSearch != SafetyLevel.None)
            {
                parameters.Add("safe_search", safeSearch.ToString("d"));
            }
            if (minUploadDate != DateTime.MinValue)
            {
                parameters.Add("min_upload_date", UtilityMethods.DateToUnixTimestamp(minUploadDate));
            }
            if (maxUploadDate != DateTime.MinValue)
            {
                parameters.Add("max_upload_date", UtilityMethods.DateToUnixTimestamp(maxUploadDate));
            }
            if (minTakenDate != DateTime.MinValue)
            {
                parameters.Add("min_taken_date", UtilityMethods.DateToMySql(minTakenDate));
            }
            if (maxTakenDate != DateTime.MinValue)
            {
                parameters.Add("max_taken_date", UtilityMethods.DateToMySql(maxTakenDate));
            }

            if (contentType != ContentTypeSearch.None)
            {
                parameters.Add("content_type", contentType.ToString("d"));
            }
            if (privacyFilter != PrivacyFilter.None)
            {
                parameters.Add("privacy_filter", privacyFilter.ToString("d"));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            if (page > 0)
            {
                parameters.Add("page", page.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (perPage > 0)
            {
                parameters.Add("per_page", perPage.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }

            GetResponseAsync <PhotoCollection>(parameters, callback);
        }
Exemple #14
0
        /// <summary>
        /// Return the list of photos for a gallery.
        /// </summary>
        /// <param name="galleryId">The ID of the gallery of photos to return.</param>
        /// <param name="extras">A list of extra information to fetch for each returned record.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public async Task <FlickrResult <GalleryPhotoCollection> > GalleriesGetPhotosAsync(string galleryId, PhotoSearchExtras extras)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.galleries.getPhotos");
            parameters.Add("gallery_id", galleryId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(await GetResponseAsync <GalleryPhotoCollection>(parameters));
        }
        /// <summary>
        /// Return the list of photos for a gallery.
        /// </summary>
        /// <param name="galleryId">The ID of the gallery of photos to return.</param>
        /// <param name="extras">A list of extra information to fetch for each returned record.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void GalleriesGetPhotosAsync(string galleryId, PhotoSearchExtras extras, Action <FlickrResult <GalleryPhotoCollection> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.galleries.getPhotos");
            parameters.Add("gallery_id", galleryId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            GetResponseAsync <GalleryPhotoCollection>(parameters, callback);
        }
        /// <summary>
        /// Return the list of photos for a gallery.
        /// </summary>
        /// <param name="galleryId">The ID of the gallery of photos to return.</param>
        /// <param name="extras">A list of extra information to fetch for each returned record.</param>
        /// <returns></returns>
        public GalleryPhotoCollection GalleriesGetPhotos(string galleryId, PhotoSearchExtras extras)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.galleries.getPhotos");
            parameters.Add("gallery_id", galleryId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <GalleryPhotoCollection>(parameters));
        }
Exemple #17
0
        /// <summary>
        /// Returns the first 24 photos for a given tag cluster.
        /// </summary>
        /// <param name="tag">The tag whose cluster photos you want to return.</param>
        /// <param name="clusterId">The cluster id for the cluster you want to return the photos. This is the first three subtags of the tag cluster appended with hyphens ('-').</param>
        /// <param name="extras">Extra information to return with each photo.</param>
        /// <returns></returns>
        public PhotoCollection TagsGetClusterPhotos(string tag, string clusterId, PhotoSearchExtras extras)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.tags.getClusterPhotos");
            parameters.Add("tag", tag);
            parameters.Add("cluster_id", clusterId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <PhotoCollection>(parameters));
        }
Exemple #18
0
        /// <summary>
        /// Returns the first 24 photos for a given tag cluster.
        /// </summary>
        /// <param name="tag">The tag whose cluster photos you want to return.</param>
        /// <param name="clusterId">The cluster id for the cluster you want to return the photos. This is the first three subtags of the tag cluster appended with hyphens ('-').</param>
        /// <param name="extras">Extra information to return with each photo.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public async Task <FlickrResult <PhotoCollection> > TagsGetClusterPhotosAsync(string tag, string clusterId, PhotoSearchExtras extras)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.tags.getClusterPhotos");
            parameters.Add("tag", tag);
            parameters.Add("cluster_id", clusterId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(await GetResponseAsync <PhotoCollection>(parameters));
        }
Exemple #19
0
        /// <summary>
        /// Returns the first 24 photos for a given tag cluster.
        /// </summary>
        /// <param name="tag">The tag whose cluster photos you want to return.</param>
        /// <param name="clusterId">The cluster id for the cluster you want to return the photos. This is the first three subtags of the tag cluster appended with hyphens ('-').</param>
        /// <param name="extras">Extra information to return with each photo.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void TagsGetClusterPhotosAsync(string tag, string clusterId, PhotoSearchExtras extras, Action <FlickrResult <PhotoCollection> > callback)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.tags.getClusterPhotos");
            parameters.Add("tag", tag);
            parameters.Add("cluster_id", clusterId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            GetResponseAsync <PhotoCollection>(parameters, callback);
        }
        /// <summary>
        /// Get the next and previous favorites in a users list of favorites, based on one of their favorites.
        /// </summary>
        /// <param name="photoId">The photo id of the photo for which to find the next and previous favorites.</param>
        /// <param name="userId">The user id of the users whose favorites you wish to search.</param>
        /// <param name="numPrevious">The number of previous favorites to list. Defaults to 1.</param>
        /// <param name="numNext">The number of next favorites to list. Defaults to 1.</param>
        /// <param name="extras">Any extras to return for each photo in the previous and next list.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        /// <returns></returns>
        public void FavoritesGetContextAsync(string photoId, string userId, int numPrevious, int numNext, PhotoSearchExtras extras, Action <FlickrResult <FavoriteContext> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.favorites.getContext");
            parameters.Add("user_id", userId);
            parameters.Add("photo_id", photoId);
            parameters.Add("num_prev", Math.Max(1, numPrevious).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("num_next", Math.Max(1, numNext).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            GetResponseAsync <FavoriteContext>(parameters, callback);
        }
Exemple #21
0
        /// <summary>
        /// Get the next and previous favorites in a users list of favorites, based on one of their favorites.
        /// </summary>
        /// <param name="photoId">The photo id of the photo for which to find the next and previous favorites.</param>
        /// <param name="userId">The user id of the users whose favorites you wish to search.</param>
        /// <param name="numPrevious">The number of previous favorites to list. Defaults to 1.</param>
        /// <param name="numNext">The number of next favorites to list. Defaults to 1.</param>
        /// <param name="extras">Any extras to return for each photo in the previous and next list.</param>
        /// <returns></returns>
        public FavoriteContext FavoritesGetContext(string photoId, string userId, int numPrevious, int numNext, PhotoSearchExtras extras)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.favorites.getContext");
            parameters.Add("user_id", userId);
            parameters.Add("photo_id", photoId);
            parameters.Add("num_prev", Math.Max(1, numPrevious).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("num_next", Math.Max(1, numNext).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <FavoriteContext>(parameters));
        }
Exemple #22
0
        /// <summary>
        /// Gets a list of photos for the given panda.
        /// </summary>
        /// <param name="pandaName">The name of the panda to return photos for.</param>
        /// <param name="extras">The extras to return with the photos.</param>
        /// <param name="perPage">The number of photos to return per page.</param>
        /// <param name="page">The age to return.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public async Task <FlickrResult <PandaPhotoCollection> > PandaGetPhotosAsync(string pandaName, PhotoSearchExtras extras, int page, int perPage)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.panda.getPhotos");
            parameters.Add("panda_name", pandaName);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.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(await GetResponseAsync <PandaPhotoCollection>(parameters));
        }
        /// <summary>
        /// Gets the photos containing the specified user.
        /// </summary>
        /// <param name="userId">The user ID to get photos of.</param>
        /// <param name="extras">A list of extras to return for each photo.</param>
        /// <param name="perPage">The number of photos to return per page.</param>
        /// <param name="page">The page of photos to return. Default is 1.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PeopleGetPhotosOfAsync(string userId, PhotoSearchExtras extras, int page, int perPage, Action <FlickrResult <PeoplePhotoCollection> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.people.getPhotosOf");
            parameters.Add("user_id", userId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.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));
            }

            GetResponseAsync <PeoplePhotoCollection>(parameters, callback);
        }
        /// <summary>
        /// Returns a list of the latest public photos uploaded to flickr.
        /// </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 PhotosGetRecent(int page, int perPage, PhotoSearchExtras extras)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.getRecent");
            parameters.Add("api_key", apiKey);
            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));
            }
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            }

            return(GetResponseCache <PhotoCollection>(parameters));
        }
        /// <summary>
        /// Get a users popular photos
        /// </summary>
        /// <param name="userId">The user id - if null then it is the authenticated user.</param>
        /// <param name="extras"></param>
        /// <param name="sort"></param>
        /// <param name="perPage"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public PhotoCollection PhotosGetPopular(string userId, PhotoSearchExtras extras = PhotoSearchExtras.None, string sort = "interesting", int perPage = 100, int page = 1)
        {
            if (userId == null)
            {
                CheckRequiresAuthentication();
            }

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

            parameters.Add("method", "flickr.photos.getPopular");
            if (userId != null)
            {
                parameters.Add("user_id", userId);
            }
            parameters.Add("sort", sort);
            parameters.Add("extras", UtilityMethods.ExtrasToString(extras));
            parameters.Add("per_page", perPage.ToString("0"));
            parameters.Add("page", page.ToString("0"));

            return(GetResponseCache <PhotoCollection>(parameters));
        }
Exemple #26
0
        /// <summary>
        /// Gets the photos containing the specified user.
        /// </summary>
        /// <param name="userId">The user ID to get photos of.</param>
        /// <param name="extras">A list of extras to return for each photo.</param>
        /// <param name="perPage">The number of photos to return per page.</param>
        /// <param name="page">The page of photos to return. Default is 1.</param>
        /// <returns>A list of photos in the <see cref="PeoplePhotoCollection"/> class.</returns>
        public PeoplePhotoCollection PeopleGetPhotosOf(string userId, PhotoSearchExtras extras, int page, int perPage)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.people.getPhotosOf");
            parameters.Add("user_id", userId);
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.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(GetResponseCache <PeoplePhotoCollection>(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>
        /// <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();

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

            parameters.Add("method", "flickr.photos.recentlyUpdated");
            parameters.Add("min_date", UtilityMethods.DateToUnixTimestamp(minDate));
            if (extras != PhotoSearchExtras.None)
            {
                parameters.Add("extras", UtilityMethods.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(GetResponseCache <PhotoCollection>(parameters));
        }