public void AddMediaTag(MediaItem mediaItem, MediaTag tag) { string relativePath = GenerateRelativeMediaTagUrl(mediaItem.Url); QueryParameterList paramaters = new QueryParameterList(); paramaters.Add(new QueryParameter(_format, "xml")); paramaters.Add(new QueryParameter("topleftx", tag.TopLeftX.ToString())); paramaters.Add(new QueryParameter("toplefty", tag.TopLeftY.ToString())); paramaters.Add(new QueryParameter("bottomrightx", tag.BottomRightX.ToString())); paramaters.Add(new QueryParameter("bottomrighty", tag.BottomRightY.ToString())); paramaters.Add(new QueryParameter("tag", tag.Name)); if (string.IsNullOrEmpty(tag.Contact) == false) { paramaters.Add(new QueryParameter("contact", tag.Contact)); } if (string.IsNullOrEmpty(tag.Url) == false) { paramaters.Add(new QueryParameter("tagurl", tag.Url)); } string addMediaTagUrl = OAuth.GenerateURL(ApiUrl, relativePath, _addMediaTagMethod, Token, paramaters); XmlResponseMessage addMediaTagResponseMessage = GetXmlResponseMessageFromUrl(addMediaTagUrl, _addMediaTagMethod); }
public void DeleteMediaTag(MediaItem mediaItem, MediaTag tag) { string relativePath = GenerateRelativeMediaTagUrl(mediaItem.Url); relativePath = relativePath + "/" + tag.TagId.ToString(); QueryParameterList paramaters = new QueryParameterList(); paramaters.Add(new QueryParameter(_format, "xml")); string deleteMediaTagUrl = OAuth.GenerateURL(ApiUrl, relativePath, _deleteMediaTagMethod, Token, paramaters); XmlResponseMessage deleteMediaTagResponseMessage = GetXmlResponseMessageFromUrl(deleteMediaTagUrl, _deleteMediaTagMethod); }
public MediaTag GetMediaTag(MediaItem mediaItem, int tagId) { string relativePath = GenerateRelativeMediaTagUrl(mediaItem.Url); relativePath = relativePath + "/" + tagId.ToString(); QueryParameterList paramaters = new QueryParameterList(); paramaters.Add(new QueryParameter(_format, "xml")); string getMediaTagUrl = OAuth.GenerateURL(ApiUrl, relativePath, _getMediaTagMethod, Token, paramaters); XmlResponseMessage getMediaTagResponseMessage = GetXmlResponseMessageFromUrl(getMediaTagUrl, _getMediaTagMethod); return(MediaTag.CreateFromXmlNode(getMediaTagResponseMessage.ResponseXml.SelectSingleNode("descendant::content"))); }
internal static MediaTag CreateFromXmlNode(XmlNode mediaTagNode) { MediaTag mediaTag = new MediaTag(); XmlNode nameNode = mediaTagNode.SelectSingleNode("descendant::name"); mediaTag._name = nameNode == null ? String.Empty : nameNode.InnerText; XmlNode countNode = mediaTagNode.SelectSingleNode("descendant::count"); mediaTag._count = countNode == null ? -1 : Convert.ToInt32(countNode.InnerText); XmlNode tagNode = mediaTagNode.SelectSingleNode("descendant::tag"); mediaTag._name = tagNode == null ? String.Empty : tagNode.InnerText; XmlNode tagIdNode = mediaTagNode.SelectSingleNode("descendant::tagid"); mediaTag._tagId = tagIdNode == null ? -1 : Convert.ToInt32(tagIdNode.InnerText); XmlNode topLeftXNode = mediaTagNode.SelectSingleNode("descendant::topLeftXCoord"); mediaTag._topLeftX = topLeftXNode == null ? -1 : Convert.ToSingle(topLeftXNode.InnerText); XmlNode topLeftYNode = mediaTagNode.SelectSingleNode("descendant::topLeftYCoord"); mediaTag._topLeftY = topLeftYNode == null ? -1 : Convert.ToSingle(topLeftYNode.InnerText); XmlNode bottomRightXNode = mediaTagNode.SelectSingleNode("descendant::bottomRightXCoord"); mediaTag._bottomRightX = bottomRightXNode == null ? -1 : Convert.ToSingle(bottomRightXNode.InnerText); XmlNode bottomRightYNode = mediaTagNode.SelectSingleNode("descendant::bottomRightYCoord"); mediaTag._bottomRightY = bottomRightYNode == null ? -1 : Convert.ToSingle(bottomRightYNode.InnerText); XmlNode contactNode = mediaTagNode.SelectSingleNode("descendant::contact"); mediaTag._contact = contactNode == null ? String.Empty : contactNode.InnerText; XmlNode urlNode = mediaTagNode.SelectSingleNode("descendant::url"); mediaTag._url = urlNode == null ? String.Empty : urlNode.InnerText; return(mediaTag); }
public MediaItemList GetAllUsersMediaWithTag(string username, MediaTag mediaTag) { MediaItemList mediaList = new MediaItemList(); int curPageNum = 0; bool stillMoreToGet = true; while (stillMoreToGet) { curPageNum++; MediaItemList curPageMediaList = GetUsersMediaWithTag(username, mediaTag.Name, curPageNum, 200); mediaList.AddRange(curPageMediaList); if (curPageMediaList.Count < 200) { stillMoreToGet = false; } } return(mediaList); }
public MediaItemList GetAllCurrentUsersMediaWithTag(MediaTag mediaTag) { return(GetAllUsersMediaWithTag(CurrentUser.Username, mediaTag)); }