Skip to content

Commit 4cd8b32

Browse files
committed
fix: Updates dependencies and adds user deletion
Updates System.Text.Json package to version 8.0.5. Adds functionality to delete users via the API. Removes the redundant dependency injection extension project and merges it into the main SDK project. This simplifies the project structure and avoids circular dependencies.
1 parent 6123d81 commit 4cd8b32

File tree

8 files changed

+47
-41
lines changed

8 files changed

+47
-41
lines changed

Directory.Packages.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
2323
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="$(DotNet8Version)" />
2424
<PackageVersion Include="System.Net.Http.Json" Version="$(DotNet8Version)" />
25-
<PackageVersion Include="System.Text.Json" Version="8.0.4" />
25+
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
2626
<PackageVersion Include="xunit" Version="2.6.5" />
2727
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.6" />
2828
</ItemGroup>

SailthruSDK.sln

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.0.31612.314
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.0.11018.127 d18.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{FCBDF6CA-6D58-4E73-AB23-26D2767501A9}"
77
ProjectSection(SolutionItems) = preProject
@@ -59,8 +59,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{89340FB5
5959
EndProject
6060
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SailthruSDK.Tests", "tests\SailthruSDK.Tests\SailthruSDK.Tests.csproj", "{2E0DE426-D135-4710-80B5-173338D364C6}"
6161
EndProject
62-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SailthruSDK.Extensions.DependencyInjection", "libs\SailthruSDK.Extensions.DependencyInjection\SailthruSDK.Extensions.DependencyInjection.csproj", "{806DCE4B-D0BD-4AA5-B8BC-502B69ABFAF3}"
63-
EndProject
6462
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{0876C34F-5AAD-405F-9303-90145D7744CF}"
6563
EndProject
6664
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SailthruSDK.Samples.Console", "samples\SailthruSDK.Samples.Console\SailthruSDK.Samples.Console.csproj", "{5CEF974B-EAA0-4DB2-9812-C8EFB74ACC96}"
@@ -95,10 +93,6 @@ Global
9593
{2E0DE426-D135-4710-80B5-173338D364C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
9694
{2E0DE426-D135-4710-80B5-173338D364C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
9795
{2E0DE426-D135-4710-80B5-173338D364C6}.Release|Any CPU.Build.0 = Release|Any CPU
98-
{806DCE4B-D0BD-4AA5-B8BC-502B69ABFAF3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
99-
{806DCE4B-D0BD-4AA5-B8BC-502B69ABFAF3}.Debug|Any CPU.Build.0 = Debug|Any CPU
100-
{806DCE4B-D0BD-4AA5-B8BC-502B69ABFAF3}.Release|Any CPU.ActiveCfg = Release|Any CPU
101-
{806DCE4B-D0BD-4AA5-B8BC-502B69ABFAF3}.Release|Any CPU.Build.0 = Release|Any CPU
10296
{5CEF974B-EAA0-4DB2-9812-C8EFB74ACC96}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
10397
{5CEF974B-EAA0-4DB2-9812-C8EFB74ACC96}.Debug|Any CPU.Build.0 = Debug|Any CPU
10498
{5CEF974B-EAA0-4DB2-9812-C8EFB74ACC96}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -114,7 +108,6 @@ Global
114108
{DEA98DC1-8E8C-4024-8D6D-3ADDA19B64BF} = {82F51994-2872-4E64-A51F-5785E6E01840}
115109
{562C63D3-F1F8-4929-B856-1463283DFC93} = {3E233261-9EBB-4F79-B840-BD73052C8428}
116110
{2E0DE426-D135-4710-80B5-173338D364C6} = {89340FB5-E457-4182-A510-7F1D8DD97371}
117-
{806DCE4B-D0BD-4AA5-B8BC-502B69ABFAF3} = {3E233261-9EBB-4F79-B840-BD73052C8428}
118111
{5CEF974B-EAA0-4DB2-9812-C8EFB74ACC96} = {0876C34F-5AAD-405F-9303-90145D7744CF}
119112
{AC001CAE-9827-45E4-845D-F73C3A5AE5DB} = {243C0586-E944-42F3-818F-2C4C2526BEC4}
120113
EndGlobalSection

libs/SailthruSDK.Extensions.DependencyInjection/SailthruSDK.Extensions.DependencyInjection.csproj

Lines changed: 0 additions & 26 deletions
This file was deleted.

libs/SailthruSDK/Api/Users/User.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,4 +445,19 @@ public override void Write(Utf8JsonWriter writer, UpsertUserRequest value, JsonS
445445
}
446446
}
447447
}
448+
449+
public class DeleteUserRequest(
450+
string id,
451+
string key = UserKeyType.Email)
452+
{
453+
/// <summary>
454+
/// Gets the user ID.
455+
/// </summary>
456+
public string Id { get; } = Ensure.IsNotNullOrEmpty(id, nameof(id));
457+
458+
/// <summary>
459+
/// Gets the key type.
460+
/// </summary>
461+
public string Key { get; } = Ensure.IsNotNullOrEmpty(key, nameof(key));
462+
}
448463
}

libs/SailthruSDK/Api/Users/UserOperations.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// This work is licensed under the terms of the MIT license.
22
// For a copy, see <https://opensource.org/licenses/MIT>.
33

4+
using System.Reflection.Metadata.Ecma335;
5+
46
namespace SailthruSDK.Api;
57

68
partial interface ISailthruApiClient
@@ -39,6 +41,11 @@ Task<SailthruResponse> UpsertUserAsync(
3941
bool? optOutSms = default,
4042
UserFields? fields = default,
4143
CancellationToken cancellationToken = default);
44+
45+
Task<SailthruResponse> DeleteUserAsync(
46+
string id,
47+
string key = UserKeyType.Email,
48+
CancellationToken cancellationToken = default);
4249
}
4350

