/// <summary>
        /// Returns a place based on the input latitude and longitude.
        /// </summary>
        /// <param name="latitude">The latitude, between -180 and 180.</param>
        /// <param name="longitude">The longitude, between -90 and 90.</param>
        /// <param name="accuracy">The level the locality will be for.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PlacesFindByLatLonAsync(double latitude, double longitude, GeoAccuracy accuracy,
                                            Action <FlickrResult <Place> > callback)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.places.findByLatLon");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None)
            {
                parameters.Add("accuracy",
                               ((int)accuracy).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }

            GetResponseAsync <PlaceCollection>(
                parameters,
                r =>
            {
                FlickrResult <Place> result = new FlickrResult <Place>();
                result.Error = r.Error;
                if (!r.HasError)
                {
                    result.Result = r.Result[0];
                }
                callback(result);
            });
        }
Esempio n. 2
0
        /// <summary>
        /// Subscribe to a particular topic.
        /// </summary>
        /// <param name="topic">The topic to subscribe to.</param>
        /// <param name="callback">The callback url.</param>
        /// <param name="verify">Either 'sync' or 'async'.</param>
        /// <param name="verifyToken">An optional token to be sent along with the verification.</param>
        /// <param name="leaseSeconds">The number of seconds the lease should be for.</param>
        /// <param name="woeIds">An array of WOE ids to listen to. Only applies if topic is 'geo'.</param>
        /// <param name="placeIds">An array of place ids to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="latitude">The latitude to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="longitude">The longitude to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="radius">The radius to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="radiusUnits">The raduis units to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="accuracy">The accuracy of the geo search to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="nsids">A list of Commons Institutes to subscribe to. Only applies if topic is 'commons'. If not present this argument defaults to all Flickr Commons institutions.</param>
        /// <param name="tags">A list of strings to be used for tag subscriptions. Photos with one or more of the tags listed will be included in the subscription. Only valid if the topic is 'tags'</param>
        public void PushSubscribe(string topic, string callback, string verify, string verifyToken, int leaseSeconds, int[] woeIds, string[] placeIds, double latitude, double longitude, int radius, RadiusUnit radiusUnits, GeoAccuracy accuracy, string[] nsids, string[] tags)
        {
            CheckRequiresAuthentication();

            if (String.IsNullOrEmpty(topic)) throw new ArgumentNullException("topic");
            if (String.IsNullOrEmpty(callback)) throw new ArgumentNullException("callback");
            if (String.IsNullOrEmpty(verify)) throw new ArgumentNullException("verify");

            if (topic == "tags" && (tags == null || tags.Length == 0)) throw new InvalidOperationException("Must specify at least one tag is using topic of 'tags'");

            var parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.push.subscribe");
            parameters.Add("topic", topic);
            parameters.Add("callback", callback);
            parameters.Add("verify", verify);
            if (!String.IsNullOrEmpty(verifyToken)) parameters.Add("verify_token", verifyToken);
            if (leaseSeconds > 0) parameters.Add("lease_seconds", leaseSeconds.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (woeIds != null && woeIds.Length > 0)
            {
                List<string> woeIdList = new List<string>();
                foreach (int i in woeIds) { woeIdList.Add(i.ToString(System.Globalization.NumberFormatInfo.InvariantInfo)); }
                parameters.Add("woe_ids", String.Join(",", woeIdList.ToArray()));
            }
            if (placeIds != null && placeIds.Length > 0) parameters.Add("place_ids", String.Join(",", placeIds));
            if (radiusUnits != RadiusUnit.None) parameters.Add("radius_units", radiusUnits.ToString("d"));

            GetResponseNoCache<NoResponse>(parameters);
        }
Esempio n. 3
0
        /// <summary>
        /// Subscribe to a particular topic.
        /// </summary>
        /// <param name="topic">The topic to subscribe to.</param>
        /// <param name="callback">The callback url.</param>
        /// <param name="verify">Either 'sync' or 'async'.</param>
        /// <param name="verifyToken">An optional token to be sent along with the verification.</param>
        /// <param name="leaseSeconds">The number of seconds the lease should be for.</param>
        /// <param name="woeIds">An array of WOE ids to listen to. Only applies if topic is 'geo'.</param>
        /// <param name="placeIds">An array of place ids to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="latitude">The latitude to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="longitude">The longitude to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="radius">The radius to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="radiusUnits">The raduis units to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="accuracy">The accuracy of the geo search to subscribe to. Only applies if topic is 'geo'.</param>
        /// <param name="nsids">A list of Commons Institutes to subscribe to. Only applies if topic is 'commons'.
        /// If not present this argument defaults to all Flickr Commons institutions.</param>
        /// <param name="tags">A list of strings to be used for tag subscriptions.
        /// Photos with one or more of the tags listed will be included in the subscription.
        /// Only valid if the topic is 'tags'</param>
        public void PushSubscribe(string topic, string callback, string verify, string verifyToken, int leaseSeconds,
                                  int[] woeIds, string[] placeIds, double latitude, double longitude, int radius,
                                  RadiusUnit radiusUnits, GeoAccuracy accuracy, string[] nsids, string[] tags)
        {
            CheckRequiresAuthentication();

            if (String.IsNullOrEmpty(topic))
            {
                throw new ArgumentNullException("topic");
            }
            if (String.IsNullOrEmpty(callback))
            {
                throw new ArgumentNullException("callback");
            }
            if (String.IsNullOrEmpty(verify))
            {
                throw new ArgumentNullException("verify");
            }

            if (topic == "tags" && (tags == null || tags.Length == 0))
            {
                throw new InvalidOperationException("Must specify at least one tag is using topic of 'tags'");
            }

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

            parameters.Add("method", "flickr.push.subscribe");
            parameters.Add("topic", topic);
            parameters.Add("callback", callback);
            parameters.Add("verify", verify);
            if (!String.IsNullOrEmpty(verifyToken))
            {
                parameters.Add("verify_token", verifyToken);
            }
            if (leaseSeconds > 0)
            {
                parameters.Add("lease_seconds",
                               leaseSeconds.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }
            if (woeIds != null && woeIds.Length > 0)
            {
                List <string> woeIdList = new List <string>();
                foreach (int i in woeIds)
                {
                    woeIdList.Add(i.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
                }
                parameters.Add("woe_ids", String.Join(",", woeIdList.ToArray()));
            }
            if (placeIds != null && placeIds.Length > 0)
            {
                parameters.Add("place_ids", String.Join(",", placeIds));
            }
            if (radiusUnits != RadiusUnit.None)
            {
                parameters.Add("radius_units", radiusUnits.ToString("d"));
            }

            GetResponseNoCache <NoResponse>(parameters);
        }
Esempio n. 4
0
        /// <summary>
        /// Returns a place based on the input latitude and longitude.
        /// </summary>
        /// <param name="latitude">The latitude, between -180 and 180.</param>
        /// <param name="longitude">The longitude, between -90 and 90.</param>
        /// <param name="accuracy">The level the locality will be for.</param>
        /// <returns>An instance of the <see cref="Place"/> that matches the locality.</returns>
        public Place PlacesFindByLatLon(double latitude, double longitude, GeoAccuracy accuracy)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.findByLatLon");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None) parameters.Add("accuracy", ((int)accuracy).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));

            return GetResponseCache<PlaceCollection>(parameters)[0];
        }
Esempio n. 5
0
        /// <summary>
        /// Correct the places hierarchy for all the photos for a user at a given latitude, longitude and accuracy.
        /// </summary>
        /// <remarks>
        /// Batch corrections are processed in a delayed queue so it may take a few minutes before the changes are reflected in a user's photos.
        /// </remarks>
        /// <param name="latitude">The latitude of the photos to be update whose valid range is -90 to 90. Anything more than 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the photos to be updated 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 photos to be updated. 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="placeId">A Flickr Places ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        /// <param name="woeId">A Where On Earth (WOE) ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public async Task<FlickrResult<NoResponse>> PhotosGeoBatchCorrectLocationAsync(double latitude, double longitude, GeoAccuracy accuracy, string placeId, string woeId)
        {
            CheckRequiresAuthentication();

            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.photos.geo.batchCorrectLocation");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("accuracy", accuracy.ToString("D"));
            parameters.Add("place_id", placeId);
            parameters.Add("woe_id", woeId);

            return await GetResponseAsync<NoResponse>(parameters);
        }
        /// <summary>
        /// Returns a place based on the input latitude and longitude.
        /// </summary>
        /// <param name="latitude">The latitude, between -180 and 180.</param>
        /// <param name="longitude">The longitude, between -90 and 90.</param>
        /// <param name="accuracy">The level the locality will be for.</param>
        /// <returns>An instance of the <see cref="Place"/> that matches the locality.</returns>
        public Place PlacesFindByLatLon(double latitude, double longitude, GeoAccuracy accuracy)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.places.findByLatLon");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None)
            {
                parameters.Add("accuracy", ((int)accuracy).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            }

            return(GetResponseCache <PlaceCollection>(parameters)[0]);
        }
        /// <summary>
        /// Correct the places hierarchy for all the photos for a user at a given latitude, longitude and accuracy.
        /// </summary>
        /// <remarks>
        /// Batch corrections are processed in a delayed queue so it may take a few minutes before the changes are reflected in a user's photos.
        /// </remarks>
        /// <param name="latitude">The latitude of the photos to be update whose valid range is -90 to 90. 
        /// Anything more than 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the photos to be updated 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 photos to be updated. 
        /// 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="placeId">A Flickr Places ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        /// <param name="woeId">A Where On Earth (WOE) ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        public void PhotosGeoBatchCorrectLocation(double latitude, double longitude, GeoAccuracy accuracy, string placeId, string woeId)
        {
            CheckRequiresAuthentication();

            if (string.IsNullOrEmpty(placeId) && string.IsNullOrEmpty(woeId))
                throw new ArgumentException("You must pass either a placeId or a woeId");

            var parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.photos.geo.batchCorrectLocation");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("accuracy", accuracy.ToString("D"));
            parameters.Add("place_id", placeId);
            parameters.Add("woe_id", woeId);

            GetResponseNoCache<NoResponse>(parameters);
        }
Esempio n. 8
0
        /// <summary>
        /// Returns a place based on the input latitude and longitude.
        /// </summary>
        /// <param name="latitude">The latitude, between -180 and 180.</param>
        /// <param name="longitude">The longitude, between -90 and 90.</param>
        /// <param name="accuracy">The level the locality will be for.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public async Task<FlickrResult<Place>> PlacesFindByLatLonAsync(double latitude, double longitude, GeoAccuracy accuracy)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.findByLatLon");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None) parameters.Add("accuracy", ((int)accuracy).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));

            var r = await GetResponseAsync<PlaceCollection>(parameters);
                
            FlickrResult<Place> result = new FlickrResult<Place>();
            result.Error = r.Error;
            if (!r.HasError)
            {
                result.Result = r.Result[0];
            }
            return result;

        }
        /// <summary>
        /// Suggest a particular location for a photo.
        /// </summary>
        /// <param name="photoId">The id of the photo.</param>
        /// <param name="latitude">The latitude of the location to suggest.</param>
        /// <param name="longitude">The longitude of the location to suggest.</param>
        /// <param name="accuracy">The accuracy of the location to suggest.</param>
        /// <param name="woeId">The WOE ID of the location to suggest.</param>
        /// <param name="placeId">The Flickr place id of the location to suggest.</param>
        /// <param name="note">A note to add to the suggestion.</param>
        /// <param name="callback"></param>
        public void PhotosSuggestionsSuggestLocationAsync(string photoId, double latitude, double longitude,
                                                          GeoAccuracy accuracy, string woeId, string placeId,
                                                          string note, Action <FlickrResult <NoResponse> > callback)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.photos.suggestions.suggestLocation");
            parameters.Add("photo_id", photoId);
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("accuracy", accuracy.ToString("D"));
            parameters.Add("place_id", placeId);
            parameters.Add("woe_id", woeId);
            parameters.Add("note", note);

            GetResponseAsync <NoResponse>(parameters, callback);
        }
