2023-11-07 03:30:32 -05:00
|
|
|
// Copyright 2023 The Forgejo Authors. All rights reserved.
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
|
|
|
package forgefed
|
|
|
|
|
|
|
|
import (
|
|
|
|
ap "github.com/go-ap/activitypub"
|
|
|
|
)
|
|
|
|
|
|
|
|
type (
|
|
|
|
SourceType string
|
|
|
|
)
|
|
|
|
|
|
|
|
type SourceTypes []SourceType
|
|
|
|
|
|
|
|
const (
|
|
|
|
StarType ap.ActivityVocabularyType = "Star"
|
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
ForgejoSourceType SourceType = "frogejo"
|
|
|
|
)
|
|
|
|
|
|
|
|
var KnownSourceTypes = SourceTypes{
|
|
|
|
ForgejoSourceType,
|
|
|
|
}
|
|
|
|
|
2023-11-08 02:56:22 -05:00
|
|
|
// Star activity for adding a star to an repository
|
|
|
|
// swagger:model
|
2023-11-07 03:30:32 -05:00
|
|
|
type Star struct {
|
2023-11-09 15:54:17 -05:00
|
|
|
// swagger:ignore
|
2023-11-07 03:30:32 -05:00
|
|
|
ap.Activity
|
|
|
|
// Source identifies the system generated this Activity. Exact one value has to be specified.
|
|
|
|
Source SourceType `jsonld:"source,omitempty"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// RepositoryNew initializes a Repository type actor
|
|
|
|
func StarNew(id ap.ID, ob ap.ID) *Star {
|
|
|
|
a := ap.ActivityNew(id, StarType, ob)
|
|
|
|
// TODO: is this not handeld by ActivityNew??
|
|
|
|
a.Type = StarType
|
|
|
|
o := Star{Activity: *a}
|
|
|
|
o.Source = ForgejoSourceType
|
|
|
|
return &o
|
|
|
|
}
|