/// <summary>
		/// Gets the desired media. This corresponds to the media.get Hyves method.
		/// </summary>
		/// <param name="mediaIds">The list of requested media IDs.</param>
		/// <param name="responsefields">Get extra information from the media.</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 desired media; null if the call fails.</returns>
		public Collection<Media> GetMedia(Collection<string> mediaIds, HyvesMediaResponsefield responsefields, bool useFancyLayout)
		{
			if (mediaIds == null || mediaIds.Count == 0)
			{
				throw new ArgumentNullException("mediaIds");
			}
			
			StringBuilder mediaIdBuilder = new StringBuilder();
			if (mediaIds != null)
			{
				foreach (string id in mediaIds)
				{
					if (mediaIdBuilder.Length != 0)
					{
						mediaIdBuilder.Append(",");
					}
					mediaIdBuilder.Append(id);
				}
			}

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

			HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGet, useFancyLayout);
			if (response.Status == HyvesResponseStatus.Succeeded)
			{
        return response.ProcessResponse<Media>("media");
			}

			return null;
		}
Пример #2
0
        /// <summary>
        /// Gets the desired media. This corresponds to the media.get Hyves method.
        /// </summary>
        /// <param name="mediaIds">The list of requested media IDs.</param>
        /// <param name="responsefields">Get extra information from the media.</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 desired media; null if the call fails.</returns>
        public Collection <Media> GetMedia(Collection <string> mediaIds, HyvesMediaResponsefield responsefields, bool useFancyLayout)
        {
            if (mediaIds == null || mediaIds.Count == 0)
            {
                throw new ArgumentNullException("mediaIds");
            }

            StringBuilder mediaIdBuilder = new StringBuilder();

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

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["mediaid"]           = mediaIdBuilder.ToString();
            request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

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

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

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

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

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

            return(returnValue.Substring(0, returnValue.Length - 1));
        }
Пример #4
0
        /// <summary>
        /// Gets the desired media from the loggedin user. This corresponds to the media.getByLoggedin Hyves method.
        /// </summary>
        /// <param name="responsefields">Get extra information from the media.</param>
        /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
        /// <param name="page">The requested page.</param>
        /// <param name="resultsPerPage">The number of results per page.</param>
        /// <returns>The information about the desired media; null if the call fails.</returns>
        public Collection <Media> GetMediaByLoggedin(HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
        {
            HyvesRequest request = new HyvesRequest(this.session);

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

            HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetByLoggedin, useFancyLayout, page, resultsPerPage);

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

            return(null);
        }
