Skip to content

Commit

Permalink
Moved the communication projects; fixed the implementations of IConfi…
Browse files Browse the repository at this point in the history
…gureIHostApplicationBuilder
  • Loading branch information
dgmjr committed Jan 30, 2024
1 parent 0413e25 commit 9a665cc
Show file tree
Hide file tree
Showing 100 changed files with 1,374 additions and 630 deletions.

This file was deleted.

6 changes: 6 additions & 0 deletions src/Communication/.vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sonarlint.connectedMode.project": {
"connectionId": "dgmjr-io",
"projectKey": "dgmjr-io_Dgmjr.Communication"
}
}
21 changes: 21 additions & 0 deletions src/Communication/All/Dgmjr.Azure.CommunicationServices.All.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
* Dgmjr.Azure.CommunicationServices.csproj
*
* Created: 2024-40-29T05:40:02-05:00
* Modified: 2024-40-29T05:40:02-05:00
*
* Author: David G. Moore, Jr. <[email protected]>
*
* Copyright © 2024 David G. Moore, Jr., All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
-->

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(TargetedDotNetFrameworks)</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="../Communcation/Dgmjr.Azure.CommunicationServices.csproj" />
<ProjectReference Include="../Communication.Abstractions/Dgmjr.Azure.CommunicationServices.Abstractions.csproj" />
</ItemGroup>
</Project>
70 changes: 70 additions & 0 deletions src/Communication/All/Dgmjr.Azure.CommunicationServices.All.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Microsoft Visual Studio Solution File, Format Version 12.00
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props
..\..\..\..\..\Directory.Build.targets = ..\..\..\..\..\Directory.Build.targets
..\..\..\..\..\global.json = ..\..\..\..\..\global.json
..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices", "..\Communcation\Dgmjr.Azure.CommunicationServices.csproj", "{3D36177C-5640-4BA3-86FD-7E73A849EC55}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices.Abstractions", "..\Communication.Abstractions\Dgmjr.Azure.CommunicationServices.Abstractions.csproj", "{8C663B7A-804D-457E-ADCB-5AAF9390387F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices.All", "Dgmjr.Azure.CommunicationServices.All.csproj", "{F8812B66-F966-497B-9777-752226D538FC}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Local|Any CPU = Local|Any CPU
Debug|Any CPU = Debug|Any CPU
Testing|Any CPU = Testing|Any CPU
Staging|Any CPU = Staging|Any CPU
Production|Any CPU = Production|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.ActiveCfg = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.Build.0 = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.Build.0 = Testing|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.Build.0 = Staging|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.ActiveCfg = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.Build.0 = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.Build.0 = Release|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Local|Any CPU.ActiveCfg = Local|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Local|Any CPU.Build.0 = Local|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Testing|Any CPU.Build.0 = Testing|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Staging|Any CPU.Build.0 = Staging|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Production|Any CPU.ActiveCfg = Local|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Production|Any CPU.Build.0 = Local|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8C663B7A-804D-457E-ADCB-5AAF9390387F}.Release|Any CPU.Build.0 = Release|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Local|Any CPU.ActiveCfg = Local|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Local|Any CPU.Build.0 = Local|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Testing|Any CPU.Build.0 = Testing|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Staging|Any CPU.Build.0 = Staging|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Production|Any CPU.ActiveCfg = Local|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Production|Any CPU.Build.0 = Local|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8812B66-F966-497B-9777-752226D538FC}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BA9DF526-DE32-44E2-A6AB-12A4E855F480}
EndGlobalSection
EndGlobal
File renamed without changes.
Binary file added src/Communication/All/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void Configure(IApplicationBuilder builder)
}
}

