/// <summary> /// Return a list of the top 100 unique tags for a Flickr Places or Where on Earth (WOE) ID. /// </summary> /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. /// (While optional, you must pass either a valid Places ID or a WOE ID.)</param> /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. /// (While optional, you must pass either a valid Places ID or a WOE ID.)</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="callback">Callback method to call upon return of the response from Flickr.</param> public void PlacesTagsForPlaceAsync(string placeId, string woeId, DateTime minUploadDate, DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate, Action <TwentyThreeResult <TagCollection> > callback) { var parameters = new Dictionary <string, string>(); parameters.Add("method", "flickr.places.tagsForPlace"); if (string.IsNullOrEmpty(placeId) && string.IsNullOrEmpty(woeId)) { throw new TwentyThreeException("Both placeId and woeId cannot be null or empty."); } if (!string.IsNullOrEmpty(woeId)) { parameters.Add("woe_id", woeId); } if (!string.IsNullOrEmpty(placeId)) { parameters.Add("place_id", placeId); } 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 (minUploadDate != DateTime.MinValue) { parameters.Add("min_upload_date", UtilityMethods.DateToUnixTimestamp(minUploadDate)); } if (maxUploadDate != DateTime.MinValue) { parameters.Add("max_upload_date", UtilityMethods.DateToUnixTimestamp(maxUploadDate)); } GetResponseAsync <TagCollection>(parameters, callback); }
/// <summary> /// Get a list of referring domains for a photoset. /// </summary> /// <param name="date">Stats will be returned for this date. /// A day according to Flickr Stats starts at midnight GMT for all users, /// and timestamps will automatically be rounded down to the start of the day.</param> /// <param name="photosetId">The id of the photoset to get stats for. /// If not provided, stats for all sets will be returned.</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 domains to return per page. /// If this argument is omitted, it defaults to 25. The maximum allowed value is 100.</param> /// <param name="callback">Callback method to call upon return of the response from Flickr.</param> public void StatsGetPhotosetDomainsAsync(DateTime date, string photosetId, int page, int perPage, Action <TwentyThreeResult <StatDomainCollection> > callback) { CheckRequiresAuthentication(); var parameters = new Dictionary <string, string>(); parameters.Add("method", "flickr.stats.getPhotosetDomains"); parameters.Add("date", UtilityMethods.DateToUnixTimestamp(date)); if (!string.IsNullOrEmpty(photosetId)) { parameters.Add("photoset_id", photosetId); } 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 <StatDomainCollection>(parameters, callback); }
/// <summary> /// Get a list of referring domains for a collection. /// </summary> /// <param name="date">Stats will be returned for this date. /// A day according to Flickr Stats starts at midnight GMT for all users, /// and timestamps will automatically be rounded down to the start of the day.</param> /// <param name="collectionId">The id of the collection to get stats for. /// If not provided, stats for all collections will be returned.</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 domains to return per page. If this argument is omitted, it defaults to 25. /// The maximum allowed value is 100.</param> /// <returns></returns> public StatDomainCollection StatsGetCollectionDomains(DateTime date, string collectionId, int page, int perPage) { CheckRequiresAuthentication(); var parameters = new Dictionary <string, string>(); parameters.Add("method", "flickr.stats.getCollectionDomains"); parameters.Add("date", UtilityMethods.DateToUnixTimestamp(date)); if (!string.IsNullOrEmpty(collectionId)) { parameters.Add("collection_id", UtilityMethods.CleanCollectionId(collectionId)); } 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 <StatDomainCollection>(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)); }
/// <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> /// <param name="callback">Callback method to call upon return of the response from Flickr.</param> public void FavoritesGetListAsync(string userId, DateTime minFavoriteDate, DateTime maxFavoriteDate, PhotoSearchExtras extras, int page, int perPage, Action <TwentyThreeResult <PhotoCollection> > callback) { CheckRequiresAuthentication(); var 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)); } GetResponseAsync <PhotoCollection>(parameters, callback); }
/// <summary> /// Takes the various properties of this instance and adds them to a <see cref="Dictionary{K,V}"/> instanced passed in, ready for sending to Flickr. /// </summary> /// <param name="parameters">The <see cref="Dictionary{K,V}"/> to add the options to.</param> public void AddToDictionary(Dictionary <string, string> parameters) { if (!string.IsNullOrEmpty(UserId)) { parameters.Add("user_id", UserId); } if (!string.IsNullOrEmpty(GroupId)) { parameters.Add("group_id", GroupId); } if (!string.IsNullOrEmpty(Text)) { parameters.Add("text", Text); } if (!string.IsNullOrEmpty(Tags)) { parameters.Add("tags", Tags); } if (TagMode != TagMode.None) { parameters.Add("tag_mode", UtilityMethods.TagModeToString(TagMode)); } if (!string.IsNullOrEmpty(MachineTags)) { parameters.Add("machine_tags", MachineTags); } if (MachineTagMode != MachineTagMode.None) { parameters.Add("machine_tag_mode", UtilityMethods.MachineTagModeToString(MachineTagMode)); } if (MinUploadDate != DateTime.MinValue) { parameters.Add("min_upload_date", UtilityMethods.DateToUnixTimestamp(MinUploadDate).ToString()); } if (MaxUploadDate != DateTime.MinValue) { parameters.Add("max_upload_date", UtilityMethods.DateToUnixTimestamp(MaxUploadDate).ToString()); } 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 (Licenses.Count != 0) { var licenseArray = new List <string>(); foreach (var license in Licenses) { licenseArray.Add(license.ToString("d")); } parameters.Add("license", string.Join(",", licenseArray.ToArray())); } 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", ExtrasString); } if (SortOrder != PhotoSearchSortOrder.None) { parameters.Add("sort", SortOrderString); } if (PrivacyFilter != PrivacyFilter.None) { parameters.Add("privacy_filter", PrivacyFilter.ToString("d")); } if (BoundaryBox != null && BoundaryBox.IsSet) { parameters.Add("bbox", BoundaryBox.ToString()); } if (Accuracy != GeoAccuracy.None) { parameters.Add("accuracy", Accuracy.ToString("d")); } if (SafeSearch != SafetyLevel.None) { parameters.Add("safe_search", SafeSearch.ToString("d")); } if (ContentType != ContentTypeSearch.None) { parameters.Add("content_type", ContentType.ToString("d")); } if (HasGeo != null) { parameters.Add("has_geo", HasGeo.Value ? "1" : "0"); } if (Latitude != null) { parameters.Add("lat", Latitude.Value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); } if (Longitude != null) { parameters.Add("lon", Longitude.Value.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); } if (Radius != null) { parameters.Add("radius", Radius.Value.ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo)); } if (RadiusUnits != RadiusUnit.None) { parameters.Add("radius_units", (RadiusUnits == RadiusUnit.Miles ? "mi" : "km")); } if (Contacts != ContactSearch.None) { parameters.Add("contacts", (Contacts == ContactSearch.AllContacts ? "all" : "ff")); } if (WoeId != null) { parameters.Add("woe_id", WoeId); } if (PlaceId != null) { parameters.Add("place_id", PlaceId); } if (IsCommons) { parameters.Add("is_commons", "1"); } if (InGallery) { parameters.Add("in_gallery", "1"); } if (IsGetty) { parameters.Add("is_getty", "1"); } if (MediaType != MediaType.None) { parameters.Add("media", UtilityMethods.MediaTypeToString(MediaType)); } if (GeoContext != GeoContext.NotDefined) { parameters.Add("geo_context", GeoContext.ToString("d")); } if (Faves) { parameters.Add("faves", "1"); } if (PersonId != null) { parameters.Add("person_id", PersonId); } if (Camera != null) { parameters.Add("camera", Camera); } if (JumpTo != null) { parameters.Add("jump_to", JumpTo); } if (!string.IsNullOrEmpty(Username)) { parameters.Add("username", Username); } if (ExifMinExposure != null) { parameters.Add("exif_min_exposure", ExifMinExposure.Value.ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo)); } if (ExifMaxExposure != null) { parameters.Add("exif_max_exposure", ExifMaxExposure.Value.ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo)); } if (ExifMinAperture != null) { parameters.Add("exif_min_aperture", ExifMinAperture.Value.ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo)); } if (ExifMaxAperture != null) { parameters.Add("exif_max_aperture", ExifMaxAperture.Value.ToString("0.00000", System.Globalization.NumberFormatInfo.InvariantInfo)); } if (ExifMinFocalLength != null) { parameters.Add("exif_min_focallen", ExifMinFocalLength.Value.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo)); } if (ExifMaxFocalLength != null) { parameters.Add("exif_max_focallen", ExifMaxFocalLength.Value.ToString("0", System.Globalization.NumberFormatInfo.InvariantInfo)); } if (ExcludeUserID != null) { parameters.Add("exclude_user_id", ExcludeUserID); } if (FoursquareVenueID != null) { parameters.Add("foursquare_venueid", FoursquareVenueID); } if (FoursquareWoeID != null) { parameters.Add("foursquare_woeid", FoursquareWoeID); } if (GroupPathAlias != null) { parameters.Add("group_path_alias", GroupPathAlias); } if (ColorCodes != null && ColorCodes.Count != 0) { parameters.Add("color_codes", ColorCodeString); } }