Пример #5
0
        /// <summary>
        /// Gets the spotted users of a media. This corresponds to the
        /// media.getSpotted Hyves method.
        /// </summary>
        /// <param name="responsefields">Get extra information from the media.</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 spotted users; null if the call fails.</returns>
        public Collection <Spotted> GetSpotted(string mediaId, HyvesMediaResponsefield responsefields, bool useFancyLayout)
        {
            if (string.IsNullOrEmpty(mediaId))
            {
                throw new ArgumentException("mediaId");
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["mediaid"] = mediaId;

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

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

            return(null);
        }
Пример #6
0
        /// <summary>
        /// Gets the desired media from the specified user by tag. This corresponds to the
        /// media.getByTag Hyves method.
        /// </summary>
        /// <param name="userId">The requested user Id.</param>
        /// <param name="responsefields">Get extra information from the media.</param>
        /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
        /// <param name="page">The requested page.</param>
        /// <param name="resultsPerPage">The number of results per page.</param>
        /// <returns>The information about the specified media; null if the call fails.</returns>
        public Collection <Media> GetMediaByTag(string tag, HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
        {
            if (string.IsNullOrEmpty(tag))
            {
                throw new ArgumentNullException("tag");
            }

            HyvesRequest request = new HyvesRequest(this.session);

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

            HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetByTag, useFancyLayout, page, resultsPerPage);

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

            return(null);
        }
		/// <summary>
		/// Gets the desired media. This corresponds to the media.get Hyves method.
		/// </summary>
		/// <param name="mediaIds">The list of requested media IDs.</param>
		/// <param name="responsefields">Get extra information from the media.</param>
		/// <returns>The information about the desired media; null if the call fails.</returns>
    public Collection<Media> GetMedia(Collection<string> mediaIds, HyvesMediaResponsefield responsefields)
		{
			return GetMedia(mediaIds, responsefields, false);
		}
    /// <summary>
    /// Gets the spotted users of a media. This corresponds to the
    /// media.getSpotted Hyves method.
    /// </summary>
    /// <param name="responsefields">Get extra information from the media.</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 spotted users; null if the call fails.</returns>
    public Collection<Spotted> GetSpotted(string mediaId, HyvesMediaResponsefield responsefields, bool useFancyLayout)
    {
      if (string.IsNullOrEmpty(mediaId))
      {
        throw new ArgumentException("mediaId");
      }

      HyvesRequest request = new HyvesRequest(this.session);
      request.Parameters["mediaid"] = mediaId;

      HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetSpotted, useFancyLayout);
      if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Spotted>("spotted");
      }

      return null;
    }
    /// <summary>
    /// Gets the public media for the loggedin user. This corresponds to the
    /// media.getPublic Hyves method.
    /// </summary>
    /// <param name="sortType">The sorttype</param>
    /// <param name="mediaType">The media type of the results.</param>
    /// <param name="timeSpan">The timespan to select from.</param>
    /// <param name="responsefields">Get extra information from the media.</param>
    /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
    /// <param name="page">The requested page.</param>
    /// <param name="resultsPerPage">The number of results per page.</param>
    /// <returns>The information about the specified media; null if the call fails.</returns>
    public Collection<Media> GetPublic(HyvesSortType sortType, HyvesMediaType mediaType, HyvesTimeSpan timeSpan, HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
    {
      if (sortType == HyvesSortType.NotSpecified)
      {
        throw new ArgumentOutOfRangeException("sortType");
      }

      if (mediaType == HyvesMediaType.Unknown)
      {
        throw new ArgumentOutOfRangeException("mediaType");
      }
            
      HyvesRequest request = new HyvesRequest(this.session);
      request.Parameters["sorttype"] = EnumHelper.GetDescription(sortType);
      request.Parameters["mediatype"] = EnumHelper.GetDescription(mediaType);
      if (timeSpan == HyvesTimeSpan.NotSpecified)
      {
        request.Parameters["timespan"] = EnumHelper.GetDescription(timeSpan);
      }

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

      HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetPublic, useFancyLayout, page, resultsPerPage);
      if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Media>("media");
      }

      return null;
    }
		/// <summary>
		/// Gets the desired media from the specified user by tag. This corresponds to the
		/// media.getByTag Hyves method.
		/// </summary>
		/// <param name="userId">The requested user Id.</param>
		/// <param name="responsefields">Get extra information from the media.</param>
		/// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
    /// <param name="page">The requested page.</param>
    /// <param name="resultsPerPage">The number of results per page.</param>
		/// <returns>The information about the specified media; null if the call fails.</returns>
    public Collection<Media> GetMediaByTag(string tag, HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
		{
			if (string.IsNullOrEmpty(tag))
			{
				throw new ArgumentNullException("tag");
			}

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

			HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetByTag, useFancyLayout, page, resultsPerPage);
			if (response.Status == HyvesResponseStatus.Succeeded)
			{
        return response.ProcessResponse<Media>("media");
			}

			return null;
		}
		/// <summary>
		/// Gets the desired media from the specified user by tag. This corresponds to the
		/// media.getByTag Hyves method.
		/// </summary>
		/// <param name="tag">The requested tag.</param>
		/// <param name="responsefields">Get extra information from the media.</param>
		/// <returns>The information about the specified media; null if the call fails.</returns>
		public Collection<Media> GetMediaByTag(string tag, HyvesMediaResponsefield responsefields)
		{
			return GetMediaByTag(tag, responsefields, false, 1, 100);
		}
		/// <summary>
		/// Gets the desired media from an album. This corresponds to the media.getByAlbum Hyves method.
		/// </summary>
		/// <param name="albumId">The requested album ID.</param>
		/// <param name="responsefields">Get extra information from the media.</param>
		/// <returns>The information about the desired media; null if the call fails.</returns>
		public Collection<Media> GetMediaByAlbum(string albumId, HyvesMediaResponsefield responsefields)
		{
			return GetMediaByAlbum(albumId, responsefields, false, 1, 100);
		}
