/// <summary> /// Gets the desired information about the specified www. This corresponds to the /// wwws.get Hyves method. /// </summary> /// <param name="wwwIDs">The requested wwwIDs.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection <Www> GetWwws(Collection <string> wwwIDs, HyvesWwwResponsefield responsefields, bool useFancyLayout) { if (wwwIDs == null || wwwIDs.Count == 0) { throw new ArgumentNullException("wwwIDs"); } StringBuilder wwwIDBuilder = new StringBuilder(); if (wwwIDs != null) { foreach (string id in wwwIDs) { if (wwwIDBuilder.Length != 0) { wwwIDBuilder.Append(","); } wwwIDBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["wwwid"] = wwwIDBuilder.ToString(); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessResponse <Www>("www")); } return(null); }
/// <summary> /// Gets the desired information about the specified www. This corresponds to the /// wwws.get Hyves method. /// </summary> /// <param name="wwwIDs">The requested wwwIDs.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection<Www> GetWwws(Collection<string> wwwIDs, HyvesWwwResponsefield responsefields, bool useFancyLayout) { if (wwwIDs == null || wwwIDs.Count == 0) { throw new ArgumentNullException("wwwIDs"); } StringBuilder wwwIDBuilder = new StringBuilder(); if (wwwIDs != null) { foreach (string id in wwwIDs) { if (wwwIDBuilder.Length != 0) { wwwIDBuilder.Append(","); } wwwIDBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["wwwid"] = wwwIDBuilder.ToString(); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Www>("www"); } return null; }
private string ConvertResponsefieldsToString(HyvesWwwResponsefield responsefields) { StringBuilder responsefieldsBuilder = new StringBuilder(); if (responsefields == HyvesWwwResponsefield.All) { responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString <HyvesWwwResponsefield>()); } else { var responsefieldsValues = Enum.GetValues(typeof(HyvesWwwResponsefield)); foreach (HyvesWwwResponsefield responseField in responsefieldsValues) { if (EnumHelper.HasFlag(responsefields, responseField)) { responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField))); } } } responsefieldsBuilder = responsefieldsBuilder.Replace( string.Format("{0},", EnumHelper.GetDescription(HyvesWwwResponsefield.All)), string.Empty); string returnValue = responsefieldsBuilder.ToString(); return(returnValue.Substring(0, returnValue.Length - 1)); }
/// <summary> /// Retrieves the most recent wwws for the friends of the loggedin user. /// This corresponds to the wwws.getForFriends Hyves method. /// </summary> /// <param name="responsefields">Get extra information from the requested www.</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 wwws; null if the call fails.</returns> public Collection <Www> GetWwwsForFriends(HyvesWwwResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage) { HyvesRequest request = new HyvesRequest(this.session); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsGetForFriends, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessResponse <Www>("www")); } return(null); }
/// <summary> /// Gets the desired information about the specified www. This corresponds to the /// wwws.get Hyves method. /// </summary> /// <param name="wwwID">The requested wwwID.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Www GetWww(string wwwID, HyvesWwwResponsefield responsefields, bool useFancyLayout) { if (string.IsNullOrEmpty(wwwID)) { throw new ArgumentNullException("wwwID"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["wwwid"] = wwwID; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessSingleItemResponse<Www>("www"); } return null; }
/// <summary> /// Gets the desired information about the specified www. This corresponds to the /// wwws.get Hyves method. /// </summary> /// <param name="wwwID">The requested wwwID.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Www GetWww(string wwwID, HyvesWwwResponsefield responsefields, bool useFancyLayout) { if (string.IsNullOrEmpty(wwwID)) { throw new ArgumentNullException("wwwID"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["wwwid"] = wwwID; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessSingleItemResponse <Www>("www")); } return(null); }
/// <summary> /// Gets the desired wwws from the specified user. This corresponds to the /// wwws.getByUser Hyves method. /// </summary> /// <param name="hubId">The requested hub Id.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection <Www> GetWwwsByHub(string hubId, HyvesWwwResponsefield 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.WwwsGetByHub, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessResponse <Www>("www")); } return(null); }
/// <summary> /// Search in public wwws. This corresponds to the /// wwws.searchPublic Hyves method. /// </summary> /// <param name="searchterms">The search terms.</param> /// <param name="scopeMinId">Only www's posted after this one will be received.</param> /// <param name="scopeMaxId">Only www's posted before this one will be received.</param> /// <param name="limit">The maximum number of results desired.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection <Www> SearchPublic(string searchterms, string scopeMinId, string scopeMaxId, int limit, HyvesWwwResponsefield responsefields, bool useFancyLayout) { HyvesRequest request = new HyvesRequest(this.session); if (string.IsNullOrEmpty(searchterms) == false) { request.Parameters["searchterms"] = searchterms; } if (string.IsNullOrEmpty(scopeMinId) == false) { request.Parameters["scope_minid"] = scopeMinId; } if (string.IsNullOrEmpty(scopeMaxId) == false) { request.Parameters["scope_maxid"] = scopeMaxId; } if (limit > 0) { request.Parameters["limit"] = limit.ToString(); } request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsSearchPublic, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return(response.ProcessResponse <Www>("www")); } return(null); }
/// <summary> /// Gets the desired wwws from the specified user. This corresponds to the /// wwws.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection <Www> GetWwwsByUser(string userId, HyvesWwwResponsefield responsefields, bool useFancyLayout) { return(GetWwwsByUser(userId, responsefields, useFancyLayout, -1, -1)); }
private string ConvertResponsefieldsToString(HyvesWwwResponsefield responsefields) { StringBuilder responsefieldsBuilder = new StringBuilder(); if (responsefields == HyvesWwwResponsefield.All) { responsefieldsBuilder.Append(EnumHelper.GetAllValuesAsString<HyvesWwwResponsefield>()); } else { var responsefieldsValues = Enum.GetValues(typeof(HyvesWwwResponsefield)); foreach (HyvesWwwResponsefield responseField in responsefieldsValues) { if (EnumHelper.HasFlag(responsefields, responseField)) { responsefieldsBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(responseField))); } } } responsefieldsBuilder = responsefieldsBuilder.Replace( string.Format("{0},", EnumHelper.GetDescription(HyvesWwwResponsefield.All)), string.Empty); string returnValue = responsefieldsBuilder.ToString(); return returnValue.Substring(0, returnValue.Length - 1); }
/// <summary> /// Search in public wwws. This corresponds to the /// wwws.searchPublic Hyves method. /// </summary> /// <param name="searchterms">The search terms.</param> /// <param name="scopeMinId">Only www's posted after this one will be received.</param> /// <param name="scopeMaxId">Only www's posted before this one will be received.</param> /// <param name="limit">The maximum number of results desired.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection<Www> SearchPublic(string searchterms, string scopeMinId, string scopeMaxId, int limit, HyvesWwwResponsefield responsefields, bool useFancyLayout) { HyvesRequest request = new HyvesRequest(this.session); if (string.IsNullOrEmpty(searchterms) == false) { request.Parameters["searchterms"] = searchterms; } if (string.IsNullOrEmpty(scopeMinId) == false) { request.Parameters["scope_minid"] = scopeMinId; } if (string.IsNullOrEmpty(scopeMaxId) == false) { request.Parameters["scope_maxid"] = scopeMaxId; } if (limit > 0) { request.Parameters["limit"] = limit.ToString(); } request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsSearchPublic, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Www>("www"); } return null; }
/// <summary> /// Retrieves the most recent wwws for the friends of the loggedin user. /// This corresponds to the wwws.getForFriends Hyves method. /// </summary> /// <param name="responsefields">Get extra information from the requested www.</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 wwws; null if the call fails.</returns> public Collection<Www> GetWwwsForFriends(HyvesWwwResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage) { HyvesRequest request = new HyvesRequest(this.session); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.WwwsGetForFriends, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Www>("www"); } return null; }
/// <summary> /// Gets the desired wwws from the specified user. This corresponds to the /// wwws.getByUser Hyves method. /// </summary> /// <param name="hubId">The requested hub Id.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection<Www> GetWwwsByHub(string hubId, HyvesWwwResponsefield 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.WwwsGetByHub, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Www>("www"); } return null; }
/// <summary> /// Gets the desired wwws from the specified user. This corresponds to the /// wwws.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</param> /// <param name="responsefields">Get extra information from the requested www.</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 www; null if the call fails.</returns> public Collection<Www> GetWwwsByUser(string userId, HyvesWwwResponsefield responsefields, bool useFancyLayout) { return GetWwwsByUser(userId, responsefields, useFancyLayout, -1, -1); }