/// <summary> /// Publishes the given link to the authenticated user's feed. /// </summary> /// <param name="title">The title of the link</param> /// <param name="link">The link URL</param> /// <param name="comment">The initial comment for this entry</param> /// <param name="imageUrls">URLs of the thumbnails to be included with this entry</param> /// <param name="imagePaths">Paths to local image files to be included as thumbnails with this entry</param> /// <param name="via">The ID of the API client sending this request</param> /// <param name="audioUrls">URLs of the mp3 files to be included with this entry</param> /// <param name="room">The room to post this entry to</param> /// <returns>The new entry as returned by the server</returns> public Entry PublishLink(string title, string link, string comment, ThumbnailUrl[] imageUrls, ThumbnailFile[] imageFiles, string via, AudioUrl[] audioUrls, string room) { SortedDictionary<string, string> postArguments = new SortedDictionary<string, string>(); postArguments["title"] = title; if (link != null) { postArguments["link"] = link; } if (comment != null) { postArguments["comment"] = comment; } if (via != null) { postArguments["via"] = via; } if (room != null) { postArguments["room"] = room; } if (imageUrls != null) { for (int i = 0; i < imageUrls.Length; i++) { postArguments["image" + i + "_url"] = imageUrls[i].Url; if (imageUrls[i].Link != null) { postArguments["image" + i + "_link"] = imageUrls[i].Url; } } } if (audioUrls != null) { for (int i = 0; i < audioUrls.Length; i++) { postArguments["audio" + i + "_url"] = audioUrls[i].Url; if (audioUrls[i].Title != null) { postArguments["audio" + i + "_title"] = audioUrls[i].Title; } } } SortedDictionary<string, string> fileAttachments = new SortedDictionary<string, string>(); if (imageFiles != null) { for (int i = 0; i < imageFiles.Length; i++) { fileAttachments["file" + i] = imageFiles[i].Path; if (imageFiles[i].Link != null) { postArguments["file" + i + "_link"] = imageUrls[i].Url; } } } HttpWebResponse response = MakeRequest("/api/share", null, postArguments, fileAttachments); XmlDocument document = new XmlDocument(); document.Load(response.GetResponseStream()); return (new Feed(document.DocumentElement)).Entries[0]; }
/// <summary> /// Publishes the given link to the authenticated user's feed. /// </summary> /// <param name="title">The title of the link</param> /// <param name="link">The link URL</param> /// <param name="comment">The initial comment for this entry</param> /// <param name="imageUrls">URLs of the thumbnails to be included with this entry</param> /// <param name="imagePaths">Paths to local image files to be included as thumbnails with this entry</param> /// <param name="via">The ID of the API client sending this request</param> /// <param name="audioUrls">URLs of the mp3 files to be included with this entry</param> /// <returns>The new entry as returned by the server</returns> public Entry PublishLink(string title, string link, string comment, ThumbnailUrl[] imageUrls, ThumbnailFile[] imageFiles, string via, AudioUrl[] audioUrls) { return PublishLink(title, link, comment, imageUrls, imageFiles, via, audioUrls, null); }