Esempio n. 10
0
        /// <summary>
        /// Correct the places hierarchy for all the photos for a user at a given latitude, longitude and accuracy.
        /// </summary>
        /// <remarks>
        /// Batch corrections are processed in a delayed queue so it may take a few minutes before the changes are reflected in a user's photos.
        /// </remarks>
        /// <param name="latitude">The latitude of the photos to be update whose valid range is -90 to 90.
        /// Anything more than 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the photos to be updated 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 photos to be updated.
        /// 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="placeId">A Flickr Places ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        /// <param name="woeId">A Where On Earth (WOE) ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        public void PhotosGeoBatchCorrectLocation(double latitude, double longitude, GeoAccuracy accuracy, string placeId, string woeId)
        {
            CheckRequiresAuthentication();

            if (String.IsNullOrEmpty(placeId) && String.IsNullOrEmpty(woeId))
            {
                throw new ArgumentException("You must pass either a placeId or a woeId");
            }

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

            parameters.Add("method", "flickr.photos.geo.batchCorrectLocation");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("accuracy", accuracy.ToString("D"));
            parameters.Add("place_id", placeId);
            parameters.Add("woe_id", woeId);

            GetResponseNoCache <NoResponse>(parameters);
        }
Esempio n. 11
0
        /// <summary>
        /// Returns a place based on the input latitude and longitude.
        /// </summary>
        /// <param name="latitude">The latitude, between -180 and 180.</param>
        /// <param name="longitude">The longitude, between -90 and 90.</param>
        /// <param name="accuracy">The level the locality will be for.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PlacesFindByLatLonAsync(double latitude, double longitude, GeoAccuracy accuracy, Action<FlickrResult<Place>> callback)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.places.findByLatLon");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None) parameters.Add("accuracy", ((int)accuracy).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));

            GetResponseAsync<PlaceCollection>(
                parameters,
                r =>
                {
                    FlickrResult<Place> result = new FlickrResult<Place>();
                    result.Error = r.Error;
                    if (!r.HasError)
                    {
                        result.Result = r.Result[0];
                    }
                    callback(result);
                });
        }
