file scoped namespaces (#565)
This commit is contained in:
@@ -6,31 +6,30 @@ using Serilog;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Core.Domain.Models.Reader;
|
||||
|
||||
namespace Wino.Core.Services
|
||||
namespace Wino.Core.Services;
|
||||
|
||||
public class UnsubscriptionService : IUnsubscriptionService
|
||||
{
|
||||
public class UnsubscriptionService : IUnsubscriptionService
|
||||
public async Task<bool> OneClickUnsubscribeAsync(UnsubscribeInfo info)
|
||||
{
|
||||
public async Task<bool> OneClickUnsubscribeAsync(UnsubscribeInfo info)
|
||||
try
|
||||
{
|
||||
try
|
||||
using var httpClient = new HttpClient();
|
||||
|
||||
var unsubscribeRequest = new HttpRequestMessage(HttpMethod.Post, info.HttpLink)
|
||||
{
|
||||
using var httpClient = new HttpClient();
|
||||
Content = new StringContent("List-Unsubscribe=One-Click", Encoding.UTF8, "application/x-www-form-urlencoded")
|
||||
};
|
||||
|
||||
var unsubscribeRequest = new HttpRequestMessage(HttpMethod.Post, info.HttpLink)
|
||||
{
|
||||
Content = new StringContent("List-Unsubscribe=One-Click", Encoding.UTF8, "application/x-www-form-urlencoded")
|
||||
};
|
||||
var result = await httpClient.SendAsync(unsubscribeRequest).ConfigureAwait(false);
|
||||
|
||||
var result = await httpClient.SendAsync(unsubscribeRequest).ConfigureAwait(false);
|
||||
|
||||
return result.IsSuccessStatusCode;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("Failed to unsubscribe from {HttpLink} - {Message}", info.HttpLink, ex.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
return result.IsSuccessStatusCode;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error("Failed to unsubscribe from {HttpLink} - {Message}", info.HttpLink, ex.Message);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user