diff options
author | Julio Capote <jcapote@gmail.com> | 2022-12-19 00:45:27 +0000 |
---|---|---|
committer | Julio Capote <jcapote@gmail.com> | 2022-12-19 00:45:27 +0000 |
commit | 6de1cd00cea3479a7a33418eebbc9399f77178c6 (patch) | |
tree | 580a612f5b9e0b729f63279481bd5c50d133d7d3 /resources/outbox.go | |
parent | bd06b6e688c63ea9eb05e187e18ce535286ca3d4 (diff) | |
download | communique-6de1cd00cea3479a7a33418eebbc9399f77178c6.tar.gz |
start of outbox
Diffstat (limited to 'resources/outbox.go')
-rw-r--r-- | resources/outbox.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/resources/outbox.go b/resources/outbox.go new file mode 100644 index 0000000..9adb817 --- /dev/null +++ b/resources/outbox.go @@ -0,0 +1,25 @@ +package resources + +import ( + "fmt" + "net/url" + "path" + + "github.com/go-fed/activity/streams" +) + +func RenderOutbox(name, domain string) (map[string]interface{}, error) { + first, err := url.Parse(path.Join("https://", domain, "actors", name, "outbox", "?=page=true")) + if err != nil { + return nil, fmt.Errorf("could not partse url: %w", err) + } + + oc := streams.NewActivityStreamsOrderedCollection() + + ocProp := streams.NewActivityStreamsFirstProperty() + ocProp.SetIRI(first) + + oc.SetActivityStreamsFirst(ocProp) + + return oc.Serialize() +} |