[feature] Allow delivery to sharedInboxes where possible (#847)

* update Activity

* add instance-deliver-to-shared-inboxes setting

* update activity version again

* add SharedInboxURI field to accounts

* serdes for endpoints/sharedInbox

* deliver to sharedInbox if one is available

* update tests

* only assign shared inbox if shared domain

* look for shared inbox if currently nil

* go fmt

* finger to get params.RemoteAccountID if necessary

* make comments clearer

* compare dns more consistently
This commit is contained in:
tobi 2022-09-23 21:27:35 +02:00 committed by GitHub
commit 69a193dae5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
69 changed files with 2212 additions and 32 deletions

View file

@ -0,0 +1,17 @@
// Code generated by astool. DO NOT EDIT.
// Package propertyendpoints contains the implementation for the endpoints
// property. All applications are strongly encouraged to use the interface
// instead of this concrete definition. The interfaces allow applications to
// consume only the types and properties needed and be independent of the
// go-fed implementation if another alternative implementation is created.
// This package is code-generated and subject to the same license as the
// go-fed tool used to generate it.
//
// This package is independent of other types' and properties' implementations
// by having a Manager injected into it to act as a factory for the concrete
// implementations. The implementations have been generated into their own
// separate subpackages for each vocabulary.
//
// Strongly consider using the interfaces instead of this package.
package propertyendpoints

View file

@ -0,0 +1,22 @@
// Code generated by astool. DO NOT EDIT.
package propertyendpoints
import vocab "github.com/superseriousbusiness/activity/streams/vocab"
var mgr privateManager
// privateManager abstracts the code-generated manager that provides access to
// concrete implementations.
type privateManager interface {
// DeserializeEndpointsActivityStreams returns the deserialization method
// for the "ActivityStreamsEndpoints" non-functional property in the
// vocabulary "ActivityStreams"
DeserializeEndpointsActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpoints, error)
}
// SetManager sets the manager package-global variable. For internal use only, do
// not use as part of Application behavior. Must be called at golang init time.
func SetManager(m privateManager) {
mgr = m
}

View file

