/// <summary> /// Gets the desired information about the specified hubCategory. This corresponds to the /// hubCategories.get Hyves method. /// </summary> /// <param name="hubCategoryId">The requested hubCategoryIds.</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 hubCategory; null if the call fails.</returns> public Collection<HubCategory> GetHubCategories(Collection<string> hubCategoryIds, bool useFancyLayout) { if (hubCategoryIds == null || hubCategoryIds.Count == 0) { throw new ArgumentNullException("hubCategoryIds"); } StringBuilder hubCategoryIdBuilder = new StringBuilder(); if (hubCategoryIds != null) { foreach (string id in hubCategoryIds) { if (hubCategoryIdBuilder.Length != 0) { hubCategoryIdBuilder.Append(","); } hubCategoryIdBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["hubcategoryid"] = hubCategoryIdBuilder.ToString(); HyvesResponse response = request.InvokeMethod(HyvesMethod.HubCategoriesGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<HubCategory>("hubcategory"); } return null; }
/// <summary> /// Retrieves the connections between the user the access token is for and /// another user. This corresponds to the friends.getConnection Hyves method. /// </summary> /// <param name="userId">The requested userId.</param> /// <returns>A list of connections; null if the call fails.</returns> public Collection<string> GetConnection(string userId) { HyvesRequest request = new HyvesRequest(this.session); request.Parameters["userid"] = userId; HyvesResponse response = request.InvokeMethod(HyvesMethod.FriendsGetConnection); if (response.Status == HyvesResponseStatus.Succeeded) { Collection<string> collection = new Collection<string>(); Debug.Assert(response.Result is Hashtable); Hashtable result = (Hashtable)response.Result; Debug.Assert(result["connection"] is ArrayList); ArrayList list = (ArrayList)result["connection"]; Debug.Assert(response.Result is Hashtable); Hashtable userIds = (Hashtable)list[0]; Debug.Assert(result["connection"] is ArrayList); list = (ArrayList)userIds["userid"]; for (int i = 0; i < list.Count; i++) { collection.Add((string)list[i]); } return collection; } return null; }
/// <summary> /// Gets the desired information about the specified region. This corresponds to the /// regions.get Hyves method. /// </summary> /// <param name="regionIDs">The requested region IDs.</param> /// <returns>The information about the specified region; null if the call fails.</returns> public Collection<Region> GetRegions(Collection<string> regionIDs) { if ((regionIDs == null) || (regionIDs.Count == 0)) { throw new ArgumentNullException("regionIDs"); } StringBuilder regionIDBuilder = new StringBuilder(); if (regionIDs != null) { foreach (string id in regionIDs) { if (regionIDBuilder.Length != 0) { regionIDBuilder.Append(","); } regionIDBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["regionid"] = regionIDBuilder.ToString(); HyvesResponse response = request.InvokeMethod(HyvesMethod.RegionsGet); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Region>("region"); } return null; }
/// <summary> /// Send a private message to multiple targets. This corresponds to the /// messages.send Hyves method. /// </summary> /// <param name="title">Title of the message.</param> /// <param name="body">Body of the message.</param> /// <param name="targetUserId">A single user.</param> /// <returns><b>true</b> if successfull; otherwise <b>false</b>.</returns> /// <remarks>Spam sensitive method (for trusted partners only).</remarks> public bool SendMessage(string title, string body, string targetUserId) { if (string.IsNullOrEmpty(title)) { throw new ArgumentNullException("title"); } if (string.IsNullOrEmpty(body)) { throw new ArgumentNullException("body"); } if (string.IsNullOrEmpty(targetUserId)) { throw new ArgumentNullException("targetUserId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["title"] = title; request.Parameters["body"] = body; request.Parameters["target_userid"] = targetUserId; HyvesResponse response = request.InvokeMethod(HyvesMethod.MessagesSend); if (response.Status == HyvesResponseStatus.Succeeded) { return true; } return false; }
/// <summary> /// Gets the desired information about the specified city. This corresponds to the /// cities.get Hyves method. /// </summary> /// <param name="cityIDs">The requested city IDs.</param> /// <returns>The information about the specified city; null if the call fails.</returns> public Collection<City> GetCities(Collection<string> cityIDs) { if ((cityIDs == null) || (cityIDs.Count == 0)) { throw new ArgumentNullException("cityIDs"); } StringBuilder cityIDBuilder = new StringBuilder(); if (cityIDs != null) { foreach (string id in cityIDs) { if (cityIDBuilder.Length != 0) { cityIDBuilder.Append(","); } cityIDBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["cityid"] = cityIDBuilder.ToString(); HyvesResponse response = request.InvokeMethod(HyvesMethod.CitiesGet); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<City>("city"); } return null; }
/// <summary> /// Gets the desired information about the specified event. This corresponds to the /// events.get Hyves method. /// </summary> /// <param name="eventIds">The requested eventIds.</param> /// <param name="responsefields">Get extra information from the requested event.</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 event; null if the call fails.</returns> public Collection<Event> GetEvents(Collection<string> eventIds, HyvesEventResponsefield responsefields, bool useFancyLayout) { if (eventIds == null || eventIds.Count == 0) { throw new ArgumentException("eventIds"); } StringBuilder eventIdBuilder = new StringBuilder(); if (eventIds != null) { foreach (string id in eventIds) { if (eventIdBuilder.Length != 0) { eventIdBuilder.Append(","); } eventIdBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["eventid"] = eventIdBuilder.ToString(); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.EventsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Event>("event"); } return null; }
/// <summary> /// Gets the desired information about the specified listener. This corresponds to the /// listeners.get Hyves method. /// </summary> /// <param name="listenerId">The requested listenerIds.</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 listener; null if the call fails.</returns> public Collection<Listener> GetListeners(Collection<string> listenerIds) { if (listenerIds == null || listenerIds.Count == 0) { throw new ArgumentNullException("listenerIds"); } StringBuilder listenerIdBuilder = new StringBuilder(); if (listenerIds != null) { foreach (string id in listenerIds) { if (listenerIdBuilder.Length != 0) { listenerIdBuilder.Append(","); } listenerIdBuilder.Append(id); } } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["listenerid"] = listenerIdBuilder.ToString(); HyvesResponse response = request.InvokeMethod(HyvesMethod.ListenersGet, false); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Listener>("listener"); } return null; }
/// <summary> /// Gets the buzz of famous hyvers. This corresponds to the /// buzz.getFamous Hyves method. /// </summary> /// <param name="responsefields">Get extra information from the buzz.</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 buzz; null if the call fails.</returns> public Collection<Buzz> GetFamous(HyvesBuzzResponsefield responsefields, bool useFancyLayout) { HyvesRequest request = new HyvesRequest(this.session); request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.BuzzGetFamous, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Buzz>("buzz"); } return null; }
/// <summary> /// Revokes all accesstokens for Consumer. This corresponds to the /// auth.revokeAll Hyves method. /// </summary> /// <returns>The number of tokens that were rovoked.</returns> public int RevokeAll() { HyvesRequest request = new HyvesRequest(this.session); HyvesResponse response = request.InvokeMethod(HyvesMethod.AuthRevokeAll); if (response.Status == HyvesResponseStatus.Succeeded) { Debug.Assert(response.Result is Hashtable); Hashtable result = (Hashtable)response.Result; Debug.Assert(result["deletecount"] is int); return (int)result["deletecount"]; } return -1; }
/// <summary> /// Gets the desired information about the specified listener. This corresponds to the /// listeners.get Hyves method. /// </summary> /// <param name="listenerId">The requested listenerId.</param> /// <returns>The information about the specified listener; null if the call fails.</returns> public Listener GetListener(string listenerId) { if (string.IsNullOrEmpty(listenerId)) { throw new ArgumentNullException("listenerId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["listenerid"] = listenerId; HyvesResponse response = request.InvokeMethod(HyvesMethod.ListenersGet, false); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessSingleItemResponse<Listener>("listener"); } return null; }
/// <summary> /// Gets the desired albums from a user. This corresponds to the albums.getByUser Hyves method. /// </summary> /// <param name="userId">The requested user Id.</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 albums; null if the call fails.</returns> public Collection<Album> GetAlbums(string userId, bool useFancyLayout) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException("userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["userid"] = userId; HyvesResponse response = request.InvokeMethod(HyvesMethod.AlbumsGetByUser, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Album>("album"); } return null; }
/// <summary> /// Gets the hub categories by hub type. This corresponds to the /// hubCategories.getByHubType Hyves method. /// </summary> /// <param name="hubType">The tybe of hub to retrieve.</param> /// <returns>The information about the hubCategories; null if the call fails.</returns> public Collection<HubCategory> GetHubCategoriesByHubType(string hubType) { if (string.IsNullOrEmpty(hubType)) { throw new ArgumentException("hubType cannot be null or empty.", "hubType"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["hubtype"] = hubType; HyvesResponse response = request.InvokeMethod(HyvesMethod.HubCategoriesGetByHubType, false); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<HubCategory>("hubcategory"); } return null; }
/// <summary> /// Gets the desired information about the specified privatespot. /// </summary> /// <param name="privatespotID">The requested privatespot ID</param> /// <param name="responsefields">Get extra information from the requested privatespot</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 specific privatespot; null if the call fails.</returns> public PrivateSpot GetPrivateSpot(string privatespotID, HyvesPrivateSpotResponsefield responsefields, bool useFancyLayout) { if (string.IsNullOrEmpty(privatespotID)) { throw new ArgumentNullException("privatespotID"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["privatespotid"] = privatespotID; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.PrivateSpotsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessSingleItemResponse<PrivateSpot>("privatespot"); } return null; }
/// <summary> /// Gets the desired information about the specified gadget. This corresponds to the /// gadgets.get Hyves method. /// </summary> /// <param name="gadgetId">The requested gadgetId.</param> /// <param name="responsefields">Get extra information from the gadget.</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 gadget; null if the call fails.</returns> public Gadget GetGadget(string gadgetId, HyvesGadgetResponsefield responsefields, bool useFancyLayout) { if (string.IsNullOrEmpty(gadgetId)) { throw new ArgumentNullException("gadgetId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["gadgetid"] = gadgetId; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields); HyvesResponse response = request.InvokeMethod(HyvesMethod.GadgetsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessSingleItemResponse<Gadget>("gadget"); } 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; }
/// <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 hub. This corresponds to the /// hubs.get Hyves method. /// </summary> /// <param name="hubId">The requested hubId.</param> /// <param name="responsefields">Get extra information from the hub.</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 hub; null if the call fails.</returns> public Hub GetHub(string hubId, HyvesHubResponsefield responsefields, bool useFancyLayout) { 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.HubsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessSingleItemResponse<Hub>("hub"); } return null; }
/// <summary> /// Gets the desired information about the specified user. /// </summary> /// <param name="userId">The requested user Id</param> /// <param name="responsefields">Get extra information from the requested user</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 specific user; null if the call fails.</returns> public User GetUser(string userId, HyvesUserResponsefield responsefields, bool useFancyLayout) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentException("userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["userid"] = userId; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields, HyvesUserPrivateResponsefield.None); HyvesResponse response = request.InvokeMethod(HyvesMethod.UsersGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessSingleItemResponse<User>("user"); } return null; }
/// <summary> /// Gets the desired albums from the specified albums. This corresponds to the albums.get Hyves method. /// </summary> /// <param name="albumId">The requested album ID.</param> /// <param name="responsefields">Get extra information from the requested album.</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 albums; null if the call fails.</returns> public Collection<Album> GetAlbums(string albumId, HyvesAlbumResponsefield responseFields, bool useFancyLayout) { if (string.IsNullOrEmpty(albumId)) { throw new ArgumentException("userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["albumid"] = albumId; request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responseFields); HyvesResponse response = request.InvokeMethod(HyvesMethod.AlbumsGet, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Album>("album"); } 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> /// Converts a string to HTML format the same way that that is being done on the site, /// including things like smilies. This corresponds to the fancylayout.parse Hyves method. /// </summary> /// <param name="layoutString">The string to convert.</param> /// <param name="type">An extra option how to do the conversion.</param> /// <returns>The converted string; null if the call fails.</returns> public string Parse(string layoutString, HyvesLayoutType type) { if (layoutString == null) { throw new ArgumentNullException("layoutString"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["string"] = layoutString; switch (type) { case HyvesLayoutType.NaturalName: request.Parameters["fancylayouttype"] = "naturalname"; break; case HyvesLayoutType.Nickname: request.Parameters["fancylayouttype"] = "nickname"; break; case HyvesLayoutType.Title: request.Parameters["fancylayouttype"] = "title"; break; case HyvesLayoutType.Oneliner: request.Parameters["fancylayouttype"] = "oneliner"; break; default: request.Parameters["fancylayouttype"] = "body"; break; } HyvesResponse response = request.InvokeMethod(HyvesMethod.FancyLayoutParse, true); if (response.Status == HyvesResponseStatus.Succeeded) { Debug.Assert(response.Result is Hashtable); Hashtable result = (Hashtable)response.Result; Debug.Assert(result["fl_string"] is string); return (string)result["fl_string"]; } return null; }
/// <summary> /// Search items in partical categories by searchterms. This corresponds to the /// search.find Hyves method. /// </summary> /// <param name="searchTerms">The search terms.</param> /// <param name="numberOfResults">The number of results to return.</param> /// <param name="userId">The identifier of a user to filter the results.</param> /// <param name="searchCategories">The categories to search in.</param> /// <returns>The search results; null if the call fails.</returns> public Collection<SearchResult> Find(string searchTerms, int numberOfResults, string userId, HyvesSearchCategory searchCategories) { if (string.IsNullOrEmpty(searchTerms)) { throw new ArgumentException("searchTerms"); } if (numberOfResults < 1) { throw new ArgumentOutOfRangeException("numberOfResults"); } if (searchCategories == HyvesSearchCategory.Friends && string.IsNullOrEmpty(userId)) { throw new ArgumentException("userId cannot be null or empty when searching for friends.", "userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["searchterms"] = searchTerms; request.Parameters["nrresults"] = numberOfResults.ToString(); if (string.IsNullOrEmpty(userId) == false) { request.Parameters["userid"] = searchTerms; } if (searchCategories != HyvesSearchCategory.All) { request.Parameters["categories"] = ConvertSearchCategoriesToString(searchCategories); } HyvesResponse response = request.InvokeMethod(HyvesMethod.SearchFind); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<SearchResult>("result"); } return null; }
/// <summary> /// Revokes all accesstokens for user. This corresponds to the /// auth.revoke Hyves method. /// </summary> /// <param name="userId">The identifier of the user.</param> /// <returns>The number of tokens that were rovoked.</returns> public int Revoke(string userId) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentException("userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["userid"] = userId; HyvesResponse response = request.InvokeMethod(HyvesMethod.AuthRevoke); if (response.Status == HyvesResponseStatus.Succeeded) { Debug.Assert(response.Result is Hashtable); Hashtable result = (Hashtable)response.Result; Debug.Assert(result["deletecount"] is int); return (int)result["deletecount"]; } return -1; }
/// <summary> /// Gets the friends of the current user. This corresponds to the /// friends.get Hyves method. /// </summary> /// <returns>The ids of the friends of the current user; null if the call fails.</returns> public Collection<string> GetFriends() { HyvesRequest request = new HyvesRequest(this.session); HyvesResponse response = request.InvokeMethod(HyvesMethod.FriendsGet); if (response.Status == HyvesResponseStatus.Succeeded) { Collection<string> collection = new Collection<string>(); Debug.Assert(response.Result is Hashtable); Hashtable result = (Hashtable)response.Result; Debug.Assert(result["userid"] is ArrayList); ArrayList friendsList = (ArrayList)result["userid"]; for (int i = 0; i < friendsList.Count; i++) { collection.Add((string)friendsList[i]); } return collection; } return null; }
/// <summary> /// Gets the smileys. This corresponds to the /// users.getSmileys Hyves method. /// </summary> /// <returns>The information about all the smileys; null if the call fails.</returns> public Collection<Smiley> GetSmileys() { HyvesRequest request = new HyvesRequest(this.session); HyvesResponse response = request.InvokeMethod(HyvesMethod.UsersGetSmileys); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Smiley>("smiley"); } return null; }
/// <summary> /// Send an email to an given userid which has to be loggedin user /// or a friend of logged in user. This corresponds to the /// users.sendNotificationToFriend Hyves method. /// </summary> /// <param name="userid">A single userid.</param> /// <param name="subject">Subject of the email.</param> /// <param name="body">Body of the email. </param> /// <param name="senderName">Sender name. </param> /// <param name="senderEmail">Sender email address.</param> /// <returns><b>True</b> if the call succeeds, otherwise <b>false</b>.</returns> /// <remarks>Spam sensitive method (for trusted partners only).</remarks> public bool SendNotificationToFriend(string userId, string subject, string body, string senderName, string senderEmail) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException("userId"); } if (string.IsNullOrEmpty(subject)) { throw new ArgumentNullException("subject"); } if (string.IsNullOrEmpty(body)) { throw new ArgumentNullException("body"); } if (string.IsNullOrEmpty(senderName)) { throw new ArgumentNullException("senderName"); } if (string.IsNullOrEmpty(senderEmail)) { throw new ArgumentNullException("senderEmail"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["userid"] = userId; request.Parameters["subject"] = subject; request.Parameters["body"] = body; request.Parameters["sender_name"] = senderName; request.Parameters["sender_email"] = senderEmail; HyvesResponse response = request.InvokeMethod(HyvesMethod.UsersSendNotificationToFriend); return response.Status == HyvesResponseStatus.Succeeded; }
/// <summary> /// Gets the testimonials from the specified user. This corresponds to the /// users.getTestimonials Hyves method. /// </summary> /// <param name="userId">The requested user Id.</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 user; null if the call fails.</returns> public Collection<Testimonial> GetTestimonials(string userId, bool useFancyLayout) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException("userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["target_userid"] = userId; HyvesResponse response = request.InvokeMethod(HyvesMethod.UsersGetTestimonials, useFancyLayout); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Testimonial>("testimonial"); } return null; }
/// <summary> /// Creates scrap for an userid which has to be a friend of /// logged in user. This corresponds to the /// user.createScrapByFriend Hyves method. /// </summary> /// <param name="targetUserId">A single userid.</param> /// <param name="body">The body of the Scrap.</param> /// <returns>True if the call succeeds, otherwise false.</returns> /// <remarks>Hidden method.</remarks> public bool CreateScrapByFriend(string targetUserId, string body) { if (string.IsNullOrEmpty(targetUserId)) { throw new ArgumentException("targetUserId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["target_userid"] = targetUserId; request.Parameters["body"] = body; HyvesResponse response = request.InvokeMethod(HyvesMethod.UsersCreateScrapByFriend); return response.Status == HyvesResponseStatus.Succeeded; }
/// <summary> /// Gets the scraps from the specified user. This corresponds to the /// users.getScraps Hyves method. /// </summary> /// <param name="userId">The requested user Id.</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 user; null if the call fails.</returns> public Collection<Scrap> GetScraps(string userId, bool useFancyLayout, int page, int resultsPerPage) { if (string.IsNullOrEmpty(userId)) { throw new ArgumentNullException("userId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["target_userid"] = userId; HyvesResponse response = request.InvokeMethod(HyvesMethod.UsersGetScraps, useFancyLayout, page, resultsPerPage); if (response.Status == HyvesResponseStatus.Succeeded) { return response.ProcessResponse<Scrap>("scrap"); } return null; }
/// <summary> /// Creates respect for a user. This corresponds to the /// user.createRespect Hyves method. /// </summary> /// <param name="targetUserId">A single userid.</param> /// <param name="respectType">The type of the respect.</param> /// <returns>True if the call succeeds, false if the call fails.</returns> public bool CreateRespect(string targetUserId, HyvesRespectType respectType) { if (string.IsNullOrEmpty(targetUserId)) { throw new ArgumentNullException("targetUserId"); } HyvesRequest request = new HyvesRequest(this.session); request.Parameters["target_userid"] = targetUserId; request.Parameters["respecttype"] = EnumHelper.GetDescription(respectType); HyvesResponse response = request.InvokeMethod(HyvesMethod.UsersCreateRespect); return response.Status == HyvesResponseStatus.Succeeded; }