aboutsummaryrefslogtreecommitdiff
path: root/resources/profile.go
blob: b62a9c54a330e06ed34d8a67119bbcba92ecebd7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package resources

import (
	"fmt"
	"net/url"
	"path"

	"github.com/go-fed/activity/streams"
)

func RenderProfile(name, domain string) (map[string]interface{}, error) {
	u, err := url.Parse(path.Join("https://", domain, "actors", name, "inbox"))
	if err != nil {
		return nil, fmt.Errorf("could not partse url: %w", err)
	}

	inb := streams.NewActivityStreamsInboxProperty()
	inb.SetIRI(u)

	p := streams.NewActivityStreamsService()
	p.SetActivityStreamsInbox(inb)

	return streams.Serialize(p)
}