Skip to content

Commit

Permalink
1.3.1 - updates for RestSharp 110.2.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
jzonthemtn committed Oct 23, 2023
1 parent a08e341 commit de99bf2
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 48 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ ExplainResponse explainResponse = client.Explain(text);

## Release History

* 1.2.0 - Renamed filter profiles to policies. Updated to .NET 7.0.
* 1.3.1 - Updates for RestSharp 110.2.0.
* 1.3.0 - Renamed filter profiles to policies. Updated to .NET 7.0.
* 1.1.0 - Added authentication support.
* 1.0.0 - Initial release.

Expand Down
2 changes: 1 addition & 1 deletion build.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dotnet clean
dotnet restore
dotnet test
REM dotnet test
dotnet build -c Release
dotnet pack -c Release
24 changes: 13 additions & 11 deletions philter-sdk-net-tests/PhilterClientIntegrationTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,29 @@ public void FilterPdfTest()

private RestClient GetClient()
{
RestClient restClient = new RestClient
var endpoint = new Uri("https://10.0.2.51:8080");

var options = new RestClientOptions(endpoint)
{
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true,
BaseUrl = new Uri("https://10.0.2.51:8080")
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
RestClient restClient = new RestClient(options);

return restClient;
}

private RestClient GetClient(string certificateFile, SecureString password)
{
RestClient restClient = new RestClient
{
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true,
BaseUrl = new Uri("https://10.0.2.51:8080")
};

X509Certificate2 certificate = new X509Certificate2(certificateFile, password,
X509KeyStorageFlags.MachineKeySet);
var endpoint = new Uri("https://10.0.2.51:8080");
X509Certificate2 certificate = new X509Certificate2(certificateFile, password, X509KeyStorageFlags.MachineKeySet);

restClient.ClientCertificates = new X509CertificateCollection() { certificate };
var options = new RestClientOptions(endpoint)
{
ClientCertificates = new X509CertificateCollection() { certificate },
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
RestClient restClient = new RestClient(options);

return restClient;
}
Expand Down
8 changes: 5 additions & 3 deletions philter-sdk-net-tests/PhilterClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,13 @@ public void GetAlerts()

private RestClient GetClient()
{
RestClient restClient = new RestClient
var endpoint = new Uri("https://10.0.2.51:8080");

var options = new RestClientOptions(endpoint)
{
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true,
BaseUrl = new Uri("http://localhost:18081/")
RemoteCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true
};
RestClient restClient = new RestClient(options);

return restClient;
}
Expand Down
18 changes: 9 additions & 9 deletions philter-sdk-net-tests/philter-sdk-net-tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>Philter</RootNamespace>
<IsPackable>false</IsPackable>
<PackageVersion>1.2.0</PackageVersion>
<AssemblyVersion>1.2.0</AssemblyVersion>
<FileVersion>1.2.0</FileVersion>
<Version>1.2.0</Version>
<PackageVersion>1.3.1</PackageVersion>
<AssemblyVersion>1.3.1</AssemblyVersion>
<FileVersion>1.3.1</FileVersion>
<Version>1.3.1</Version>
<Authors>Philterd, LLC</Authors>
<Company>Philterd, LLC</Company>
</PropertyGroup>
Expand All @@ -17,11 +17,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentSimulator" Version="2.0.49" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="coverlet.collector" Version="1.2.0">
<PackageReference Include="FluentSimulator" Version="2.1.9" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" />
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
28 changes: 16 additions & 12 deletions philter-sdk-net/PhilterClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ public PhilterClient(string endpoint, string certificatePfx, SecureString privat
{
X509Certificate2 certificate = new X509Certificate2(certificatePfx, privateKeyPassword, X509KeyStorageFlags.MachineKeySet);

_client = new RestClient(endpoint);
_client.ClientCertificates = new X509CertificateCollection() { certificate };
var options = new RestClientOptions(endpoint)
{
ClientCertificates = new X509CertificateCollection() { certificate }
};
_client = new RestClient(options);

}

/// <summary>
Expand Down Expand Up @@ -91,7 +95,7 @@ public string Filter(string text, string context, string policyName)
public string Filter(string text, string context, string documentId, string policyName)
{

var request = new RestRequest("api/filter", Method.POST);
var request = new RestRequest("api/filter", Method.Post);
request.AddParameter("c", context);
request.AddParameter("p", policyName);
request.AddHeader("accept", "text/plain");
Expand Down Expand Up @@ -125,7 +129,7 @@ public string Filter(string text, string context, string documentId, string poli
/// <exception cref="ClientException"></exception>
public byte[] Filter(String fileName, string context, string documentId, string policyName, ResponseFormat responseFormat)
{
var request = new RestRequest("api/filter", Method.POST);
var request = new RestRequest("api/filter", Method.Post);

var bytes = File.ReadAllBytes(fileName);

Expand Down Expand Up @@ -176,7 +180,7 @@ public ExplainResponse Explain(string text, string context, string policyName)
public ExplainResponse Explain(string text, string context, string documentId, string policyName)
{

var request = new RestRequest("api/explain", Method.POST);
var request = new RestRequest("api/explain", Method.Post);
request.AddParameter("c", context);
request.AddParameter("p", policyName);
request.AddHeader("accept", "application/json");
Expand Down Expand Up @@ -206,7 +210,7 @@ public ExplainResponse Explain(string text, string context, string documentId, s
public StatusResponse GetStatus()
{

var request = new RestRequest("api/status", Method.GET);
var request = new RestRequest("api/status", Method.Get);

var response = _client.Execute(request);

Expand All @@ -227,7 +231,7 @@ public StatusResponse GetStatus()
public List<Alert> GetAlerts()
{

var request = new RestRequest("api/alerts", Method.GET);
var request = new RestRequest("api/alerts", Method.Get);
request.AddHeader("accept", "application/json");

var response = _client.Execute(request);
Expand Down Expand Up @@ -256,7 +260,7 @@ public List<Alert> GetAlerts()
public void DeleteAlert(string alertId)
{

var request = new RestRequest("api/alerts/{alertId}", Method.DELETE).AddParameter("alertId", alertId);
var request = new RestRequest("api/alerts/{alertId}", Method.Delete).AddParameter("alertId", alertId);

var response = _client.Execute(request);

Expand All @@ -275,7 +279,7 @@ public void DeleteAlert(string alertId)
public List<string> GetPolicies()
{

var request = new RestRequest("api/profiles", Method.GET);
var request = new RestRequest("api/profiles", Method.Get);
request.AddHeader("accept", "application/json");

var response = _client.Execute(request);
Expand All @@ -298,7 +302,7 @@ public List<string> GetPolicies()
public string GetPolicy(string policyName)
{

var request = new RestRequest("api/profiles/{policyName}", Method.GET);
var request = new RestRequest("api/profiles/{policyName}", Method.Get);
request.AddParameter("policyName", policyName, ParameterType.UrlSegment);
request.AddHeader("accept", "application/json");

Expand All @@ -321,7 +325,7 @@ public string GetPolicy(string policyName)
public void SavePolicy(string policy)
{

var request = new RestRequest("api/profiles", Method.POST);
var request = new RestRequest("api/profiles", Method.Post);
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", policy, ParameterType.RequestBody);

Expand All @@ -342,7 +346,7 @@ public void SavePolicy(string policy)
public void DeletePolicy(string policyName)
{

var request = new RestRequest("api/profiles/{policyName}", Method.DELETE);
var request = new RestRequest("api/profiles/{policyName}", Method.Delete);
request.AddParameter("policyName", policyName, ParameterType.UrlSegment);

var response = _client.Execute(request);
Expand Down
22 changes: 11 additions & 11 deletions philter-sdk-net/philter-sdk-net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@
<Product>Philter .NET SDK</Product>
<Copyright>Copyright 2023 Philterd, LLC</Copyright>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<Description>The Philter SDK for .NET enables .NET developers to easily integrate their applications with Philter to identify and remove sensitive information, such as Protected Health Information (PHI) and personally identifiable information (PII), from natural language text.</Description>
<Description>The Philter SDK for .NET is a client for de-identifying and redacting text using Philter.</Description>
<PackageProjectUrl>https://github.com/philterd/philter-sdk-net</PackageProjectUrl>
<RepositoryUrl>https://github.com/mtnfog/philter-sdk-net</RepositoryUrl>
<RepositoryUrl>https://github.com/philterd/philter-sdk-net</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>philter pii phi deidentify redact deidentification redaction</PackageTags>
<PackageIcon>icon.png</PackageIcon>
<PackageReleaseNotes>See https://github.com/mtnfog/philter-sdk-net for a list of changes.</PackageReleaseNotes>
<PackageReleaseNotes>See https://github.com/philterd/philter-sdk-net for a list of changes.</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageVersion>1.3.0</PackageVersion>
<AssemblyVersion>1.3.0</AssemblyVersion>
<FileVersion>1.3.0</FileVersion>
<Version>1.3.0</Version>
<PackageVersion>1.3.1</PackageVersion>
<AssemblyVersion>1.3.1</AssemblyVersion>
<FileVersion>1.3.1</FileVersion>
<Version>1.3.1</Version>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Title>philter-sdk-net</Title>
<PackageReadmeFile>README.md</PackageReadmeFile>
<TargetFramework>net7.0</TargetFramework>
<PackageId>philter-sdk-net</PackageId>
<PackageId>Philterd.Philter.Client</PackageId>
<Company>Philterd, LLC</Company>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="RestSharp" Version="106.12.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RestSharp" Version="110.2.0" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" PrivateAssets="All" Version="1.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit de99bf2

Please sign in to comment.