Esempio n. 12
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);
        }
Esempio n. 13
0
 /// <summary>
 /// Constructor for the <see cref="BoundaryBox"/>.
 /// </summary>
 /// <param name="minimumLongitude">The minimum longitude of the boundary box. Range of -180 to 180 allowed.</param>
 /// <param name="minimumLatitude">The minimum latitude of the boundary box. Range of -90 to 90 allowed.</param>
 /// <param name="maximumLongitude">The maximum longitude of the boundary box. Range of -180 to 180 allowed.</param>
 /// <param name="maximumLatitude">The maximum latitude of the boundary box. Range of -90 to 90 allowed.</param>
 /// <param name="accuracy">The <see cref="GeoAccuracy"/> of the search parameter.</param>
 public BoundaryBox(double minimumLongitude, double minimumLatitude, double maximumLongitude, double maximumLatitude, GeoAccuracy accuracy)
     : this(minimumLongitude, minimumLatitude, maximumLongitude, maximumLatitude)
 {
     _accuracy = accuracy;
 }
Esempio n. 14
0
 /// <summary>
 /// Default constructor, specifying only the accuracy level.
 /// </summary>
 /// <param name="accuracy">The <see cref="GeoAccuracy"/> of the search parameter.</param>
 public BoundaryBox(GeoAccuracy accuracy)
 {
     _accuracy = accuracy;
 }
