mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-20 21:57:14 -04:00
add star activity & bind to swagger
This commit is contained in:
parent
ff5a4405fd
commit
46fb4fec8f
2 changed files with 45 additions and 1 deletions
42
modules/forgefed/star.go
Normal file
42
modules/forgefed/star.go
Normal file
|
@ -0,0 +1,42 @@
|
|||
// 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,
|
||||
}
|
||||
|
||||
type Star struct {
|
||||
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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue