/// <summary> /// Returns first 50 photos for a venue. /// </summary> /// <param name="venue">The venue you want photos for.</param> /// <exception cref="ArgumentNullException"></exception> public static Task <IReadOnlyCollection <VenuePhoto> > GetPhotos(this CompactVenue venue) { if (venue == null) { throw new ArgumentNullException(nameof(venue)); } var client = new PhotosClient(venue.HttpClient); return(client.GetVenuePhotos(venue.Id, 50, 0)); }
public void AddVenue( string name, Dictionary <string, string> dataPairs, Action <CompactVenue> okNewVenue, Action <DuplicateVenueChallenge> duplicatesChallenge, Action <Exception> error) { ValidateIsUser(); var flat = new List <string>(); dataPairs["name"] = name; foreach (var kp in dataPairs) { if (!string.IsNullOrEmpty(kp.Value)) { flat.Add(kp.Key); flat.Add(kp.Value); } } var uuri = FourSquareWebClient.BuildFourSquareUri( "venues/add", GeoMethodType.Optional, flat.ToArray() ); var r = new FourSquareServiceRequest { Uri = uuri.Uri, PostString = string.Empty, }; var token = CentralStatusManager.Instance.BeginShowEllipsisMessage("Saving place"); r.CallAsync( (str, ex) => { Exception exx = ex; try { FourSquare.IgnoreNextNotification = true; var json = FourSquareDataLoaderBase <LoadContext> .ProcessMetaAndNotificationsReturnJson(str); FourSquare.IgnoreNextNotification = false; string ignoreDuplicatesKey = Json.TryGetJsonProperty(json, "ignoreDuplicatesKey"); if (!string.IsNullOrEmpty(ignoreDuplicatesKey)) { var duplicates = json["candidateDuplicateVenues"]; if (duplicates != null) { List <CompactVenue> dupes = new List <CompactVenue>(); foreach (var dupe in duplicates) { var dd = CompactVenue.ParseJson(dupe); if (dd != null) { dupes.Add(dd); } } DuplicateVenueChallenge dvc = new DuplicateVenueChallenge(); dvc.CandidateDuplicateVenues = dupes; dvc.IgnoreDuplicatesKey = ignoreDuplicatesKey; duplicatesChallenge(dvc); token.Complete(); return; } } var vjson = json["venue"]; CompactVenue cv = null; if (vjson != null) { cv = CompactVenue.ParseJson(vjson); } okNewVenue(cv); token.CompleteWithAcknowledgement(); } catch (Exception e) { exx = e; } if (exx != null) { error(exx); StatusToken.TryComplete(ref token); } }); }