WIP Add star to swagger

This commit is contained in:
erik 2023-11-09 15:38:55 +01:00 committed by Michael Jerger
parent 17dfc7bdc1
commit d7dfdca8b9

View file

@ -4,6 +4,7 @@
package forgefed package forgefed
import ( import (
"code.gitea.io/gitea/modules/context"
ap "github.com/go-ap/activitypub" ap "github.com/go-ap/activitypub"
) )
@ -26,7 +27,6 @@ var KnownSourceTypes = SourceTypes{
} }
// Star activity data type // Star activity data type
// swagger:model
type Star struct { type Star struct {
// swagger:ignore // swagger:ignore
ap.Activity ap.Activity
@ -34,12 +34,20 @@ type Star struct {
Source SourceType `jsonld:"source,omitempty"` 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 { func StarNew(id ap.ID, ob ap.ID) *Star {
a := ap.ActivityNew(id, StarType, ob) a := ap.ActivityNew(id, StarType, ob)
// TODO: is this not handeld by ActivityNew?? o := Star{Activity: *a, Source: ForgejoSourceType}
a.Type = StarType
o := Star{Activity: *a}
o.Source = ForgejoSourceType
return &o return &o
} }
func AddStar(ctx *context.APIContext) {
}