コード例 #1
0
        /// <summary>
        /// The get near by deals uri.
        /// </summary>
        /// <param name="coordinates">
        /// The coordinates.
        /// </param>
        /// <param name="radius">
        /// The radius.
        /// </param>
        /// <param name="count">
        /// The count.
        /// </param>
        /// <param name="refinements">
        /// The refinements.
        /// </param>
        /// <returns>
        /// The <see cref="Uri"/>.
        /// </returns>
        internal Uri GetNearByDealsUri(Coordinates coordinates, double?radius = null, int?count = null, Refinements refinements = null)
        {
            var queryString = new List <KeyValuePair <string, string> > {
                this.clientQueryParameter
            };

            if (coordinates != null)
            {
                queryString.Add(new KeyValuePair <string, string>(CoordKey, string.Format("{0},{1}", coordinates.Latitude, coordinates.Longitude)));
            }

            if (radius.HasValue)
            {
                queryString.Add(new KeyValuePair <string, string>(RadiusKey, radius.Value.ToString(CultureInfo.InvariantCulture)));
            }

            if (count.HasValue)
            {
                queryString.Add(new KeyValuePair <string, string>(CountKey, count.Value.ToString(CultureInfo.InvariantCulture)));
            }

            if (refinements != null)
            {
                queryString.Add(new KeyValuePair <string, string>(RefinementsKey, RefinementsQueryStringConstructor.ConstructString(refinements)));
            }

            return(this.BuildUrl(GetNearbyDealsMethod, queryString));
        }
コード例 #2
0
        /// <summary>
        /// The get deals by id.
        /// </summary>
        /// <param name="dealIds">
        /// The deal ids.
        /// </param>
        /// <param name="count">
        /// The count.
        /// </param>
        /// <param name="refinements">The refinements. <seealso cref="Refinements"/> </param>
        /// <param name="format">The format of the response: "simple", "all",...</param>
        /// <returns>
        /// The <see cref="Uri"/>.
        /// </returns>
        internal Uri GetDealsById(IList <Guid> dealIds, int?count = null, Refinements refinements = null, string format = "default")
        {
            var queryString = new List <KeyValuePair <string, string> > {
                this.clientQueryParameter
            };

            if (dealIds != null && dealIds.Any())
            {
                queryString.Add(new KeyValuePair <string, string>(DealIdsKey, string.Join(",", dealIds)));
            }

            if (count.HasValue)
            {
                queryString.Add(new KeyValuePair <string, string>(CountKey, count.Value.ToString(CultureInfo.InvariantCulture)));
            }

            if (refinements != null)
            {
                queryString.Add(new KeyValuePair <string, string>(RefinementsKey, RefinementsQueryStringConstructor.ConstructString(refinements)));
            }

            if (string.Compare(format, "default", StringComparison.CurrentCultureIgnoreCase) != 0)
            {
                queryString.Add(new KeyValuePair <string, string>(FormatKey, format));
            }

            return(this.BuildUrl(GetDealsByIdMethod, queryString));
        }
コード例 #3
0
        /// <summary>
        /// The get online deals uri.
        /// </summary>
        /// <param name="count">
        /// The count.
        /// </param>
        /// <param name="refinements">
        /// The refinements.
        /// </param>
        /// <returns>
        /// The <see cref="Uri"/>.
        /// </returns>
        internal Uri GetOnlineDealsUri(int?count = null, Refinements refinements = null)
        {
            var queryString = new List <KeyValuePair <string, string> > {
                this.clientQueryParameter
            };

            if (count.HasValue)
            {
                queryString.Add(new KeyValuePair <string, string>(CountKey, count.Value.ToString(CultureInfo.InvariantCulture)));
            }

            if (refinements != null)
            {
                queryString.Add(new KeyValuePair <string, string>(RefinementsKey, RefinementsQueryStringConstructor.ConstructString(refinements)));
            }

            return(this.BuildUrl(GetOnlineDealsMethod, queryString));
        }
コード例 #4
0
        /// <summary>
        /// The get deals by region uri.
        /// </summary>
        /// <param name="regionCode">
        /// The region code.
        /// </param>
        /// <param name="coordinates">
        /// The coordinates.
        /// </param>
        /// <param name="radius">
        /// The radius.
        /// </param>
        /// <param name="count">
        /// The count.
        /// </param>
        /// <param name="refinements">
        /// The refinements.
        /// </param>
        /// <param name="anid">
        /// Anid of the user
        /// </param>
        /// <returns>
        /// The <see cref="Uri"/>.
        /// </returns>
        internal Uri GetDealsByRegionUri(string regionCode, Coordinates coordinates, double?radius, int?count, Refinements refinements, string anid = null)
        {
            var queryString = new List <KeyValuePair <string, string> > {
                this.clientQueryParameter
            };

            if (coordinates != null)
            {
                queryString.Add(new KeyValuePair <string, string>(CoordKey, string.Format("{0},{1}", coordinates.Latitude, coordinates.Longitude)));
            }

            if (!string.IsNullOrEmpty(regionCode))
            {
                queryString.Add(new KeyValuePair <string, string>(RegionKey, regionCode));
            }

            if (!string.IsNullOrEmpty(anid))
            {
                queryString.Add(new KeyValuePair <string, string>(AnidKey, anid));
            }

            if (radius.HasValue)
            {
                queryString.Add(new KeyValuePair <string, string>(RadiusKey, radius.Value.ToString(CultureInfo.InvariantCulture)));
            }

            if (count.HasValue)
            {
                queryString.Add(new KeyValuePair <string, string>(CountKey, count.Value.ToString(CultureInfo.InvariantCulture)));
            }

            if (refinements != null)
            {
                queryString.Add(new KeyValuePair <string, string>(RefinementsKey, RefinementsQueryStringConstructor.ConstructString(refinements)));
            }

            return(this.BuildUrl(GetDealsByRegionMethod, queryString));
        }