Esempio n. 15
0
        /// <summary>
        /// Sets the geo location for a photo.
        /// </summary>
        /// <param name="photoId">The ID of the photo to set to location for.</param>
        /// <param name="latitude">The latitude of the geo location. A double number ranging from -180.00 to 180.00. 
        /// Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the geo location. A double number ranging from -180.00 to 180.00. 
        /// Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="accuracy">The accuracy of the photos geo location.</param>
        /// <param name="context">The context of the geolocation data, i.e. Inside or Outside.</param>
        public void PhotosGeoSetLocation(string photoId, double latitude, double longitude, GeoAccuracy accuracy, GeoContext context)
        {
            var parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.photos.geo.setLocation");
            parameters.Add("photo_id", photoId);
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None)
                parameters.Add("accuracy", accuracy.ToString("D"));
            if (context != GeoContext.NotDefined)
                parameters.Add("context", context.ToString("D"));

            GetResponseNoCache<NoResponse>(parameters);
        }
Esempio n. 16
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>
        /// <returns></returns>
        public PhotoCollection PhotosGeoPhotosForLocation(double latitude, double longitude, GeoAccuracy accuracy,
                                                          PhotoSearchExtras extras, int perPage, int page)
        {
            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));

            return GetResponseNoCache<PhotoCollection>(parameters);
        }
