/// <summary> /// Creates a new list for the authenticated user. Note that you can't create more than 20 lists per account. /// </summary> /// <param name="name"></param> /// <param name="mode"></param> /// <param name="description"></param> /// <returns></returns> public TwitterList CreateList(string name, TwitterListMode mode = TwitterListMode.Public, string description = null) { if (String.IsNullOrEmpty(name)) { throw new ArgumentException(); } if (!this.TwitterApi.Authenticated) { throw new InvalidOperationException("Authentication required."); } var postData = new Dictionary <string, string> { { "name", name }, { "mode", mode.ToString().ToLowerInvariant() } }; if (!String.IsNullOrEmpty(description)) { postData.Add("description", description); } var uri = new Uri(this.CommandBaseUri + "/create.json"); var response = this.TwitterApi.ExecuteAuthenticatedRequest(uri, HttpMethod.Post, postData); var list = TwitterObject.Parse <TwitterList>(response); return(list); }
public TwitterList UpdateListById(string listId, string name = null, TwitterListMode mode = TwitterListMode.Public, string description = null) { if (String.IsNullOrEmpty(listId)) { throw new ArgumentException(); } return(this.UpdateList(listId, null, null, null, name, mode, description)); }
public TwitterList UpdateListBySlug(string slug, string ownerScreenName, string name = null, TwitterListMode mode = TwitterListMode.Public, string description = null, string ownerId = null) { if (String.IsNullOrEmpty(slug)) { throw new ArgumentException(); } if (String.IsNullOrEmpty(ownerId) && String.IsNullOrEmpty(ownerScreenName)) { throw new ArgumentException("A owner id or screen name must be provided."); } return(this.UpdateList(null, slug, ownerId, ownerScreenName, name, mode, description)); }
private TwitterList UpdateList(string listId, string slug, string ownerId, string ownerScreenName, string name, TwitterListMode mode, string description) { if (!this.TwitterApi.Authenticated) { throw new InvalidOperationException("Authentication required."); } var postData = new Dictionary <string, string> { { "mode", mode.ToString().ToLowerInvariant() } }; if (!String.IsNullOrEmpty(listId)) { postData.Add("list_id", listId); } if (!String.IsNullOrEmpty(slug)) { postData.Add("slug", slug); } if (!String.IsNullOrEmpty(ownerId)) { postData.Add("owner_id", ownerId); } if (!String.IsNullOrEmpty(ownerScreenName)) { postData.Add("owner_screen_name", ownerScreenName); } if (!String.IsNullOrEmpty(name)) { postData.Add("name", name); } if (!String.IsNullOrEmpty(description)) { postData.Add("description", description); } var uri = new Uri(this.CommandBaseUri + "/update.json"); var response = this.TwitterApi.ExecuteAuthenticatedRequest(uri, HttpMethod.Post, postData); var list = TwitterObject.Parse <TwitterList>(response); return(list); }
/// <summary> /// Initializes a new instance with the specified <paramref name="name"/>, <paramref name="mode"/> and <paramref name="description"/>. /// </summary> /// <param name="name">The name for the list. A list’s name must start with a letter and can consist only of 25 /// or fewer letters, numbers, <c>-</c>, or <c>_</c> characters.</param> /// <param name="mode">Whether the list will be public or private. Values can be /// <see cref="TwitterListMode.Public"/> or <see cref="TwitterListMode.Private"/>.</param> /// <param name="description">The description to give the list.</param> public TwitterCreateListOptions(string name, TwitterListMode mode, string description) { Name = name; Mode = mode; Description = description; }
/// <summary> /// Initializes a new instance with the specified <paramref name="name"/> and <paramref name="mode"/>. /// </summary> /// <param name="name">The name for the list. A list’s name must start with a letter and can consist only of 25 /// or fewer letters, numbers, <c>-</c>, or <c>_</c> characters.</param> /// <param name="mode">Whether the list will be public or private. Values can be /// <see cref="TwitterListMode.Public"/> or <see cref="TwitterListMode.Private"/>.</param> public TwitterCreateListOptions(string name, TwitterListMode mode) { Name = name; Mode = mode; }