Esempio n. 1
0
        /// <summary>
        /// Gets the desired information about the specified blog. This corresponds to the
        /// blogs.get Hyves method.
        /// </summary>
        /// <param name="blogIds">The requested blogIds.</param>
        /// <param name="responsefields">Get extra information from the blog.</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 blog; null if the call fails.</returns>
        public Collection <Blog> GetBlogs(Collection <string> blogIds, HyvesBlogResponsefield responsefields, bool useFancyLayout)
        {
            if (blogIds == null || blogIds.Count == 0)
            {
                throw new ArgumentException("blogIds");
            }

            StringBuilder blogIdBuilder = new StringBuilder();

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

            HyvesRequest request = new HyvesRequest(this.session);

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

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

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

            return(null);
        }
Esempio n. 2
0
        private string ConvertResponsefieldsToString(HyvesBlogResponsefield responsefields)
        {
            StringBuilder responsefieldsBuilder = new StringBuilder();

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

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

            return(returnValue.Substring(0, returnValue.Length - 1));
        }
Esempio n. 3
0
        /// <summary>
        /// Retrieves the most recent blogs for the friends of the loggedin user.
        /// This corresponds to the blogs.getForFriends Hyves method.
        /// </summary>
        /// <param name="responsefields">Get extra information from the blog.</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 blogs; null if the call fails.</returns>
        public Collection <Blog> GetBlogsForFriends(HyvesBlogResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
        {
            HyvesRequest request = new HyvesRequest(this.session);

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

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

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

            return(null);
        }
		/// <summary>
		/// Gets the desired information about the specified blog. This corresponds to the
		/// blogs.get Hyves method.
		/// </summary>
		/// <param name="blogId">The requested blogId.</param>
		/// <param name="responsefields">Get extra information from the blog.</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 blog; null if the call fails.</returns>
		public Blog GetBlog(string blogId, HyvesBlogResponsefield responsefields, bool useFancyLayout)
		{
			if (string.IsNullOrEmpty(blogId))
			{
				throw new ArgumentNullException("blogId");
			}

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

			HyvesResponse response = request.InvokeMethod(HyvesMethod.BlogsGet, useFancyLayout);
			if (response.Status == HyvesResponseStatus.Succeeded)
			{
        return response.ProcessSingleItemResponse<Blog>("blog");
			}

			return null;
		}
Esempio n. 5
0
        /// <summary>
        /// Gets the desired information about the specified blog. This corresponds to the
        /// blogs.get Hyves method.
        /// </summary>
        /// <param name="blogId">The requested blogId.</param>
        /// <param name="responsefields">Get extra information from the blog.</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 blog; null if the call fails.</returns>
        public Blog GetBlog(string blogId, HyvesBlogResponsefield responsefields, bool useFancyLayout)
        {
            if (string.IsNullOrEmpty(blogId))
            {
                throw new ArgumentNullException("blogId");
            }

            HyvesRequest request = new HyvesRequest(this.session);

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

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

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

            return(null);
        }
Esempio n. 6
0
        /// <summary>
        /// Gets the desired blogs from the specified hub. This corresponds to the
        /// blogs.getByHub Hyves method.
        /// </summary>
        /// <param name="hubId">The requested hub Id.</param>
        /// <param name="responsefields">Get extra information from the blog.</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 blog; null if the call fails.</returns>
        public Collection <Blog> GetBlogsByHub(string hubId, HyvesBlogResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
        {
            if (string.IsNullOrEmpty(hubId))
            {
                throw new ArgumentNullException("hubId");
            }

            HyvesRequest request = new HyvesRequest(this.session);

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

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

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

            return(null);
        }
Esempio n. 7
0
 /// <summary>
 /// Retrieves the most recent blogs for the friends of the loggedin user.
 /// This corresponds to the blogs.getForFriends Hyves method.
 /// </summary>
 /// <param name="responsefields">Get extra information from the blog.</param>
 /// <returns>The information about the blogs; null if the call fails.</returns>
 public Collection <Blog> GetBlogsForFriends(HyvesBlogResponsefield responsefields)
 {
     return(GetBlogsForFriends(responsefields, false, -1, -1));
 }
Esempio n. 8
0
 /// <summary>
 /// Gets the desired blogs from the specified user. This corresponds to the
 /// blogs.getByUser Hyves method.
 /// </summary>
 /// <param name="userId">The requested user Id.</param>
 /// <param name="responsefields">Get extra information from the blog.</param>
 /// <returns>The information about the specified blog; null if the call fails.</returns>
 public Collection <Blog> GetBlogsByUser(string userId, HyvesBlogResponsefield responsefields)
 {
     return(GetBlogsByUser(userId, responsefields, false, -1, -1));
 }
Esempio n. 9
0
 /// <summary>
 /// Gets the desired blogs from the specified user by tag. This corresponds to the
 /// blogs.getByTag Hyves method.
 /// </summary>
 /// <param name="tag">The requested tag.</param>
 /// <param name="responsefields">Get extra information from the blog.</param>
 /// <returns>The information about the specified blog; null if the call fails.</returns>
 public Collection <Blog> GetBlogsByTag(string tag, HyvesBlogResponsefield responsefields)
 {
     return(GetBlogsByTag(tag, responsefields, false, -1, -1));
 }
		/// <summary>
		/// Gets the desired blogs from the specified hub. This corresponds to the
		/// blogs.getByHub Hyves method.
		/// </summary>
		/// <param name="hubId">The requested hub Id.</param>
		/// <param name="responsefields">Get extra information from the blog.</param>
		/// <returns>The information about the specified blog; null if the call fails.</returns>
		public Collection<Blog> GetBlogsByHub(string hubId, HyvesBlogResponsefield responsefields)
		{
			return GetBlogsByHub(hubId, responsefields, false, -1, -1);
		}
Esempio n. 11
0
        /// <summary>
        /// Create a new blog for the current user. This corresponds to the
        /// blog.create Hyves method.
        /// </summary>
        /// <param name="title">The title of the blog.</param>
        /// <param name="body">The body of the blog.</param>
        /// <param name="visibility">The visibility of the blog.</param>
        /// <param name="latitude">Latitude of the geolocation.</param>
        /// <param name="longitude">Longitude of the geolocation. </param>
        /// <param name="hubIds">List of hubIds.</param>
        /// <param name="responsefields">Get extra information from the blog.</param>
        /// <returns>The new blog; null if the call fails.</returns>
        public Blog CreateBlog(string title, string body, HyvesVisibility visibility, float?latitude, float?longitude, Collection <string> hubIds, HyvesBlogResponsefield responsefields)
        {
            if (string.IsNullOrEmpty(title))
            {
                throw new ArgumentException("title");
            }

            if (string.IsNullOrEmpty(body))
            {
                throw new ArgumentException("body");
            }

            if (visibility == HyvesVisibility.Private)
            {
                throw new ArgumentOutOfRangeException("visibility");
            }

            StringBuilder hubIdBuilder = new StringBuilder();

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

                    hubIdBuilder.Append(id);
                }
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["title"]      = title;
            request.Parameters["body"]       = body;
            request.Parameters["visibility"] = EnumHelper.GetDescription(visibility);
            if (latitude.HasValue)
            {
                request.Parameters["latitude"] = latitude.Value.ToString("F");
            }

            if (longitude.HasValue)
            {
                request.Parameters["longitude"] = longitude.Value.ToString("F");
            }

            if (hubIdBuilder.Length > 0)
            {
                request.Parameters["hubid"] = hubIdBuilder.ToString();
            }

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

            HyvesResponse response = request.InvokeMethod(HyvesMethod.BlogsCreate);

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

            return(null);
        }
Esempio n. 12
0
        /// <summary>
        /// Retrieve public blogs. This corresponds to the blogs.getPublic Hyves method.
        /// </summary>
        /// <param name="sortType">The sort type.</param>
        /// <param name="timeSpan">The timespan to select from.</param>
        /// <returns>The information about the blogs; null if the call fails.</returns>
        public Collection <Blog> GetPublicBlogs(HyvesSortType sortType, HyvesTimeSpan timeSpan, HyvesBlogResponsefield responsefields, bool useFancyLayout)
        {
            if (sortType == HyvesSortType.NotSpecified)
            {
                throw new ArgumentOutOfRangeException("sortType");
            }

            if (timeSpan == HyvesTimeSpan.NotSpecified)
            {
                throw new ArgumentOutOfRangeException("timeSpan");
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["sorttype"]          = EnumHelper.GetDescription(sortType);
            request.Parameters["timespan"]          = EnumHelper.GetDescription(timeSpan);
            request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

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

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

            return(null);
        }
    /// <summary>
    /// Update a blog for the current user. This corresponds to the
    /// blog.update Hyves method.
    /// </summary>
    /// <param name="title">The title of the blog.</param>
    /// <param name="body">The body of the blog.</param>
    /// <param name="visibility">The visibility of the blog.</param>
    /// <param name="latitude">Latitude of the geolocation.</param>
    /// <param name="longitude">Longitude of the geolocation. </param>
    /// <param name="responsefields">Get extra information from the blog.</param>
    /// <returns>The new blog; null if the call fails.</returns>
    public Blog UpdateBlog(string blogId, string title, string body, HyvesVisibility visibility, float? latitude, float? longitude, HyvesBlogResponsefield responsefields)
    {
      if (string.IsNullOrEmpty(blogId))
      {
        throw new ArgumentException("blogId");
      }

      if (string.IsNullOrEmpty(title))
      {
        throw new ArgumentException("title");
      }

      if (string.IsNullOrEmpty(body))
      {
        throw new ArgumentException("body");
      }

      if (visibility == HyvesVisibility.Private)
      {
        throw new ArgumentOutOfRangeException("visibility");
      }

      HyvesRequest request = new HyvesRequest(this.session);
      request.Parameters["blogid"] = blogId;
      request.Parameters["title"] = title;
      request.Parameters["body"] = body;
      request.Parameters["visibility"] = EnumHelper.GetDescription(visibility);
      if (latitude.HasValue)
      {
        request.Parameters["latitude"] = latitude.Value.ToString("F");
      }

      if (longitude.HasValue)
      {
        request.Parameters["longitude"] = longitude.Value.ToString("F");
      }

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

      HyvesResponse response = request.InvokeMethod(HyvesMethod.BlogsUpdate);
      if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessSingleItemResponse<Blog>("blog");
      }

      return null;
    }
		/// <summary>
		/// Create a new blog for the current user. This corresponds to the
		/// blog.create Hyves method.
		/// </summary>
		/// <param name="title">The title of the blog.</param>
		/// <param name="body">The body of the blog.</param>
		/// <param name="visibility">The visibility of the blog.</param>
		/// <param name="responsefields">Get extra information from the blog.</param>
		/// <returns>The new blog; null if the call fails.</returns>
		public Blog CreateBlog(string title, string body, HyvesVisibility visibility, HyvesBlogResponsefield responsefields)
		{
      return CreateBlog(title, body, visibility, null, null, null, responsefields);
    }
    /// <summary>
    /// Create a new blog for the current user. This corresponds to the
    /// blog.create Hyves method.
    /// </summary>
    /// <param name="title">The title of the blog.</param>
    /// <param name="body">The body of the blog.</param>
    /// <param name="visibility">The visibility of the blog.</param>
    /// <param name="latitude">Latitude of the geolocation.</param>
    /// <param name="longitude">Longitude of the geolocation. </param>
    /// <param name="hubIds">List of hubIds.</param>
    /// <param name="responsefields">Get extra information from the blog.</param>
    /// <returns>The new blog; null if the call fails.</returns>
    public Blog CreateBlog(string title, string body, HyvesVisibility visibility, float? latitude, float? longitude, Collection<string> hubIds, HyvesBlogResponsefield responsefields)
    {
			if (string.IsNullOrEmpty(title))
			{
				throw new ArgumentException("title");
			}

			if (string.IsNullOrEmpty(body))
			{
				throw new ArgumentException("body");
			}

			if (visibility == HyvesVisibility.Private)
			{
				throw new ArgumentOutOfRangeException("visibility");
			}

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

          hubIdBuilder.Append(id);
        }
      }

			HyvesRequest request = new HyvesRequest(this.session);
			request.Parameters["title"] = title;
			request.Parameters["body"] = body;
      request.Parameters["visibility"] = EnumHelper.GetDescription(visibility);
      if (latitude.HasValue)
      {
        request.Parameters["latitude"] = latitude.Value.ToString("F");
      }

      if (longitude.HasValue)
      {
        request.Parameters["longitude"] = longitude.Value.ToString("F");
      }

      if (hubIdBuilder.Length > 0)
      {
        request.Parameters["hubid"] = hubIdBuilder.ToString();
      }

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

			HyvesResponse response = request.InvokeMethod(HyvesMethod.BlogsCreate);
			if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessSingleItemResponse<Blog>("blog");
			}

			return null;
		}
    /// <summary>
    /// Retrieve public blogs. This corresponds to the blogs.getPublic Hyves method.
    /// </summary>
    /// <param name="sortType">The sort type.</param>
    /// <param name="timeSpan">The timespan to select from.</param>
    /// <returns>The information about the blogs; null if the call fails.</returns>
    public Collection<Blog> GetPublicBlogs(HyvesSortType sortType, HyvesTimeSpan timeSpan, HyvesBlogResponsefield responsefields, bool useFancyLayout)
    {
      if (sortType == HyvesSortType.NotSpecified)
      {
        throw new ArgumentOutOfRangeException("sortType");
      }

      if (timeSpan == HyvesTimeSpan.NotSpecified)
      {
        throw new ArgumentOutOfRangeException("timeSpan");
      }

      HyvesRequest request = new HyvesRequest(this.session);
      request.Parameters["sorttype"] = EnumHelper.GetDescription(sortType);
      request.Parameters["timespan"] = EnumHelper.GetDescription(timeSpan);
      request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

      HyvesResponse response = request.InvokeMethod(HyvesMethod.BlogsGetForFriends, useFancyLayout);
      if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Blog>("blog");
      }

      return null;
    }
		/// <summary>
		/// Gets the desired information about the specified blog. This corresponds to the
		/// blogs.get Hyves method.
		/// </summary>
		/// <param name="blogId">The requested blogId.</param>
		/// <param name="responsefields">Get extra information from the blog.</param>
		/// <returns>The information about the specified blog; null if the call fails.</returns>
		public Blog GetBlog(string blogId, HyvesBlogResponsefield responsefields)
		{
			return GetBlog(blogId, responsefields, false);
		}
		/// <summary>
		/// Gets the desired blogs from the specified hub. This corresponds to the
		/// blogs.getByHub Hyves method.
		/// </summary>
		/// <param name="hubId">The requested hub Id.</param>
		/// <param name="responsefields">Get extra information from the blog.</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 blog; null if the call fails.</returns>
		public Collection<Blog> GetBlogsByHub(string hubId, HyvesBlogResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
		{
			if (string.IsNullOrEmpty(hubId))
			{
				throw new ArgumentNullException("hubId");
			}

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

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

			return null;
		}
		/// <summary>
		/// Gets the desired blogs from the specified user by tag. This corresponds to the
		/// blogs.getByTag Hyves method.
		/// </summary>
		/// <param name="tag">The requested tag.</param>
		/// <param name="responsefields">Get extra information from the blog.</param>
		/// <returns>The information about the specified blog; null if the call fails.</returns>
		public Collection<Blog> GetBlogsByTag(string tag, HyvesBlogResponsefield responsefields)
		{
			return GetBlogsByTag(tag, responsefields, false, -1, -1);
		}
		/// <summary>
		/// Retrieves the most recent blogs for the friends of the loggedin user. 
		/// This corresponds to the blogs.getForFriends Hyves method.
		/// </summary>
		/// <param name="responsefields">Get extra information from the blog.</param>
		/// <returns>The information about the blogs; null if the call fails.</returns>
		public Collection<Blog> GetBlogsForFriends(HyvesBlogResponsefield responsefields)
		{
			return GetBlogsForFriends(responsefields, false, -1, -1);
		}
Esempio n. 21
0
 /// <summary>
 /// Gets the desired blogs from the specified hub. This corresponds to the
 /// blogs.getByHub Hyves method.
 /// </summary>
 /// <param name="hubId">The requested hub Id.</param>
 /// <param name="responsefields">Get extra information from the blog.</param>
 /// <returns>The information about the specified blog; null if the call fails.</returns>
 public Collection <Blog> GetBlogsByHub(string hubId, HyvesBlogResponsefield responsefields)
 {
     return(GetBlogsByHub(hubId, responsefields, false, -1, -1));
 }
Esempio n. 22
0
        /// <summary>
        /// Update a blog for the current user. This corresponds to the
        /// blog.update Hyves method.
        /// </summary>
        /// <param name="title">The title of the blog.</param>
        /// <param name="body">The body of the blog.</param>
        /// <param name="visibility">The visibility of the blog.</param>
        /// <param name="latitude">Latitude of the geolocation.</param>
        /// <param name="longitude">Longitude of the geolocation. </param>
        /// <param name="responsefields">Get extra information from the blog.</param>
        /// <returns>The new blog; null if the call fails.</returns>
        public Blog UpdateBlog(string blogId, string title, string body, HyvesVisibility visibility, float?latitude, float?longitude, HyvesBlogResponsefield responsefields)
        {
            if (string.IsNullOrEmpty(blogId))
            {
                throw new ArgumentException("blogId");
            }

            if (string.IsNullOrEmpty(title))
            {
                throw new ArgumentException("title");
            }

            if (string.IsNullOrEmpty(body))
            {
                throw new ArgumentException("body");
            }

            if (visibility == HyvesVisibility.Private)
            {
                throw new ArgumentOutOfRangeException("visibility");
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["blogid"]     = blogId;
            request.Parameters["title"]      = title;
            request.Parameters["body"]       = body;
            request.Parameters["visibility"] = EnumHelper.GetDescription(visibility);
            if (latitude.HasValue)
            {
                request.Parameters["latitude"] = latitude.Value.ToString("F");
            }

            if (longitude.HasValue)
            {
                request.Parameters["longitude"] = longitude.Value.ToString("F");
            }

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

            HyvesResponse response = request.InvokeMethod(HyvesMethod.BlogsUpdate);

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

            return(null);
        }
Esempio n. 23
0
 /// <summary>
 /// Gets the desired information about the specified blog. This corresponds to the
 /// blogs.get Hyves method.
 /// </summary>
 /// <param name="blogId">The requested blogId.</param>
 /// <param name="responsefields">Get extra information from the blog.</param>
 /// <returns>The information about the specified blog; null if the call fails.</returns>
 public Blog GetBlog(string blogId, HyvesBlogResponsefield responsefields)
 {
     return(GetBlog(blogId, responsefields, false));
 }
		/// <summary>
		/// Gets the desired information about the specified blog. This corresponds to the
		/// blogs.get Hyves method.
		/// </summary>
		/// <param name="blogIds">The requested blogIds.</param>
		/// <param name="responsefields">Get extra information from the blog.</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 blog; null if the call fails.</returns>
		public Collection<Blog> GetBlogs(Collection<string> blogIds, HyvesBlogResponsefield responsefields, bool useFancyLayout)
		{
			if (blogIds == null || blogIds.Count == 0)
			{
				throw new ArgumentException("blogIds");
			}

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

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

			HyvesResponse response = request.InvokeMethod(HyvesMethod.BlogsGet, useFancyLayout);
			if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Blog>("blog");
			}

			return null;
		}
Esempio n. 25
0
 /// <summary>
 /// Create a new blog for the current user. This corresponds to the
 /// blog.create Hyves method.
 /// </summary>
 /// <param name="title">The title of the blog.</param>
 /// <param name="body">The body of the blog.</param>
 /// <param name="visibility">The visibility of the blog.</param>
 /// <param name="responsefields">Get extra information from the blog.</param>
 /// <returns>The new blog; null if the call fails.</returns>
 public Blog CreateBlog(string title, string body, HyvesVisibility visibility, HyvesBlogResponsefield responsefields)
 {
     return(CreateBlog(title, body, visibility, null, null, null, responsefields));
 }
		/// <summary>
		/// Gets the desired blogs from the specified user. This corresponds to the
		/// blogs.getByUser Hyves method.
		/// </summary>
		/// <param name="userId">The requested user Id.</param>
		/// <param name="responsefields">Get extra information from the blog.</param>
		/// <returns>The information about the specified blog; null if the call fails.</returns>
		public Collection<Blog> GetBlogsByUser(string userId, HyvesBlogResponsefield responsefields)
		{
			return GetBlogsByUser(userId, responsefields, false, -1, -1);
		}
    private string ConvertResponsefieldsToString(HyvesBlogResponsefield responsefields)
    {
      StringBuilder responsefieldsBuilder = new StringBuilder();
      if (responsefields == HyvesBlogResponsefield.All)
      {
        responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString<HyvesBlogResponsefield>());
      }
      else
      {
        var userResponsefields = Enum.GetValues(typeof(HyvesBlogResponsefield));
        foreach (HyvesBlogResponsefield responseField in userResponsefields)
        {
          if (EnumHelper.HasFlag(responsefields, responseField))
          {
            responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField)));
          }
        }
      }

      responsefieldsBuilder = responsefieldsBuilder.Replace(
        string.Format("{0},", EnumHelper.GetDescription(HyvesBlogResponsefield.All)), string.Empty);
      string returnValue = responsefieldsBuilder.ToString();
      return returnValue.Substring(0, returnValue.Length - 1);
    }
		/// <summary>
		/// Retrieves the most recent blogs for the friends of the loggedin user. 
		/// This corresponds to the blogs.getForFriends Hyves method.
		/// </summary>
		/// <param name="responsefields">Get extra information from the blog.</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 blogs; null if the call fails.</returns>
		public Collection<Blog> GetBlogsForFriends(HyvesBlogResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
		{
			HyvesRequest request = new HyvesRequest(this.session);
			request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

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

			return null;
		}
Esempio n. 29
0
 /// <summary>
 /// Gets the desired information about the specified blog. This corresponds to the
 /// blogs.get Hyves method.
 /// </summary>
 /// <param name="blogIds">The requested blogIds.</param>
 /// <param name="responsefields">Get extra information from the blog.</param>
 /// <returns>The information about the specified blog; null if the call fails.</returns>
 public Collection <Blog> GetBlogs(Collection <string> blogIds, HyvesBlogResponsefield responsefields)
 {
     return(GetBlogs(blogIds, responsefields, false));
 }
		/// <summary>
		/// Gets the desired information about the specified blog. This corresponds to the
		/// blogs.get Hyves method.
		/// </summary>
		/// <param name="blogIds">The requested blogIds.</param>
		/// <param name="responsefields">Get extra information from the blog.</param>
		/// <returns>The information about the specified blog; null if the call fails.</returns>
		public Collection<Blog> GetBlogs(Collection<string> blogIds, HyvesBlogResponsefield responsefields)
		{
			return GetBlogs(blogIds, responsefields, false);
		}