Пример #1
0
        /// <summary>
        /// Gets the desired information about the specified ping. This corresponds to the
        /// pings.get Hyves method.
        /// </summary>
        /// <param name="pingIds">The requested pingIds.</param>
        /// <param name="responsefields">Get extra information from the ping.</param>
        /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
        /// <returns>The information about the specified ping; null if the call fails.</returns>
        public Collection <Ping> GetPings(Collection <string> pingIds, HyvesPingResponsefield responsefields, bool useFancyLayout)
        {
            if (pingIds == null || pingIds.Count == 0)
            {
                throw new ArgumentNullException("pingIds");
            }

            StringBuilder pingIdBuilder = new StringBuilder();

            if (pingIds != null)
            {
                foreach (string id in pingIds)
                {
                    if (pingIdBuilder.Length != 0)
                    {
                        pingIdBuilder.Append(",");
                    }
                    pingIdBuilder.Append(id);
                }
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["pingid"]            = pingIdBuilder.ToString();
            request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

            HyvesResponse response = request.InvokeMethod(HyvesMethod.PingsGet, useFancyLayout);

            if (response.Status == HyvesResponseStatus.Succeeded)
            {
                return(response.ProcessResponse <Ping>("ping"));
            }

            return(null);
        }
Пример #2
0
        private string ConvertResponsefieldsToString(HyvesPingResponsefield responsefields)
        {
            StringBuilder responsefieldsBuilder = new StringBuilder();

            if (responsefields == HyvesPingResponsefield.All)
            {
                responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString <HyvesPingResponsefield>());
            }
            else
            {
                var responsefieldsValues = Enum.GetValues(typeof(HyvesPingResponsefield));
                foreach (HyvesPingResponsefield responseField in responsefieldsValues)
                {
                    if (EnumHelper.HasFlag(responsefields, responseField))
                    {
                        responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField)));
                    }
                }
            }

            responsefieldsBuilder = responsefieldsBuilder.Replace(
                string.Format("{0},", EnumHelper.GetDescription(HyvesPingResponsefield.All)), string.Empty);
            string returnValue = responsefieldsBuilder.ToString();

            return(returnValue.Substring(0, returnValue.Length - 1));
        }
		/// <summary>
		/// Gets the desired information about the specified ping. This corresponds to the
		/// pings.get Hyves method.
		/// </summary>
		/// <param name="pingId">The requested pingId.</param>
		/// <param name="responsefields">Get extra information from the ping.</param>
		/// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
		/// <returns>The information about the specified ping; null if the call fails.</returns>
		public Ping GetPing(string pingId, HyvesPingResponsefield responsefields, bool useFancyLayout)
		{
			if (string.IsNullOrEmpty(pingId))
			{
				throw new ArgumentNullException("pingId");
			}

			HyvesRequest request = new HyvesRequest(this.session);
			request.Parameters["pingid"] = pingId;
			request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

			HyvesResponse response = request.InvokeMethod(HyvesMethod.PingsGet, useFancyLayout);
			if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessSingleItemResponse<Ping>("ping");
			}

			return null;
		}
Пример #4
0
        /// <summary>
        /// Gets the desired information about the specified ping. This corresponds to the
        /// pings.get Hyves method.
        /// </summary>
        /// <param name="pingId">The requested pingId.</param>
        /// <param name="responsefields">Get extra information from the ping.</param>
        /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
        /// <returns>The information about the specified ping; null if the call fails.</returns>
        public Ping GetPing(string pingId, HyvesPingResponsefield responsefields, bool useFancyLayout)
        {
            if (string.IsNullOrEmpty(pingId))
            {
                throw new ArgumentNullException("pingId");
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["pingid"]            = pingId;
            request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

            HyvesResponse response = request.InvokeMethod(HyvesMethod.PingsGet, useFancyLayout);

            if (response.Status == HyvesResponseStatus.Succeeded)
            {
                return(response.ProcessSingleItemResponse <Ping>("ping"));
            }

            return(null);
        }
Пример #5
0
        /// <summary>
        /// Gets the desired pings from the specified user. This corresponds to the
        /// pings.getByUser Hyves method.
        /// </summary>
        /// <param name="userId">The requested user Id.</param>
        /// <param name="responsefields">Get extra information from the ping.</param>
        /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
        /// <returns>The information about the specified ping; null if the call fails.</returns>
        public Collection <Ping> GetPingsByUser(string userId, HyvesPingResponsefield responsefields, bool useFancyLayout)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException("userId cannot be null or empty.", "userId");
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["userid"]            = userId;
            request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

            HyvesResponse response = request.InvokeMethod(HyvesMethod.PingsGetByUser, useFancyLayout);

            if (response.Status == HyvesResponseStatus.Succeeded)
            {
                return(response.ProcessResponse <Ping>("ping"));
            }

            return(null);
        }
Пример #6
0
 /// <summary>
 /// Gets the desired information about the specified ping. This corresponds to the
 /// pings.get Hyves method.
 /// </summary>
 /// <param name="pingId">The requested pingId.</param>
 /// <param name="responsefields">Get extra information from the ping.</param>
 /// <returns>The information about the specified ping; null if the call fails.</returns>
 public Ping GetPing(string pingId, HyvesPingResponsefield responsefields)
 {
     return(GetPing(pingId, responsefields, false));
 }