4451
public partial class UserOperations(
@@ -85,4 +92,18 @@ public async Task<SailthruResponse> UpsertUserAsync(
8592
cancellationToken)
8693
.ConfigureAwait(false);
8794
}
95+
96+
public async Task<SailthruResponse> DeleteUserAsync(
97+
string id,
98+
string key = UserKeyType.Email,
99+
CancellationToken cancellationToken = default)
100+
{
101+
var model = new DeleteUserRequest(id, key);
102+
var request = new SailthruRequest<DeleteUserRequest>(HttpMethod.Delete, _path, model);
103+
104+
return await _client.SendAsync(
105+
request,
106+
cancellationToken)
107+
.ConfigureAwait(false);
108+
}
88109
}

libs/SailthruSDK/SailthruSDK.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
<PackageReference Include="FluentValidation" />
2424
<PackageReference Include="MinVer" />
2525
<PackageReference Include="Microsoft.Extensions.Http" />
26+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
27+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" />
2628
<PackageReference Include="Microsoft.Extensions.Options" />
29+
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" />
2730
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
2831
<PackageReference Include="System.Net.Http.Json" />
2932
<PackageReference Include="System.Text.Json" />
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
namespace Microsoft.Extensions.DependencyInjection
1+
// This work is licensed under the terms of the MIT license.
2+
// For a copy, see <https://opensource.org/licenses/MIT>.
3+
4+
namespace Microsoft.Extensions.DependencyInjection
25
{
36
using System;
47
using System.Net.Http;
58
using System.Net.Http.Headers;
69

7-
using FluentValidation;
8-
910
using Microsoft.Extensions.Configuration;
1011
using Microsoft.Extensions.Options;
1112

1213
using SailthruSDK;
13-
using SailthruSDK.Api;
1414

1515
/// <summary>
1616
/// Provides extensions for the <see cref="IServiceCollection"/>

0 commit comments

Comments
 (0)