aboutsummaryrefslogtreecommitdiff
path: root/resources/outbox.go
diff options
context:
space:
mode:
authorJulio Capote <jcapote@gmail.com>2022-12-19 00:45:27 +0000
committerJulio Capote <jcapote@gmail.com>2022-12-19 00:45:27 +0000
commit6de1cd00cea3479a7a33418eebbc9399f77178c6 (patch)
tree580a612f5b9e0b729f63279481bd5c50d133d7d3 /resources/outbox.go
parentbd06b6e688c63ea9eb05e187e18ce535286ca3d4 (diff)
downloadcommunique-6de1cd00cea3479a7a33418eebbc9399f77178c6.tar.gz
start of outbox
Diffstat (limited to '')
-rw-r--r--resources/outbox.go25
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()
+}