/// <summary> /// Creates a custom list asyncronously /// </summary> /// <param name="parameters">The options to use while creating the list</param> /// <param name="cancellationToken">Token allowing the request to be cancelled</param> /// <returns>The list that was created</returns> public async Task <CustomList> CreateAsync(CreateListParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { Ensure.IsNotNull(parameters, nameof(parameters)); var request = new CreateListRequest(parameters); var url = UrlProvider.GetV1ListCreateUrl(); return((await PostJsonAsync <CreateListResponse>(url, request, cancellationToken)).Payload.List); }
public void GetCreateListQuery_ReturnsExpectedQuery() { // arrange var queryGenerator = CreateTwitterListQueryGenerator(); var parameters = new CreateListParameters("list_name") { Description = "list_desc", PrivacyMode = PrivacyMode.Private, CustomQueryParameters = { new Tuple <string, string>("hello", "world") } }; // Act var result = queryGenerator.GetCreateListQuery(parameters); // Assert Assert.Equal(result, "https://api.twitter.com/1.1/lists/create.json?name=list_name&mode=private&description=list_desc&hello=world"); }
/// <summary> /// Initializes a new instance of the <see cref="CreateListRequest" /> class /// </summary> /// <param name="list">The list details</param> public CreateListRequest(CreateListParameters list) { List = list; }