public static TagModeToString ( TagMode tagMode ) : string | ||
tagMode | TagMode | The tag mode to convert. |
리턴 | string |
/// <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> /// 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); } }