diff options
Diffstat (limited to 'resources')
-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() +} |