23 lines
475 B
Go
Raw Normal View History

2018-11-16 20:33:40 +00:00
package utils
import (
"fmt"
"strings"
2019-06-03 09:32:43 +00:00
"github.com/animenotifier/notify.moe/arn"
2018-11-16 20:33:40 +00:00
)
// ActivityAPILink returns the API link for any activity.
func ActivityAPILink(activity arn.Activity) string {
id := activity.GetID()
typeName := activity.TypeName()
if activity.TypeName() == "ActivityCreate" {
created := activity.(*arn.ActivityCreate)
typeName = created.ObjectType
id = created.ObjectID
}
return fmt.Sprintf("/api/%s/%s", strings.ToLower(typeName), id)
}