Пример #13
0
 /// <summary>
 /// Gets the desired media. This corresponds to the media.get Hyves method.
 /// </summary>
 /// <param name="mediaIds">The list of requested media IDs.</param>
 /// <param name="responsefields">Get extra information from the media.</param>
 /// <returns>The information about the desired media; null if the call fails.</returns>
 public Collection <Media> GetMedia(Collection <string> mediaIds, HyvesMediaResponsefield responsefields)
 {
     return(GetMedia(mediaIds, responsefields, false));
 }
Пример #14
0
        /// <summary>
        /// Gets the public media for the loggedin user. This corresponds to the
        /// media.getPublic Hyves method.
        /// </summary>
        /// <param name="sortType">The sorttype</param>
        /// <param name="mediaType">The media type of the results.</param>
        /// <param name="timeSpan">The timespan to select from.</param>
        /// <param name="responsefields">Get extra information from the media.</param>
        /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
        /// <param name="page">The requested page.</param>
        /// <param name="resultsPerPage">The number of results per page.</param>
        /// <returns>The information about the specified media; null if the call fails.</returns>
        public Collection <Media> GetPublic(HyvesSortType sortType, HyvesMediaType mediaType, HyvesTimeSpan timeSpan, HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
        {
            if (sortType == HyvesSortType.NotSpecified)
            {
                throw new ArgumentOutOfRangeException("sortType");
            }

            if (mediaType == HyvesMediaType.Unknown)
            {
                throw new ArgumentOutOfRangeException("mediaType");
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["sorttype"]  = EnumHelper.GetDescription(sortType);
            request.Parameters["mediatype"] = EnumHelper.GetDescription(mediaType);
            if (timeSpan == HyvesTimeSpan.NotSpecified)
            {
                request.Parameters["timespan"] = EnumHelper.GetDescription(timeSpan);
            }

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

            HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetPublic, useFancyLayout, page, resultsPerPage);

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

            return(null);
        }
Пример #15
0
 /// <summary>
 /// Gets the desired media from the specified user by tag. This corresponds to the
 /// media.getByTag Hyves method.
 /// </summary>
 /// <param name="tag">The requested tag.</param>
 /// <param name="responsefields">Get extra information from the media.</param>
 /// <returns>The information about the specified media; null if the call fails.</returns>
 public Collection <Media> GetMediaByTag(string tag, HyvesMediaResponsefield responsefields)
 {
     return(GetMediaByTag(tag, responsefields, false, 1, 100));
 }
    private string ConvertResponsefieldsToString(HyvesMediaResponsefield responsefields)
    {
      StringBuilder responsefieldsBuilder = new StringBuilder();
      if (responsefields == HyvesMediaResponsefield.All)
      {
        responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString<HyvesMediaResponsefield>());
      }
      else
      {
        var userResponsefields = Enum.GetValues(typeof(HyvesMediaResponsefield));
        foreach (HyvesMediaResponsefield responseField in userResponsefields)
        {
          if (EnumHelper.HasFlag(responsefields, responseField))
          {
            responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField)));
          }
        }
      }

      responsefieldsBuilder = responsefieldsBuilder.Replace(
        string.Format("{0},", EnumHelper.GetDescription(HyvesMediaResponsefield.All)), string.Empty);
      string returnValue = responsefieldsBuilder.ToString();
      return returnValue.Substring(0, returnValue.Length - 1);
		}    
    /// <summary>
    /// Gets the desired media from the loggedin user. This corresponds to the media.getByLoggedin Hyves method.
    /// </summary>
    /// <param name="responsefields">Get extra information from the media.</param>
    /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
    /// <param name="page">The requested page.</param>
    /// <param name="resultsPerPage">The number of results per page.</param>
    /// <returns>The information about the desired media; null if the call fails.</returns>
    public Collection<Media> GetMediaByLoggedin(HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
    {
      HyvesRequest request = new HyvesRequest(this.session);
      request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

      HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetByLoggedin, useFancyLayout, page, resultsPerPage);
      if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Media>("media");
      }

      return null;
    }
Пример #18
0
 /// <summary>
 /// Gets the desired media from an album. This corresponds to the media.getByAlbum Hyves method.
 /// </summary>
 /// <param name="albumId">The requested album ID.</param>
 /// <param name="responsefields">Get extra information from the media.</param>
 /// <returns>The information about the desired media; null if the call fails.</returns>
 public Collection <Media> GetMediaByAlbum(string albumId, HyvesMediaResponsefield responsefields)
 {
     return(GetMediaByAlbum(albumId, responsefields, false, 1, 100));
 }