public void Configure(IHostApplicationBuilder builder)
public void Configure(WebApplicationBuilder builder)
{
var optionsSection = builder.Configuration.GetSection(
AzureCommunicationServicesOptionsBase.ConfigurationSectionName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<SlnGenSolutionFolder>comms</SlnGenSolutionFolder>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<TargetFrameworks>$(TargetedDotNetFrameworks)</TargetFrameworks>
<ProjectGuid>3d36177c-5640-4ba3-86fd-7e73a849ec55</ProjectGuid>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
Expand All @@ -24,16 +25,19 @@
<PackageReference Include="Azure.Communication.Email" />
<PackageReference Include="Azure.Communication.Sms" />
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Dgmjr.Primitives" />
<PackageReference Include="Dgmjr.Configuration.Extensions" />
<PackageReference Include="Dgmjr.Enumerations.Abstractions" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="Dgmjr.Enumerations.CodeGenerator" IncludeAssets="Analyzers;Build" ExcludeAssets="Native;BuildTransitive;BuildMultitargeting;ContentFiles;Compile;Runtime" PrivateAssets="All" />
<PackageReference Include="Dgmjr.Primitives" />
<PackageReference Include="Dgmjr.RegexDtoGenerator" IncludeAssets="Analyzers;Build" ExcludeAssets="Native;BuildTransitive;BuildMultitargeting;ContentFiles;Compile;Runtime" PrivateAssets="All" />
<ProjectReference Include="../Communication.Abstractions/Dgmjr.AspNetCore.Communication.Abstractions.csproj" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" />
<PackageReference Include="Microsoft.Extensions.Options" />
<PackageReference Include="System.Polyfills" />
<ProjectReference Include="../Communication.Abstractions/Dgmjr.Azure.CommunicationServices.Abstractions.csproj" />
</ItemGroup>
<ItemGroup>
<Using Include="Dgmjr.Enumerations" />
<Using Include="System.Domain" />
<Using Include="System.Net.Mail" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
Microsoft Visual Studio Solution File, Format Version 12.00
#
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}"
ProjectSection(SolutionItems) = preProject
..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props
..\..\..\..\..\Directory.Build.targets = ..\..\..\..\..\Directory.Build.targets
..\..\..\..\..\global.json = ..\..\..\..\..\global.json
..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices.Abstractions", "..\Communication.Abstractions\Dgmjr.Azure.CommunicationServices.Abstractions.csproj", "{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices", "Dgmjr.Azure.CommunicationServices.csproj", "{3D36177C-5640-4BA3-86FD-7E73A849EC55}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Local|Any CPU = Local|Any CPU
Debug|Any CPU = Debug|Any CPU
Testing|Any CPU = Testing|Any CPU
Staging|Any CPU = Staging|Any CPU
Production|Any CPU = Production|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Local|Any CPU.ActiveCfg = Local|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Local|Any CPU.Build.0 = Local|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Testing|Any CPU.Build.0 = Testing|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Staging|Any CPU.Build.0 = Staging|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Production|Any CPU.ActiveCfg = Local|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Production|Any CPU.Build.0 = Local|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Release|Any CPU.Build.0 = Release|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.ActiveCfg = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.Build.0 = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.ActiveCfg = Testing|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.Build.0 = Testing|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.Build.0 = Staging|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.ActiveCfg = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.Build.0 = Local|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {991D96AC-24E8-4358-9F0C-99BE9D5C3BE5}
EndGlobalSection
EndGlobal
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ public record class EmailSenderOptions : AzureCommunicationServicesOptions<Email
public new const string ConfigurationSectionName =
$"{AzureCommunicationServicesOptionsBase.ConfigurationSectionName}:Email";

public override required EmailAddress DefaultFrom { get; set; }
[Required]
public override EmailAddress DefaultFrom { get; set; }

public static new EmailSenderOptions Parse(string connectionString)
{
var options = AzureCommunicationServicesOptions<EmailAddress>.Parse(connectionString);
return new EmailSenderOptions(options);
}

[SetsRequiredMembers]
public EmailSenderOptions(
AzureCommunicationServicesOptionsBase options,
EmailAddress? defaultFrom = null
Expand All @@ -41,7 +41,6 @@ public EmailSenderOptions(
AccessKey = options.AccessKey;
}

[SetsRequiredMembers]
public EmailSenderOptions(AzureCommunicationServicesOptions<EmailAddress> options)
: base(options)
{
Expand All @@ -51,19 +50,19 @@ public EmailSenderOptions(AzureCommunicationServicesOptions<EmailAddress> option
SecurityFrom = options.SecurityFrom;
}

[SetsRequiredMembers]
public EmailSenderOptions(string connectionString, EmailAddress? defaultFrom = null)
: this(Parse(connectionString) with { DefaultFrom = defaultFrom ?? EmailAddress.Empty }) { }

[SetsRequiredMembers]
public EmailSenderOptions(string endpoint, string accessKey, EmailAddress? defaultFrom = null)
{
DefaultFrom = defaultFrom ?? EmailAddress.Empty;
Endpoint = endpoint;
AccessKey = accessKey;
}

[SetsRequiredMembers]
public EmailSenderOptions()
: this(EmptyValue) { }

public IDictionary<string, EmailAddress> Addresses { get; set; } =
new Dictionary<string, EmailAddress>();
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
namespace Dgmjr.AspNetCore.Communication.Email;

using System.Runtime.CompilerServices;

/// <summary>
/// Represents the result of sending an email.
/// </summary>
public readonly record struct MailSendResult : IMailSendResult
public readonly record struct MailSendResult(Azure.Communication.Email.EmailSendResult result)
: IMailSendResult
{
/// <summary>
/// Gets or sets the response code of the email send result.
/// </summary>
public Abstractions.IMailSendResponseCode Status
{
get => MailSendResponseCode.FromId(StatusCode)!;
init => StatusCode = ((IIdentifiable<int>)value).Id;
}
public Abstractions.IMailSendResponseCode Status => MailSendResponseCode.Parse(StatusName);

public string StatusName => result.Status.ToString();

/// <summary>
/// Gets a value indicating whether the email send operation was successful.
Expand All @@ -24,5 +25,5 @@ public Abstractions.IMailSendResponseCode Status
/// <summary>
/// Gets or sets the status code of the email send result.
/// </summary>
public int StatusCode { get; init; }
public int StatusCode => ((IIdentifiable<int>)Status).Id;
}
File renamed without changes.
34 changes: 34 additions & 0 deletions src/Communication/Communcation/Sms/SmsSendResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
namespace Dgmjr.AspNetCore.Communication.Sms;

/// <summary>
/// Represents the result of sending an SMS message.
/// </summary>
public readonly record struct SmsSendResult(Azure.Communication.Sms.SmsSendResult result)
: ISmsSendResult
{
// public SmsSendResult
// {
// StatusCode = result.HttpStatusCode;
// ErrorMessage = result.ErrorMessage;
// To = (PhoneNumber)result.To;
// }

public string? ErrorMessage => result.ErrorMessage;
public PhoneNumber To => (PhoneNumber)result.To;

/// <summary>
/// Gets the status code of the message send result.
/// </summary>
public int StatusCode => result.HttpStatusCode;

/// <summary>
/// Gets a value indicating whether the SMS message was sent successfully.
/// </summary>
public bool IsSuccess =>
StatusCode is SmsSendResponseCode.Success.Id or SmsSendResponseCode.Accepted.Id;

/// <summary>
/// Gets or sets the response code of the SMS send result.
/// </summary>
public Abstractions.ISmsSendResponseCode Status => SmsSendResponseCode.FromId(StatusCode);
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@ public SmsSenderOptions(string connectionString, PhoneNumber? fromPhoneNumber)
{
DefaultFrom = fromPhoneNumber.HasValue ? fromPhoneNumber.Value : PhoneNumber.Empty;
}

public IDictionary<string, PhoneNumber> Numbers { get; set; } =
new Dictionary<string, PhoneNumber>();
}
Binary file added src/Communication/Communcation/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9a665cc

Please sign in to comment.