Skip to content

Commit

Permalink
some cleanup and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Genteure committed Dec 10, 2022
1 parent 55e18f7 commit 2413920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 59 deletions.
59 changes: 0 additions & 59 deletions src/Naprise.Service.MailKit/MailKitEmail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,65 +152,6 @@ public override async Task NotifyAsync(Message message, CancellationToken cancel

await client.SendAsync(mime, cancellationToken).ConfigureAwait(false);
await client.DisconnectAsync(true, cancellationToken).ConfigureAwait(false);

// TODO build the message body
/*
var payload = new Payload
{
// TODO fill payload
// TODO check message.Type
};
var url = new Url($"{(true ? "https" : "http")}://{"localhost"}").AppendPathSegments("example");
var content = JsonContent.Create(payload, options: null);
cancellationToken.ThrowIfCancellationRequested();
var resp = await this.HttpClientFactory().PostAsync(url, content, cancellationToken);
var respText = await resp.Content.ReadAsStringAsync();
if (!resp.IsSuccessStatusCode)
{
throw new NapriseNotifyFailedException($"Failed to send notification to {nameof(MailKit)}: {resp.StatusCode}") // TODO change class name
{
Notifier = this,
Notification = message,
ResponseStatus = resp.StatusCode,
ResponseBody = respText,
};
}
try
{
var jobj = JsonDocument.Parse(respText);
// TODO parse response and check if it's successful
var status = jobj.RootElement.GetProperty("status").GetString();
if (status != "ok")
{
var respMessage = jobj.RootElement.GetProperty("message").GetString();
throw new NapriseNotifyFailedException($"Failed to send notification to {nameof(MailKit)}: \"{respMessage}\"")
{
Notifier = this,
Notification = message,
ResponseStatus = resp.StatusCode,
ResponseBody = respText,
};
}
}
catch (Exception ex)
{
throw new NapriseNotifyFailedException($"Failed to send notification to {nameof(MailKit)}", ex)
{
Notifier = this,
Notification = message,
ResponseStatus = resp.StatusCode,
ResponseBody = respText,
};
}
*/
}

private class Payload
{
// TODO add payload
}

internal readonly struct EmailPlatform
Expand Down
6 changes: 6 additions & 0 deletions src/dotnet-releaser.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ kinds = ["tar"]
rid = ["osx-x64", "osx-arm64"]
kinds = ["tar"]

[brew]
publish = false

[scoop]
publish = false

[nuget]
publish = true

Expand Down

0 comments on commit 2413920

Please sign in to comment.