From 5262c595090462a6bad5bd1607eef4dc49777f83 Mon Sep 17 00:00:00 2001 From: Kieran Date: Fri, 2 Feb 2024 16:44:28 +0000 Subject: [PATCH] Move models to client lib --- .../LinkPreviewData.cs | 2 +- NostrServices.Client/NostrServices.Client.csproj | 7 ++----- NostrServices.Client/NostrServicesClient.cs | 1 - .../Profile.cs | 2 +- .../RelayDistance.cs | 2 +- NostrServices.Model/NostrServices.Model.csproj | 15 --------------- NostrServices.sln | 6 ------ NostrServices/Controllers/ImportController.cs | 2 +- .../Controllers/LinkPreviewController.cs | 2 +- NostrServices/Controllers/OpenGraphController.cs | 2 +- NostrServices/Controllers/RelaysController.cs | 8 ++++---- NostrServices/Extensions.cs | 2 +- NostrServices/NostrServices.csproj | 2 +- .../Services/EventHandlers/RedisEventCache.cs | 2 +- NostrServices/Services/RedisStore.cs | 2 +- 15 files changed, 16 insertions(+), 41 deletions(-) rename {NostrServices.Model => NostrServices.Client}/LinkPreviewData.cs (95%) rename {NostrServices.Model => NostrServices.Client}/Profile.cs (98%) rename {NostrServices.Model => NostrServices.Client}/RelayDistance.cs (96%) delete mode 100644 NostrServices.Model/NostrServices.Model.csproj diff --git a/NostrServices.Model/LinkPreviewData.cs b/NostrServices.Client/LinkPreviewData.cs similarity index 95% rename from NostrServices.Model/LinkPreviewData.cs rename to NostrServices.Client/LinkPreviewData.cs index 92fdf01..a536221 100644 --- a/NostrServices.Model/LinkPreviewData.cs +++ b/NostrServices.Client/LinkPreviewData.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using ProtoBuf; -namespace NostrServices.Model; +namespace NostrServices.Client; [ProtoContract] public class LinkPreviewData diff --git a/NostrServices.Client/NostrServices.Client.csproj b/NostrServices.Client/NostrServices.Client.csproj index 91c914a..3b19170 100644 --- a/NostrServices.Client/NostrServices.Client.csproj +++ b/NostrServices.Client/NostrServices.Client.csproj @@ -6,7 +6,7 @@ enable true https://git.v0l.io/Kieran/NostrServices - 1.0.2 + 1.0.3 Kieran Client wrapper for https://nostr.api.v0l.io https://git.v0l.io/Kieran/NostrServices @@ -17,10 +17,7 @@ - - - - + diff --git a/NostrServices.Client/NostrServicesClient.cs b/NostrServices.Client/NostrServicesClient.cs index ffe12cc..0bece61 100644 --- a/NostrServices.Client/NostrServicesClient.cs +++ b/NostrServices.Client/NostrServicesClient.cs @@ -2,7 +2,6 @@ using System.Net.Http.Headers; using Newtonsoft.Json; using Nostr.Client.Json; using Nostr.Client.Messages; -using NostrServices.Model; namespace NostrServices.Client; diff --git a/NostrServices.Model/Profile.cs b/NostrServices.Client/Profile.cs similarity index 98% rename from NostrServices.Model/Profile.cs rename to NostrServices.Client/Profile.cs index 5cfbd1b..b437c10 100644 --- a/NostrServices.Model/Profile.cs +++ b/NostrServices.Client/Profile.cs @@ -5,7 +5,7 @@ using Nostr.Client.Messages; using Nostr.Client.Messages.Metadata; using ProtoBuf; -namespace NostrServices.Model; +namespace NostrServices.Client; [ProtoContract] public class CompactProfile diff --git a/NostrServices.Model/RelayDistance.cs b/NostrServices.Client/RelayDistance.cs similarity index 96% rename from NostrServices.Model/RelayDistance.cs rename to NostrServices.Client/RelayDistance.cs index 28548df..bdf1594 100644 --- a/NostrServices.Model/RelayDistance.cs +++ b/NostrServices.Client/RelayDistance.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace NostrServices.Model; +namespace NostrServices.Client; public class RelayDistance { diff --git a/NostrServices.Model/NostrServices.Model.csproj b/NostrServices.Model/NostrServices.Model.csproj deleted file mode 100644 index 076b41a..0000000 --- a/NostrServices.Model/NostrServices.Model.csproj +++ /dev/null @@ -1,15 +0,0 @@ - - - - net8.0 - enable - enable - - - - - - - - - diff --git a/NostrServices.sln b/NostrServices.sln index b134b21..4ffb49f 100644 --- a/NostrServices.sln +++ b/NostrServices.sln @@ -19,8 +19,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PayForReactions", "PayForRe EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NostrServices.Client", "NostrServices.Client\NostrServices.Client.csproj", "{17CA7036-95BC-4851-BAB1-419996EA2761}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NostrServices.Model", "NostrServices.Model\NostrServices.Model.csproj", "{70E7A5B7-005F-4EEE-9C0D-7FFB1389ED2A}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -51,9 +49,5 @@ Global {17CA7036-95BC-4851-BAB1-419996EA2761}.Debug|Any CPU.Build.0 = Debug|Any CPU {17CA7036-95BC-4851-BAB1-419996EA2761}.Release|Any CPU.ActiveCfg = Release|Any CPU {17CA7036-95BC-4851-BAB1-419996EA2761}.Release|Any CPU.Build.0 = Release|Any CPU - {70E7A5B7-005F-4EEE-9C0D-7FFB1389ED2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {70E7A5B7-005F-4EEE-9C0D-7FFB1389ED2A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {70E7A5B7-005F-4EEE-9C0D-7FFB1389ED2A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {70E7A5B7-005F-4EEE-9C0D-7FFB1389ED2A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/NostrServices/Controllers/ImportController.cs b/NostrServices/Controllers/ImportController.cs index b16bdf2..c9a9c4b 100644 --- a/NostrServices/Controllers/ImportController.cs +++ b/NostrServices/Controllers/ImportController.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc; using Newtonsoft.Json; using Nostr.Client.Json; using Nostr.Client.Messages; -using NostrServices.Model; +using NostrServices.Client; using NostrServices.Services; namespace NostrServices.Controllers; diff --git a/NostrServices/Controllers/LinkPreviewController.cs b/NostrServices/Controllers/LinkPreviewController.cs index 85fcbcc..91cf28f 100644 --- a/NostrServices/Controllers/LinkPreviewController.cs +++ b/NostrServices/Controllers/LinkPreviewController.cs @@ -3,7 +3,7 @@ using System.Text; using AngleSharp; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Caching.Memory; -using NostrServices.Model; +using NostrServices.Client; using StackExchange.Redis; namespace NostrServices.Controllers; diff --git a/NostrServices/Controllers/OpenGraphController.cs b/NostrServices/Controllers/OpenGraphController.cs index 7245b11..eb83d32 100644 --- a/NostrServices/Controllers/OpenGraphController.cs +++ b/NostrServices/Controllers/OpenGraphController.cs @@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc; using Nostr.Client.Identifiers; using Nostr.Client.Messages; using Nostr.Client.Utils; -using NostrServices.Model; +using NostrServices.Client; using NostrServices.Services; using ProtoBuf; diff --git a/NostrServices/Controllers/RelaysController.cs b/NostrServices/Controllers/RelaysController.cs index ebc83a3..a9334ad 100644 --- a/NostrServices/Controllers/RelaysController.cs +++ b/NostrServices/Controllers/RelaysController.cs @@ -45,10 +45,10 @@ public class LatLonReq public static class RelayDistanceExtension { - public static Model.RelayDistance FromDistance(this RelayDistance x) + public static Client.RelayDistance FromDistance(this RelayDistance x) { var rp = x.Relay.Positions.FirstOrDefault(a => a.IpAddress == x.IpAddress) ?? x.Relay.Positions.First(); - return new Model.RelayDistance() + return new Client.RelayDistance() { Url = x.Relay.Url, Distance = x.Distance, @@ -63,10 +63,10 @@ public static class RelayDistanceExtension }; } - public static Model.RelayDistance FromInfo(this RelayInfo x) + public static Client.RelayDistance FromInfo(this RelayInfo x) { var rp = x.Positions.First(); - return new Model.RelayDistance() + return new Client.RelayDistance() { Url = x.Url, Distance = 0, diff --git a/NostrServices/Extensions.cs b/NostrServices/Extensions.cs index 328fc91..562e73f 100644 --- a/NostrServices/Extensions.cs +++ b/NostrServices/Extensions.cs @@ -5,7 +5,7 @@ using Nostr.Client.Json; using Nostr.Client.Messages; using Nostr.Client.Utils; using NostrRelay; -using NostrServices.Model; +using NostrServices.Client; using NostrServices.Services; using ProtoBuf; using StackExchange.Redis; diff --git a/NostrServices/NostrServices.csproj b/NostrServices/NostrServices.csproj index 58f89b7..05ab40a 100644 --- a/NostrServices/NostrServices.csproj +++ b/NostrServices/NostrServices.csproj @@ -31,7 +31,7 @@ - + diff --git a/NostrServices/Services/EventHandlers/RedisEventCache.cs b/NostrServices/Services/EventHandlers/RedisEventCache.cs index 1df314d..0df17e0 100644 --- a/NostrServices/Services/EventHandlers/RedisEventCache.cs +++ b/NostrServices/Services/EventHandlers/RedisEventCache.cs @@ -1,7 +1,7 @@ using NBitcoin; using Newtonsoft.Json; using Nostr.Client.Messages; -using NostrServices.Model; +using NostrServices.Client; namespace NostrServices.Services.EventHandlers; diff --git a/NostrServices/Services/RedisStore.cs b/NostrServices/Services/RedisStore.cs index f00de22..1ed4e14 100644 --- a/NostrServices/Services/RedisStore.cs +++ b/NostrServices/Services/RedisStore.cs @@ -2,7 +2,7 @@ using NBitcoin; using Nostr.Client.Identifiers; using Nostr.Client.Messages; using Nostr.Client.Utils; -using NostrServices.Model; +using NostrServices.Client; using ProtoBuf; using StackExchange.Redis;