Skip to content

Commit 1f7f320

Browse files
authored
Remove tokenless client. Closes #38 (#40)
* Remove tokenless client. Closes #38 * Bump version
1 parent 796853c commit 1f7f320

7 files changed

+11
-245
lines changed

src/Todoist.Net.Tests/Services/ItemsServiceTests.cs

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Linq;
3+
using System.Threading.Tasks;
34

45
using Todoist.Net.Exceptions;
56
using Todoist.Net.Models;
@@ -125,30 +126,30 @@ public void CreateItem_InvalidPDueDate_ThrowsException()
125126

126127
[Fact]
127128
[Trait(Constants.TraitName, Constants.IntegrationFreeTraitValue)]
128-
public void MoveItemsToProject_Success()
129+
public async Task MoveItemsToProject_Success()
129130
{
130131
var client = TodoistClientFactory.Create(_outputHelper);
131132

132133
var item = new Item("demo task");
133134
client.Items.AddAsync(item).Wait();
134135

135136
item.DueDate = new DueDate("every fri");
136-
client.Items.UpdateAsync(item).Wait();
137+
await client.Items.UpdateAsync(item);
137138

138139
var project = new Project(Guid.NewGuid().ToString());
139-
client.Projects.AddAsync(project).Wait();
140+
await client.Projects.AddAsync(project);
140141

141-
var itemInfo = client.Items.GetAsync(item.Id).Result;
142+
var itemInfo = await client.Items.GetAsync(item.Id);
142143

143144
Assert.True(project.Id != itemInfo.Project.Id);
144145

145-
client.Items.MoveAsync(ItemMoveArgument.CreateMoveToProject(itemInfo.Item.Id, project.Id)).Wait();
146-
itemInfo = client.Items.GetAsync(itemInfo.Item.Id).Result;
146+
await client.Items.MoveAsync(ItemMoveArgument.CreateMoveToProject(itemInfo.Item.Id, project.Id));
147+
itemInfo = await client.Items.GetAsync(itemInfo.Item.Id);
147148

148149
Assert.True(project.Id == itemInfo.Project.Id);
149150

150-
client.Projects.DeleteAsync(project.Id).Wait();
151-
client.Items.DeleteAsync(itemInfo.Item.Id).Wait();
151+
await client.Items.DeleteAsync(itemInfo.Item.Id);
152+
await client.Projects.DeleteAsync(project.Id);
152153
}
153154

154155
[Fact]
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
using System;
21
using System.Threading.Tasks;
32

4-
using Todoist.Net.Models;
53
using Todoist.Net.Tests.Extensions;
64

75
using Xunit;
@@ -30,31 +28,5 @@ public async Task GetCurrentAsync_Success()
3028
Assert.NotNull(user);
3129
Assert.NotNull(user.Id);
3230
}
33-
34-
[Fact]
35-
[Trait(Constants.TraitName, Constants.IntegrationFreeTraitValue)]
36-
public async Task RegisterUpdateSettingsAndDeleteUser_Success()
37-
{
38-
var todoistTokenlessClient = TodoistClientFactory.CreateTokenlessClient();
39-
40-
const string password = "Pa$$W@rd";
41-
var userBase = new UserBase(Guid.NewGuid().ToString("N") + "@example.com", "test user", password);
42-
var userInfo = await todoistTokenlessClient.RegisterUserAsync(userBase);
43-
Assert.NotNull(userInfo);
44-
45-
var todoistClient = await todoistTokenlessClient.LoginAsync(userBase.Email, userBase.Password);
46-
await todoistClient.Users.UpdateKarmaGoalsAsync(new KarmaGoals() { KarmaDisabled = true });
47-
48-
if (userInfo.HasPassword)
49-
{
50-
userInfo.CurrentPassword = password;
51-
}
52-
53-
await todoistClient.Users.UpdateAsync(userInfo);
54-
55-
await todoistClient.Users.DeleteAsync(userBase.Password, "test");
56-
57-
todoistClient.Dispose();
58-
}
5931
}
6032
}

src/Todoist.Net.Tests/TodoistClientFactory.cs

-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,5 @@ public static ITodoistClient Create(ITestOutputHelper outputHelper)
1111
var token = SettingsProvider.GetToken();
1212
return new TodoistClient(new RateLimitAwareRestClient(token, outputHelper));
1313
}
14-
15-
public static ITodoistTokenlessClient CreateTokenlessClient()
16-
{
17-
return new TodoistTokenlessClient();
18-
}
1914
}
2015
}

src/Todoist.Net/ITodoistTokenlessClient.cs

-64
This file was deleted.

src/Todoist.Net/Todoist.Net.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<Description>A Todoist API client for .NET</Description>
5-
<VersionPrefix>5.1.0</VersionPrefix>
5+
<VersionPrefix>6.0.0</VersionPrefix>
66
<Authors>Oleg Shevchenko</Authors>
77
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/Todoist.Net/TodoistClient.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public void Dispose()
200200
/// <inheritdoc/>
201201
public Task<Resources> GetResourcesAsync(params ResourceType[] resourceTypes) =>
202202
GetResourcesAsync("*", resourceTypes);
203-
203+
204204
/// <inheritdoc/>
205205
public Task<Resources> GetResourcesAsync(CancellationToken cancellationToken, params ResourceType[] resourceTypes) =>
206206
GetResourcesAsync("*", cancellationToken, resourceTypes);

src/Todoist.Net/TodoistTokenlessClient.cs

-138
This file was deleted.

0 commit comments

Comments
 (0)