/// <summary> /// Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags. /// </summary> /// <param name="placeType">The ID for a specific place type to cluster photos by. </param> /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. </param> /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param> /// <param name="threshold">The minimum number of photos that a place type must have to be included. /// If the number of photos is lowered then the parent place type for that place will be used.</param> /// <param name="tags">A list of tags. Photos with one or more of the tags listed will be returned.</param> /// <param name="tagMode">Either 'any' for an OR combination of tags, or 'all' for an AND combination. /// Defaults to 'any' if not specified.</param> /// <param name="machineTags"></param> /// <param name="machineTagMode"></param> /// <param name="minUploadDate">Minimum upload date.</param> /// <param name="maxUploadDate">Maximum upload date.</param> /// <param name="minTakenDate">Minimum taken date.</param> /// <param name="maxTakenDate">Maximum taken date.</param> /// <param name="callback">Callback method to call upon return of the response from Flickr.</param> public void PlacesPlacesForTagsAsync(PlaceType placeType, string woeId, string placeId, int threshold, string[] tags, TagMode tagMode, string[] machineTags, MachineTagMode machineTagMode, DateTime minUploadDate, DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate, Action <FlickrResult <PlaceCollection> > callback) { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("method", "flickr.places.placesForTags"); parameters.Add("place_type_id", placeType.ToString("D")); if (!String.IsNullOrEmpty(woeId)) { parameters.Add("woe_id", woeId); } if (!String.IsNullOrEmpty(placeId)) { parameters.Add("place_id", placeId); } if (threshold > 0) { parameters.Add("threshold", threshold.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); } if (tags != null && tags.Length > 0) { parameters.Add("tags", String.Join(",", tags)); } if (tagMode != TagMode.None) { parameters.Add("tag_mode", UtilityMethods.TagModeToString(tagMode)); } if (machineTags != null && machineTags.Length > 0) { parameters.Add("machine_tags", String.Join(",", machineTags)); } if (machineTagMode != MachineTagMode.None) { parameters.Add("machine_tag_mode", UtilityMethods.MachineTagModeToString(machineTagMode)); } 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 <PlaceCollection>(parameters, callback); }
/// <summary> /// Convert a <see cref="MachineTagMode"/> to a string used when passing to Flickr. /// </summary> /// <param name="machineTagMode">The machine tag mode to convert.</param> /// <returns>The string to pass to Flickr.</returns> public static string MachineTagModeToString(MachineTagMode machineTagMode) { switch (machineTagMode) { case MachineTagMode.None: return String.Empty; case MachineTagMode.AllTags: return "all"; case MachineTagMode.AnyTag: return "any"; default: return String.Empty; } }
/// <summary> /// Convert a <see cref="MachineTagMode"/> to a string used when passing to Flickr. /// </summary> /// <param name="machineTagMode">The machine tag mode to convert.</param> /// <returns>The string to pass to Flickr.</returns> public static string MachineTagModeToString(MachineTagMode machineTagMode) { switch (machineTagMode) { case MachineTagMode.None: return(String.Empty); case MachineTagMode.AllTags: return("all"); case MachineTagMode.AnyTag: return("any"); default: return(String.Empty); } }
public PlaceCollection PlacesPlacesForTags(string woeId, IEnumerable<string> machineTags, MachineTagMode machineTagMode, DateTime? minUploadDate, DateTime? maxUploadDate, DateTime? minTakenDate, DateTime? maxTakenDate) { return PlacesPlacesForTags(PlaceType.None, woeId, null, null, null, TagMode.None, machineTags, machineTagMode, minUploadDate, maxUploadDate, minTakenDate, maxTakenDate); }
public PlaceCollection PlacesPlacesForTags(string woeId, IEnumerable<string> machineTags, MachineTagMode machineTagMode) { return PlacesPlacesForTags(PlaceType.None, woeId, null, null, null, TagMode.None, machineTags, machineTagMode, null, null, null, null); }
public PlaceCollection PlacesPlacesForTags(PlaceType placeTypeId, string woeId, string placeId, int? threshold, IEnumerable<string> tags, TagMode tagMode, IEnumerable<string> machineTags, MachineTagMode machineTagMode, DateTime? minUploadDate, DateTime? maxUploadDate, DateTime? minTakenDate, DateTime? maxTakenDate) { var dictionary = new Dictionary<string, string>(); dictionary.Add("method", "flickr.places.placesForTags"); if (placeTypeId != PlaceType.None) dictionary.Add("place_type_id", placeTypeId.ToString().ToLower()); if (woeId != null) dictionary.Add("woe_id", woeId); if (placeId != null) dictionary.Add("place_id", placeId); if (threshold != null) dictionary.Add("threshold", threshold.ToString().ToLower()); if (tags != null) dictionary.Add("tags", tags == null ? String.Empty : String.Join(",", tags.ToArray())); if (tagMode != TagMode.None) dictionary.Add("tag_mode", tagMode.ToString().ToLower()); if (machineTags != null) dictionary.Add("machine_tags", machineTags == null ? String.Empty : String.Join(",", machineTags.ToArray())); if (machineTagMode != MachineTagMode.None) dictionary.Add("machine_tag_mode", machineTagMode.ToString().ToLower()); if (minUploadDate != null) dictionary.Add("min_upload_date", minUploadDate.Value.ToUnixTimestamp()); if (maxUploadDate != null) dictionary.Add("max_upload_date", maxUploadDate.Value.ToUnixTimestamp()); if (minTakenDate != null) dictionary.Add("min_taken_date", minTakenDate.Value.ToUnixTimestamp()); if (maxTakenDate != null) dictionary.Add("max_taken_date", maxTakenDate.Value.ToUnixTimestamp()); return GetResponse<PlaceCollection>(dictionary); }
/// <summary> /// Return a list of the top 100 unique places clustered by a given placetype for set of tags or machine tags. /// </summary> /// <param name="placeType">The ID for a specific place type to cluster photos by. </param> /// <param name="woeId">A Where on Earth identifier to use to filter photo clusters. </param> /// <param name="placeId">A Flickr Places identifier to use to filter photo clusters. </param> /// <param name="threshold">The minimum number of photos that a place type must have to be included. If the number of photos is lowered then the parent place type for that place will be used.</param> /// <param name="tags">A list of tags. Photos with one or more of the tags listed will be returned.</param> /// <param name="tagMode">Either 'any' for an OR combination of tags, or 'all' for an AND combination. Defaults to 'any' if not specified.</param> /// <param name="machineTags"></param> /// <param name="machineTagMode"></param> /// <param name="minUploadDate">Minimum upload date.</param> /// <param name="maxUploadDate">Maximum upload date.</param> /// <param name="minTakenDate">Minimum taken date.</param> /// <param name="maxTakenDate">Maximum taken date.</param> /// <returns></returns> public PlaceCollection PlacesPlacesForTags(PlaceType placeType, string woeId, string placeId, int threshold, string[] tags, TagMode tagMode, string[] machineTags, MachineTagMode machineTagMode, DateTime minUploadDate, DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate) { Dictionary<string, string> parameters = new Dictionary<string, string>(); parameters.Add("method", "flickr.places.placesForTags"); parameters.Add("place_type_id", placeType.ToString("D")); if (!String.IsNullOrEmpty(woeId)) parameters.Add("woe_id", woeId); if (!String.IsNullOrEmpty(placeId)) parameters.Add("place_id", placeId); if (threshold > 0) parameters.Add("threshold", threshold.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); if (tags != null && tags.Length > 0) parameters.Add("tags", String.Join(",", tags)); if (tagMode != TagMode.None) parameters.Add("tag_mode", UtilityMethods.TagModeToString(tagMode)); if (machineTags != null && machineTags.Length > 0) parameters.Add("machine_tags", String.Join(",", machineTags)); if (machineTagMode != MachineTagMode.None) parameters.Add("machine_tag_mode", UtilityMethods.MachineTagModeToString(machineTagMode)); 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)); return GetResponseCache<PlaceCollection>(parameters); }
public PlaceCollection PlacesPlacesForTags(PlaceType placeType, string woeId, string placeId, int threshold, string[] tags, TagMode tagMode, string[] machineTags, MachineTagMode machineTagMode, DateTime minUploadDate, DateTime maxUploadDate, DateTime minTakenDate, DateTime maxTakenDate);