Publish NostrServices.Client to NuGet
This commit is contained in:
@ -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; }
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user