/// <summary> /// Build URL to see if user is subscribed to a list /// </summary> /// <param name="parameters">Should contain ID and ListID</param> /// <returns>URL for IsSubscribed query</returns> private string BuildIsSubcribedUrl(Dictionary <string, string> parameters) { string url = BaseUrl; if (parameters.ContainsKey("ListID")) { ListID = parameters["ListID"]; url += parameters["ListID"] + "/subscribers.xml"; } else { throw new ArgumentException("ListID is required for IsSubscribed query."); } if (parameters.ContainsKey("ID")) { ID = parameters["ID"]; url = BuildUrlHelper.TransformIDUrl(parameters, url); } else { throw new ArgumentException("ID (user ID) is required for IsSubscribed query."); } return(url); }
/// <summary> /// appends parameters for Blocking queries /// </summary> /// <param name="parameters">list of parameters from expression tree</param> /// <param name="url">base url</param> /// <returns>base url + parameters</returns> private string BuildBlockingExistsUrlParameters(Dictionary <string, string> parameters, string url) { var urlParams = new List <string>(); if (!parameters.ContainsKey("ID") && !parameters.ContainsKey("UserID") && !parameters.ContainsKey("ScreenName")) { throw new ArgumentException("You must specify either ID, UserID, or ScreenName."); } if (parameters.ContainsKey("ID")) { ID = parameters["ID"]; url = BuildUrlHelper.TransformIDUrl(parameters, url); } if (parameters.ContainsKey("UserID")) { UserID = ulong.Parse(parameters["UserID"]); urlParams.Add("user_id=" + parameters["UserID"]); } if (parameters.ContainsKey("ScreenName")) { ScreenName = parameters["ScreenName"]; urlParams.Add("screen_name=" + parameters["ScreenName"]); } if (urlParams.Count > 0) { url += "?" + string.Join("&", urlParams.ToArray()); } return(url); }
/// <summary> /// builds an url for showing status of user /// </summary> /// <param name="parameters">parameter list</param> /// <returns>base url + show segment</returns> private string BuildShowUrl(Dictionary <string, string> parameters) { var url = BaseUrl + "statuses/show.xml"; url = BuildUrlHelper.TransformIDUrl(parameters, url); return(url); }
/// <summary> /// construct a base user url /// </summary> /// <param name="url">base status url</param> /// <returns>base url + user timeline segment</returns> private string BuildUserUrl(Dictionary <string, string> parameters) { var url = BaseUrl + "statuses/user_timeline.xml"; url = BuildUrlHelper.TransformIDUrl(parameters, url); url = BuildFriendRepliesAndUrlParameters(parameters, url); return(url); }
/// <summary> /// common code for building parameter list for friends and followers urls /// </summary> /// <param name="parameters">parameters to add</param> /// <param name="url">url to start with</param> /// <returns>new url with parameters</returns> private string BuildFriendsAndFollowersUrlParameters(Dictionary <string, string> parameters, string url) { if (parameters == null) { return(url); } if (!parameters.ContainsKey("ID") && !parameters.ContainsKey("UserID") && !parameters.ContainsKey("ScreenName")) { throw new ArgumentException("Parameters must include at least one of ID, UserID, or ScreenName."); } var urlParams = new List <string>(); if (parameters.ContainsKey("ID")) { ID = parameters["ID"]; url = BuildUrlHelper.TransformIDUrl(parameters, url); } if (parameters.ContainsKey("UserID")) { UserID = parameters["UserID"]; urlParams.Add("user_id=" + parameters["UserID"]); } if (parameters.ContainsKey("ScreenName")) { ScreenName = parameters["ScreenName"]; urlParams.Add("screen_name=" + parameters["ScreenName"]); } if (parameters.ContainsKey("Page")) { Page = int.Parse(parameters["Page"]); urlParams.Add("page=" + parameters["Page"]); } if (parameters.ContainsKey("Cursor")) { Cursor = parameters["Cursor"]; urlParams.Add("cursor=" + parameters["Cursor"]); } if (urlParams.Count > 0) { url += "?" + string.Join("&", urlParams.ToArray()); } return(url); }
/// <summary> /// builds an url for showing status of user /// </summary> /// <param name="parameters">parameter list</param> /// <returns>base url + show segment</returns> private string BuildShowUrl(Dictionary <string, string> parameters) { if (parameters.ContainsKey("ID")) { ID = parameters["ID"]; } var url = BaseUrl + "statuses/show.xml"; url = BuildUrlHelper.TransformIDUrl(parameters, url); return(url); }
/// <summary> /// construct a base show url /// </summary> /// <param name="url">base show url</param> /// <returns>base url + show segment</returns> Request BuildShowUrl(Dictionary <string, string> parameters) { if (!parameters.ContainsKey("ID")) { throw new ArgumentException("ID is required for a Saved Search Show query.", "ID"); } ID = parameters["ID"]; var url = BuildUrlHelper.TransformIDUrl(parameters, "saved_searches/show.json"); return(new Request(BaseUrl + url)); }
private string BuildShowUrl(Dictionary <string, string> parameters) { if (!parameters.ContainsKey("ID")) { throw new ArgumentNullException("ID", "ID is required."); } var url = BaseUrl + "direct_messages/show.xml"; url = BuildUrlHelper.TransformIDUrl(parameters, url); ID = ulong.Parse(parameters["ID"]); return(url); }
/// <summary> /// Builds URL to retrieve info on a specific List /// </summary> /// <param name="parameters">Contains ID for List</param> /// <returns>URL for List query</returns> private string BuildListUrl(Dictionary <string, string> parameters) { string url = BaseUrl + @"lists.xml"; if (parameters.ContainsKey("ID")) { ID = parameters["ID"]; url = BuildUrlHelper.TransformIDUrl(parameters, url); } else { throw new ArgumentException("ID (user ID) is required for List query."); } return(url); }
/// <summary> /// construct a url that will request all the retweets of a given tweet /// </summary> /// <param name="parameters">input parameters</param> /// <returns>base url + retweet segment</returns> Request BuildRetweetsUrl(Dictionary <string, string> parameters) { if (parameters.ContainsKey("ID")) { ID = parameters["ID"]; } var url = BuildUrlHelper.TransformIDUrl(parameters, "statuses/retweets.json"); var req = new Request(BaseUrl + url); var urlParams = req.RequestParameters; if (parameters.ContainsKey("Count")) { Count = int.Parse(parameters["Count"]); urlParams.Add(new QueryParameter("count", Count.ToString(CultureInfo.InvariantCulture))); } return(req); }
/// <summary> /// construct a url that will request all the retweets of a given tweet /// </summary> /// <param name="parameters">input parameters</param> /// <returns>base url + retweet segment</returns> private string BuildRetweetsUrl(Dictionary <string, string> parameters) { var url = BaseUrl + "statuses/retweets.xml"; if (parameters.ContainsKey("ID")) { ID = parameters["ID"]; } url = BuildUrlHelper.TransformIDUrl(parameters, url); if (parameters.ContainsKey("Count")) { Count = int.Parse(parameters["Count"]); url += "?count=" + Count; } return(url); }