Publish NostrServices.Client to NuGet

This commit is contained in:
2024-02-02 11:51:48 +00:00
parent d2e9b07151
commit 067fe24eb7
4 changed files with 82 additions and 2 deletions

View File

@ -1,4 +1,6 @@
using Newtonsoft.Json;
using Nostr.Client.Json;
using Nostr.Client.Messages;
namespace NostrServices.Client;
@ -25,12 +27,42 @@ public class NostrServicesClient
return default;
}
public async Task<NostrEvent?> Event(string id)
{
var rsp = await _client.GetAsync($"/api/v1/export/{id}");
if (rsp.IsSuccessStatusCode)
{
var json = await rsp.Content.ReadAsStringAsync();
return NostrJson.Deserialize<NostrEvent>(json);
}
return default;
}
public class NostrProfile
{
[JsonProperty("pubkey")]
public byte[] PubKey { get; init; } = null!;
[JsonProperty("name")]
public string? Name { get; init; }
[JsonProperty("about")]
public string? About { get; init; }
[JsonProperty("picture")]
public string? Picture { get; init; }
[JsonProperty("nip05")]
public string? Nip05 { get; init; }
[JsonProperty("lud16")]
public string? LightningAddress { get; init; }
[JsonProperty("banner")]
public string? Banner { get; init; }
[JsonProperty("created")]
public DateTime Created { get; init; }
}
}