package goap // Interface for every struct that can be part of an ActivityPub object type BaseApChain interface { // Get the next "object" in the chain (or self if last element in chain) // Though preferably the last element should always be a BaseObject // The 2nd parameter indicates whether the returned value is different from the one the function is called on // So true => Is a different object, false => is self GetSelfOrBase() (BaseApChain, bool) // Convert the chain to a map // Should include the rest of the chain (extend the map the underlying object returns) MarshalToMap() map[string]any } // Func used to add parsers for other attributes not yet included in the library // It is expected that, on success, the function removes its key from the raw map type UnmarshalFunc func(map[string]any, BaseApChain) (BaseApChain, error) type EmptyBaseObject struct{} func (e *EmptyBaseObject) GetSelfOrBase() (BaseApChain, bool) { return e, false } func (e *EmptyBaseObject) MarshalToMap() map[string]any { return map[string]any{} }