Esempio n. 17
0
 /// <summary>
 /// Sets the geo location for a photo.
 /// </summary>
 /// <param name="photoId">The ID of the photo to set to location for.</param>
 /// <param name="latitude">The latitude of the geo location. A double number ranging from -180.00 to 180.00.
 /// Digits beyond 6 decimal places will be truncated.</param>
 /// <param name="longitude">The longitude of the geo location. A double number ranging from -180.00 to 180.00.
 /// Digits beyond 6 decimal places will be truncated.</param>
 /// <param name="accuracy">The accuracy for the geo location. Default is 16 - World.</param>
 public void PhotosGeoSetLocation(string photoId, double latitude, double longitude, GeoAccuracy accuracy)
 {
     PhotosGeoSetLocation(photoId, latitude, longitude, accuracy, GeoContext.NotDefined);
 }
 public PhotoCollection PhotosGeoPhotosForLocation(double lat, double lon, GeoAccuracy accuracy, int page)
 {
     return PhotosGeoPhotosForLocation(lat, lon, accuracy, PhotoSearchExtras.None, page, 0);
 }
 public PhotoCollection PhotosGeoPhotosForLocation(double lat, double lon, GeoAccuracy accuracy, PhotoSearchExtras extras, int page, int perPage)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.photos.geo.photosForLocation");
     dictionary.Add("lat", lat.ToString(NumberFormatInfo.InvariantInfo));
     dictionary.Add("lon", lon.ToString(NumberFormatInfo.InvariantInfo));
     if (accuracy != GeoAccuracy.None) dictionary.Add("accuracy", accuracy.ToString("d"));
     if (extras != PhotoSearchExtras.None) dictionary.Add("extras", UtilityMethods.ExtrasToString(extras));
     if (page != 0) dictionary.Add("page", page.ToString(CultureInfo.InvariantCulture));
     if (perPage != 0) dictionary.Add("perPage", perPage.ToString(CultureInfo.InvariantCulture));
     return GetResponse<PhotoCollection>(dictionary);
 }
 public void PhotosGeoBatchCorrectLocation(double latitude, double longitude, GeoAccuracy accuracy, string placeId, string woeId)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.photos.geo.batchCorrectLocation");
     dictionary.Add("latitude", latitude.ToString(NumberFormatInfo.InvariantInfo));
     dictionary.Add("longitude", longitude.ToString(NumberFormatInfo.InvariantInfo));
     if (accuracy != GeoAccuracy.None) dictionary.Add("accuracy", accuracy.ToString("d"));
     if (placeId != null) dictionary.Add("place_id", placeId);
     if (woeId != null) dictionary.Add("woe_id", woeId);
     GetResponse<NoResponse>(dictionary);
 }
Esempio n. 21
0
 public LatLong(double latitude, double longitude, GeoAccuracy geoAccuracy = GeoAccuracy.Unknown)
 {
     _latitude    = latitude;
     _longitude   = longitude;
     _geoAccuracy = geoAccuracy;
 }
        /// <summary>
        /// Suggest a particular location for a photo.
        /// </summary>
        /// <param name="photoId">The id of the photo.</param>
        /// <param name="latitude">The latitude of the location to suggest.</param>
        /// <param name="longitude">The longitude of the location to suggest.</param>
        /// <param name="accuracy">The accuracy of the location to suggest.</param>
        /// <param name="woeId">The WOE ID of the location to suggest.</param>
        /// <param name="placeId">The Flickr place id of the location to suggest.</param>
        /// <param name="note">A note to add to the suggestion.</param>
        public void PhotosSuggestionsSuggestLocation(string photoId, double latitude, double longitude, GeoAccuracy accuracy, string woeId, string placeId, string note)
        {
            CheckRequiresAuthentication();

            var parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.photos.suggestions.suggestLocation");
            parameters.Add("photo_id", photoId);
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("accuracy", accuracy.ToString("D"));
            parameters.Add("place_id", placeId);
            parameters.Add("woe_id", woeId);
            parameters.Add("note", note);

            GetResponseNoCache<NoResponse>(parameters);
        }
Esempio n. 23
0
        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader == null)
            {
                throw new ArgumentNullException("reader");
            }
            if (reader.LocalName != "suggestion")
            {
                UtilityMethods.CheckParsingException(reader); return;
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "id":
                    SuggestionId = reader.Value;
                    break;

                case "photo_id":
                    PhotoId = reader.Value;
                    break;

                case "date_suggested":
                    DateSuggested = UtilityMethods.UnixTimestampToDate(reader.Value);
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();

            while (reader.LocalName != "suggestion" && reader.NodeType != System.Xml.XmlNodeType.EndElement)
            {
                switch (reader.LocalName)
                {
                case "suggested_by":
                    SuggestedByUserId   = reader.GetAttribute("nsid");
                    SuggestedByUserName = reader.GetAttribute("username");
                    reader.Skip();
                    break;

                case "note":
                    Note = reader.ReadElementContentAsString();
                    break;

                case "location":
                    while (reader.MoveToNextAttribute())
                    {
                        switch (reader.LocalName)
                        {
                        case "woeid":
                            WoeId = reader.Value;
                            break;

                        case "latitude":
                            Latitude = reader.ReadContentAsDouble();
                            break;

                        case "longitude":
                            Longitude = reader.ReadContentAsDouble();
                            break;

                        case "accuracy":
                            Accuracy = (GeoAccuracy)reader.ReadContentAsInt();
                            break;

                        default:
                            UtilityMethods.CheckParsingException(reader);
                            break;
                        }
                    }
                    reader.Skip();
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }
        }
Esempio n. 24
0
        /// <summary>
        /// Sets the geo location for a photo.
        /// </summary>
        /// <param name="photoId">The ID of the photo to set to location for.</param>
        /// <param name="latitude">The latitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="accuracy">The accuracy of the photos geo location.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public async Task<FlickrResult<NoResponse>> PhotosGeoSetLocationAsync(string photoId, double latitude, double longitude, GeoAccuracy accuracy)
        {
            Dictionary<string, string> parameters = new Dictionary<string, string>();
            parameters.Add("method", "flickr.photos.geo.setLocation");
            parameters.Add("photo_id", photoId);
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None)
                parameters.Add("accuracy", accuracy.ToString("D"));

            return await GetResponseAsync<NoResponse>(parameters);
        }