Пример #7
0
 /// <summary>
 /// Gets the desired pings from the specified user. This corresponds to the
 /// pings.getByUser Hyves method.
 /// </summary>
 /// <param name="userId">The requested user Id.</param>
 /// <param name="responsefields">Get extra information from the ping.</param>
 /// <returns>The information about the specified ping; null if the call fails.</returns>
 public Collection <Ping> GetPingsByUser(string userId, HyvesPingResponsefield responsefields)
 {
     return(GetPingsByUser(userId, responsefields, false));
 }
Пример #8
0
 /// <summary>
 /// Gets the desired information about the specified ping. This corresponds to the
 /// pings.get Hyves method.
 /// </summary>
 /// <param name="pingIds">The requested pingIds.</param>
 /// <param name="responsefields">Get extra information from the ping.</param>
 /// <returns>The information about the specified ping; null if the call fails.</returns>
 public Collection <Ping> GetPings(Collection <string> pingIds, HyvesPingResponsefield responsefields)
 {
     return(GetPings(pingIds, responsefields, false));
 }
		/// <summary>
		/// Gets the desired information about the specified ping. This corresponds to the
		/// pings.get Hyves method.
		/// </summary>
		/// <param name="pingId">The requested pingId.</param>
		/// <param name="responsefields">Get extra information from the ping.</param>
		/// <returns>The information about the specified ping; null if the call fails.</returns>
		public Ping GetPing(string pingId, HyvesPingResponsefield responsefields)
		{
			return GetPing(pingId, responsefields, false);
		}
		private string ConvertResponsefieldsToString(HyvesPingResponsefield responsefields)
    {
      StringBuilder responsefieldsBuilder = new StringBuilder();
      if (responsefields == HyvesPingResponsefield.All)
      {
        responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString<HyvesPingResponsefield>());
      }
      else
      {
        var responsefieldsValues = Enum.GetValues(typeof(HyvesPingResponsefield));
        foreach (HyvesPingResponsefield responseField in responsefieldsValues)
        {
          if (EnumHelper.HasFlag(responsefields, responseField))
          {
            responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField)));
          }
        }
      }

      responsefieldsBuilder = responsefieldsBuilder.Replace(
        string.Format("{0},", EnumHelper.GetDescription(HyvesPingResponsefield.All)), string.Empty);
      string returnValue = responsefieldsBuilder.ToString();
      return returnValue.Substring(0, returnValue.Length - 1);
		}
		/// <summary>
		/// Gets the desired pings from the specified user. This corresponds to the
		/// pings.getByUser Hyves method.
		/// </summary>
		/// <param name="userId">The requested user Id.</param>
		/// <param name="responsefields">Get extra information from the ping.</param>
		/// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
		/// <returns>The information about the specified ping; null if the call fails.</returns>
		public Collection<Ping> GetPingsByUser(string userId, HyvesPingResponsefield responsefields, bool useFancyLayout)
		{
			if (string.IsNullOrEmpty(userId))
			{
        throw new ArgumentException("userId cannot be null or empty.", "userId");
			}

			HyvesRequest request = new HyvesRequest(this.session);
			request.Parameters["userid"] = userId;
			request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

			HyvesResponse response = request.InvokeMethod(HyvesMethod.PingsGetByUser, useFancyLayout);
			if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Ping>("ping");
			}

			return null;
		}
		/// <summary>
		/// Gets the desired pings from the specified user. This corresponds to the
		/// pings.getByUser Hyves method.
		/// </summary>
		/// <param name="userId">The requested user Id.</param>
		/// <param name="responsefields">Get extra information from the ping.</param>
		/// <returns>The information about the specified ping; null if the call fails.</returns>
		public Collection<Ping> GetPingsByUser(string userId, HyvesPingResponsefield responsefields)
		{
			return GetPingsByUser(userId, responsefields, false);
		}
		/// <summary>
		/// Gets the desired information about the specified ping. This corresponds to the
		/// pings.get Hyves method.
		/// </summary>
		/// <param name="pingIds">The requested pingIds.</param>
		/// <param name="responsefields">Get extra information from the ping.</param>
		/// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
		/// <returns>The information about the specified ping; null if the call fails.</returns>
		public Collection<Ping> GetPings(Collection<string> pingIds, HyvesPingResponsefield responsefields, bool useFancyLayout)
		{
			if (pingIds == null || pingIds.Count == 0)
			{
				throw new ArgumentNullException("pingIds");
			}

			StringBuilder pingIdBuilder = new StringBuilder();
			if (pingIds != null)
			{
				foreach (string id in pingIds)
				{
					if (pingIdBuilder.Length != 0)
					{
						pingIdBuilder.Append(",");
					}
					pingIdBuilder.Append(id);
				}
			}

			HyvesRequest request = new HyvesRequest(this.session);
			request.Parameters["pingid"] = pingIdBuilder.ToString();
			request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

			HyvesResponse response = request.InvokeMethod(HyvesMethod.PingsGet, useFancyLayout);
			if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Ping>("ping");
			}

			return null;
		}
		/// <summary>
		/// Gets the desired information about the specified ping. This corresponds to the
		/// pings.get Hyves method.
		/// </summary>
		/// <param name="pingIds">The requested pingIds.</param>
		/// <param name="responsefields">Get extra information from the ping.</param>
		/// <returns>The information about the specified ping; null if the call fails.</returns>
		public Collection<Ping> GetPings(Collection<string> pingIds, HyvesPingResponsefield responsefields)
		{
			return GetPings(pingIds, responsefields, false);
		}