WIP Add star to swagger

forgejo-federated-star
erik 6 months ago
parent fb64807072
commit 0650fa031f

@ -4,6 +4,7 @@
package forgefed
import (
"code.gitea.io/gitea/modules/context"
ap "github.com/go-ap/activitypub"
)
@ -26,20 +27,26 @@ var KnownSourceTypes = SourceTypes{
}
// Star activity data type
// swagger:model
type Star struct {
// swagger: ignore
ap.Activity
// Source identifies the system which generated this activity. Exactly one value has to be specified.
Source SourceType `jsonld:"source,omitempty"`
}
// RepositoryNew initializes a Repository type actor
// Infos needed to star a repo
type StarRepo struct {
StargazerID int `json:"Stargazer"`
RepoID int `json:"RepoToStar"`
}
// StarNew initializes a Star type activity
// Guess: no return value needed, we may need to add the star to the context
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
o := Star{Activity: *a, Source: ForgejoSourceType}
return &o
}
func AddStar(ctx *context.APIContext) {
}

Loading…
Cancel
Save