Esempio n. 25
0
        /// <summary>
        /// Correct the places hierarchy for all the photos for a user at a given latitude, longitude and accuracy.
        /// </summary>
        /// <remarks>
        /// Batch corrections are processed in a delayed queue so it may take a few minutes before the changes are reflected in a user's photos.
        /// </remarks>
        /// <param name="latitude">The latitude of the photos to be update whose valid range is -90 to 90. Anything more than 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the photos to be updated 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 photos to be updated. 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="placeId">A Flickr Places ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        /// <param name="woeId">A Where On Earth (WOE) ID. (While optional, you must pass either a valid Places ID or a WOE ID.)</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public async Task <FlickrResult <NoResponse> > PhotosGeoBatchCorrectLocationAsync(double latitude, double longitude, GeoAccuracy accuracy, string placeId, string woeId)
        {
            CheckRequiresAuthentication();

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

            parameters.Add("method", "flickr.photos.geo.batchCorrectLocation");
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("accuracy", accuracy.ToString("D"));
            parameters.Add("place_id", placeId);
            parameters.Add("woe_id", woeId);

            return(await GetResponseAsync <NoResponse>(parameters));
        }
Esempio n. 26
0
 /// <summary>
 /// Constructor for the <see cref="BoundaryBox"/>.
 /// </summary>
 /// <param name="minimumLongitude">The minimum longitude of the boundary box. Range of -180 to 180 allowed.</param>
 /// <param name="minimumLatitude">The minimum latitude of the boundary box. Range of -90 to 90 allowed.</param>
 /// <param name="maximumLongitude">The maximum longitude of the boundary box. Range of -180 to 180 allowed.</param>
 /// <param name="maximumLatitude">The maximum latitude of the boundary box. Range of -90 to 90 allowed.</param>
 /// <param name="accuracy">The <see cref="GeoAccuracy"/> of the search parameter.</param>
 public BoundaryBox(double minimumLongitude, double minimumLatitude, double maximumLongitude, double maximumLatitude, GeoAccuracy accuracy)
     : this(minimumLongitude, minimumLatitude, maximumLongitude, maximumLatitude)
 {
     Accuracy = accuracy;
 }
 public void PhotosGeoSetLocation(string photoId, double lat, double lon, GeoAccuracy accuracy, GeoContext context)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.photos.geo.setLocation");
     dictionary.Add("photo_id", photoId);
     dictionary.Add("lat", lat.ToString(NumberFormatInfo.InvariantInfo));
     dictionary.Add("lon", lon.ToString(NumberFormatInfo.InvariantInfo));
     if (accuracy != GeoAccuracy.None) dictionary.Add("accuracy", accuracy.ToString("d"));
     if (context != GeoContext.NotDefined) dictionary.Add("context", context.ToString("d"));
     GetResponse<NoResponse>(dictionary);
 }
