forgejo/models/forgefed/star.go

32 lines
619 B
Go
Raw Normal View History

2023-11-07 09:30:32 +01:00
// Copyright 2023 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package forgefed
import (
2024-01-03 18:10:24 +01:00
"code.gitea.io/gitea/modules/validation"
2023-11-07 09:30:32 +01:00
ap "github.com/go-ap/activitypub"
)
2023-11-09 14:24:19 +01:00
// Star activity data type
2023-11-09 21:59:51 +01:00
// swagger:model
2023-11-07 09:30:32 +01:00
type Star struct {
2023-11-09 21:54:17 +01:00
// swagger:ignore
2023-11-15 08:53:02 +01:00
ap.Activity
2023-11-07 09:30:32 +01:00
}
2024-01-03 18:10:24 +01:00
func (a Star) MarshalJSON() ([]byte, error) {
return a.Activity.MarshalJSON()
2023-11-07 09:30:32 +01:00
}
2023-11-09 15:38:55 +01:00
2024-01-03 18:10:24 +01:00
func (s *Star) UnmarshalJSON(data []byte) error {
return s.UnmarshalJSON(data)
}
2024-01-03 18:10:24 +01:00
func (s Star) Validate() []string {
var result []string
result = append(result, validation.ValidateNotEmpty(string(s.Type), "type")...)
2024-01-03 18:10:24 +01:00
return result
}