kopia lustrzana https://github.com/reiver/greatape
feat(activitypub): ✨ implement follower and following object model
rodzic
eb63fd65e8
commit
33971f851d
|
@ -834,6 +834,93 @@ func (x *ActivityPubOutgoingActivity) GetRaw() string {
|
|||
return ""
|
||||
}
|
||||
|
||||
type ActivityPubFollower struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
Handle string `protobuf:"bytes,2,opt,name=handle,proto3" json:"handle,omitempty"`
|
||||
Inbox string `protobuf:"bytes,3,opt,name=inbox,proto3" json:"inbox,omitempty"`
|
||||
Subject string `protobuf:"bytes,4,opt,name=subject,proto3" json:"subject,omitempty"`
|
||||
Activity string `protobuf:"bytes,5,opt,name=activity,proto3" json:"activity,omitempty"`
|
||||
Accepted bool `protobuf:"varint,6,opt,name=accepted,proto3" json:"accepted,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) Reset() {
|
||||
*x = ActivityPubFollower{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_objects_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ActivityPubFollower) ProtoMessage() {}
|
||||
|
||||
func (x *ActivityPubFollower) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_objects_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ActivityPubFollower.ProtoReflect.Descriptor instead.
|
||||
func (*ActivityPubFollower) Descriptor() ([]byte, []int) {
|
||||
return file_objects_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) GetHandle() string {
|
||||
if x != nil {
|
||||
return x.Handle
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) GetInbox() string {
|
||||
if x != nil {
|
||||
return x.Inbox
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) GetSubject() string {
|
||||
if x != nil {
|
||||
return x.Subject
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) GetActivity() string {
|
||||
if x != nil {
|
||||
return x.Activity
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ActivityPubFollower) GetAccepted() bool {
|
||||
if x != nil {
|
||||
return x.Accepted
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
var File_objects_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_objects_proto_rawDesc = []byte{
|
||||
|
@ -931,8 +1018,19 @@ var file_objects_proto_rawDesc = []byte{
|
|||
0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x74, 0x6f, 0x12,
|
||||
0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09,
|
||||
0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x72, 0x61, 0x77,
|
||||
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x61, 0x77, 0x42, 0x04, 0x5a, 0x02, 0x2e,
|
||||
0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x72, 0x61, 0x77, 0x22, 0xa5, 0x01, 0x0a, 0x13,
|
||||
0x41, 0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x50, 0x75, 0x62, 0x46, 0x6f, 0x6c, 0x6c, 0x6f,
|
||||
0x77, 0x65, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52,
|
||||
0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x69,
|
||||
0x6e, 0x62, 0x6f, 0x78, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f,
|
||||
0x78, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, 0x20, 0x01,
|
||||
0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x61,
|
||||
0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x61,
|
||||
0x63, 0x74, 0x69, 0x76, 0x69, 0x74, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70,
|
||||
0x74, 0x65, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x61, 0x63, 0x63, 0x65, 0x70,
|
||||
0x74, 0x65, 0x64, 0x42, 0x04, 0x5a, 0x02, 0x2e, 0x2f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -947,7 +1045,7 @@ func file_objects_proto_rawDescGZIP() []byte {
|
|||
return file_objects_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_objects_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_objects_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_objects_proto_goTypes = []interface{}{
|
||||
(*Error)(nil), // 0: protobuf.Error
|
||||
(*Document)(nil), // 1: protobuf.Document
|
||||
|
@ -959,6 +1057,7 @@ var file_objects_proto_goTypes = []interface{}{
|
|||
(*ActivityPubMedia)(nil), // 7: protobuf.ActivityPubMedia
|
||||
(*ActivityPubIncomingActivity)(nil), // 8: protobuf.ActivityPubIncomingActivity
|
||||
(*ActivityPubOutgoingActivity)(nil), // 9: protobuf.ActivityPubOutgoingActivity
|
||||
(*ActivityPubFollower)(nil), // 10: protobuf.ActivityPubFollower
|
||||
}
|
||||
var file_objects_proto_depIdxs = []int32{
|
||||
3, // 0: protobuf.ActivityPubActivity.object:type_name -> protobuf.ActivityPubObject
|
||||
|
@ -1095,6 +1194,18 @@ func file_objects_proto_init() {
|
|||
return nil
|
||||
}
|
||||
}
|
||||
file_objects_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*ActivityPubFollower); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
|
@ -1102,7 +1213,7 @@ func file_objects_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_objects_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
|
|
@ -86,3 +86,12 @@ message ActivityPubOutgoingActivity {
|
|||
string content = 0x00000007;
|
||||
string raw = 0x00000008;
|
||||
}
|
||||
|
||||
message ActivityPubFollower {
|
||||
int64 id = 0x00000001;
|
||||
string handle = 0x00000002;
|
||||
string inbox = 0x00000003;
|
||||
string subject = 0x00000004;
|
||||
string activity = 0x00000005;
|
||||
bool accepted = 0x00000006;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ const (
|
|||
ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND"
|
||||
ERROR_MESSAGE_ACTIVITY_PUB_INCOMING_ACTIVITY_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_INCOMING_ACTIVITY_NOT_FOUND"
|
||||
ERROR_MESSAGE_ACTIVITY_PUB_OUTGOING_ACTIVITY_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_OUTGOING_ACTIVITY_NOT_FOUND"
|
||||
ERROR_MESSAGE_ACTIVITY_PUB_FOLLOWER_NOT_FOUND = "ERROR_MESSAGE_ACTIVITY_PUB_FOLLOWER_NOT_FOUND"
|
||||
ERROR_MESSAGE_SPI_NOT_FOUND = "ERROR_MESSAGE_SPI_NOT_FOUND"
|
||||
ERROR_MESSAGE_UNKNOWN_DOCUMENT = "ERROR_MESSAGE_UNKNOWN_DOCUMENT"
|
||||
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE = "ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE"
|
||||
|
@ -45,6 +46,7 @@ const (
|
|||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA"
|
||||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_INCOMING_ACTIVITY = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_INCOMING_ACTIVITY"
|
||||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OUTGOING_ACTIVITY = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OUTGOING_ACTIVITY"
|
||||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_FOLLOWER = "ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_FOLLOWER"
|
||||
ERROR_MESSAGE_UNKNOWN_SPI = "ERROR_MESSAGE_UNKNOWN_SPI"
|
||||
ERROR_MESSAGE_INVALID_ID = "ERROR_MESSAGE_INVALID_ID"
|
||||
ERROR_MESSAGE_INVALID_PARAMETERS = "ERROR_MESSAGE_INVALID_PARAMETERS"
|
||||
|
@ -86,6 +88,7 @@ var (
|
|||
ERROR_ACTIVITY_PUB_MEDIA_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND)
|
||||
ERROR_ACTIVITY_PUB_INCOMING_ACTIVITY_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_INCOMING_ACTIVITY_NOT_FOUND)
|
||||
ERROR_ACTIVITY_PUB_OUTGOING_ACTIVITY_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_OUTGOING_ACTIVITY_NOT_FOUND)
|
||||
ERROR_ACTIVITY_PUB_FOLLOWER_NOT_FOUND = errors.New(ERROR_MESSAGE_ACTIVITY_PUB_FOLLOWER_NOT_FOUND)
|
||||
ERROR_SPI_NOT_FOUND = errors.New(ERROR_MESSAGE_SPI_NOT_FOUND)
|
||||
ERROR_UNKNOWN_DOCUMENT = errors.New(ERROR_MESSAGE_UNKNOWN_DOCUMENT)
|
||||
ERROR_UNKNOWN_SYSTEM_SCHEDULE = errors.New(ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE)
|
||||
|
@ -102,6 +105,7 @@ var (
|
|||
ERROR_UNKNOWN_ACTIVITY_PUB_MEDIA = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA)
|
||||
ERROR_UNKNOWN_ACTIVITY_PUB_INCOMING_ACTIVITY = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_INCOMING_ACTIVITY)
|
||||
ERROR_UNKNOWN_ACTIVITY_PUB_OUTGOING_ACTIVITY = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OUTGOING_ACTIVITY)
|
||||
ERROR_UNKNOWN_ACTIVITY_PUB_FOLLOWER = errors.New(ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_FOLLOWER)
|
||||
ERROR_UNKNOWN_SPI = errors.New(ERROR_MESSAGE_UNKNOWN_SPI)
|
||||
ERROR_INVALID_ID = errors.New(ERROR_MESSAGE_INVALID_ID)
|
||||
ERROR_INVALID_PARAMETERS = errors.New(ERROR_MESSAGE_INVALID_PARAMETERS)
|
||||
|
|
|
@ -26,6 +26,7 @@ var Errors = Resource{
|
|||
ERROR_MESSAGE_ACTIVITY_PUB_MEDIA_NOT_FOUND: "activity_pub_media_not_found",
|
||||
ERROR_MESSAGE_ACTIVITY_PUB_INCOMING_ACTIVITY_NOT_FOUND: "activity_pub_incoming_activity_not_found",
|
||||
ERROR_MESSAGE_ACTIVITY_PUB_OUTGOING_ACTIVITY_NOT_FOUND: "activity_pub_outgoing_activity_not_found",
|
||||
ERROR_MESSAGE_ACTIVITY_PUB_FOLLOWER_NOT_FOUND: "activity_pub_follower_not_found",
|
||||
ERROR_MESSAGE_SPI_NOT_FOUND: "spi_not_found",
|
||||
ERROR_MESSAGE_UNKNOWN_DOCUMENT: "unknown_document",
|
||||
ERROR_MESSAGE_UNKNOWN_SYSTEM_SCHEDULE: "unknown_system_schedule",
|
||||
|
@ -42,6 +43,7 @@ var Errors = Resource{
|
|||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_MEDIA: "unknown_activity_pub_media",
|
||||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_INCOMING_ACTIVITY: "unknown_activity_pub_incoming_activity",
|
||||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_OUTGOING_ACTIVITY: "unknown_activity_pub_outgoing_activity",
|
||||
ERROR_MESSAGE_UNKNOWN_ACTIVITY_PUB_FOLLOWER: "unknown_activity_pub_follower",
|
||||
ERROR_MESSAGE_UNKNOWN_SPI: "unknown_spi",
|
||||
ERROR_MESSAGE_INVALID_ID: "invalid_id",
|
||||
ERROR_MESSAGE_INVALID_PARAMETERS: "invalid_parameters",
|
||||
|
|
|
@ -0,0 +1,99 @@
|
|||
package contracts
|
||||
|
||||
import . "github.com/xeronith/diamante/contracts/security"
|
||||
|
||||
var ActivityPubFollowerPassThroughFilter = func(IActivityPubFollower) bool { return true }
|
||||
|
||||
type (
|
||||
ActivityPubFollowers []IActivityPubFollower
|
||||
ActivityPubFollowerIterator func(IActivityPubFollower)
|
||||
ActivityPubFollowerCondition func(IActivityPubFollower) bool
|
||||
ActivityPubFollowerFilterPredicate func(IActivityPubFollower) bool
|
||||
ActivityPubFollowerMapPredicate func(IActivityPubFollower) IActivityPubFollower
|
||||
ActivityPubFollowerCacheCallback func()
|
||||
|
||||
IActivityPubFollower interface {
|
||||
IObject
|
||||
// Handle returns 'Handle' of this 'ActivityPubFollower' instance.
|
||||
Handle() string
|
||||
// UpdateHandle directly updates 'Handle' into persistent data store and
|
||||
// refreshes the in-memory cache after successful update.
|
||||
UpdateHandle(handle string, editor Identity)
|
||||
// UpdateHandleAtomic updates 'Handle' into persistent data store through a transaction and
|
||||
// refreshes the in-memory cache after successful commit.
|
||||
UpdateHandleAtomic(transaction ITransaction, handle string, editor Identity)
|
||||
// Inbox returns 'Inbox' of this 'ActivityPubFollower' instance.
|
||||
Inbox() string
|
||||
// UpdateInbox directly updates 'Inbox' into persistent data store and
|
||||
// refreshes the in-memory cache after successful update.
|
||||
UpdateInbox(inbox string, editor Identity)
|
||||
// UpdateInboxAtomic updates 'Inbox' into persistent data store through a transaction and
|
||||
// refreshes the in-memory cache after successful commit.
|
||||
UpdateInboxAtomic(transaction ITransaction, inbox string, editor Identity)
|
||||
// Subject returns 'Subject' of this 'ActivityPubFollower' instance.
|
||||
Subject() string
|
||||
// UpdateSubject directly updates 'Subject' into persistent data store and
|
||||
// refreshes the in-memory cache after successful update.
|
||||
UpdateSubject(subject string, editor Identity)
|
||||
// UpdateSubjectAtomic updates 'Subject' into persistent data store through a transaction and
|
||||
// refreshes the in-memory cache after successful commit.
|
||||
UpdateSubjectAtomic(transaction ITransaction, subject string, editor Identity)
|
||||
// Activity returns 'Activity' of this 'ActivityPubFollower' instance.
|
||||
Activity() string
|
||||
// UpdateActivity directly updates 'Activity' into persistent data store and
|
||||
// refreshes the in-memory cache after successful update.
|
||||
UpdateActivity(activity string, editor Identity)
|
||||
// UpdateActivityAtomic updates 'Activity' into persistent data store through a transaction and
|
||||
// refreshes the in-memory cache after successful commit.
|
||||
UpdateActivityAtomic(transaction ITransaction, activity string, editor Identity)
|
||||
// Accepted returns 'Accepted' of this 'ActivityPubFollower' instance.
|
||||
Accepted() bool
|
||||
// UpdateAccepted directly updates 'Accepted' into persistent data store and
|
||||
// refreshes the in-memory cache after successful update.
|
||||
UpdateAccepted(accepted bool, editor Identity)
|
||||
// UpdateAcceptedAtomic updates 'Accepted' into persistent data store through a transaction and
|
||||
// refreshes the in-memory cache after successful commit.
|
||||
UpdateAcceptedAtomic(transaction ITransaction, accepted bool, editor Identity)
|
||||
}
|
||||
|
||||
IActivityPubFollowerCollection interface {
|
||||
Count() int
|
||||
IsEmpty() bool
|
||||
IsNotEmpty() bool
|
||||
HasExactlyOneItem() bool
|
||||
HasAtLeastOneItem() bool
|
||||
First() IActivityPubFollower
|
||||
Append(activityPubFollower IActivityPubFollower)
|
||||
ForEach(ActivityPubFollowerIterator)
|
||||
Array() ActivityPubFollowers
|
||||
}
|
||||
|
||||
IActivityPubFollowerManager interface {
|
||||
ISystemComponent
|
||||
OnCacheChanged(ActivityPubFollowerCacheCallback)
|
||||
Count() int
|
||||
Exists(id int64) bool
|
||||
ExistsWhich(condition ActivityPubFollowerCondition) bool
|
||||
ListActivityPubFollowers(pageIndex uint32, pageSize uint32, criteria string, editor Identity) IActivityPubFollowerCollection
|
||||
GetActivityPubFollower(id int64, editor Identity) (IActivityPubFollower, error)
|
||||
AddActivityPubFollower(handle string, inbox string, subject string, activity string, accepted bool, editor Identity) (IActivityPubFollower, error)
|
||||
AddActivityPubFollowerWithCustomId(id int64, handle string, inbox string, subject string, activity string, accepted bool, editor Identity) (IActivityPubFollower, error)
|
||||
AddActivityPubFollowerObject(activityPubFollower IActivityPubFollower, editor Identity) (IActivityPubFollower, error)
|
||||
AddActivityPubFollowerAtomic(transaction ITransaction, handle string, inbox string, subject string, activity string, accepted bool, editor Identity) (IActivityPubFollower, error)
|
||||
AddActivityPubFollowerWithCustomIdAtomic(id int64, transaction ITransaction, handle string, inbox string, subject string, activity string, accepted bool, editor Identity) (IActivityPubFollower, error)
|
||||
AddActivityPubFollowerObjectAtomic(transaction ITransaction, activityPubFollower IActivityPubFollower, editor Identity) (IActivityPubFollower, error)
|
||||
Log(handle string, inbox string, subject string, activity string, accepted bool, source string, editor Identity, payload string)
|
||||
UpdateActivityPubFollower(id int64, handle string, inbox string, subject string, activity string, accepted bool, editor Identity) (IActivityPubFollower, error)
|
||||
UpdateActivityPubFollowerObject(id int64, activityPubFollower IActivityPubFollower, editor Identity) (IActivityPubFollower, error)
|
||||
UpdateActivityPubFollowerAtomic(transaction ITransaction, id int64, handle string, inbox string, subject string, activity string, accepted bool, editor Identity) (IActivityPubFollower, error)
|
||||
UpdateActivityPubFollowerObjectAtomic(transaction ITransaction, id int64, activityPubFollower IActivityPubFollower, editor Identity) (IActivityPubFollower, error)
|
||||
AddOrUpdateActivityPubFollowerObject(id int64, activityPubFollower IActivityPubFollower, editor Identity) (IActivityPubFollower, error)
|
||||
AddOrUpdateActivityPubFollowerObjectAtomic(transaction ITransaction, id int64, activityPubFollower IActivityPubFollower, editor Identity) (IActivityPubFollower, error)
|
||||
RemoveActivityPubFollower(id int64, editor Identity) (IActivityPubFollower, error)
|
||||
RemoveActivityPubFollowerAtomic(transaction ITransaction, id int64, editor Identity) (IActivityPubFollower, error)
|
||||
Find(id int64) IActivityPubFollower
|
||||
ForEach(iterator ActivityPubFollowerIterator)
|
||||
Filter(predicate ActivityPubFollowerFilterPredicate) IActivityPubFollowerCollection
|
||||
Map(predicate ActivityPubFollowerMapPredicate) IActivityPubFollowerCollection
|
||||
}
|
||||
)
|
|
@ -0,0 +1,41 @@
|
|||
package model
|
||||
|
||||
type (
|
||||
ActivityPubFollowerEntities []IActivityPubFollowerEntity
|
||||
|
||||
IActivityPubFollowerEntity interface {
|
||||
IEntity
|
||||
Handle() string
|
||||
Inbox() string
|
||||
Subject() string
|
||||
Activity() string
|
||||
Accepted() bool
|
||||
}
|
||||
|
||||
IActivityPubFollowerPipeEntity interface {
|
||||
IActivityPubFollowerEntity
|
||||
IPipeEntity
|
||||
}
|
||||
|
||||
IActivityPubFollowersRepository interface {
|
||||
IRepository
|
||||
Add(entity IActivityPubFollowerEntity, editor int64) error
|
||||
AddAtomic(transaction IRepositoryTransaction, entity IActivityPubFollowerEntity, editor int64) error
|
||||
FetchById(editor int64) (IActivityPubFollowerEntity, error)
|
||||
Update(entity IActivityPubFollowerEntity, editor int64) error
|
||||
UpdateAtomic(transaction IRepositoryTransaction, entity IActivityPubFollowerEntity, editor int64) error
|
||||
Remove(entity IActivityPubFollowerEntity, editor int64) error
|
||||
RemoveAtomic(transaction IRepositoryTransaction, entity IActivityPubFollowerEntity, editor int64) error
|
||||
FetchAll() (ActivityPubFollowerEntities, error)
|
||||
UpdateHandle(id int64, value string, editor int64) error
|
||||
UpdateHandleAtomic(transaction IRepositoryTransaction, id int64, value string, editor int64) error
|
||||
UpdateInbox(id int64, value string, editor int64) error
|
||||
UpdateInboxAtomic(transaction IRepositoryTransaction, id int64, value string, editor int64) error
|
||||
UpdateSubject(id int64, value string, editor int64) error
|
||||
UpdateSubjectAtomic(transaction IRepositoryTransaction, id int64, value string, editor int64) error
|
||||
UpdateActivity(id int64, value string, editor int64) error
|
||||
UpdateActivityAtomic(transaction IRepositoryTransaction, id int64, value string, editor int64) error
|
||||
UpdateAccepted(id int64, value bool, editor int64) error
|
||||
UpdateAcceptedAtomic(transaction IRepositoryTransaction, id int64, value bool, editor int64) error
|
||||
}
|
||||
)
|
|
@ -0,0 +1,381 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
. "github.com/xeronith/diamante/contracts/security"
|
||||
"rail.town/infrastructure/app/validators"
|
||||
. "rail.town/infrastructure/components/constants"
|
||||
. "rail.town/infrastructure/components/contracts"
|
||||
. "rail.town/infrastructure/components/contracts/model"
|
||||
"rail.town/infrastructure/components/model/repository"
|
||||
)
|
||||
|
||||
type activityPubFollower struct {
|
||||
object
|
||||
handle string
|
||||
inbox string
|
||||
subject string
|
||||
activity string
|
||||
accepted bool
|
||||
}
|
||||
|
||||
// noinspection GoUnusedExportedFunction
|
||||
func InitializeActivityPubFollower() {
|
||||
_ = ENABLE_SECURITY
|
||||
_ = ENABLE_CUSTOM_ERRORS
|
||||
_ = validators.Initialize
|
||||
_ = repository.Initialize
|
||||
}
|
||||
|
||||
func NewActivityPubFollower(id int64, handle string, inbox string, subject string, activity string, accepted bool) (IActivityPubFollower, error) {
|
||||
instance := &activityPubFollower{
|
||||
object: object{
|
||||
id: id,
|
||||
},
|
||||
handle: handle,
|
||||
inbox: inbox,
|
||||
subject: subject,
|
||||
activity: activity,
|
||||
accepted: accepted,
|
||||
}
|
||||
|
||||
if err := instance.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return instance, nil
|
||||
}
|
||||
|
||||
func NewActivityPubFollowerFromEntity(entity IActivityPubFollowerEntity) (IActivityPubFollower, error) {
|
||||
instance := &activityPubFollower{
|
||||
object: object{
|
||||
id: entity.Id(),
|
||||
},
|
||||
handle: entity.Handle(),
|
||||
inbox: entity.Inbox(),
|
||||
subject: entity.Subject(),
|
||||
activity: entity.Activity(),
|
||||
accepted: entity.Accepted(),
|
||||
}
|
||||
|
||||
if err := instance.Validate(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return instance, nil
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) Handle() string {
|
||||
return activityPubFollower.handle
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateHandle(handle string, editor Identity) {
|
||||
if err := repository.ActivityPubFollowers.UpdateHandle(activityPubFollower.id, handle, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
activityPubFollower.handle = handle
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateHandleAtomic(transaction ITransaction, handle string, editor Identity) {
|
||||
transaction.OnCommit(func() {
|
||||
activityPubFollower.handle = handle
|
||||
})
|
||||
|
||||
if err := repository.ActivityPubFollowers.UpdateHandleAtomic(transaction, activityPubFollower.id, handle, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) Inbox() string {
|
||||
return activityPubFollower.inbox
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateInbox(inbox string, editor Identity) {
|
||||
if err := repository.ActivityPubFollowers.UpdateInbox(activityPubFollower.id, inbox, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
activityPubFollower.inbox = inbox
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateInboxAtomic(transaction ITransaction, inbox string, editor Identity) {
|
||||
transaction.OnCommit(func() {
|
||||
activityPubFollower.inbox = inbox
|
||||
})
|
||||
|
||||
if err := repository.ActivityPubFollowers.UpdateInboxAtomic(transaction, activityPubFollower.id, inbox, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) Subject() string {
|
||||
return activityPubFollower.subject
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateSubject(subject string, editor Identity) {
|
||||
if err := repository.ActivityPubFollowers.UpdateSubject(activityPubFollower.id, subject, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
activityPubFollower.subject = subject
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateSubjectAtomic(transaction ITransaction, subject string, editor Identity) {
|
||||
transaction.OnCommit(func() {
|
||||
activityPubFollower.subject = subject
|
||||
})
|
||||
|
||||
if err := repository.ActivityPubFollowers.UpdateSubjectAtomic(transaction, activityPubFollower.id, subject, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) Activity() string {
|
||||
return activityPubFollower.activity
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateActivity(activity string, editor Identity) {
|
||||
if err := repository.ActivityPubFollowers.UpdateActivity(activityPubFollower.id, activity, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
activityPubFollower.activity = activity
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateActivityAtomic(transaction ITransaction, activity string, editor Identity) {
|
||||
transaction.OnCommit(func() {
|
||||
activityPubFollower.activity = activity
|
||||
})
|
||||
|
||||
if err := repository.ActivityPubFollowers.UpdateActivityAtomic(transaction, activityPubFollower.id, activity, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) Accepted() bool {
|
||||
return activityPubFollower.accepted
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateAccepted(accepted bool, editor Identity) {
|
||||
if err := repository.ActivityPubFollowers.UpdateAccepted(activityPubFollower.id, accepted, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
|
||||
activityPubFollower.accepted = accepted
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) UpdateAcceptedAtomic(transaction ITransaction, accepted bool, editor Identity) {
|
||||
transaction.OnCommit(func() {
|
||||
activityPubFollower.accepted = accepted
|
||||
})
|
||||
|
||||
if err := repository.ActivityPubFollowers.UpdateAcceptedAtomic(transaction, activityPubFollower.id, accepted, editor.Id()); err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) Validate() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (activityPubFollower *activityPubFollower) String() string {
|
||||
return fmt.Sprintf("ActivityPubFollower (Id: %d, Handle: %v, Inbox: %v, Subject: %v, Activity: %v, Accepted: %v)", activityPubFollower.Id(), activityPubFollower.Handle(), activityPubFollower.Inbox(), activityPubFollower.Subject(), activityPubFollower.Activity(), activityPubFollower.Accepted())
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
type activityPubFollowers struct {
|
||||
collection ActivityPubFollowers
|
||||
}
|
||||
|
||||
// NewActivityPubFollowers creates an empty collection of 'Activity Pub Follower' which is not thread-safe.
|
||||
func NewActivityPubFollowers() IActivityPubFollowerCollection {
|
||||
return &activityPubFollowers{
|
||||
collection: make(ActivityPubFollowers, 0),
|
||||
}
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) Count() int {
|
||||
return len(activityPubFollowers.collection)
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) IsEmpty() bool {
|
||||
return len(activityPubFollowers.collection) == 0
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) IsNotEmpty() bool {
|
||||
return len(activityPubFollowers.collection) > 0
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) HasExactlyOneItem() bool {
|
||||
return len(activityPubFollowers.collection) == 1
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) HasAtLeastOneItem() bool {
|
||||
return len(activityPubFollowers.collection) >= 1
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) First() IActivityPubFollower {
|
||||
return activityPubFollowers.collection[0]
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) Append(activityPubFollower IActivityPubFollower) {
|
||||
activityPubFollowers.collection = append(activityPubFollowers.collection, activityPubFollower)
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) ForEach(iterator ActivityPubFollowerIterator) {
|
||||
if iterator == nil {
|
||||
return
|
||||
}
|
||||
|
||||
for _, value := range activityPubFollowers.collection {
|
||||
iterator(value)
|
||||
}
|
||||
}
|
||||
|
||||
func (activityPubFollowers *activityPubFollowers) Array() ActivityPubFollowers {
|
||||
return activityPubFollowers.collection
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
func (dispatcher *dispatcher) ActivityPubFollowerExists(id int64) bool {
|
||||
return dispatcher.conductor.ActivityPubFollowerManager().Exists(id)
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) ActivityPubFollowerExistsWhich(condition ActivityPubFollowerCondition) bool {
|
||||
return dispatcher.conductor.ActivityPubFollowerManager().ExistsWhich(condition)
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) ListActivityPubFollowers() IActivityPubFollowerCollection {
|
||||
return dispatcher.conductor.ActivityPubFollowerManager().ListActivityPubFollowers(0, 0, "", dispatcher.identity)
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) ForEachActivityPubFollower(iterator ActivityPubFollowerIterator) {
|
||||
dispatcher.conductor.ActivityPubFollowerManager().ForEach(iterator)
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) FilterActivityPubFollowers(predicate ActivityPubFollowerFilterPredicate) IActivityPubFollowerCollection {
|
||||
return dispatcher.conductor.ActivityPubFollowerManager().Filter(predicate)
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) MapActivityPubFollowers(predicate ActivityPubFollowerMapPredicate) IActivityPubFollowerCollection {
|
||||
return dispatcher.conductor.ActivityPubFollowerManager().Map(predicate)
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) GetActivityPubFollower(id int64) IActivityPubFollower {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().GetActivityPubFollower(id, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) AddActivityPubFollower(handle string, inbox string, subject string, activity string, accepted bool) IActivityPubFollower {
|
||||
transaction := dispatcher.transaction
|
||||
if transaction != nil {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().AddActivityPubFollowerAtomic(transaction, handle, inbox, subject, activity, accepted, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
} else {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().AddActivityPubFollower(handle, inbox, subject, activity, accepted, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) AddActivityPubFollowerWithCustomId(id int64, handle string, inbox string, subject string, activity string, accepted bool) IActivityPubFollower {
|
||||
transaction := dispatcher.transaction
|
||||
if transaction != nil {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().AddActivityPubFollowerWithCustomIdAtomic(id, transaction, handle, inbox, subject, activity, accepted, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
} else {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().AddActivityPubFollowerWithCustomId(id, handle, inbox, subject, activity, accepted, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) LogActivityPubFollower(handle string, inbox string, subject string, activity string, accepted bool, source string, payload string) {
|
||||
dispatcher.conductor.ActivityPubFollowerManager().Log(handle, inbox, subject, activity, accepted, source, dispatcher.identity, payload)
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) UpdateActivityPubFollower(id int64, handle string, inbox string, subject string, activity string, accepted bool) IActivityPubFollower {
|
||||
transaction := dispatcher.transaction
|
||||
if transaction != nil {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().UpdateActivityPubFollowerAtomic(transaction, id, handle, inbox, subject, activity, accepted, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
} else {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().UpdateActivityPubFollower(id, handle, inbox, subject, activity, accepted, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// noinspection GoUnusedParameter
|
||||
func (dispatcher *dispatcher) UpdateActivityPubFollowerObject(object IObject, activityPubFollower IActivityPubFollower) IActivityPubFollower {
|
||||
transaction := dispatcher.transaction
|
||||
if transaction != nil {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().UpdateActivityPubFollowerAtomic(transaction, object.Id(), activityPubFollower.Handle(), activityPubFollower.Inbox(), activityPubFollower.Subject(), activityPubFollower.Activity(), activityPubFollower.Accepted(), dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
} else {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().UpdateActivityPubFollower(object.Id(), activityPubFollower.Handle(), activityPubFollower.Inbox(), activityPubFollower.Subject(), activityPubFollower.Activity(), activityPubFollower.Accepted(), dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) AddOrUpdateActivityPubFollowerObject(object IObject, activityPubFollower IActivityPubFollower) IActivityPubFollower {
|
||||
transaction := dispatcher.transaction
|
||||
if transaction != nil {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().AddOrUpdateActivityPubFollowerObjectAtomic(transaction, object.Id(), activityPubFollower, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
} else {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().AddOrUpdateActivityPubFollowerObject(object.Id(), activityPubFollower, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (dispatcher *dispatcher) RemoveActivityPubFollower(id int64) IActivityPubFollower {
|
||||
transaction := dispatcher.transaction
|
||||
if transaction != nil {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().RemoveActivityPubFollowerAtomic(transaction, id, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
} else {
|
||||
if activityPubFollower, err := dispatcher.conductor.ActivityPubFollowerManager().RemoveActivityPubFollower(id, dispatcher.identity); err != nil {
|
||||
panic(err.Error())
|
||||
} else {
|
||||
return activityPubFollower
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package entity
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"time"
|
||||
|
||||
"rail.town/infrastructure/app/validators"
|
||||
. "rail.town/infrastructure/components/constants"
|
||||
. "rail.town/infrastructure/components/contracts/model"
|
||||
)
|
||||
|
||||
var ActivityPubFollowerEntityType = reflect.TypeOf(activityPubFollowerEntity{})
|
||||
|
||||
// noinspection GoUnusedExportedFunction
|
||||
func InitializeActivityPubFollowerEntity() {
|
||||
_ = ENABLE_CUSTOM_ERRORS
|
||||
_ = validators.Initialize
|
||||
}
|
||||
|
||||
type activityPubFollowerEntity struct {
|
||||
entity
|
||||
HandleField string `json:"handle" previous:"id" storage:"VARCHAR(256)" default:"''"`
|
||||
InboxField string `json:"inbox" previous:"handle" storage:"VARCHAR(256)" default:"''"`
|
||||
SubjectField string `json:"subject" previous:"inbox" storage:"VARCHAR(256)" default:"''"`
|
||||
ActivityField string `json:"activity" previous:"subject" storage:"VARCHAR(4096)" default:"''"`
|
||||
AcceptedField bool `json:"accepted" previous:"activity" storage:"BIT(1)" default:"FALSE"`
|
||||
}
|
||||
|
||||
func NewActivityPubFollowerEntity(id int64, handle string, inbox string, subject string, activity string, accepted bool) IActivityPubFollowerEntity {
|
||||
return &activityPubFollowerEntity{
|
||||
entity: entity{IdField: id},
|
||||
HandleField: handle,
|
||||
InboxField: inbox,
|
||||
SubjectField: subject,
|
||||
ActivityField: activity,
|
||||
AcceptedField: accepted,
|
||||
}
|
||||
}
|
||||
|
||||
type activityPubFollowerPipeEntity struct {
|
||||
activityPubFollowerEntity
|
||||
pipeEntity
|
||||
}
|
||||
|
||||
func NewActivityPubFollowerPipeEntity(id int64, handle string, inbox string, subject string, activity string, accepted bool, source string, editor int64, payload string) IActivityPubFollowerPipeEntity {
|
||||
return &activityPubFollowerPipeEntity{
|
||||
activityPubFollowerEntity: activityPubFollowerEntity{
|
||||
entity: entity{IdField: id, PayloadField: payload},
|
||||
HandleField: handle,
|
||||
InboxField: inbox,
|
||||
SubjectField: subject,
|
||||
ActivityField: activity,
|
||||
AcceptedField: accepted,
|
||||
},
|
||||
pipeEntity: pipeEntity{
|
||||
Pipe: PIPE_ACTIVITY_PUB_FOLLOWER,
|
||||
Source: source,
|
||||
Editor: editor,
|
||||
QueueTimestamp: time.Now(),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func (entity *activityPubFollowerEntity) Handle() string {
|
||||
return entity.HandleField
|
||||
}
|
||||
|
||||
func (entity *activityPubFollowerEntity) Inbox() string {
|
||||
return entity.InboxField
|
||||
}
|
||||
|
||||
func (entity *activityPubFollowerEntity) Subject() string {
|
||||
return entity.SubjectField
|
||||
}
|
||||
|
||||
func (entity *activityPubFollowerEntity) Activity() string {
|
||||
return entity.ActivityField
|
||||
}
|
||||
|
||||
func (entity *activityPubFollowerEntity) Accepted() bool {
|
||||
return entity.AcceptedField
|
||||
}
|
||||
|
||||
func (entity *activityPubFollowerEntity) Validate() error {
|
||||
if entity.IdField <= 0 {
|
||||
return ERROR_INVALID_ID
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (entity *activityPubFollowerEntity) String() string {
|
||||
return fmt.Sprintf("ActivityPubFollower (Id: %d, Handle: %v, Inbox: %v, Subject: %v, Activity: %v, Accepted: %v)", entity.Id(), entity.Handle(), entity.Inbox(), entity.Subject(), entity.Activity(), entity.Accepted())
|
||||
}
|
Ładowanie…
Reference in New Issue