feat(ntfy): add the HTTP client, stream manager, and account discovery
Speak the ntfy JSON API directly: subscribe, publish, group topics that share a server and credentials, reconnect with backoff and a since cursor, and list account subscriptions, reservations, and ACL grants.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package ntfy
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"lazyntfy/internal/config"
|
||||
)
|
||||
|
||||
func TestGroupSubs(t *testing.T) {
|
||||
subs := []config.Sub{
|
||||
{Origin: "https://h", Name: "a", Auth: config.Auth{Token: "t"}},
|
||||
{Origin: "https://h", Name: "b", Auth: config.Auth{Token: "t"}},
|
||||
{Origin: "https://h", Name: "c", Auth: config.Auth{Token: "other"}},
|
||||
}
|
||||
groups := GroupSubs(subs)
|
||||
if len(groups) != 2 || len(groups[0].Names) != 2 {
|
||||
t.Fatalf("%+v", groups)
|
||||
}
|
||||
if groups[0].URL("all") != "https://h/a,b/json?since=all" {
|
||||
t.Fatalf("url %s", groups[0].URL("all"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user