forgejo/models/forgefed/star.go

32 lines
619 B
Go
Raw Normal View History

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