@ -0,0 +1,621 @@
// Code generated by astool. DO NOT EDIT.
package propertyendpoints
import (
"fmt"
vocab "github.com/superseriousbusiness/activity/streams/vocab"
"net/url"
)
// ActivityStreamsEndpointsPropertyIterator is an iterator for a property. It is
// permitted to be a single nilable value type.
type ActivityStreamsEndpointsPropertyIterator struct {
activitystreamsEndpointsMember vocab.ActivityStreamsEndpoints
unknown interface{}
iri *url.URL
alias string
myIdx int
parent vocab.ActivityStreamsEndpointsProperty
}
// NewActivityStreamsEndpointsPropertyIterator creates a new
// ActivityStreamsEndpoints property.
func NewActivityStreamsEndpointsPropertyIterator() *ActivityStreamsEndpointsPropertyIterator {
return &ActivityStreamsEndpointsPropertyIterator{alias: ""}
}
// deserializeActivityStreamsEndpointsPropertyIterator creates an iterator from an
// element that has been unmarshalled from a text or binary format.
func deserializeActivityStreamsEndpointsPropertyIterator(i interface{}, aliasMap map[string]string) (*ActivityStreamsEndpointsPropertyIterator, error) {
alias := ""
if a, ok := aliasMap["https://www.w3.org/ns/activitystreams"]; ok {
alias = a
}
if s, ok := i.(string); ok {
u, err := url.Parse(s)
// If error exists, don't error out -- skip this and treat as unknown string ([]byte) at worst
// Also, if no scheme exists, don't treat it as a URL -- net/url is greedy
if err == nil && len(u.Scheme) > 0 {
this := &ActivityStreamsEndpointsPropertyIterator{
alias: alias,
iri: u,
}
return this, nil
}
}
if m, ok := i.(map[string]interface{}); ok {
if v, err := mgr.DeserializeEndpointsActivityStreams()(m, aliasMap); err == nil {
this := &ActivityStreamsEndpointsPropertyIterator{
activitystreamsEndpointsMember: v,
alias: alias,
}
return this, nil
}
}
this := &ActivityStreamsEndpointsPropertyIterator{
alias: alias,
unknown: i,
}
return this, nil
}
// Get returns the value of this property. When IsActivityStreamsEndpoints returns
// false, Get will return any arbitrary value.
func (this ActivityStreamsEndpointsPropertyIterator) Get() vocab.ActivityStreamsEndpoints {
return this.activitystreamsEndpointsMember
}
// GetIRI returns the IRI of this property. When IsIRI returns false, GetIRI will
// return any arbitrary value.
func (this ActivityStreamsEndpointsPropertyIterator) GetIRI() *url.URL {
return this.iri
}
// GetType returns the value in this property as a Type. Returns nil if the value
// is not an ActivityStreams type, such as an IRI or another value.
func (this ActivityStreamsEndpointsPropertyIterator) GetType() vocab.Type {
if this.IsActivityStreamsEndpoints() {
return this.Get()
}
return nil
}
// HasAny returns true if the value or IRI is set.
func (this ActivityStreamsEndpointsPropertyIterator) HasAny() bool {
return this.IsActivityStreamsEndpoints() || this.iri != nil
}
// IsActivityStreamsEndpoints returns true if this property is set and not an IRI.
func (this ActivityStreamsEndpointsPropertyIterator) IsActivityStreamsEndpoints() bool {
return this.activitystreamsEndpointsMember != nil
}
// IsIRI returns true if this property is an IRI.
func (this ActivityStreamsEndpointsPropertyIterator) IsIRI() bool {
return this.iri != nil
}
// JSONLDContext returns the JSONLD URIs required in the context string for this
// property and the specific values that are set. The value in the map is the
// alias used to import the property's value or values.
func (this ActivityStreamsEndpointsPropertyIterator) JSONLDContext() map[string]string {
m := map[string]string{"https://www.w3.org/ns/activitystreams": this.alias}
var child map[string]string
if this.IsActivityStreamsEndpoints() {
child = this.Get().JSONLDContext()
}
/*
Since the literal maps in this function are determined at
code-generation time, this loop should not overwrite an existing key with a
new value.
*/
for k, v := range child {
m[k] = v
}
return m
}
// KindIndex computes an arbitrary value for indexing this kind of value. This is
// a leaky API detail only for folks looking to replace the go-fed
// implementation. Applications should not use this method.
func (this ActivityStreamsEndpointsPropertyIterator) KindIndex() int {
if this.IsActivityStreamsEndpoints() {
return 0
}
if this.IsIRI() {
return -2
}
return -1
}
// LessThan compares two instances of this property with an arbitrary but stable
// comparison. Applications should not use this because it is only meant to
// help alternative implementations to go-fed to be able to normalize
// nonfunctional properties.
func (this ActivityStreamsEndpointsPropertyIterator) LessThan(o vocab.ActivityStreamsEndpointsPropertyIterator) bool {
// LessThan comparison for if either or both are IRIs.
if this.IsIRI() && o.IsIRI() {
return this.iri.String() < o.GetIRI().String()
} else if this.IsIRI() {
// IRIs are always less than other values, none, or unknowns
return true
} else if o.IsIRI() {
// This other, none, or unknown value is always greater than IRIs
return false
}
// LessThan comparison for the single value or unknown value.
if !this.IsActivityStreamsEndpoints() && !o.IsActivityStreamsEndpoints() {
// Both are unknowns.
return false
} else if this.IsActivityStreamsEndpoints() && !o.IsActivityStreamsEndpoints() {
// Values are always greater than unknown values.
return false
} else if !this.IsActivityStreamsEndpoints() && o.IsActivityStreamsEndpoints() {
// Unknowns are always less than known values.
return true
} else {
// Actual comparison.
return this.Get().LessThan(o.Get())
}
}
// Name returns the name of this property: "ActivityStreamsEndpoints".
func (this ActivityStreamsEndpointsPropertyIterator) Name() string {
if len(this.alias) > 0 {
return this.alias + ":" + "ActivityStreamsEndpoints"
} else {
return "ActivityStreamsEndpoints"
}
}
// Next returns the next iterator, or nil if there is no next iterator.
func (this ActivityStreamsEndpointsPropertyIterator) Next() vocab.ActivityStreamsEndpointsPropertyIterator {
if this.myIdx+1 >= this.parent.Len() {
return nil
} else {
return this.parent.At(this.myIdx + 1)
}
}
// Prev returns the previous iterator, or nil if there is no previous iterator.
func (this ActivityStreamsEndpointsPropertyIterator) Prev() vocab.ActivityStreamsEndpointsPropertyIterator {
if this.myIdx-1 < 0 {
return nil
} else {
return this.parent.At(this.myIdx - 1)
}
}
// Set sets the value of this property. Calling IsActivityStreamsEndpoints
// afterwards will return true.
func (this *ActivityStreamsEndpointsPropertyIterator) Set(v vocab.ActivityStreamsEndpoints) {
this.clear()
this.activitystreamsEndpointsMember = v
}
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
// true.
func (this *ActivityStreamsEndpointsPropertyIterator) SetIRI(v *url.URL) {
this.clear()
this.iri = v
}
// SetType attempts to set the property for the arbitrary type. Returns an error
// if it is not a valid type to set on this property.
func (this *ActivityStreamsEndpointsPropertyIterator) SetType(t vocab.Type) error {
if v, ok := t.(vocab.ActivityStreamsEndpoints); ok {
this.Set(v)
return nil
}
return fmt.Errorf("illegal type to set on ActivityStreamsEndpoints property: %T", t)
}
// clear ensures no value of this property is set. Calling
// IsActivityStreamsEndpoints afterwards will return false.
func (this *ActivityStreamsEndpointsPropertyIterator) clear() {
this.unknown = nil
this.iri = nil
this.activitystreamsEndpointsMember = nil
}
// serialize converts this into an interface representation suitable for
// marshalling into a text or binary format. Applications should not need this
// function as most typical use cases serialize types instead of individual
// properties. It is exposed for alternatives to go-fed implementations to use.
func (this ActivityStreamsEndpointsPropertyIterator) serialize() (interface{}, error) {
if this.IsActivityStreamsEndpoints() {
return this.Get().Serialize()
} else if this.IsIRI() {
return this.iri.String(), nil
}
return this.unknown, nil
}
// ActivityStreamsEndpointsProperty is the non-functional property "endpoints". It
// is permitted to have one or more values, and of different value types.
type ActivityStreamsEndpointsProperty struct {
properties []*ActivityStreamsEndpointsPropertyIterator
alias string
}
// DeserializeEndpointsProperty creates a "endpoints" property from an interface
// representation that has been unmarshalled from a text or binary format.
func DeserializeEndpointsProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.ActivityStreamsEndpointsProperty, error) {
alias := ""
if a, ok := aliasMap["https://www.w3.org/ns/activitystreams"]; ok {
alias = a
}
propName := "endpoints"
if len(alias) > 0 {
propName = fmt.Sprintf("%s:%s", alias, "endpoints")
}
i, ok := m[propName]
if ok {
this := &ActivityStreamsEndpointsProperty{
alias: alias,
properties: []*ActivityStreamsEndpointsPropertyIterator{},
}
if list, ok := i.([]interface{}); ok {
for _, iterator := range list {
if p, err := deserializeActivityStreamsEndpointsPropertyIterator(iterator, aliasMap); err != nil {
return this, err
} else if p != nil {
this.properties = append(this.properties, p)
}
}
} else {
if p, err := deserializeActivityStreamsEndpointsPropertyIterator(i, aliasMap); err != nil {
return this, err
} else if p != nil {
this.properties = append(this.properties, p)
}
}
// Set up the properties for iteration.
for idx, ele := range this.properties {
ele.parent = this
ele.myIdx = idx
}
return this, nil
}
return nil, nil
}
// NewActivityStreamsEndpointsProperty creates a new endpoints property.
func NewActivityStreamsEndpointsProperty() *ActivityStreamsEndpointsProperty {
return &ActivityStreamsEndpointsProperty{alias: ""}
}
// AppendActivityStreamsEndpoints appends a Endpoints value to the back of a list
// of the property "endpoints". Invalidates iterators that are traversing
// using Prev.
func (this *ActivityStreamsEndpointsProperty) AppendActivityStreamsEndpoints(v vocab.ActivityStreamsEndpoints) {
this.properties = append(this.properties, &ActivityStreamsEndpointsPropertyIterator{
activitystreamsEndpointsMember: v,
alias: this.alias,
myIdx: this.Len(),
parent: this,
})
}
// AppendIRI appends an IRI value to the back of a list of the property "endpoints"
func (this *ActivityStreamsEndpointsProperty) AppendIRI(v *url.URL) {
this.properties = append(this.properties, &ActivityStreamsEndpointsPropertyIterator{
alias: this.alias,
iri: v,
myIdx: this.Len(),
parent: this,
})
}
// PrependType prepends an arbitrary type value to the front of a list of the
// property "endpoints". Invalidates iterators that are traversing using Prev.
// Returns an error if the type is not a valid one to set for this property.
func (this *ActivityStreamsEndpointsProperty) AppendType(t vocab.Type) error {
n := &ActivityStreamsEndpointsPropertyIterator{
alias: this.alias,
myIdx: this.Len(),
parent: this,
}
if err := n.SetType(t); err != nil {
return err
}
this.properties = append(this.properties, n)
return nil
}
// At returns the property value for the specified index. Panics if the index is
// out of bounds.
func (this ActivityStreamsEndpointsProperty) At(index int) vocab.ActivityStreamsEndpointsPropertyIterator {
return this.properties[index]
}
// Begin returns the first iterator, or nil if empty. Can be used with the
// iterator's Next method and this property's End method to iterate from front
// to back through all values.
func (this ActivityStreamsEndpointsProperty) Begin() vocab.ActivityStreamsEndpointsPropertyIterator {
if this.Empty() {
return nil
} else {
return this.properties[0]
}
}
// Empty returns returns true if there are no elements.
func (this ActivityStreamsEndpointsProperty) Empty() bool {
return this.Len() == 0
}
// End returns beyond-the-last iterator, which is nil. Can be used with the
// iterator's Next method and this property's Begin method to iterate from
// front to back through all values.
func (this ActivityStreamsEndpointsProperty) End() vocab.ActivityStreamsEndpointsPropertyIterator {
return nil
}
// InsertActivityStreamsEndpoints inserts a Endpoints value at the specified index
// for a property "endpoints". Existing elements at that index and higher are
// shifted back once. Invalidates all iterators.
func (this *ActivityStreamsEndpointsProperty) InsertActivityStreamsEndpoints(idx int, v vocab.ActivityStreamsEndpoints) {
this.properties = append(this.properties, nil)
copy(this.properties[idx+1:], this.properties[idx:])
this.properties[idx] = &ActivityStreamsEndpointsPropertyIterator{
activitystreamsEndpointsMember: v,
alias: this.alias,
myIdx: idx,
parent: this,
}
for i := idx; i < this.Len(); i++ {
(this.properties)[i].myIdx = i
}
}
// Insert inserts an IRI value at the specified index for a property "endpoints".
// Existing elements at that index and higher are shifted back once.
// Invalidates all iterators.
func (this *ActivityStreamsEndpointsProperty) InsertIRI(idx int, v *url.URL) {
this.properties = append(this.properties, nil)
copy(this.properties[idx+1:], this.properties[idx:])
this.properties[idx] = &ActivityStreamsEndpointsPropertyIterator{
alias: this.alias,
iri: v,
myIdx: idx,
parent: this,
}
for i := idx; i < this.Len(); i++ {
(this.properties)[i].myIdx = i
}
}
// PrependType prepends an arbitrary type value to the front of a list of the
// property "endpoints". Invalidates all iterators. Returns an error if the
// type is not a valid one to set for this property.
func (this *ActivityStreamsEndpointsProperty) InsertType(idx int, t vocab.Type) error {
n := &ActivityStreamsEndpointsPropertyIterator{
alias: this.alias,
myIdx: idx,
parent: this,
}
if err := n.SetType(t); err != nil {
return err
}
this.properties = append(this.properties, nil)
copy(this.properties[idx+1:], this.properties[idx:])
this.properties[idx] = n
for i := idx; i < this.Len(); i++ {
(this.properties)[i].myIdx = i
}
return nil
}
// JSONLDContext returns the JSONLD URIs required in the context string for this
// property and the specific values that are set. The value in the map is the
// alias used to import the property's value or values.
func (this ActivityStreamsEndpointsProperty) JSONLDContext() map[string]string {
m := map[string]string{"https://www.w3.org/ns/activitystreams": this.alias}
for _, elem := range this.properties {
child := elem.JSONLDContext()
/*
Since the literal maps in this function are determined at
code-generation time, this loop should not overwrite an existing key with a
new value.
*/
for k, v := range child {
m[k] = v
}
}
return m
}
// KindIndex computes an arbitrary value for indexing this kind of value. This is
// a leaky API method specifically needed only for alternate implementations
// for go-fed. Applications should not use this method. Panics if the index is
// out of bounds.
func (this ActivityStreamsEndpointsProperty) KindIndex(idx int) int {
return this.properties[idx].KindIndex()
}
// Len returns the number of values that exist for the "endpoints" property.
func (this ActivityStreamsEndpointsProperty) Len() (length int) {
return len(this.properties)
}
// Less computes whether another property is less than this one. Mixing types
// results in a consistent but arbitrary ordering
func (this ActivityStreamsEndpointsProperty) Less(i, j int) bool {
idx1 := this.KindIndex(i)
idx2 := this.KindIndex(j)
if idx1 < idx2 {
return true
} else if idx1 == idx2 {
if idx1 == 0 {
lhs := this.properties[i].Get()
rhs := this.properties[j].Get()
return lhs.LessThan(rhs)
} else if idx1 == -2 {
lhs := this.properties[i].GetIRI()
rhs := this.properties[j].GetIRI()
return lhs.String() < rhs.String()
}
}
return false
}
// LessThan compares two instances of this property with an arbitrary but stable
// comparison. Applications should not use this because it is only meant to
// help alternative implementations to go-fed to be able to normalize
// nonfunctional properties.
func (this ActivityStreamsEndpointsProperty) LessThan(o vocab.ActivityStreamsEndpointsProperty) bool {
l1 := this.Len()
l2 := o.Len()
l := l1
if l2 < l1 {
l = l2
}
for i := 0; i < l; i++ {
if this.properties[i].LessThan(o.At(i)) {
return true
} else if o.At(i).LessThan(this.properties[i]) {
return false
}
}
return l1 < l2
}
// Name returns the name of this property ("endpoints") with any alias.
func (this ActivityStreamsEndpointsProperty) Name() string {
if len(this.alias) > 0 {
return this.alias + ":" + "endpoints"
} else {
return "endpoints"
}
}
// PrependActivityStreamsEndpoints prepends a Endpoints value to the front of a
// list of the property "endpoints". Invalidates all iterators.
func (this *ActivityStreamsEndpointsProperty) PrependActivityStreamsEndpoints(v vocab.ActivityStreamsEndpoints) {
this.properties = append([]*ActivityStreamsEndpointsPropertyIterator{{
activitystreamsEndpointsMember: v,
alias: this.alias,
myIdx: 0,
parent: this,
}}, this.properties...)
for i := 1; i < this.Len(); i++ {
(this.properties)[i].myIdx = i
}
}
// PrependIRI prepends an IRI value to the front of a list of the property
// "endpoints".
func (this *ActivityStreamsEndpointsProperty) PrependIRI(v *url.URL) {
this.properties = append([]*ActivityStreamsEndpointsPropertyIterator{{
alias: this.alias,
iri: v,
myIdx: 0,
parent: this,
}}, this.properties...)
for i := 1; i < this.Len(); i++ {
(this.properties)[i].myIdx = i
}
}
// PrependType prepends an arbitrary type value to the front of a list of the
// property "endpoints". Invalidates all iterators. Returns an error if the
// type is not a valid one to set for this property.
func (this *ActivityStreamsEndpointsProperty) PrependType(t vocab.Type) error {
n := &ActivityStreamsEndpointsPropertyIterator{
alias: this.alias,
myIdx: 0,
parent: this,
}
if err := n.SetType(t); err != nil {
return err
}
this.properties = append([]*ActivityStreamsEndpointsPropertyIterator{n}, this.properties...)
for i := 1; i < this.Len(); i++ {
(this.properties)[i].myIdx = i
}
return nil
}
// Remove deletes an element at the specified index from a list of the property
// "endpoints", regardless of its type. Panics if the index is out of bounds.
// Invalidates all iterators.
func (this *ActivityStreamsEndpointsProperty) Remove(idx int) {
(this.properties)[idx].parent = nil
copy((this.properties)[idx:], (this.properties)[idx+1:])
(this.properties)[len(this.properties)-1] = &ActivityStreamsEndpointsPropertyIterator{}
this.properties = (this.properties)[:len(this.properties)-1]
for i := idx; i < this.Len(); i++ {
(this.properties)[i].myIdx = i
}
}
// Serialize converts this into an interface representation suitable for
// marshalling into a text or binary format. Applications should not need this
// function as most typical use cases serialize types instead of individual
// properties. It is exposed for alternatives to go-fed implementations to use.
func (this ActivityStreamsEndpointsProperty) Serialize() (interface{}, error) {
s := make([]interface{}, 0, len(this.properties))
for _, iterator := range this.properties {
if b, err := iterator.serialize(); err != nil {
return s, err
} else {
s = append(s, b)
}
}
// Shortcut: if serializing one value, don't return an array -- pretty sure other Fediverse software would choke on a "type" value with array, for example.
if len(s) == 1 {
return s[0], nil
}
return s, nil
}
// Set sets a Endpoints value to be at the specified index for the property
// "endpoints". Panics if the index is out of bounds. Invalidates all
// iterators.
func (this *ActivityStreamsEndpointsProperty) Set(idx int, v vocab.ActivityStreamsEndpoints) {
(this.properties)[idx].parent = nil
(this.properties)[idx] = &ActivityStreamsEndpointsPropertyIterator{
activitystreamsEndpointsMember: v,
alias: this.alias,
myIdx: idx,
parent: this,
}
}
// SetIRI sets an IRI value to be at the specified index for the property
// "endpoints". Panics if the index is out of bounds.
func (this *ActivityStreamsEndpointsProperty) SetIRI(idx int, v *url.URL) {
(this.properties)[idx].parent = nil
(this.properties)[idx] = &ActivityStreamsEndpointsPropertyIterator{
alias: this.alias,
iri: v,
myIdx: idx,
parent: this,
}
}
// SetType sets an arbitrary type value to the specified index of the property
// "endpoints". Invalidates all iterators. Returns an error if the type is not
// a valid one to set for this property. Panics if the index is out of bounds.
func (this *ActivityStreamsEndpointsProperty) SetType(idx int, t vocab.Type) error {
n := &ActivityStreamsEndpointsPropertyIterator{
alias: this.alias,
myIdx: idx,
parent: this,
}
if err := n.SetType(t); err != nil {
return err
}
(this.properties)[idx] = n
return nil
}
// Swap swaps the location of values at two indices for the "endpoints" property.
func (this ActivityStreamsEndpointsProperty) Swap(i, j int) {
this.properties[i], this.properties[j] = this.properties[j], this.properties[i]
}