Esempio n. 28
0
        /// <summary>
        /// Sets the geo location for a photo.
        /// </summary>
        /// <param name="photoId">The ID of the photo to set to location for.</param>
        /// <param name="latitude">The latitude of the geo location. A double number ranging from -180.00 to 180.00.
        /// Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the geo location. A double number ranging from -180.00 to 180.00.
        /// Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="accuracy">The accuracy of the photos geo location.</param>
        /// <param name="context">The context of the geolocation data, i.e. Inside or Outside.</param>
        public void PhotosGeoSetLocation(string photoId, double latitude, double longitude, GeoAccuracy accuracy, GeoContext context)
        {
            Dictionary <string, string> parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.geo.setLocation");
            parameters.Add("photo_id", photoId);
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None)
            {
                parameters.Add("accuracy", accuracy.ToString("D"));
            }
            if (context != GeoContext.NotDefined)
            {
                parameters.Add("context", context.ToString("D"));
            }

            GetResponseNoCache <NoResponse>(parameters);
        }
 public void PhotosSuggestionsSuggestLocation(string photoId, double lat, double lon, GeoAccuracy accuracy, string woeId, string placeId, string note)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.photos.suggestions.suggestLocation");
     dictionary.Add("photo_id", photoId);
     dictionary.Add("lat", lat.ToString(NumberFormatInfo.InvariantInfo));
     dictionary.Add("lon", lon.ToString(NumberFormatInfo.InvariantInfo));
     if (accuracy != GeoAccuracy.None) dictionary.Add("accuracy", accuracy.ToString("d"));
     if (woeId != null) dictionary.Add("woe_id", woeId);
     if (placeId != null) dictionary.Add("place_id", placeId);
     if (note != null) dictionary.Add("note", note);
     GetResponse<NoResponse>(dictionary);
 }
 public Place PlacesFindByLatLon(double latitude, double longitude, GeoAccuracy accuracy);
Esempio n. 31
0
 public BoundaryBox(GeoAccuracy accuracy)
 {
     this.Accuracy = accuracy;
 }
Esempio n. 32
0
 /// <summary>
 /// Sets the geo location for a photo.
 /// </summary>
 /// <param name="photoId">The ID of the photo to set to location for.</param>
 /// <param name="latitude">The latitude of the geo location. A double number ranging from -180.00 to 180.00. 
 /// Digits beyond 6 decimal places will be truncated.</param>
 /// <param name="longitude">The longitude of the geo location. A double number ranging from -180.00 to 180.00. 
 /// Digits beyond 6 decimal places will be truncated.</param>
 /// <param name="accuracy">The accuracy for the geo location. Default is 16 - World.</param>
 public void PhotosGeoSetLocation(string photoId, double latitude, double longitude, GeoAccuracy accuracy)
 {
     PhotosGeoSetLocation(photoId, latitude, longitude, accuracy, GeoContext.NotDefined);
 }
 public void PhotosGeoSetLocation(string photoId, double latitude, double longitude, GeoAccuracy accuracy);
 public PhotoCollection PhotosGeoPhotosForLocation(double latitude, double longitude, GeoAccuracy accuracy,
                                                   PhotoSearchExtras extras, int perPage, int page);
 public void PushSubscribe(string topic, string callback, string verify, string verifyToken, int? leaseSeconds, IEnumerable<int> woeIds, IEnumerable<string> placeIds, double? lat, double? lon, int? radius, RadiusUnit radiusUnits, GeoAccuracy accuracy, IEnumerable<string> nsids, IEnumerable<string> tags)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.push.subscribe");
     dictionary.Add("topic", topic);
     dictionary.Add("callback", callback);
     dictionary.Add("verify", verify);
     if (verifyToken != null) dictionary.Add("verify_token", verifyToken);
     if (leaseSeconds != null) dictionary.Add("lease_seconds", leaseSeconds.ToString().ToLower());
     if (woeIds != null) dictionary.Add("woe_ids", woeIds == null ? String.Empty : String.Join(",", woeIds.Select(d => d.ToString(CultureInfo.InvariantCulture)).ToArray()));
     if (placeIds != null) dictionary.Add("place_ids", placeIds == null ? String.Empty : String.Join(",", placeIds.ToArray()));
     if (lat != null) dictionary.Add("lat", lat.ToString().ToLower());
     if (lon != null) dictionary.Add("lon", lon.ToString().ToLower());
     if (radius != null) dictionary.Add("radius", radius.ToString().ToLower());
     if (radiusUnits != RadiusUnit.None) dictionary.Add("radius_units", radiusUnits.ToString().ToLower());
     if (accuracy != GeoAccuracy.None) dictionary.Add("accuracy", accuracy.ToString("d"));
     if (nsids != null) dictionary.Add("nsids", nsids == null ? String.Empty : String.Join(",", nsids.ToArray()));
     if (tags != null) dictionary.Add("tags", tags == null ? String.Empty : String.Join(",", tags.ToArray()));
     GetResponse<NoResponse>(dictionary);
 }
