diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index dc9a596..028e028 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -51,9 +51,8 @@ jobs:
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
- 6.0.x
- 7.0.x
8.0.x
+ 9.0.x
- name: Checkout Wiremock fixtures repo
uses: actions/checkout@v3
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
index d89ab26..a2e7c7f 100644
--- a/.github/workflows/publish.yaml
+++ b/.github/workflows/publish.yaml
@@ -8,7 +8,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
- dotnet-version: '8.0.x'
+ dotnet-version: '9.0.x'
# https://github.com/dawidd6/action-download-artifact
- name: Download artifact
diff --git a/README.md b/README.md
index ff7cdaa..cefd76a 100644
--- a/README.md
+++ b/README.md
@@ -2,9 +2,8 @@
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/sinch/sinch-sdk-dotnet/blob/main/LICENSE)
-[![.NET 6.0](https://img.shields.io/badge/.NET-6.0-blue.svg)](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
-[![.NET 7.0](https://img.shields.io/badge/.NET-7.0-blue.svg)](https://dotnet.microsoft.com/en-us/download/dotnet/7.0)
[![.NET 8.0](https://img.shields.io/badge/.NET-8.0-blue.svg)](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
+[![.NET 9.0](https://img.shields.io/badge/.NET-9.0-blue.svg)](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
Here you'll find documentation related to the Sinch .NET SDK, including how to install it, initialize it, and start developing .NET code using Sinch services.
diff --git a/examples/Console/Examples.csproj b/examples/Console/Examples.csproj
index b5dafb5..63cdedf 100644
--- a/examples/Console/Examples.csproj
+++ b/examples/Console/Examples.csproj
@@ -4,11 +4,11 @@
Exe
enable
enable
- net7.0
+ net8.0
-
+
diff --git a/examples/WebApi/Controllers/HandleFaxEventController.cs b/examples/WebApi/Controllers/HandleFaxEventController.cs
index a38eb23..8714f3a 100644
--- a/examples/WebApi/Controllers/HandleFaxEventController.cs
+++ b/examples/WebApi/Controllers/HandleFaxEventController.cs
@@ -9,7 +9,7 @@ namespace WebApiExamples.Controllers
[Route("fax")]
public class HandleFaxEventController : ControllerBase
{
- private List _incomingFaxIds = new(); // track fax ids which was sent
+ private readonly List _incomingFaxIds = new(); // track fax ids which was sent
[HttpPost]
[Route("event-json")]
@@ -19,15 +19,22 @@ public async Task HandleJsonEvent([FromBody] IFaxEvent faxEvent)
{
case IncomingFaxEvent incomingFaxEvent:
// just track fax ids for future
- _incomingFaxIds.Add(incomingFaxEvent.Fax.Id);
+ if (incomingFaxEvent?.Fax?.Id is not null)
+ {
+ _incomingFaxIds.Add(incomingFaxEvent.Fax.Id);
+ }
break;
case CompletedFaxEvent completedFaxEvent:
// download if fax completed
foreach (var file in completedFaxEvent.Files)
{
+ if (file.File is null || completedFaxEvent.Fax is null)
+ {
+ continue;
+ }
var bytes = Convert.FromBase64String(file.File);
var contents = new MemoryStream(bytes);
- var fileName = completedFaxEvent.Fax.Id + "." + file.FileType.Value.ToLower();
+ var fileName = completedFaxEvent.Fax.Id + "." + file.FileType?.Value.ToLower();
await SaveFile(fileName, contents);
}
break;
diff --git a/examples/WebApi/WebApiExamples.csproj b/examples/WebApi/WebApiExamples.csproj
index 482711f..d965fb1 100644
--- a/examples/WebApi/WebApiExamples.csproj
+++ b/examples/WebApi/WebApiExamples.csproj
@@ -1,7 +1,7 @@
- net7.0
+ net8.0
enable
enable
f6d17a10-702c-41a9-b9e3-8f42339006f6
diff --git a/src/Sinch/Auth/OAuth.cs b/src/Sinch/Auth/OAuth.cs
index 5791942..f05f5d5 100644
--- a/src/Sinch/Auth/OAuth.cs
+++ b/src/Sinch/Auth/OAuth.cs
@@ -82,7 +82,7 @@ private class AuthResponse
{
[JsonPropertyName("access_token")]
#if NET7_0_OR_GREATER
- public required string AccessToken { get; set; }
+ public required string AccessToken { get; set; }
#else
public string AccessToken { get; set; } = null!;
#endif
diff --git a/src/Sinch/Conversation/TemplatesV2/CreateTemplateRequest.cs b/src/Sinch/Conversation/TemplatesV2/CreateTemplateRequest.cs
index 7115b75..bd23cdc 100644
--- a/src/Sinch/Conversation/TemplatesV2/CreateTemplateRequest.cs
+++ b/src/Sinch/Conversation/TemplatesV2/CreateTemplateRequest.cs
@@ -19,7 +19,7 @@ public class CreateTemplateRequest
/// Gets or Sets Translations
///
#if NET7_0_OR_GREATER
- public required List Translations { get; set; }
+ public required List Translations { get; set; }
#else
public List Translations { get; set; } = null!;
#endif
diff --git a/src/Sinch/Conversation/TemplatesV2/Template.cs b/src/Sinch/Conversation/TemplatesV2/Template.cs
index 75aa536..bff4a12 100644
--- a/src/Sinch/Conversation/TemplatesV2/Template.cs
+++ b/src/Sinch/Conversation/TemplatesV2/Template.cs
@@ -11,7 +11,7 @@ public class Template
/// be unique for a given project.
///
#if NET7_0_OR_GREATER
-public required string Id { get; set; }
+ public required string Id { get; set; }
#else
public string Id { get; set; } = null!;
#endif
diff --git a/src/Sinch/Conversation/Webhooks/Webhook.cs b/src/Sinch/Conversation/Webhooks/Webhook.cs
index ffa5101..8627b99 100644
--- a/src/Sinch/Conversation/Webhooks/Webhook.cs
+++ b/src/Sinch/Conversation/Webhooks/Webhook.cs
@@ -92,7 +92,7 @@ public string? Secret
/// Maximum URL length is 742. The conversation-api.*.sinch.com subdomains are forbidden.
///
#if NET7_0_OR_GREATER
- public required string Target
+ public required string Target
#else
public string Target
#endif
diff --git a/src/Sinch/Core/StreamExtensions.cs b/src/Sinch/Core/StreamExtensions.cs
index 0fc10ed..0a8d858 100644
--- a/src/Sinch/Core/StreamExtensions.cs
+++ b/src/Sinch/Core/StreamExtensions.cs
@@ -16,7 +16,7 @@ public static string ConvertToBase64(this Stream stream)
var bytes = new Byte[(int)stream.Length];
stream.Seek(0, SeekOrigin.Begin);
- stream.Read(bytes, 0, (int)stream.Length);
+ stream.ReadExactly(bytes, 0, (int)stream.Length);
return Convert.ToBase64String(bytes);
}
diff --git a/src/Sinch/SMS/Groups/Replace/ReplaceGroupRequest.cs b/src/Sinch/SMS/Groups/Replace/ReplaceGroupRequest.cs
index 7dbd007..0356ecc 100644
--- a/src/Sinch/SMS/Groups/Replace/ReplaceGroupRequest.cs
+++ b/src/Sinch/SMS/Groups/Replace/ReplaceGroupRequest.cs
@@ -21,7 +21,7 @@ public sealed class ReplaceGroupRequest
/// E.164 format MSISDNs.
///
#if NET7_0_OR_GREATER
- public required List Members { get; init; }
+ public required List Members { get; init; }
#else
public List Members { get; set; } = null!;
#endif
diff --git a/src/Sinch/SMS/Hooks/IncomingTextSms.cs b/src/Sinch/SMS/Hooks/IncomingTextSms.cs
index cc8afb5..e9984ac 100644
--- a/src/Sinch/SMS/Hooks/IncomingTextSms.cs
+++ b/src/Sinch/SMS/Hooks/IncomingTextSms.cs
@@ -16,7 +16,7 @@ public class IncomingTextSms : IIncomingSms
///
[JsonPropertyName("body")]
#if NET7_0_OR_GREATER
- public required virtual string Body { get; set; }
+ public required virtual string Body { get; set; }
#else
public virtual string Body { get; set; } = null!;
#endif
diff --git a/src/Sinch/Sinch.csproj b/src/Sinch/Sinch.csproj
index 358e6c6..13901ae 100644
--- a/src/Sinch/Sinch.csproj
+++ b/src/Sinch/Sinch.csproj
@@ -2,7 +2,7 @@
enable
- net6.0;net7.0;net8.0
+ net8.0;net9.0
https://github.com/sinch/sinch-sdk-dotnet
0.1.0
Sinch
diff --git a/tests/Sinch.Tests/Sinch.Tests.csproj b/tests/Sinch.Tests/Sinch.Tests.csproj
index b68876a..09409f6 100644
--- a/tests/Sinch.Tests/Sinch.Tests.csproj
+++ b/tests/Sinch.Tests/Sinch.Tests.csproj
@@ -5,11 +5,11 @@
false
true
- net6.0;net7.0;net8.0
+ net8.0;net9.0
-
+