following and unfollowing

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-05-15 11:08:36 -07:00
parent 8da251dc88
commit 7554a87d88
10 changed files with 277 additions and 15 deletions

View File

@@ -227,6 +227,11 @@ func decode_nostr_event(txt: String) -> NostrResponse? {
return decode_data(Data(txt.utf8))
}
func encode_json<T: Encodable>(_ val: T) -> String? {
let encoder = JSONEncoder()
return (try? encoder.encode(val)).map { String(decoding: $0, as: UTF8.self) }
}
func decode_data<T: Decodable>(_ data: Data) -> T? {
let decoder = JSONDecoder()
do {

View File

@@ -7,7 +7,7 @@
import Foundation
struct RelayInfo {
struct RelayInfo: Codable {
let read: Bool
let write: Bool