Esempio n. 36
0
 /// <summary>
 /// Constructor for the <see cref="BoundaryBox"/>
 /// </summary>
 /// <param name="points">A comma seperated list of co-ordinates defining the boundary box.</param>
 /// <param name="accuracy">The <see cref="GeoAccuracy"/> of the search parameter.</param>
 public BoundaryBox(string points, GeoAccuracy accuracy)
     : this(points)
 {
     _accuracy = accuracy;
 }
Esempio n. 37
0
        /// <summary>
        /// Sets the geo location for a photo.
        /// </summary>
        /// <param name="photoId">The ID of the photo to set to location for.</param>
        /// <param name="latitude">The latitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="accuracy">The accuracy of the photos geo location.</param>
        public void PhotosGeoSetLocation(string photoId, double latitude, double longitude, GeoAccuracy accuracy)
        {
            System.Globalization.NumberFormatInfo nfi = System.Globalization.NumberFormatInfo.InvariantInfo;
            Hashtable parameters = new Hashtable();
            parameters.Add("method", "flickr.photos.geo.setLocation");
            parameters.Add("photo_id", photoId);
            parameters.Add("lat", latitude.ToString(nfi));
            parameters.Add("lon", longitude.ToString(nfi));
            if( accuracy != GeoAccuracy.None )
                parameters.Add("accuracy", ((int)accuracy).ToString());

            FlickrNet.Response response = GetResponseNoCache(parameters);
            if( response.Status == ResponseStatus.OK )
            {
                return;
            }
            else
            {
                throw new FlickrException(response.Error);
            }
        }
Esempio n. 38
0
        /// <summary>
        /// Sets the geo location for a photo.
        /// </summary>
        /// <param name="photoId">The ID of the photo to set to location for.</param>
        /// <param name="latitude">The latitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="longitude">The longitude of the geo location. A double number ranging from -180.00 to 180.00. Digits beyond 6 decimal places will be truncated.</param>
        /// <param name="accuracy">The accuracy of the photos geo location.</param>
        /// <param name="callback">Callback method to call upon return of the response from Flickr.</param>
        public void PhotosGeoSetLocationAsync(string photoId, double latitude, double longitude, GeoAccuracy accuracy, Action <FlickrResult <NoResponse> > callback)
        {
            var parameters = new Dictionary <string, string>();

            parameters.Add("method", "flickr.photos.geo.setLocation");
            parameters.Add("photo_id", photoId);
            parameters.Add("lat", latitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            parameters.Add("lon", longitude.ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
            if (accuracy != GeoAccuracy.None)
            {
                parameters.Add("accuracy", accuracy.ToString("D"));
            }

            GetResponseAsync <NoResponse>(parameters, callback);
        }
Esempio n. 39
0
 /// <summary>
 /// Default constructor, specifying only the accuracy level.
 /// </summary>
 /// <param name="accuracy">The <see cref="GeoAccuracy"/> of the search parameter.</param>
 public BoundaryBox(GeoAccuracy accuracy)
 {
     Accuracy = accuracy;
 }
 public void PhotosSuggestionsSuggestLocation(string photoId, double lat, double lon, GeoAccuracy accuracy, string woeId)
 {
     PhotosSuggestionsSuggestLocation(photoId, lat, lon, accuracy, woeId, null, null);
 }
Esempio n. 41
0
 /// <summary>
 /// Constructor for the <see cref="BoundaryBox"/>
 /// </summary>
 /// <param name="points">A comma seperated list of co-ordinates defining the boundary box.</param>
 /// <param name="accuracy">The <see cref="GeoAccuracy"/> of the search parameter.</param>
 public BoundaryBox(string points, GeoAccuracy accuracy)
     : this(points)
 {
     Accuracy = accuracy;
 }
 public PlaceCollection PlacesFindByLatLon(double lat, double lon, GeoAccuracy accuracy)
 {
     var dictionary = new Dictionary<string, string>();
     dictionary.Add("method", "flickr.places.findByLatLon");
     dictionary.Add("lat", lat.ToString(NumberFormatInfo.InvariantInfo));
     dictionary.Add("lon", lon.ToString(NumberFormatInfo.InvariantInfo));
     if (accuracy != GeoAccuracy.None) dictionary.Add("accuracy", accuracy.ToString("d"));
     return GetResponse<PlaceCollection>(dictionary);
 }
 public void PhotosGeoBatchCorrectLocation(double latitude, double longitude, GeoAccuracy accuracy,
                                           string placeId, string woeId);