View file

@ -0,0 +1,17 @@
// Code generated by astool. DO NOT EDIT.
// Package propertysharedinbox contains the implementation for the sharedInbox
// property. All applications are strongly encouraged to use the interface
// instead of this concrete definition. The interfaces allow applications to
// consume only the types and properties needed and be independent of the
// go-fed implementation if another alternative implementation is created.
// This package is code-generated and subject to the same license as the
// go-fed tool used to generate it.
//
// This package is independent of other types' and properties' implementations
// by having a Manager injected into it to act as a factory for the concrete
// implementations. The implementations have been generated into their own
// separate subpackages for each vocabulary.
//
// Strongly consider using the interfaces instead of this package.
package propertysharedinbox

View file

@ -0,0 +1,15 @@
// Code generated by astool. DO NOT EDIT.
package propertysharedinbox
var mgr privateManager
// privateManager abstracts the code-generated manager that provides access to
// concrete implementations.
type privateManager interface{}
// SetManager sets the manager package-global variable. For internal use only, do
// not use as part of Application behavior. Must be called at golang init time.
func SetManager(m privateManager) {
mgr = m
}

View file

@ -0,0 +1,182 @@
// Code generated by astool. DO NOT EDIT.
package propertysharedinbox
import (
"fmt"
anyuri "github.com/superseriousbusiness/activity/streams/values/anyURI"
vocab "github.com/superseriousbusiness/activity/streams/vocab"
"net/url"
)
// ActivityStreamsSharedInboxProperty is the functional property "sharedInbox". It
// is permitted to be a single nilable value type.
type ActivityStreamsSharedInboxProperty struct {
xmlschemaAnyURIMember *url.URL
unknown interface{}
alias string
}
// DeserializeSharedInboxProperty creates a "sharedInbox" property from an
// interface representation that has been unmarshalled from a text or binary
// format.
func DeserializeSharedInboxProperty(m map[string]interface{}, aliasMap map[string]string) (*ActivityStreamsSharedInboxProperty, error) {
alias := ""
if a, ok := aliasMap["https://www.w3.org/ns/activitystreams"]; ok {
alias = a
}
propName := "sharedInbox"
if len(alias) > 0 {
// Use alias both to find the property, and set within the property.
propName = fmt.Sprintf("%s:%s", alias, "sharedInbox")
}
i, ok := m[propName]
if ok {
if v, err := anyuri.DeserializeAnyURI(i); err == nil {
this := &ActivityStreamsSharedInboxProperty{
alias: alias,
xmlschemaAnyURIMember: v,
}
return this, nil
}
this := &ActivityStreamsSharedInboxProperty{
alias: alias,
unknown: i,
}
return this, nil
}
return nil, nil
}
// NewActivityStreamsSharedInboxProperty creates a new sharedInbox property.
func NewActivityStreamsSharedInboxProperty() *ActivityStreamsSharedInboxProperty {
return &ActivityStreamsSharedInboxProperty{alias: ""}
}
// Clear ensures no value of this property is set. Calling IsXMLSchemaAnyURI
// afterwards will return false.
func (this *ActivityStreamsSharedInboxProperty) Clear() {
this.unknown = nil
this.xmlschemaAnyURIMember = nil
}
// Get returns the value of this property. When IsXMLSchemaAnyURI returns false,
// Get will return any arbitrary value.
func (this ActivityStreamsSharedInboxProperty) Get() *url.URL {
return this.xmlschemaAnyURIMember
}
// GetIRI returns the IRI of this property. When IsIRI returns false, GetIRI will
// return any arbitrary value.
func (this ActivityStreamsSharedInboxProperty) GetIRI() *url.URL {
return this.xmlschemaAnyURIMember
}
// HasAny returns true if the value or IRI is set.
func (this ActivityStreamsSharedInboxProperty) HasAny() bool {
return this.IsXMLSchemaAnyURI()
}
// IsIRI returns true if this property is an IRI.
func (this ActivityStreamsSharedInboxProperty) IsIRI() bool {
return this.xmlschemaAnyURIMember != nil
}
// IsXMLSchemaAnyURI returns true if this property is set and not an IRI.
func (this ActivityStreamsSharedInboxProperty) IsXMLSchemaAnyURI() bool {
return this.xmlschemaAnyURIMember != nil
}
// JSONLDContext returns the JSONLD URIs required in the context string for this
// property and the specific values that are set. The value in the map is the
// alias used to import the property's value or values.
func (this ActivityStreamsSharedInboxProperty) JSONLDContext() map[string]string {
m := map[string]string{"https://www.w3.org/ns/activitystreams": this.alias}
var child map[string]string
/*
Since the literal maps in this function are determined at
code-generation time, this loop should not overwrite an existing key with a
new value.
*/
for k, v := range child {
m[k] = v
}
return m
}
// KindIndex computes an arbitrary value for indexing this kind of value. This is
// a leaky API detail only for folks looking to replace the go-fed
// implementation. Applications should not use this method.
func (this ActivityStreamsSharedInboxProperty) KindIndex() int {
if this.IsXMLSchemaAnyURI() {
return 0
}
if this.IsIRI() {
return -2
}
return -1
}
// LessThan compares two instances of this property with an arbitrary but stable
// comparison. Applications should not use this because it is only meant to
// help alternative implementations to go-fed to be able to normalize
// nonfunctional properties.
func (this ActivityStreamsSharedInboxProperty) LessThan(o vocab.ActivityStreamsSharedInboxProperty) bool {
if this.IsIRI() {
// IRIs are always less than other values, none, or unknowns
return true
} else if o.IsIRI() {
// This other, none, or unknown value is always greater than IRIs
return false
}
// LessThan comparison for the single value or unknown value.
if !this.IsXMLSchemaAnyURI() && !o.IsXMLSchemaAnyURI() {
// Both are unknowns.
return false
} else if this.IsXMLSchemaAnyURI() && !o.IsXMLSchemaAnyURI() {
// Values are always greater than unknown values.
return false
} else if !this.IsXMLSchemaAnyURI() && o.IsXMLSchemaAnyURI() {
// Unknowns are always less than known values.
return true
} else {
// Actual comparison.
return anyuri.LessAnyURI(this.Get(), o.Get())
}
}
// Name returns the name of this property: "sharedInbox".
func (this ActivityStreamsSharedInboxProperty) Name() string {
if len(this.alias) > 0 {
return this.alias + ":" + "sharedInbox"
} else {
return "sharedInbox"
}
}
// Serialize converts this into an interface representation suitable for
// marshalling into a text or binary format. Applications should not need this
// function as most typical use cases serialize types instead of individual
// properties. It is exposed for alternatives to go-fed implementations to use.
func (this ActivityStreamsSharedInboxProperty) Serialize() (interface{}, error) {
if this.IsXMLSchemaAnyURI() {
return anyuri.SerializeAnyURI(this.Get())
}
return this.unknown, nil
}
// Set sets the value of this property. Calling IsXMLSchemaAnyURI afterwards will
// return true.
func (this *ActivityStreamsSharedInboxProperty) Set(v *url.URL) {
this.Clear()
this.xmlschemaAnyURIMember = v
}
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
// true.
func (this *ActivityStreamsSharedInboxProperty) SetIRI(v *url.URL) {
this.Clear()
this.Set(v)
}

