/// <summary> /// Updates a custom list asyncronously /// </summary> /// <param name="listId">The ID of the list to update</param> /// <param name="parameters">The options to use while updating the list</param> /// <param name="cancellationToken">Token allowing the request to be cancelled</param> /// <returns>The updated list</returns> public async Task <CustomList> UpdateAsync(int listId, UpdateListParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) { Ensure.IsNotNull(parameters, nameof(parameters)); var request = new UpdateListRequest(parameters); var url = UrlProvider.GetV1ListUpdateUrl(listId); return((await PutJsonAsync <UpdateListResponse>(url, request, cancellationToken)).Payload.List); }
public void GetUpdateListQuery_WithSlug_ReturnsExpectedQuery() { // arrange var queryGenerator = CreateTwitterListQueryGenerator(); var parameters = new UpdateListParameters(new TwitterListIdentifier("myslug", "username")) { Name = "myName", Description = "desc", PrivacyMode = PrivacyMode.Private, CustomQueryParameters = { new Tuple <string, string>("hello", "world") } }; // Act var result = queryGenerator.GetUpdateListQuery(parameters); // Assert Assert.Equal(result, "https://api.twitter.com/1.1/lists/update.json?slug=myslug&owner_screen_name=username&name=myName&mode=private&description=desc&hello=world"); }
public void GetUpdateListQuery_ReturnsExpectedQuery() { // arrange var queryGenerator = CreateTwitterListQueryGenerator(); var parameters = new UpdateListParameters(42) { Name = "myName", Description = "desc", PrivacyMode = PrivacyMode.Public, CustomQueryParameters = { new Tuple <string, string>("hello", "world") } }; // Act var result = queryGenerator.GetUpdateListQuery(parameters); // Assert Assert.Equal(result, "https://api.twitter.com/1.1/lists/update.json?list_id=42&name=myName&mode=public&description=desc&hello=world"); }
/// <summary> /// Initializes a new instance of the <see cref="UpdateListRequest" /> class /// </summary> /// <param name="list">The updates for the list</param> public UpdateListRequest(UpdateListParameters list) { List = list; }