From d7dfdca8b9976fd76caf43d00df14facce461e11 Mon Sep 17 00:00:00 2001 From: erik Date: Thu, 9 Nov 2023 15:38:55 +0100 Subject: [PATCH] WIP Add star to swagger --- modules/forgefed/star.go | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/modules/forgefed/star.go b/modules/forgefed/star.go index 913af850d7..fdcd696f9b 100644 --- a/modules/forgefed/star.go +++ b/modules/forgefed/star.go @@ -4,6 +4,7 @@ package forgefed import ( + "code.gitea.io/gitea/modules/context" ap "github.com/go-ap/activitypub" ) @@ -26,7 +27,6 @@ var KnownSourceTypes = SourceTypes{ } // Star activity data type -// swagger:model type Star struct { // swagger:ignore ap.Activity @@ -34,12 +34,20 @@ type Star struct { 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) { + +}