/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipIds">The requested tipIds.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Collection <Tip> GetTips(Collection <string> tipIds, HyvesTipResponsefield responsefields, bool useFancyLayout) { if (tipIds == null || tipIds.Count == 0) { throw new ArgumentNullException("tipIds"); } StringBuilder tipIdBuilder = new StringBuilder(); if (tipIds != null) { foreach (string id in tipIds) { if (tipIdBuilder.Length != 0) { tipIdBuilder.Append(","); } tipIdBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["tipid"] = tipIdBuilder.ToString(); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessResponse <Tip>("tip")); } return(null); }
/// <summary> /// Gets the desired tips from the specified user by user. This corresponds to the /// tips.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</param> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Collection <Tip> GetTipsByUser(string userId, string tipCategoryId, HyvesTipResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentException("userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["userid"] = userId; if (string.IsNullOrEmpty(tipCategoryId) == false) { request.Parameters["tipcategoryid"] = tipCategoryId; } request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGetByUser, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessResponse <Tip>("tip")); } return(null); }
private string ConvertResponsefieldsToString(HyvesTipResponsefield responsefields) { StringBuilder responsefieldsBuilder = new StringBuilder(); if (responsefields == HyvesTipResponsefield.All) { responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString <HyvesTipResponsefield>()); } else { var userResponsefields = Enum.GetValues(typeof(HyvesTipResponsefield)); foreach (HyvesTipResponsefield responseField in userResponsefields) { if (EnumHelper.HasFlag(responsefields, responseField)) { responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField))); } } } responsefieldsBuilder = responsefieldsBuilder.Replace( string.Format("{0},", EnumHelper.GetDescription(HyvesTipResponsefield.All)), string.Empty); string returnValue = responsefieldsBuilder.ToString(); return(returnValue.Substring(0, returnValue.Length - 1)); }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</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 tips; null if the call fails.</returns> public Collection <Tip> GetTipsForFriends(string tipCategoryId, HyvesTipResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage) { HyvesRequest request = new HyvesRequest(this.session); if (string.IsNullOrEmpty(tipCategoryId)) { request.Parameters["tipcategoryid"] = tipCategoryId; } request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGetForFriends, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessResponse <Tip>("tip")); } return(null); }
/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipId">The requested tipId.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Tip GetTip(string tipId, HyvesTipResponsefield responsefields, bool useFancyLayout) { if (string.IsNullOrEmpty(tipId)) { throw new ArgumentNullException("tipId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["tipid"] = tipId; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessSingleItemResponse<Tip>("tip"); } return null; }
/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipId">The requested tipId.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Tip GetTip(string tipId, HyvesTipResponsefield responsefields, bool useFancyLayout) { if (string.IsNullOrEmpty(tipId)) { throw new ArgumentNullException("tipId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["tipid"] = tipId; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessSingleItemResponse <Tip>("tip")); } return(null); }
/// <summary> /// Gets the desired tips from the specified user by user. This corresponds to the /// tips.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</param> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Collection<Tip> GetTipsByUser(string userId, string tipCategoryId, HyvesTipResponsefield responsefields) { return GetTipsByUser(userId, tipCategoryId, responsefields, false, -1, -1); }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the tips; null if the call fails.</returns> public Collection <Tip> GetTipsForFriends(string tipCategoryId, HyvesTipResponsefield responsefields) { return(GetTipsForFriends(tipCategoryId, responsefields, false, -1, -1)); }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="responsefields">Get extra information from the tip.</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 tips; null if the call fails.</returns> public Collection <Tip> GetTipsForFriends(HyvesTipResponsefield responsefields, bool useFancyLayout) { return(GetTipsForFriends(string.Empty, responsefields, useFancyLayout, -1, -1)); }
/// <summary> /// Gets the desired tips from the specified user by user. This corresponds to the /// tips.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Collection<Tip> GetTipsByUser(string userId, HyvesTipResponsefield responsefields, bool useFancyLayout) { return GetTipsByUser(userId, string.Empty, responsefields, useFancyLayout, -1, -1); }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the tips; null if the call fails.</returns> public Collection <Tip> GetTipsForFriends(HyvesTipResponsefield responsefields) { return(GetTipsForFriends(string.Empty, responsefields, false, -1, -1)); }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</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 tips; null if the call fails.</returns> public Collection<Tip> GetTipsForFriends(string tipCategoryId, HyvesTipResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage) { HyvesRequest request = new HyvesRequest(this.session); if (string.IsNullOrEmpty(tipCategoryId)) { request.Parameters["tipcategoryid"] = tipCategoryId; } request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGetForFriends, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Tip>("tip"); } return null; }
/// <summary> /// Gets the desired tips from the specified user by user. This corresponds to the /// tips.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Collection <Tip> GetTipsByUser(string userId, HyvesTipResponsefield responsefields, bool useFancyLayout) { return(GetTipsByUser(userId, string.Empty, responsefields, useFancyLayout, -1, -1)); }
/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipIds">The requested tipIds.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Collection<Tip> GetTips(Collection<string> tipIds, HyvesTipResponsefield responsefields, bool useFancyLayout) { if (tipIds == null || tipIds.Count == 0) { throw new ArgumentNullException("tipIds"); } StringBuilder tipIdBuilder = new StringBuilder(); if (tipIds != null) { foreach (string id in tipIds) { if (tipIdBuilder.Length != 0) { tipIdBuilder.Append(","); } tipIdBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["tipid"] = tipIdBuilder.ToString(); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Tip>("tip"); } return null; }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the tips; null if the call fails.</returns> public Collection<Tip> GetTipsForFriends(HyvesTipResponsefield responsefields) { return GetTipsForFriends(string.Empty, responsefields, false, -1, -1); }
private string ConvertResponsefieldsToString(HyvesTipResponsefield responsefields) { StringBuilder responsefieldsBuilder = new StringBuilder(); if (responsefields == HyvesTipResponsefield.All) { responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString<HyvesTipResponsefield>()); } else { var userResponsefields = Enum.GetValues(typeof(HyvesTipResponsefield)); foreach (HyvesTipResponsefield responseField in userResponsefields) { if (EnumHelper.HasFlag(responsefields, responseField)) { responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField))); } } } responsefieldsBuilder = responsefieldsBuilder.Replace( string.Format("{0},", EnumHelper.GetDescription(HyvesTipResponsefield.All)), string.Empty); string returnValue = responsefieldsBuilder.ToString(); return returnValue.Substring(0, returnValue.Length - 1); }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the tips; null if the call fails.</returns> public Collection<Tip> GetTipsForFriends(string tipCategoryId, HyvesTipResponsefield responsefields) { return GetTipsForFriends(tipCategoryId, responsefields, false, -1, -1); }
/// <summary> /// Gets the desired tips from the specified hub by hub. This corresponds to the /// tips.getByHub Hyves method. /// </summary> /// <param name="hubId">The requested hub Id.</param> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</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 tip; null if the call fails.</returns> public Collection<Tip> GetTipsByHub(string hubId, HyvesTipResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage) { if (string.IsNullOrEmpty(hubId)) { throw new ArgumentException("hubId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["hubid"] = hubId; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.TipsGetByHub, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Tip>("tip"); } return null; }
/// <summary> /// Gets the desired tips from the specified hub by hub. This corresponds to the /// tips.getByHub Hyves method. /// </summary> /// <param name="hubId">The requested hub Id.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Collection<Tip> GetTipsByHub(string hubId, HyvesTipResponsefield responsefields) { return GetTipsByHub(hubId, responsefields, false, -1, -1); }
/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipId">The requested tipId.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Tip GetTip(string tipId, HyvesTipResponsefield responsefields) { return GetTip(tipId, responsefields, false); }
/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipId">The requested tipId.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Tip GetTip(string tipId, HyvesTipResponsefield responsefields) { return(GetTip(tipId, responsefields, false)); }
/// <summary> /// Gets the desired tips from the specified user by user. This corresponds to the /// tips.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</param> /// <param name="tipCategoryId">Filter selecting tips by tip category ID.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Collection <Tip> GetTipsByUser(string userId, string tipCategoryId, HyvesTipResponsefield responsefields) { return(GetTipsByUser(userId, tipCategoryId, responsefields, false, -1, -1)); }
/// <summary> /// Gets the desired tips from the specified hub by hub. This corresponds to the /// tips.getByHub Hyves method. /// </summary> /// <param name="hubId">The requested hub Id.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Collection <Tip> GetTipsByHub(string hubId, HyvesTipResponsefield responsefields) { return(GetTipsByHub(hubId, responsefields, false, -1, -1)); }
/// <summary> /// Retrieves the most recent tips for the friends of the loggedin user. /// This corresponds to the tips.getForFriends Hyves method. /// </summary> /// <param name="responsefields">Get extra information from the tip.</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 tips; null if the call fails.</returns> public Collection<Tip> GetTipsForFriends(HyvesTipResponsefield responsefields, bool useFancyLayout) { return GetTipsForFriends(string.Empty, responsefields, useFancyLayout, -1, -1); }
/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipIds">The requested tipIds.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Collection <Tip> GetTips(Collection <string> tipIds, HyvesTipResponsefield responsefields) { return(GetTips(tipIds, responsefields, false)); }
/// <summary> /// Gets the desired information about the specified tip. This corresponds to the /// tips.get Hyves method. /// </summary> /// <param name="tipIds">The requested tipIds.</param> /// <param name="responsefields">Get extra information from the tip.</param> /// <returns>The information about the specified tip; null if the call fails.</returns> public Collection<Tip> GetTips(Collection<string> tipIds, HyvesTipResponsefield responsefields) { return GetTips(tipIds, responsefields, false); }