View file

@ -60,6 +60,10 @@ type privateManager interface {
// method for the "ActivityStreamsEndTimeProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndTimePropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndTimeProperty, error)
// DeserializeEndpointsPropertyActivityStreams returns the deserialization
// method for the "ActivityStreamsEndpointsProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndpointsPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpointsProperty, error)
// DeserializeFeaturedPropertyToot returns the deserialization method for
// the "TootFeaturedProperty" non-functional property in the
// vocabulary "Toot"

View file

@ -28,6 +28,7 @@ type ActivityStreamsApplication struct {
TootDiscoverable vocab.TootDiscoverableProperty
ActivityStreamsDuration vocab.ActivityStreamsDurationProperty
ActivityStreamsEndTime vocab.ActivityStreamsEndTimeProperty
ActivityStreamsEndpoints vocab.ActivityStreamsEndpointsProperty
TootFeatured vocab.TootFeaturedProperty
ActivityStreamsFollowers vocab.ActivityStreamsFollowersProperty
ActivityStreamsFollowing vocab.ActivityStreamsFollowingProperty
@ -197,6 +198,11 @@ func DeserializeApplication(m map[string]interface{}, aliasMap map[string]string
} else if p != nil {
this.ActivityStreamsEndTime = p
}
if p, err := mgr.DeserializeEndpointsPropertyActivityStreams()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
this.ActivityStreamsEndpoints = p
}
if p, err := mgr.DeserializeFeaturedPropertyToot()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
@ -408,6 +414,8 @@ func DeserializeApplication(m map[string]interface{}, aliasMap map[string]string
continue
} else if k == "endTime" {
continue
} else if k == "endpoints" {
continue
} else if k == "featured" {
continue
} else if k == "followers" {
@ -580,6 +588,12 @@ func (this ActivityStreamsApplication) GetActivityStreamsEndTime() vocab.Activit
return this.ActivityStreamsEndTime
}
// GetActivityStreamsEndpoints returns the "endpoints" property if it exists, and
// nil otherwise.
func (this ActivityStreamsApplication) GetActivityStreamsEndpoints() vocab.ActivityStreamsEndpointsProperty {
return this.ActivityStreamsEndpoints
}
// GetActivityStreamsFollowers returns the "followers" property if it exists, and
// nil otherwise.
func (this ActivityStreamsApplication) GetActivityStreamsFollowers() vocab.ActivityStreamsFollowersProperty {
@ -834,6 +848,7 @@ func (this ActivityStreamsApplication) JSONLDContext() map[string]string {
m = this.helperJSONLDContext(this.TootDiscoverable, m)
m = this.helperJSONLDContext(this.ActivityStreamsDuration, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndTime, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndpoints, m)
m = this.helperJSONLDContext(this.TootFeatured, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowers, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowing, m)
@ -1046,6 +1061,20 @@ func (this ActivityStreamsApplication) LessThan(o vocab.ActivityStreamsApplicati
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "endpoints"
if lhs, rhs := this.ActivityStreamsEndpoints, o.GetActivityStreamsEndpoints(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
return true
} else if rhs.LessThan(lhs) {
return false
}
} else if lhs == nil && rhs != nil {
// Nil is less than anything else
return true
} else if rhs != nil && rhs == nil {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "featured"
if lhs, rhs := this.TootFeatured, o.GetTootFeatured(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
@ -1669,6 +1698,14 @@ func (this ActivityStreamsApplication) Serialize() (map[string]interface{}, erro
m[this.ActivityStreamsEndTime.Name()] = i
}
}
// Maybe serialize property "endpoints"
if this.ActivityStreamsEndpoints != nil {
if i, err := this.ActivityStreamsEndpoints.Serialize(); err != nil {
return nil, err
} else if i != nil {
m[this.ActivityStreamsEndpoints.Name()] = i
}
}
// Maybe serialize property "featured"
if this.TootFeatured != nil {
if i, err := this.TootFeatured.Serialize(); err != nil {
@ -2026,6 +2063,11 @@ func (this *ActivityStreamsApplication) SetActivityStreamsEndTime(i vocab.Activi
this.ActivityStreamsEndTime = i
}
// SetActivityStreamsEndpoints sets the "endpoints" property.
func (this *ActivityStreamsApplication) SetActivityStreamsEndpoints(i vocab.ActivityStreamsEndpointsProperty) {
this.ActivityStreamsEndpoints = i
}
// SetActivityStreamsFollowers sets the "followers" property.
func (this *ActivityStreamsApplication) SetActivityStreamsFollowers(i vocab.ActivityStreamsFollowersProperty) {
this.ActivityStreamsFollowers = i

View file

@ -0,0 +1,17 @@
// Code generated by astool. DO NOT EDIT.
// Package typeendpoints contains the implementation for the Endpoints type. All
// applications are strongly encouraged to use the interface instead of this
// concrete definition. The interfaces allow applications to consume only the
// types and properties needed and be independent of the go-fed implementation
// if another alternative implementation is created. This package is
// code-generated and subject to the same license as the go-fed tool used to
// generate it.
//
// This package is independent of other types' and properties' implementations
// by having a Manager injected into it to act as a factory for the concrete
// implementations. The implementations have been generated into their own
// separate subpackages for each vocabulary.
//
// Strongly consider using the interfaces instead of this package.
package typeendpoints

View file

@ -0,0 +1,50 @@
// Code generated by astool. DO NOT EDIT.
package typeendpoints
import vocab "github.com/superseriousbusiness/activity/streams/vocab"
var mgr privateManager
var typePropertyConstructor func() vocab.JSONLDTypeProperty
// privateManager abstracts the code-generated manager that provides access to
// concrete implementations.
type privateManager interface {
// DeserializeIdPropertyJSONLD returns the deserialization method for the
// "JSONLDIdProperty" non-functional property in the vocabulary
// "JSONLD"
DeserializeIdPropertyJSONLD() func(map[string]interface{}, map[string]string) (vocab.JSONLDIdProperty, error)
// DeserializeSharedInboxPropertyActivityStreams returns the
// deserialization method for the "ActivityStreamsSharedInboxProperty"
// non-functional property in the vocabulary "ActivityStreams"
DeserializeSharedInboxPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsSharedInboxProperty, error)
}
// jsonldContexter is a private interface to determine the JSON-LD contexts and
// aliases needed for functional and non-functional properties. It is a helper
// interface for this implementation.
type jsonldContexter interface {
// JSONLDContext returns the JSONLD URIs required in the context string
// for this property and the specific values that are set. The value
// in the map is the alias used to import the property's value or
// values.
JSONLDContext() map[string]string
}
// SetManager sets the manager package-global variable. For internal use only, do
// not use as part of Application behavior. Must be called at golang init time.
func SetManager(m privateManager) {
mgr = m
}
// SetTypePropertyConstructor sets the "type" property's constructor in the
// package-global variable. For internal use only, do not use as part of
// Application behavior. Must be called at golang init time. Permits
// ActivityStreams types to correctly set their "type" property at
// construction time, so users don't have to remember to do so each time. It
// is dependency injected so other go-fed compatible implementations could
// inject their own type.
func SetTypePropertyConstructor(f func() vocab.JSONLDTypeProperty) {
typePropertyConstructor = f
}

View file

@ -0,0 +1,250 @@
// Code generated by astool. DO NOT EDIT.
package typeendpoints
import vocab "github.com/superseriousbusiness/activity/streams/vocab"
// A json object which maps additional (typically server/domain-wide) endpoints
// which may be useful either for this actor or someone referencing this
// actor. This mapping may be nested inside the actor document as the value or
// may be a link to a JSON-LD document with these properties.
type ActivityStreamsEndpoints struct {
JSONLDId vocab.JSONLDIdProperty
ActivityStreamsSharedInbox vocab.ActivityStreamsSharedInboxProperty
alias string
unknown map[string]interface{}
}
// ActivityStreamsEndpointsExtends returns true if the Endpoints type extends from
// the other type.
func ActivityStreamsEndpointsExtends(other vocab.Type) bool {
// Shortcut implementation: this does not extend anything.
return false
}
// DeserializeEndpoints creates a Endpoints from a map representation that has
// been unmarshalled from a text or binary format.
func DeserializeEndpoints(m map[string]interface{}, aliasMap map[string]string) (*ActivityStreamsEndpoints, error) {
alias := ""
if a, ok := aliasMap["https://www.w3.org/ns/activitystreams"]; ok {
alias = a
}
this := &ActivityStreamsEndpoints{
alias: alias,
unknown: make(map[string]interface{}),
}
// Begin: Known property deserialization
if p, err := mgr.DeserializeIdPropertyJSONLD()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
this.JSONLDId = p
}
if p, err := mgr.DeserializeSharedInboxPropertyActivityStreams()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
this.ActivityStreamsSharedInbox = p
}
// End: Known property deserialization
// Begin: Unknown deserialization
for k, v := range m {
// Begin: Code that ensures a property name is unknown
if k == "id" {
continue
} else if k == "sharedInbox" {
continue
} // End: Code that ensures a property name is unknown
this.unknown[k] = v
}
// End: Unknown deserialization
return this, nil
}
// EndpointsIsDisjointWith returns true if the other provided type is disjoint
// with the Endpoints type.
func EndpointsIsDisjointWith(other vocab.Type) bool {
// Shortcut implementation: is not disjoint with anything.
return false
}
// EndpointsIsExtendedBy returns true if the other provided type extends from the
// Endpoints type. Note that it returns false if the types are the same; see
// the "IsOrExtendsEndpoints" variant instead.
func EndpointsIsExtendedBy(other vocab.Type) bool {
// Shortcut implementation: is not extended by anything.
return false
}
// IsOrExtendsEndpoints returns true if the other provided type is the Endpoints
// type or extends from the Endpoints type.
func IsOrExtendsEndpoints(other vocab.Type) bool {
if other.GetTypeName() == "Endpoints" {
return true
}
return EndpointsIsExtendedBy(other)
}
// NewActivityStreamsEndpoints creates a new Endpoints type
func NewActivityStreamsEndpoints() *ActivityStreamsEndpoints {
return &ActivityStreamsEndpoints{
alias: "",
unknown: make(map[string]interface{}),
}
}
// GetActivityStreamsSharedInbox returns the "sharedInbox" property if it exists,
// and nil otherwise.
func (this ActivityStreamsEndpoints) GetActivityStreamsSharedInbox() vocab.ActivityStreamsSharedInboxProperty {
return this.ActivityStreamsSharedInbox
}
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
func (this ActivityStreamsEndpoints) GetJSONLDId() vocab.JSONLDIdProperty {
return this.JSONLDId
}
// GetTypeName returns the name of this type.
func (this ActivityStreamsEndpoints) GetTypeName() string {
return "Endpoints"
}
// GetUnknownProperties returns the unknown properties for the Endpoints type.
// Note that this should not be used by app developers. It is only used to
// help determine which implementation is LessThan the other. Developers who
// are creating a different implementation of this type's interface can use
// this method in their LessThan implementation, but routine ActivityPub
// applications should not use this to bypass the code generation tool.
func (this ActivityStreamsEndpoints) GetUnknownProperties() map[string]interface{} {
return this.unknown
}
// IsExtending returns true if the Endpoints type extends from the other type.
func (this ActivityStreamsEndpoints) IsExtending(other vocab.Type) bool {
return ActivityStreamsEndpointsExtends(other)
}
// JSONLDContext returns the JSONLD URIs required in the context string for this
// type and the specific properties that are set. The value in the map is the
// alias used to import the type and its properties.
func (this ActivityStreamsEndpoints) JSONLDContext() map[string]string {
m := map[string]string{"https://www.w3.org/ns/activitystreams": this.alias}
m = this.helperJSONLDContext(this.JSONLDId, m)
m = this.helperJSONLDContext(this.ActivityStreamsSharedInbox, m)
return m
}
// LessThan computes if this Endpoints is lesser, with an arbitrary but stable
// determination.
func (this ActivityStreamsEndpoints) LessThan(o vocab.ActivityStreamsEndpoints) bool {
// Begin: Compare known properties
// Compare property "id"
if lhs, rhs := this.JSONLDId, o.GetJSONLDId(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
return true
} else if rhs.LessThan(lhs) {
return false
}
} else if lhs == nil && rhs != nil {
// Nil is less than anything else
return true
} else if rhs != nil && rhs == nil {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "sharedInbox"
if lhs, rhs := this.ActivityStreamsSharedInbox, o.GetActivityStreamsSharedInbox(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
return true
} else if rhs.LessThan(lhs) {
return false
}
} else if lhs == nil && rhs != nil {
// Nil is less than anything else
return true
} else if rhs != nil && rhs == nil {
// Anything else is greater than nil
return false
} // Else: Both are nil
// End: Compare known properties
// Begin: Compare unknown properties (only by number of them)
if len(this.unknown) < len(o.GetUnknownProperties()) {
return true
} else if len(o.GetUnknownProperties()) < len(this.unknown) {
return false
} // End: Compare unknown properties (only by number of them)
// All properties are the same.
return false
}
// Serialize converts this into an interface representation suitable for
// marshalling into a text or binary format.
func (this ActivityStreamsEndpoints) Serialize() (map[string]interface{}, error) {
m := make(map[string]interface{})
// Begin: Serialize known properties
// Maybe serialize property "id"
if this.JSONLDId != nil {
if i, err := this.JSONLDId.Serialize(); err != nil {
return nil, err
} else if i != nil {
m[this.JSONLDId.Name()] = i
}
}
// Maybe serialize property "sharedInbox"
if this.ActivityStreamsSharedInbox != nil {
if i, err := this.ActivityStreamsSharedInbox.Serialize(); err != nil {
return nil, err
} else if i != nil {
m[this.ActivityStreamsSharedInbox.Name()] = i
}
}
// End: Serialize known properties
// Begin: Serialize unknown properties
for k, v := range this.unknown {
// To be safe, ensure we aren't overwriting a known property
if _, has := m[k]; !has {
m[k] = v
}
}
// End: Serialize unknown properties
return m, nil
}
// SetActivityStreamsSharedInbox sets the "sharedInbox" property.
func (this *ActivityStreamsEndpoints) SetActivityStreamsSharedInbox(i vocab.ActivityStreamsSharedInboxProperty) {
this.ActivityStreamsSharedInbox = i
}
// SetJSONLDId sets the "id" property.
func (this *ActivityStreamsEndpoints) SetJSONLDId(i vocab.JSONLDIdProperty) {
this.JSONLDId = i
}
// VocabularyURI returns the vocabulary's URI as a string.
func (this ActivityStreamsEndpoints) VocabularyURI() string {
return "https://www.w3.org/ns/activitystreams"
}
// helperJSONLDContext obtains the context uris and their aliases from a property,
// if it is not nil.
func (this ActivityStreamsEndpoints) helperJSONLDContext(i jsonldContexter, toMerge map[string]string) map[string]string {
if i == nil {
return toMerge
}
for k, v := range i.JSONLDContext() {
/*
Since the literal maps in this function are determined at
code-generation time, this loop should not overwrite an existing key with a
new value.
*/
toMerge[k] = v
}
return toMerge
}

View file

@ -60,6 +60,10 @@ type privateManager interface {
// method for the "ActivityStreamsEndTimeProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndTimePropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndTimeProperty, error)
// DeserializeEndpointsPropertyActivityStreams returns the deserialization
// method for the "ActivityStreamsEndpointsProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndpointsPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpointsProperty, error)
// DeserializeFeaturedPropertyToot returns the deserialization method for
// the "TootFeaturedProperty" non-functional property in the
// vocabulary "Toot"

View file

@ -28,6 +28,7 @@ type ActivityStreamsGroup struct {
TootDiscoverable vocab.TootDiscoverableProperty
ActivityStreamsDuration vocab.ActivityStreamsDurationProperty
ActivityStreamsEndTime vocab.ActivityStreamsEndTimeProperty
ActivityStreamsEndpoints vocab.ActivityStreamsEndpointsProperty
TootFeatured vocab.TootFeaturedProperty
ActivityStreamsFollowers vocab.ActivityStreamsFollowersProperty
ActivityStreamsFollowing vocab.ActivityStreamsFollowingProperty
@ -177,6 +178,11 @@ func DeserializeGroup(m map[string]interface{}, aliasMap map[string]string) (*Ac
} else if p != nil {
this.ActivityStreamsEndTime = p
}
if p, err := mgr.DeserializeEndpointsPropertyActivityStreams()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
this.ActivityStreamsEndpoints = p
}
if p, err := mgr.DeserializeFeaturedPropertyToot()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
@ -388,6 +394,8 @@ func DeserializeGroup(m map[string]interface{}, aliasMap map[string]string) (*Ac
continue
} else if k == "endTime" {
continue
} else if k == "endpoints" {
continue
} else if k == "featured" {
continue
} else if k == "followers" {
@ -580,6 +588,12 @@ func (this ActivityStreamsGroup) GetActivityStreamsEndTime() vocab.ActivityStrea
return this.ActivityStreamsEndTime
}
// GetActivityStreamsEndpoints returns the "endpoints" property if it exists, and
// nil otherwise.
func (this ActivityStreamsGroup) GetActivityStreamsEndpoints() vocab.ActivityStreamsEndpointsProperty {
return this.ActivityStreamsEndpoints
}
// GetActivityStreamsFollowers returns the "followers" property if it exists, and
// nil otherwise.
func (this ActivityStreamsGroup) GetActivityStreamsFollowers() vocab.ActivityStreamsFollowersProperty {
@ -834,6 +848,7 @@ func (this ActivityStreamsGroup) JSONLDContext() map[string]string {
m = this.helperJSONLDContext(this.TootDiscoverable, m)
m = this.helperJSONLDContext(this.ActivityStreamsDuration, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndTime, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndpoints, m)
m = this.helperJSONLDContext(this.TootFeatured, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowers, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowing, m)
@ -1046,6 +1061,20 @@ func (this ActivityStreamsGroup) LessThan(o vocab.ActivityStreamsGroup) bool {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "endpoints"
if lhs, rhs := this.ActivityStreamsEndpoints, o.GetActivityStreamsEndpoints(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
return true
} else if rhs.LessThan(lhs) {
return false
}
} else if lhs == nil && rhs != nil {
// Nil is less than anything else
return true
} else if rhs != nil && rhs == nil {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "featured"
if lhs, rhs := this.TootFeatured, o.GetTootFeatured(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
@ -1669,6 +1698,14 @@ func (this ActivityStreamsGroup) Serialize() (map[string]interface{}, error) {
m[this.ActivityStreamsEndTime.Name()] = i
}
}
// Maybe serialize property "endpoints"
if this.ActivityStreamsEndpoints != nil {
if i, err := this.ActivityStreamsEndpoints.Serialize(); err != nil {
return nil, err
} else if i != nil {
m[this.ActivityStreamsEndpoints.Name()] = i
}
}
// Maybe serialize property "featured"
if this.TootFeatured != nil {
if i, err := this.TootFeatured.Serialize(); err != nil {
@ -2026,6 +2063,11 @@ func (this *ActivityStreamsGroup) SetActivityStreamsEndTime(i vocab.ActivityStre
this.ActivityStreamsEndTime = i
}
// SetActivityStreamsEndpoints sets the "endpoints" property.
func (this *ActivityStreamsGroup) SetActivityStreamsEndpoints(i vocab.ActivityStreamsEndpointsProperty) {
this.ActivityStreamsEndpoints = i
}
// SetActivityStreamsFollowers sets the "followers" property.
func (this *ActivityStreamsGroup) SetActivityStreamsFollowers(i vocab.ActivityStreamsFollowersProperty) {
this.ActivityStreamsFollowers = i

View file

@ -60,6 +60,10 @@ type privateManager interface {
// method for the "ActivityStreamsEndTimeProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndTimePropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndTimeProperty, error)
// DeserializeEndpointsPropertyActivityStreams returns the deserialization
// method for the "ActivityStreamsEndpointsProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndpointsPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpointsProperty, error)
// DeserializeFeaturedPropertyToot returns the deserialization method for
// the "TootFeaturedProperty" non-functional property in the
// vocabulary "Toot"

View file

@ -28,6 +28,7 @@ type ActivityStreamsOrganization struct {
TootDiscoverable vocab.TootDiscoverableProperty
ActivityStreamsDuration vocab.ActivityStreamsDurationProperty
ActivityStreamsEndTime vocab.ActivityStreamsEndTimeProperty
ActivityStreamsEndpoints vocab.ActivityStreamsEndpointsProperty
TootFeatured vocab.TootFeaturedProperty
ActivityStreamsFollowers vocab.ActivityStreamsFollowersProperty
ActivityStreamsFollowing vocab.ActivityStreamsFollowingProperty
@ -177,6 +178,11 @@ func DeserializeOrganization(m map[string]interface{}, aliasMap map[string]strin
} else if p != nil {
this.ActivityStreamsEndTime = p
}
if p, err := mgr.DeserializeEndpointsPropertyActivityStreams()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
this.ActivityStreamsEndpoints = p
}
if p, err := mgr.DeserializeFeaturedPropertyToot()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
@ -388,6 +394,8 @@ func DeserializeOrganization(m map[string]interface{}, aliasMap map[string]strin
continue
} else if k == "endTime" {
continue
} else if k == "endpoints" {
continue
} else if k == "featured" {
continue
} else if k == "followers" {
@ -580,6 +588,12 @@ func (this ActivityStreamsOrganization) GetActivityStreamsEndTime() vocab.Activi
return this.ActivityStreamsEndTime
}
// GetActivityStreamsEndpoints returns the "endpoints" property if it exists, and
// nil otherwise.
func (this ActivityStreamsOrganization) GetActivityStreamsEndpoints() vocab.ActivityStreamsEndpointsProperty {
return this.ActivityStreamsEndpoints
}
// GetActivityStreamsFollowers returns the "followers" property if it exists, and
// nil otherwise.
func (this ActivityStreamsOrganization) GetActivityStreamsFollowers() vocab.ActivityStreamsFollowersProperty {
@ -834,6 +848,7 @@ func (this ActivityStreamsOrganization) JSONLDContext() map[string]string {
m = this.helperJSONLDContext(this.TootDiscoverable, m)
m = this.helperJSONLDContext(this.ActivityStreamsDuration, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndTime, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndpoints, m)
m = this.helperJSONLDContext(this.TootFeatured, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowers, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowing, m)
@ -1046,6 +1061,20 @@ func (this ActivityStreamsOrganization) LessThan(o vocab.ActivityStreamsOrganiza
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "endpoints"
if lhs, rhs := this.ActivityStreamsEndpoints, o.GetActivityStreamsEndpoints(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
return true
} else if rhs.LessThan(lhs) {
return false
}
} else if lhs == nil && rhs != nil {
// Nil is less than anything else
return true
} else if rhs != nil && rhs == nil {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "featured"
if lhs, rhs := this.TootFeatured, o.GetTootFeatured(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
@ -1669,6 +1698,14 @@ func (this ActivityStreamsOrganization) Serialize() (map[string]interface{}, err
m[this.ActivityStreamsEndTime.Name()] = i
}
}
// Maybe serialize property "endpoints"
if this.ActivityStreamsEndpoints != nil {
if i, err := this.ActivityStreamsEndpoints.Serialize(); err != nil {
return nil, err
} else if i != nil {
m[this.ActivityStreamsEndpoints.Name()] = i
}
}
// Maybe serialize property "featured"
if this.TootFeatured != nil {
if i, err := this.TootFeatured.Serialize(); err != nil {
@ -2026,6 +2063,11 @@ func (this *ActivityStreamsOrganization) SetActivityStreamsEndTime(i vocab.Activ
this.ActivityStreamsEndTime = i
}
// SetActivityStreamsEndpoints sets the "endpoints" property.
func (this *ActivityStreamsOrganization) SetActivityStreamsEndpoints(i vocab.ActivityStreamsEndpointsProperty) {
this.ActivityStreamsEndpoints = i
}
// SetActivityStreamsFollowers sets the "followers" property.
func (this *ActivityStreamsOrganization) SetActivityStreamsFollowers(i vocab.ActivityStreamsFollowersProperty) {
this.ActivityStreamsFollowers = i

View file

@ -60,6 +60,10 @@ type privateManager interface {
// method for the "ActivityStreamsEndTimeProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndTimePropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndTimeProperty, error)
// DeserializeEndpointsPropertyActivityStreams returns the deserialization
// method for the "ActivityStreamsEndpointsProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndpointsPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpointsProperty, error)
// DeserializeFeaturedPropertyToot returns the deserialization method for
// the "TootFeaturedProperty" non-functional property in the
// vocabulary "Toot"

View file

@ -28,6 +28,7 @@ type ActivityStreamsPerson struct {
TootDiscoverable vocab.TootDiscoverableProperty
ActivityStreamsDuration vocab.ActivityStreamsDurationProperty
ActivityStreamsEndTime vocab.ActivityStreamsEndTimeProperty
ActivityStreamsEndpoints vocab.ActivityStreamsEndpointsProperty
TootFeatured vocab.TootFeaturedProperty
ActivityStreamsFollowers vocab.ActivityStreamsFollowersProperty
ActivityStreamsFollowing vocab.ActivityStreamsFollowingProperty
@ -177,6 +178,11 @@ func DeserializePerson(m map[string]interface{}, aliasMap map[string]string) (*A
} else if p != nil {
this.ActivityStreamsEndTime = p
}
if p, err := mgr.DeserializeEndpointsPropertyActivityStreams()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
this.ActivityStreamsEndpoints = p
}
if p, err := mgr.DeserializeFeaturedPropertyToot()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
@ -388,6 +394,8 @@ func DeserializePerson(m map[string]interface{}, aliasMap map[string]string) (*A
continue
} else if k == "endTime" {
continue
} else if k == "endpoints" {
continue
} else if k == "featured" {
continue
} else if k == "followers" {
@ -580,6 +588,12 @@ func (this ActivityStreamsPerson) GetActivityStreamsEndTime() vocab.ActivityStre
return this.ActivityStreamsEndTime
}
// GetActivityStreamsEndpoints returns the "endpoints" property if it exists, and
// nil otherwise.
func (this ActivityStreamsPerson) GetActivityStreamsEndpoints() vocab.ActivityStreamsEndpointsProperty {
return this.ActivityStreamsEndpoints
}
// GetActivityStreamsFollowers returns the "followers" property if it exists, and
// nil otherwise.
func (this ActivityStreamsPerson) GetActivityStreamsFollowers() vocab.ActivityStreamsFollowersProperty {
@ -834,6 +848,7 @@ func (this ActivityStreamsPerson) JSONLDContext() map[string]string {
m = this.helperJSONLDContext(this.TootDiscoverable, m)
m = this.helperJSONLDContext(this.ActivityStreamsDuration, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndTime, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndpoints, m)
m = this.helperJSONLDContext(this.TootFeatured, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowers, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowing, m)
@ -1046,6 +1061,20 @@ func (this ActivityStreamsPerson) LessThan(o vocab.ActivityStreamsPerson) bool {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "endpoints"
if lhs, rhs := this.ActivityStreamsEndpoints, o.GetActivityStreamsEndpoints(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
return true
} else if rhs.LessThan(lhs) {
return false
}
} else if lhs == nil && rhs != nil {
// Nil is less than anything else
return true
} else if rhs != nil && rhs == nil {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "featured"
if lhs, rhs := this.TootFeatured, o.GetTootFeatured(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
@ -1669,6 +1698,14 @@ func (this ActivityStreamsPerson) Serialize() (map[string]interface{}, error) {
m[this.ActivityStreamsEndTime.Name()] = i
}
}
// Maybe serialize property "endpoints"
if this.ActivityStreamsEndpoints != nil {
if i, err := this.ActivityStreamsEndpoints.Serialize(); err != nil {
return nil, err
} else if i != nil {
m[this.ActivityStreamsEndpoints.Name()] = i
}
}
// Maybe serialize property "featured"
if this.TootFeatured != nil {
if i, err := this.TootFeatured.Serialize(); err != nil {
@ -2026,6 +2063,11 @@ func (this *ActivityStreamsPerson) SetActivityStreamsEndTime(i vocab.ActivityStr
this.ActivityStreamsEndTime = i
}
// SetActivityStreamsEndpoints sets the "endpoints" property.
func (this *ActivityStreamsPerson) SetActivityStreamsEndpoints(i vocab.ActivityStreamsEndpointsProperty) {
this.ActivityStreamsEndpoints = i
}
// SetActivityStreamsFollowers sets the "followers" property.
func (this *ActivityStreamsPerson) SetActivityStreamsFollowers(i vocab.ActivityStreamsFollowersProperty) {
this.ActivityStreamsFollowers = i

View file

@ -60,6 +60,10 @@ type privateManager interface {
// method for the "ActivityStreamsEndTimeProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndTimePropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndTimeProperty, error)
// DeserializeEndpointsPropertyActivityStreams returns the deserialization
// method for the "ActivityStreamsEndpointsProperty" non-functional
// property in the vocabulary "ActivityStreams"
DeserializeEndpointsPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpointsProperty, error)
// DeserializeFeaturedPropertyToot returns the deserialization method for
// the "TootFeaturedProperty" non-functional property in the
// vocabulary "Toot"

View file

@ -28,6 +28,7 @@ type ActivityStreamsService struct {
TootDiscoverable vocab.TootDiscoverableProperty
ActivityStreamsDuration vocab.ActivityStreamsDurationProperty
ActivityStreamsEndTime vocab.ActivityStreamsEndTimeProperty
ActivityStreamsEndpoints vocab.ActivityStreamsEndpointsProperty
TootFeatured vocab.TootFeaturedProperty
ActivityStreamsFollowers vocab.ActivityStreamsFollowersProperty
ActivityStreamsFollowing vocab.ActivityStreamsFollowingProperty
@ -177,6 +178,11 @@ func DeserializeService(m map[string]interface{}, aliasMap map[string]string) (*
} else if p != nil {
this.ActivityStreamsEndTime = p
}
if p, err := mgr.DeserializeEndpointsPropertyActivityStreams()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
this.ActivityStreamsEndpoints = p
}
if p, err := mgr.DeserializeFeaturedPropertyToot()(m, aliasMap); err != nil {
return nil, err
} else if p != nil {
@ -388,6 +394,8 @@ func DeserializeService(m map[string]interface{}, aliasMap map[string]string) (*
continue
} else if k == "endTime" {
continue
} else if k == "endpoints" {
continue
} else if k == "featured" {
continue
} else if k == "followers" {
@ -580,6 +588,12 @@ func (this ActivityStreamsService) GetActivityStreamsEndTime() vocab.ActivityStr
return this.ActivityStreamsEndTime
}
// GetActivityStreamsEndpoints returns the "endpoints" property if it exists, and
// nil otherwise.
func (this ActivityStreamsService) GetActivityStreamsEndpoints() vocab.ActivityStreamsEndpointsProperty {
return this.ActivityStreamsEndpoints
}
// GetActivityStreamsFollowers returns the "followers" property if it exists, and
// nil otherwise.
func (this ActivityStreamsService) GetActivityStreamsFollowers() vocab.ActivityStreamsFollowersProperty {
@ -834,6 +848,7 @@ func (this ActivityStreamsService) JSONLDContext() map[string]string {
m = this.helperJSONLDContext(this.TootDiscoverable, m)
m = this.helperJSONLDContext(this.ActivityStreamsDuration, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndTime, m)
m = this.helperJSONLDContext(this.ActivityStreamsEndpoints, m)
m = this.helperJSONLDContext(this.TootFeatured, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowers, m)
m = this.helperJSONLDContext(this.ActivityStreamsFollowing, m)
@ -1046,6 +1061,20 @@ func (this ActivityStreamsService) LessThan(o vocab.ActivityStreamsService) bool
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "endpoints"
if lhs, rhs := this.ActivityStreamsEndpoints, o.GetActivityStreamsEndpoints(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
return true
} else if rhs.LessThan(lhs) {
return false
}
} else if lhs == nil && rhs != nil {
// Nil is less than anything else
return true
} else if rhs != nil && rhs == nil {
// Anything else is greater than nil
return false
} // Else: Both are nil
// Compare property "featured"
if lhs, rhs := this.TootFeatured, o.GetTootFeatured(); lhs != nil && rhs != nil {
if lhs.LessThan(rhs) {
@ -1669,6 +1698,14 @@ func (this ActivityStreamsService) Serialize() (map[string]interface{}, error) {
m[this.ActivityStreamsEndTime.Name()] = i
}
}
// Maybe serialize property "endpoints"
if this.ActivityStreamsEndpoints != nil {
if i, err := this.ActivityStreamsEndpoints.Serialize(); err != nil {
return nil, err
} else if i != nil {
m[this.ActivityStreamsEndpoints.Name()] = i
}
}
// Maybe serialize property "featured"
if this.TootFeatured != nil {
if i, err := this.TootFeatured.Serialize(); err != nil {
@ -2026,6 +2063,11 @@ func (this *ActivityStreamsService) SetActivityStreamsEndTime(i vocab.ActivitySt
this.ActivityStreamsEndTime = i
}
// SetActivityStreamsEndpoints sets the "endpoints" property.
func (this *ActivityStreamsService) SetActivityStreamsEndpoints(i vocab.ActivityStreamsEndpointsProperty) {
this.ActivityStreamsEndpoints = i
}
// SetActivityStreamsFollowers sets the "followers" property.
func (this *ActivityStreamsService) SetActivityStreamsFollowers(i vocab.ActivityStreamsFollowersProperty) {
this.ActivityStreamsFollowers = i