mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-29 10:06:15 -06:00
[chore] upstep activity to v1.7.0-gts (#3074)
This commit is contained in:
parent
49009fbd8f
commit
1a66ea8998
96 changed files with 8362 additions and 4 deletions
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_always/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_always/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package propertyalways contains the implementation for the always 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 propertyalways
|
||||
15
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_always/gen_pkg.go
generated
vendored
Normal file
15
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_always/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyalways
|
||||
|
||||
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
|
||||
}
|
||||
503
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_always/gen_property_gotosocial_always.go
generated
vendored
Normal file
503
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_always/gen_property_gotosocial_always.go
generated
vendored
Normal file
|
|
@ -0,0 +1,503 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyalways
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
anyuri "github.com/superseriousbusiness/activity/streams/values/anyURI"
|
||||
vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GoToSocialAlwaysPropertyIterator is an iterator for a property. It is permitted
|
||||
// to be a single nilable value type.
|
||||
type GoToSocialAlwaysPropertyIterator struct {
|
||||
xmlschemaAnyURIMember *url.URL
|
||||
unknown interface{}
|
||||
alias string
|
||||
myIdx int
|
||||
parent vocab.GoToSocialAlwaysProperty
|
||||
}
|
||||
|
||||
// NewGoToSocialAlwaysPropertyIterator creates a new GoToSocialAlways property.
|
||||
func NewGoToSocialAlwaysPropertyIterator() *GoToSocialAlwaysPropertyIterator {
|
||||
return &GoToSocialAlwaysPropertyIterator{alias: ""}
|
||||
}
|
||||
|
||||
// deserializeGoToSocialAlwaysPropertyIterator creates an iterator from an element
|
||||
// that has been unmarshalled from a text or binary format.
|
||||
func deserializeGoToSocialAlwaysPropertyIterator(i interface{}, aliasMap map[string]string) (*GoToSocialAlwaysPropertyIterator, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
if v, err := anyuri.DeserializeAnyURI(i); err == nil {
|
||||
this := &GoToSocialAlwaysPropertyIterator{
|
||||
alias: alias,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
this := &GoToSocialAlwaysPropertyIterator{
|
||||
alias: alias,
|
||||
unknown: i,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// Get returns the value of this property. When IsXMLSchemaAnyURI returns false,
|
||||
// Get will return any arbitrary value.
|
||||
func (this GoToSocialAlwaysPropertyIterator) 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 GoToSocialAlwaysPropertyIterator) GetIRI() *url.URL {
|
||||
return this.xmlschemaAnyURIMember
|
||||
}
|
||||
|
||||
// HasAny returns true if the value or IRI is set.
|
||||
func (this GoToSocialAlwaysPropertyIterator) HasAny() bool {
|
||||
return this.IsXMLSchemaAnyURI()
|
||||
}
|
||||
|
||||
// IsIRI returns true if this property is an IRI.
|
||||
func (this GoToSocialAlwaysPropertyIterator) IsIRI() bool {
|
||||
return this.xmlschemaAnyURIMember != nil
|
||||
}
|
||||
|
||||
// IsXMLSchemaAnyURI returns true if this property is set and not an IRI.
|
||||
func (this GoToSocialAlwaysPropertyIterator) 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 GoToSocialAlwaysPropertyIterator) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialAlwaysPropertyIterator) 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 GoToSocialAlwaysPropertyIterator) LessThan(o vocab.GoToSocialAlwaysPropertyIterator) 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: "GoToSocialAlways".
|
||||
func (this GoToSocialAlwaysPropertyIterator) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "GoToSocialAlways"
|
||||
} else {
|
||||
return "GoToSocialAlways"
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next iterator, or nil if there is no next iterator.
|
||||
func (this GoToSocialAlwaysPropertyIterator) Next() vocab.GoToSocialAlwaysPropertyIterator {
|
||||
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 GoToSocialAlwaysPropertyIterator) Prev() vocab.GoToSocialAlwaysPropertyIterator {
|
||||
if this.myIdx-1 < 0 {
|
||||
return nil
|
||||
} else {
|
||||
return this.parent.At(this.myIdx - 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Set sets the value of this property. Calling IsXMLSchemaAnyURI afterwards will
|
||||
// return true.
|
||||
func (this *GoToSocialAlwaysPropertyIterator) Set(v *url.URL) {
|
||||
this.clear()
|
||||
this.xmlschemaAnyURIMember = v
|
||||
}
|
||||
|
||||
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
|
||||
// true.
|
||||
func (this *GoToSocialAlwaysPropertyIterator) SetIRI(v *url.URL) {
|
||||
this.clear()
|
||||
this.Set(v)
|
||||
}
|
||||
|
||||
// clear ensures no value of this property is set. Calling IsXMLSchemaAnyURI
|
||||
// afterwards will return false.
|
||||
func (this *GoToSocialAlwaysPropertyIterator) clear() {
|
||||
this.unknown = nil
|
||||
this.xmlschemaAnyURIMember = 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 GoToSocialAlwaysPropertyIterator) serialize() (interface{}, error) {
|
||||
if this.IsXMLSchemaAnyURI() {
|
||||
return anyuri.SerializeAnyURI(this.Get())
|
||||
}
|
||||
return this.unknown, nil
|
||||
}
|
||||
|
||||
// GoToSocialAlwaysProperty is the non-functional property "always". It is
|
||||
// permitted to have one or more values, and of different value types.
|
||||
type GoToSocialAlwaysProperty struct {
|
||||
properties []*GoToSocialAlwaysPropertyIterator
|
||||
alias string
|
||||
}
|
||||
|
||||
// DeserializeAlwaysProperty creates a "always" property from an interface
|
||||
// representation that has been unmarshalled from a text or binary format.
|
||||
func DeserializeAlwaysProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.GoToSocialAlwaysProperty, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
propName := "always"
|
||||
if len(alias) > 0 {
|
||||
propName = fmt.Sprintf("%s:%s", alias, "always")
|
||||
}
|
||||
i, ok := m[propName]
|
||||
|
||||
if ok {
|
||||
this := &GoToSocialAlwaysProperty{
|
||||
alias: alias,
|
||||
properties: []*GoToSocialAlwaysPropertyIterator{},
|
||||
}
|
||||
if list, ok := i.([]interface{}); ok {
|
||||
for _, iterator := range list {
|
||||
if p, err := deserializeGoToSocialAlwaysPropertyIterator(iterator, aliasMap); err != nil {
|
||||
return this, err
|
||||
} else if p != nil {
|
||||
this.properties = append(this.properties, p)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if p, err := deserializeGoToSocialAlwaysPropertyIterator(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
|
||||
}
|
||||
|
||||
// NewGoToSocialAlwaysProperty creates a new always property.
|
||||
func NewGoToSocialAlwaysProperty() *GoToSocialAlwaysProperty {
|
||||
return &GoToSocialAlwaysProperty{alias: ""}
|
||||
}
|
||||
|
||||
// AppendIRI appends an IRI value to the back of a list of the property "always"
|
||||
func (this *GoToSocialAlwaysProperty) AppendIRI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialAlwaysPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
})
|
||||
}
|
||||
|
||||
// AppendXMLSchemaAnyURI appends a anyURI value to the back of a list of the
|
||||
// property "always". Invalidates iterators that are traversing using Prev.
|
||||
func (this *GoToSocialAlwaysProperty) AppendXMLSchemaAnyURI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialAlwaysPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
})
|
||||
}
|
||||
|
||||
// At returns the property value for the specified index. Panics if the index is
|
||||
// out of bounds.
|
||||
func (this GoToSocialAlwaysProperty) At(index int) vocab.GoToSocialAlwaysPropertyIterator {
|
||||
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 GoToSocialAlwaysProperty) Begin() vocab.GoToSocialAlwaysPropertyIterator {
|
||||
if this.Empty() {
|
||||
return nil
|
||||
} else {
|
||||
return this.properties[0]
|
||||
}
|
||||
}
|
||||
|
||||
// Empty returns returns true if there are no elements.
|
||||
func (this GoToSocialAlwaysProperty) 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 GoToSocialAlwaysProperty) End() vocab.GoToSocialAlwaysPropertyIterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Insert inserts an IRI value at the specified index for a property "always".
|
||||
// Existing elements at that index and higher are shifted back once.
|
||||
// Invalidates all iterators.
|
||||
func (this *GoToSocialAlwaysProperty) InsertIRI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialAlwaysPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
for i := idx; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// InsertXMLSchemaAnyURI inserts a anyURI value at the specified index for a
|
||||
// property "always". Existing elements at that index and higher are shifted
|
||||
// back once. Invalidates all iterators.
|
||||
func (this *GoToSocialAlwaysProperty) InsertXMLSchemaAnyURI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialAlwaysPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
for i := idx; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// 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 GoToSocialAlwaysProperty) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialAlwaysProperty) KindIndex(idx int) int {
|
||||
return this.properties[idx].KindIndex()
|
||||
}
|
||||
|
||||
// Len returns the number of values that exist for the "always" property.
|
||||
func (this GoToSocialAlwaysProperty) 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 GoToSocialAlwaysProperty) 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 anyuri.LessAnyURI(lhs, 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 GoToSocialAlwaysProperty) LessThan(o vocab.GoToSocialAlwaysProperty) 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 ("always") with any alias.
|
||||
func (this GoToSocialAlwaysProperty) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "always"
|
||||
} else {
|
||||
return "always"
|
||||
}
|
||||
}
|
||||
|
||||
// PrependIRI prepends an IRI value to the front of a list of the property
|
||||
// "always".
|
||||
func (this *GoToSocialAlwaysProperty) PrependIRI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialAlwaysPropertyIterator{{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}}, this.properties...)
|
||||
for i := 1; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// PrependXMLSchemaAnyURI prepends a anyURI value to the front of a list of the
|
||||
// property "always". Invalidates all iterators.
|
||||
func (this *GoToSocialAlwaysProperty) PrependXMLSchemaAnyURI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialAlwaysPropertyIterator{{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}}, this.properties...)
|
||||
for i := 1; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// Remove deletes an element at the specified index from a list of the property
|
||||
// "always", regardless of its type. Panics if the index is out of bounds.
|
||||
// Invalidates all iterators.
|
||||
func (this *GoToSocialAlwaysProperty) Remove(idx int) {
|
||||
(this.properties)[idx].parent = nil
|
||||
copy((this.properties)[idx:], (this.properties)[idx+1:])
|
||||
(this.properties)[len(this.properties)-1] = &GoToSocialAlwaysPropertyIterator{}
|
||||
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 GoToSocialAlwaysProperty) 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 anyURI value to be at the specified index for the property "always".
|
||||
// Panics if the index is out of bounds. Invalidates all iterators.
|
||||
func (this *GoToSocialAlwaysProperty) Set(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialAlwaysPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
}
|
||||
|
||||
// SetIRI sets an IRI value to be at the specified index for the property
|
||||
// "always". Panics if the index is out of bounds.
|
||||
func (this *GoToSocialAlwaysProperty) SetIRI(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialAlwaysPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
}
|
||||
|
||||
// Swap swaps the location of values at two indices for the "always" property.
|
||||
func (this GoToSocialAlwaysProperty) Swap(i, j int) {
|
||||
this.properties[i], this.properties[j] = this.properties[j], this.properties[i]
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvalrequired/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvalrequired/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package propertyapprovalrequired contains the implementation for the
|
||||
// approvalRequired 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 propertyapprovalrequired
|
||||
15
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvalrequired/gen_pkg.go
generated
vendored
Normal file
15
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvalrequired/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyapprovalrequired
|
||||
|
||||
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
|
||||
}
|
||||
|
|
@ -0,0 +1,510 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyapprovalrequired
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
anyuri "github.com/superseriousbusiness/activity/streams/values/anyURI"
|
||||
vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GoToSocialApprovalRequiredPropertyIterator is an iterator for a property. It is
|
||||
// permitted to be a single nilable value type.
|
||||
type GoToSocialApprovalRequiredPropertyIterator struct {
|
||||
xmlschemaAnyURIMember *url.URL
|
||||
unknown interface{}
|
||||
alias string
|
||||
myIdx int
|
||||
parent vocab.GoToSocialApprovalRequiredProperty
|
||||
}
|
||||
|
||||
// NewGoToSocialApprovalRequiredPropertyIterator creates a new
|
||||
// GoToSocialApprovalRequired property.
|
||||
func NewGoToSocialApprovalRequiredPropertyIterator() *GoToSocialApprovalRequiredPropertyIterator {
|
||||
return &GoToSocialApprovalRequiredPropertyIterator{alias: ""}
|
||||
}
|
||||
|
||||
// deserializeGoToSocialApprovalRequiredPropertyIterator creates an iterator from
|
||||
// an element that has been unmarshalled from a text or binary format.
|
||||
func deserializeGoToSocialApprovalRequiredPropertyIterator(i interface{}, aliasMap map[string]string) (*GoToSocialApprovalRequiredPropertyIterator, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
if v, err := anyuri.DeserializeAnyURI(i); err == nil {
|
||||
this := &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: alias,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
this := &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: alias,
|
||||
unknown: i,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// Get returns the value of this property. When IsXMLSchemaAnyURI returns false,
|
||||
// Get will return any arbitrary value.
|
||||
func (this GoToSocialApprovalRequiredPropertyIterator) 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 GoToSocialApprovalRequiredPropertyIterator) GetIRI() *url.URL {
|
||||
return this.xmlschemaAnyURIMember
|
||||
}
|
||||
|
||||
// HasAny returns true if the value or IRI is set.
|
||||
func (this GoToSocialApprovalRequiredPropertyIterator) HasAny() bool {
|
||||
return this.IsXMLSchemaAnyURI()
|
||||
}
|
||||
|
||||
// IsIRI returns true if this property is an IRI.
|
||||
func (this GoToSocialApprovalRequiredPropertyIterator) IsIRI() bool {
|
||||
return this.xmlschemaAnyURIMember != nil
|
||||
}
|
||||
|
||||
// IsXMLSchemaAnyURI returns true if this property is set and not an IRI.
|
||||
func (this GoToSocialApprovalRequiredPropertyIterator) 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 GoToSocialApprovalRequiredPropertyIterator) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialApprovalRequiredPropertyIterator) 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 GoToSocialApprovalRequiredPropertyIterator) LessThan(o vocab.GoToSocialApprovalRequiredPropertyIterator) 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: "GoToSocialApprovalRequired".
|
||||
func (this GoToSocialApprovalRequiredPropertyIterator) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "GoToSocialApprovalRequired"
|
||||
} else {
|
||||
return "GoToSocialApprovalRequired"
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next iterator, or nil if there is no next iterator.
|
||||
func (this GoToSocialApprovalRequiredPropertyIterator) Next() vocab.GoToSocialApprovalRequiredPropertyIterator {
|
||||
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 GoToSocialApprovalRequiredPropertyIterator) Prev() vocab.GoToSocialApprovalRequiredPropertyIterator {
|
||||
if this.myIdx-1 < 0 {
|
||||
return nil
|
||||
} else {
|
||||
return this.parent.At(this.myIdx - 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Set sets the value of this property. Calling IsXMLSchemaAnyURI afterwards will
|
||||
// return true.
|
||||
func (this *GoToSocialApprovalRequiredPropertyIterator) Set(v *url.URL) {
|
||||
this.clear()
|
||||
this.xmlschemaAnyURIMember = v
|
||||
}
|
||||
|
||||
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
|
||||
// true.
|
||||
func (this *GoToSocialApprovalRequiredPropertyIterator) SetIRI(v *url.URL) {
|
||||
this.clear()
|
||||
this.Set(v)
|
||||
}
|
||||
|
||||
// clear ensures no value of this property is set. Calling IsXMLSchemaAnyURI
|
||||
// afterwards will return false.
|
||||
func (this *GoToSocialApprovalRequiredPropertyIterator) clear() {
|
||||
this.unknown = nil
|
||||
this.xmlschemaAnyURIMember = 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 GoToSocialApprovalRequiredPropertyIterator) serialize() (interface{}, error) {
|
||||
if this.IsXMLSchemaAnyURI() {
|
||||
return anyuri.SerializeAnyURI(this.Get())
|
||||
}
|
||||
return this.unknown, nil
|
||||
}
|
||||
|
||||
// GoToSocialApprovalRequiredProperty is the non-functional property
|
||||
// "approvalRequired". It is permitted to have one or more values, and of
|
||||
// different value types.
|
||||
type GoToSocialApprovalRequiredProperty struct {
|
||||
properties []*GoToSocialApprovalRequiredPropertyIterator
|
||||
alias string
|
||||
}
|
||||
|
||||
// DeserializeApprovalRequiredProperty creates a "approvalRequired" property from
|
||||
// an interface representation that has been unmarshalled from a text or
|
||||
// binary format.
|
||||
func DeserializeApprovalRequiredProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.GoToSocialApprovalRequiredProperty, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
propName := "approvalRequired"
|
||||
if len(alias) > 0 {
|
||||
propName = fmt.Sprintf("%s:%s", alias, "approvalRequired")
|
||||
}
|
||||
i, ok := m[propName]
|
||||
|
||||
if ok {
|
||||
this := &GoToSocialApprovalRequiredProperty{
|
||||
alias: alias,
|
||||
properties: []*GoToSocialApprovalRequiredPropertyIterator{},
|
||||
}
|
||||
if list, ok := i.([]interface{}); ok {
|
||||
for _, iterator := range list {
|
||||
if p, err := deserializeGoToSocialApprovalRequiredPropertyIterator(iterator, aliasMap); err != nil {
|
||||
return this, err
|
||||
} else if p != nil {
|
||||
this.properties = append(this.properties, p)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if p, err := deserializeGoToSocialApprovalRequiredPropertyIterator(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
|
||||
}
|
||||
|
||||
// NewGoToSocialApprovalRequiredProperty creates a new approvalRequired property.
|
||||
func NewGoToSocialApprovalRequiredProperty() *GoToSocialApprovalRequiredProperty {
|
||||
return &GoToSocialApprovalRequiredProperty{alias: ""}
|
||||
}
|
||||
|
||||
// AppendIRI appends an IRI value to the back of a list of the property
|
||||
// "approvalRequired"
|
||||
func (this *GoToSocialApprovalRequiredProperty) AppendIRI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
})
|
||||
}
|
||||
|
||||
// AppendXMLSchemaAnyURI appends a anyURI value to the back of a list of the
|
||||
// property "approvalRequired". Invalidates iterators that are traversing
|
||||
// using Prev.
|
||||
func (this *GoToSocialApprovalRequiredProperty) AppendXMLSchemaAnyURI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
})
|
||||
}
|
||||
|
||||
// At returns the property value for the specified index. Panics if the index is
|
||||
// out of bounds.
|
||||
func (this GoToSocialApprovalRequiredProperty) At(index int) vocab.GoToSocialApprovalRequiredPropertyIterator {
|
||||
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 GoToSocialApprovalRequiredProperty) Begin() vocab.GoToSocialApprovalRequiredPropertyIterator {
|
||||
if this.Empty() {
|
||||
return nil
|
||||
} else {
|
||||
return this.properties[0]
|
||||
}
|
||||
}
|
||||
|
||||
// Empty returns returns true if there are no elements.
|
||||
func (this GoToSocialApprovalRequiredProperty) 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 GoToSocialApprovalRequiredProperty) End() vocab.GoToSocialApprovalRequiredPropertyIterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Insert inserts an IRI value at the specified index for a property
|
||||
// "approvalRequired". Existing elements at that index and higher are shifted
|
||||
// back once. Invalidates all iterators.
|
||||
func (this *GoToSocialApprovalRequiredProperty) InsertIRI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
for i := idx; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// InsertXMLSchemaAnyURI inserts a anyURI value at the specified index for a
|
||||
// property "approvalRequired". Existing elements at that index and higher are
|
||||
// shifted back once. Invalidates all iterators.
|
||||
func (this *GoToSocialApprovalRequiredProperty) InsertXMLSchemaAnyURI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
for i := idx; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// 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 GoToSocialApprovalRequiredProperty) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialApprovalRequiredProperty) KindIndex(idx int) int {
|
||||
return this.properties[idx].KindIndex()
|
||||
}
|
||||
|
||||
// Len returns the number of values that exist for the "approvalRequired" property.
|
||||
func (this GoToSocialApprovalRequiredProperty) 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 GoToSocialApprovalRequiredProperty) 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 anyuri.LessAnyURI(lhs, 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 GoToSocialApprovalRequiredProperty) LessThan(o vocab.GoToSocialApprovalRequiredProperty) 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 ("approvalRequired") with any alias.
|
||||
func (this GoToSocialApprovalRequiredProperty) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "approvalRequired"
|
||||
} else {
|
||||
return "approvalRequired"
|
||||
}
|
||||
}
|
||||
|
||||
// PrependIRI prepends an IRI value to the front of a list of the property
|
||||
// "approvalRequired".
|
||||
func (this *GoToSocialApprovalRequiredProperty) PrependIRI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialApprovalRequiredPropertyIterator{{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}}, this.properties...)
|
||||
for i := 1; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// PrependXMLSchemaAnyURI prepends a anyURI value to the front of a list of the
|
||||
// property "approvalRequired". Invalidates all iterators.
|
||||
func (this *GoToSocialApprovalRequiredProperty) PrependXMLSchemaAnyURI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialApprovalRequiredPropertyIterator{{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}}, this.properties...)
|
||||
for i := 1; i < this.Len(); i++ {
|
||||
(this.properties)[i].myIdx = i
|
||||
}
|
||||
}
|
||||
|
||||
// Remove deletes an element at the specified index from a list of the property
|
||||
// "approvalRequired", regardless of its type. Panics if the index is out of
|
||||
// bounds. Invalidates all iterators.
|
||||
func (this *GoToSocialApprovalRequiredProperty) Remove(idx int) {
|
||||
(this.properties)[idx].parent = nil
|
||||
copy((this.properties)[idx:], (this.properties)[idx+1:])
|
||||
(this.properties)[len(this.properties)-1] = &GoToSocialApprovalRequiredPropertyIterator{}
|
||||
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 GoToSocialApprovalRequiredProperty) 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 anyURI value to be at the specified index for the property
|
||||
// "approvalRequired". Panics if the index is out of bounds. Invalidates all
|
||||
// iterators.
|
||||
func (this *GoToSocialApprovalRequiredProperty) Set(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
}
|
||||
|
||||
// SetIRI sets an IRI value to be at the specified index for the property
|
||||
// "approvalRequired". Panics if the index is out of bounds.
|
||||
func (this *GoToSocialApprovalRequiredProperty) SetIRI(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialApprovalRequiredPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
}
|
||||
|
||||
// Swap swaps the location of values at two indices for the "approvalRequired"
|
||||
// property.
|
||||
func (this GoToSocialApprovalRequiredProperty) Swap(i, j int) {
|
||||
this.properties[i], this.properties[j] = this.properties[j], this.properties[i]
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvedby/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvedby/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package propertyapprovedby contains the implementation for the approvedBy
|
||||
// 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 propertyapprovedby
|
||||
15
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvedby/gen_pkg.go
generated
vendored
Normal file
15
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvedby/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyapprovedby
|
||||
|
||||
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
|
||||
}
|
||||
181
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvedby/gen_property_gotosocial_approvedBy.go
generated
vendored
Normal file
181
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_approvedby/gen_property_gotosocial_approvedBy.go
generated
vendored
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyapprovedby
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
anyuri "github.com/superseriousbusiness/activity/streams/values/anyURI"
|
||||
vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GoToSocialApprovedByProperty is the functional property "approvedBy". It is
|
||||
// permitted to be a single nilable value type.
|
||||
type GoToSocialApprovedByProperty struct {
|
||||
xmlschemaAnyURIMember *url.URL
|
||||
unknown interface{}
|
||||
alias string
|
||||
}
|
||||
|
||||
// DeserializeApprovedByProperty creates a "approvedBy" property from an interface
|
||||
// representation that has been unmarshalled from a text or binary format.
|
||||
func DeserializeApprovedByProperty(m map[string]interface{}, aliasMap map[string]string) (*GoToSocialApprovedByProperty, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
propName := "approvedBy"
|
||||
if len(alias) > 0 {
|
||||
// Use alias both to find the property, and set within the property.
|
||||
propName = fmt.Sprintf("%s:%s", alias, "approvedBy")
|
||||
}
|
||||
i, ok := m[propName]
|
||||
|
||||
if ok {
|
||||
if v, err := anyuri.DeserializeAnyURI(i); err == nil {
|
||||
this := &GoToSocialApprovedByProperty{
|
||||
alias: alias,
|
||||
xmlschemaAnyURIMember: v,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
this := &GoToSocialApprovedByProperty{
|
||||
alias: alias,
|
||||
unknown: i,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// NewGoToSocialApprovedByProperty creates a new approvedBy property.
|
||||
func NewGoToSocialApprovedByProperty() *GoToSocialApprovedByProperty {
|
||||
return &GoToSocialApprovedByProperty{alias: ""}
|
||||
}
|
||||
|
||||
// Clear ensures no value of this property is set. Calling IsXMLSchemaAnyURI
|
||||
// afterwards will return false.
|
||||
func (this *GoToSocialApprovedByProperty) 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 GoToSocialApprovedByProperty) 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 GoToSocialApprovedByProperty) GetIRI() *url.URL {
|
||||
return this.xmlschemaAnyURIMember
|
||||
}
|
||||
|
||||
// HasAny returns true if the value or IRI is set.
|
||||
func (this GoToSocialApprovedByProperty) HasAny() bool {
|
||||
return this.IsXMLSchemaAnyURI()
|
||||
}
|
||||
|
||||
// IsIRI returns true if this property is an IRI.
|
||||
func (this GoToSocialApprovedByProperty) IsIRI() bool {
|
||||
return this.xmlschemaAnyURIMember != nil
|
||||
}
|
||||
|
||||
// IsXMLSchemaAnyURI returns true if this property is set and not an IRI.
|
||||
func (this GoToSocialApprovedByProperty) 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 GoToSocialApprovedByProperty) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialApprovedByProperty) 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 GoToSocialApprovedByProperty) LessThan(o vocab.GoToSocialApprovedByProperty) 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: "approvedBy".
|
||||
func (this GoToSocialApprovedByProperty) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "approvedBy"
|
||||
} else {
|
||||
return "approvedBy"
|
||||
}
|
||||
}
|
||||
|
||||
// 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 GoToSocialApprovedByProperty) 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 *GoToSocialApprovedByProperty) Set(v *url.URL) {
|
||||
this.Clear()
|
||||
this.xmlschemaAnyURIMember = v
|
||||
}
|
||||
|
||||
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
|
||||
// true.
|
||||
func (this *GoToSocialApprovedByProperty) SetIRI(v *url.URL) {
|
||||
this.Clear()
|
||||
this.Set(v)
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canannounce/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canannounce/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package propertycanannounce contains the implementation for the canAnnounce
|
||||
// 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 propertycanannounce
|
||||
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canannounce/gen_pkg.go
generated
vendored
Normal file
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canannounce/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertycanannounce
|
||||
|
||||
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 {
|
||||
// DeserializeCanAnnounceGoToSocial returns the deserialization method for
|
||||
// the "GoToSocialCanAnnounce" non-functional property in the
|
||||
// vocabulary "GoToSocial"
|
||||
DeserializeCanAnnounceGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialCanAnnounce, 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
|
||||
}
|
||||
625
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canannounce/gen_property_gotosocial_canAnnounce.go
generated
vendored
Normal file
625
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canannounce/gen_property_gotosocial_canAnnounce.go
generated
vendored
Normal file
|
|
@ -0,0 +1,625 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertycanannounce
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GoToSocialCanAnnouncePropertyIterator is an iterator for a property. It is
|
||||
// permitted to be a single nilable value type.
|
||||
type GoToSocialCanAnnouncePropertyIterator struct {
|
||||
gotosocialCanAnnounceMember vocab.GoToSocialCanAnnounce
|
||||
unknown interface{}
|
||||
iri *url.URL
|
||||
alias string
|
||||
myIdx int
|
||||
parent vocab.GoToSocialCanAnnounceProperty
|
||||
}
|
||||
|
||||
// NewGoToSocialCanAnnouncePropertyIterator creates a new GoToSocialCanAnnounce
|
||||
// property.
|
||||
func NewGoToSocialCanAnnouncePropertyIterator() *GoToSocialCanAnnouncePropertyIterator {
|
||||
return &GoToSocialCanAnnouncePropertyIterator{alias: ""}
|
||||
}
|
||||
|
||||
// deserializeGoToSocialCanAnnouncePropertyIterator creates an iterator from an
|
||||
// element that has been unmarshalled from a text or binary format.
|
||||
func deserializeGoToSocialCanAnnouncePropertyIterator(i interface{}, aliasMap map[string]string) (*GoToSocialCanAnnouncePropertyIterator, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; 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 := &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: alias,
|
||||
iri: u,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
if m, ok := i.(map[string]interface{}); ok {
|
||||
if v, err := mgr.DeserializeCanAnnounceGoToSocial()(m, aliasMap); err == nil {
|
||||
this := &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: alias,
|
||||
gotosocialCanAnnounceMember: v,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
this := &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: alias,
|
||||
unknown: i,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// Get returns the value of this property. When IsGoToSocialCanAnnounce returns
|
||||
// false, Get will return any arbitrary value.
|
||||
func (this GoToSocialCanAnnouncePropertyIterator) Get() vocab.GoToSocialCanAnnounce {
|
||||
return this.gotosocialCanAnnounceMember
|
||||
}
|
||||
|
||||
// GetIRI returns the IRI of this property. When IsIRI returns false, GetIRI will
|
||||
// return any arbitrary value.
|
||||
func (this GoToSocialCanAnnouncePropertyIterator) 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 GoToSocialCanAnnouncePropertyIterator) GetType() vocab.Type {
|
||||
if this.IsGoToSocialCanAnnounce() {
|
||||
return this.Get()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// HasAny returns true if the value or IRI is set.
|
||||
func (this GoToSocialCanAnnouncePropertyIterator) HasAny() bool {
|
||||
return this.IsGoToSocialCanAnnounce() || this.iri != nil
|
||||
}
|
||||
|
||||
// IsGoToSocialCanAnnounce returns true if this property is set and not an IRI.
|
||||
func (this GoToSocialCanAnnouncePropertyIterator) IsGoToSocialCanAnnounce() bool {
|
||||
return this.gotosocialCanAnnounceMember != nil
|
||||
}
|
||||
|
||||
// IsIRI returns true if this property is an IRI.
|
||||
func (this GoToSocialCanAnnouncePropertyIterator) 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 GoToSocialCanAnnouncePropertyIterator) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
var child map[string]string
|
||||
if this.IsGoToSocialCanAnnounce() {
|
||||
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 GoToSocialCanAnnouncePropertyIterator) KindIndex() int {
|
||||
if this.IsGoToSocialCanAnnounce() {
|
||||
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 GoToSocialCanAnnouncePropertyIterator) LessThan(o vocab.GoToSocialCanAnnouncePropertyIterator) 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.IsGoToSocialCanAnnounce() && !o.IsGoToSocialCanAnnounce() {
|
||||
// Both are unknowns.
|
||||
return false
|
||||
} else if this.IsGoToSocialCanAnnounce() && !o.IsGoToSocialCanAnnounce() {
|
||||
// Values are always greater than unknown values.
|
||||
return false
|
||||
} else if !this.IsGoToSocialCanAnnounce() && o.IsGoToSocialCanAnnounce() {
|
||||
// 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: "GoToSocialCanAnnounce".
|
||||
func (this GoToSocialCanAnnouncePropertyIterator) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "GoToSocialCanAnnounce"
|
||||
} else {
|
||||
return "GoToSocialCanAnnounce"
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next iterator, or nil if there is no next iterator.
|
||||
func (this GoToSocialCanAnnouncePropertyIterator) Next() vocab.GoToSocialCanAnnouncePropertyIterator {
|
||||
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 GoToSocialCanAnnouncePropertyIterator) Prev() vocab.GoToSocialCanAnnouncePropertyIterator {
|
||||
if this.myIdx-1 < 0 {
|
||||
return nil
|
||||
} else {
|
||||
return this.parent.At(this.myIdx - 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Set sets the value of this property. Calling IsGoToSocialCanAnnounce afterwards
|
||||
// will return true.
|
||||
func (this *GoToSocialCanAnnouncePropertyIterator) Set(v vocab.GoToSocialCanAnnounce) {
|
||||
this.clear()
|
||||
this.gotosocialCanAnnounceMember = v
|
||||
}
|
||||
|
||||
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
|
||||
// true.
|
||||
func (this *GoToSocialCanAnnouncePropertyIterator) 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 *GoToSocialCanAnnouncePropertyIterator) SetType(t vocab.Type) error {
|
||||
if v, ok := t.(vocab.GoToSocialCanAnnounce); ok {
|
||||
this.Set(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("illegal type to set on GoToSocialCanAnnounce property: %T", t)
|
||||
}
|
||||
|
||||
// clear ensures no value of this property is set. Calling IsGoToSocialCanAnnounce
|
||||
// afterwards will return false.
|
||||
func (this *GoToSocialCanAnnouncePropertyIterator) clear() {
|
||||
this.unknown = nil
|
||||
this.iri = nil
|
||||
this.gotosocialCanAnnounceMember = 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 GoToSocialCanAnnouncePropertyIterator) serialize() (interface{}, error) {
|
||||
if this.IsGoToSocialCanAnnounce() {
|
||||
return this.Get().Serialize()
|
||||
} else if this.IsIRI() {
|
||||
return this.iri.String(), nil
|
||||
}
|
||||
return this.unknown, nil
|
||||
}
|
||||
|
||||
// GoToSocialCanAnnounceProperty is the non-functional property "canAnnounce". It
|
||||
// is permitted to have one or more values, and of different value types.
|
||||
type GoToSocialCanAnnounceProperty struct {
|
||||
properties []*GoToSocialCanAnnouncePropertyIterator
|
||||
alias string
|
||||
}
|
||||
|
||||
// DeserializeCanAnnounceProperty creates a "canAnnounce" property from an
|
||||
// interface representation that has been unmarshalled from a text or binary
|
||||
// format.
|
||||
func DeserializeCanAnnounceProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.GoToSocialCanAnnounceProperty, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
propName := "canAnnounce"
|
||||
if len(alias) > 0 {
|
||||
propName = fmt.Sprintf("%s:%s", alias, "canAnnounce")
|
||||
}
|
||||
i, ok := m[propName]
|
||||
|
||||
if ok {
|
||||
this := &GoToSocialCanAnnounceProperty{
|
||||
alias: alias,
|
||||
properties: []*GoToSocialCanAnnouncePropertyIterator{},
|
||||
}
|
||||
if list, ok := i.([]interface{}); ok {
|
||||
for _, iterator := range list {
|
||||
if p, err := deserializeGoToSocialCanAnnouncePropertyIterator(iterator, aliasMap); err != nil {
|
||||
return this, err
|
||||
} else if p != nil {
|
||||
this.properties = append(this.properties, p)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if p, err := deserializeGoToSocialCanAnnouncePropertyIterator(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
|
||||
}
|
||||
|
||||
// NewGoToSocialCanAnnounceProperty creates a new canAnnounce property.
|
||||
func NewGoToSocialCanAnnounceProperty() *GoToSocialCanAnnounceProperty {
|
||||
return &GoToSocialCanAnnounceProperty{alias: ""}
|
||||
}
|
||||
|
||||
// AppendGoToSocialCanAnnounce appends a CanAnnounce value to the back of a list
|
||||
// of the property "canAnnounce". Invalidates iterators that are traversing
|
||||
// using Prev.
|
||||
func (this *GoToSocialCanAnnounceProperty) AppendGoToSocialCanAnnounce(v vocab.GoToSocialCanAnnounce) {
|
||||
this.properties = append(this.properties, &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanAnnounceMember: v,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
})
|
||||
}
|
||||
|
||||
// AppendIRI appends an IRI value to the back of a list of the property
|
||||
// "canAnnounce"
|
||||
func (this *GoToSocialCanAnnounceProperty) AppendIRI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialCanAnnouncePropertyIterator{
|
||||
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 "canAnnounce". 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 *GoToSocialCanAnnounceProperty) AppendType(t vocab.Type) error {
|
||||
n := &GoToSocialCanAnnouncePropertyIterator{
|
||||
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 GoToSocialCanAnnounceProperty) At(index int) vocab.GoToSocialCanAnnouncePropertyIterator {
|
||||
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 GoToSocialCanAnnounceProperty) Begin() vocab.GoToSocialCanAnnouncePropertyIterator {
|
||||
if this.Empty() {
|
||||
return nil
|
||||
} else {
|
||||
return this.properties[0]
|
||||
}
|
||||
}
|
||||
|
||||
// Empty returns returns true if there are no elements.
|
||||
func (this GoToSocialCanAnnounceProperty) 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 GoToSocialCanAnnounceProperty) End() vocab.GoToSocialCanAnnouncePropertyIterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertGoToSocialCanAnnounce inserts a CanAnnounce value at the specified index
|
||||
// for a property "canAnnounce". Existing elements at that index and higher
|
||||
// are shifted back once. Invalidates all iterators.
|
||||
func (this *GoToSocialCanAnnounceProperty) InsertGoToSocialCanAnnounce(idx int, v vocab.GoToSocialCanAnnounce) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanAnnounceMember: v,
|
||||
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
|
||||
// "canAnnounce". Existing elements at that index and higher are shifted back
|
||||
// once. Invalidates all iterators.
|
||||
func (this *GoToSocialCanAnnounceProperty) InsertIRI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialCanAnnouncePropertyIterator{
|
||||
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 "canAnnounce". Invalidates all iterators. Returns an error if the
|
||||
// type is not a valid one to set for this property.
|
||||
func (this *GoToSocialCanAnnounceProperty) InsertType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialCanAnnouncePropertyIterator{
|
||||
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 GoToSocialCanAnnounceProperty) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialCanAnnounceProperty) KindIndex(idx int) int {
|
||||
return this.properties[idx].KindIndex()
|
||||
}
|
||||
|
||||
// Len returns the number of values that exist for the "canAnnounce" property.
|
||||
func (this GoToSocialCanAnnounceProperty) 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 GoToSocialCanAnnounceProperty) 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 GoToSocialCanAnnounceProperty) LessThan(o vocab.GoToSocialCanAnnounceProperty) 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 ("canAnnounce") with any alias.
|
||||
func (this GoToSocialCanAnnounceProperty) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "canAnnounce"
|
||||
} else {
|
||||
return "canAnnounce"
|
||||
}
|
||||
}
|
||||
|
||||
// PrependGoToSocialCanAnnounce prepends a CanAnnounce value to the front of a
|
||||
// list of the property "canAnnounce". Invalidates all iterators.
|
||||
func (this *GoToSocialCanAnnounceProperty) PrependGoToSocialCanAnnounce(v vocab.GoToSocialCanAnnounce) {
|
||||
this.properties = append([]*GoToSocialCanAnnouncePropertyIterator{{
|
||||
alias: this.alias,
|
||||
gotosocialCanAnnounceMember: v,
|
||||
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
|
||||
// "canAnnounce".
|
||||
func (this *GoToSocialCanAnnounceProperty) PrependIRI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialCanAnnouncePropertyIterator{{
|
||||
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 "canAnnounce". Invalidates all iterators. Returns an error if the
|
||||
// type is not a valid one to set for this property.
|
||||
func (this *GoToSocialCanAnnounceProperty) PrependType(t vocab.Type) error {
|
||||
n := &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
}
|
||||
if err := n.SetType(t); err != nil {
|
||||
return err
|
||||
}
|
||||
this.properties = append([]*GoToSocialCanAnnouncePropertyIterator{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
|
||||
// "canAnnounce", regardless of its type. Panics if the index is out of
|
||||
// bounds. Invalidates all iterators.
|
||||
func (this *GoToSocialCanAnnounceProperty) Remove(idx int) {
|
||||
(this.properties)[idx].parent = nil
|
||||
copy((this.properties)[idx:], (this.properties)[idx+1:])
|
||||
(this.properties)[len(this.properties)-1] = &GoToSocialCanAnnouncePropertyIterator{}
|
||||
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 GoToSocialCanAnnounceProperty) 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 CanAnnounce value to be at the specified index for the property
|
||||
// "canAnnounce". Panics if the index is out of bounds. Invalidates all
|
||||
// iterators.
|
||||
func (this *GoToSocialCanAnnounceProperty) Set(idx int, v vocab.GoToSocialCanAnnounce) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanAnnounceMember: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetIRI sets an IRI value to be at the specified index for the property
|
||||
// "canAnnounce". Panics if the index is out of bounds.
|
||||
func (this *GoToSocialCanAnnounceProperty) SetIRI(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialCanAnnouncePropertyIterator{
|
||||
alias: this.alias,
|
||||
iri: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetType sets an arbitrary type value to the specified index of the property
|
||||
// "canAnnounce". 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 *GoToSocialCanAnnounceProperty) SetType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialCanAnnouncePropertyIterator{
|
||||
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 "canAnnounce" property.
|
||||
func (this GoToSocialCanAnnounceProperty) Swap(i, j int) {
|
||||
this.properties[i], this.properties[j] = this.properties[j], this.properties[i]
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canlike/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canlike/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package propertycanlike contains the implementation for the canLike 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 propertycanlike
|
||||
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canlike/gen_pkg.go
generated
vendored
Normal file
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canlike/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertycanlike
|
||||
|
||||
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 {
|
||||
// DeserializeCanLikeGoToSocial returns the deserialization method for the
|
||||
// "GoToSocialCanLike" non-functional property in the vocabulary
|
||||
// "GoToSocial"
|
||||
DeserializeCanLikeGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialCanLike, 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
|
||||
}
|
||||
618
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canlike/gen_property_gotosocial_canLike.go
generated
vendored
Normal file
618
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canlike/gen_property_gotosocial_canLike.go
generated
vendored
Normal file
|
|
@ -0,0 +1,618 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertycanlike
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GoToSocialCanLikePropertyIterator is an iterator for a property. It is
|
||||
// permitted to be a single nilable value type.
|
||||
type GoToSocialCanLikePropertyIterator struct {
|
||||
gotosocialCanLikeMember vocab.GoToSocialCanLike
|
||||
unknown interface{}
|
||||
iri *url.URL
|
||||
alias string
|
||||
myIdx int
|
||||
parent vocab.GoToSocialCanLikeProperty
|
||||
}
|
||||
|
||||
// NewGoToSocialCanLikePropertyIterator creates a new GoToSocialCanLike property.
|
||||
func NewGoToSocialCanLikePropertyIterator() *GoToSocialCanLikePropertyIterator {
|
||||
return &GoToSocialCanLikePropertyIterator{alias: ""}
|
||||
}
|
||||
|
||||
// deserializeGoToSocialCanLikePropertyIterator creates an iterator from an
|
||||
// element that has been unmarshalled from a text or binary format.
|
||||
func deserializeGoToSocialCanLikePropertyIterator(i interface{}, aliasMap map[string]string) (*GoToSocialCanLikePropertyIterator, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; 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 := &GoToSocialCanLikePropertyIterator{
|
||||
alias: alias,
|
||||
iri: u,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
if m, ok := i.(map[string]interface{}); ok {
|
||||
if v, err := mgr.DeserializeCanLikeGoToSocial()(m, aliasMap); err == nil {
|
||||
this := &GoToSocialCanLikePropertyIterator{
|
||||
alias: alias,
|
||||
gotosocialCanLikeMember: v,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
this := &GoToSocialCanLikePropertyIterator{
|
||||
alias: alias,
|
||||
unknown: i,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// Get returns the value of this property. When IsGoToSocialCanLike returns false,
|
||||
// Get will return any arbitrary value.
|
||||
func (this GoToSocialCanLikePropertyIterator) Get() vocab.GoToSocialCanLike {
|
||||
return this.gotosocialCanLikeMember
|
||||
}
|
||||
|
||||
// GetIRI returns the IRI of this property. When IsIRI returns false, GetIRI will
|
||||
// return any arbitrary value.
|
||||
func (this GoToSocialCanLikePropertyIterator) 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 GoToSocialCanLikePropertyIterator) GetType() vocab.Type {
|
||||
if this.IsGoToSocialCanLike() {
|
||||
return this.Get()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// HasAny returns true if the value or IRI is set.
|
||||
func (this GoToSocialCanLikePropertyIterator) HasAny() bool {
|
||||
return this.IsGoToSocialCanLike() || this.iri != nil
|
||||
}
|
||||
|
||||
// IsGoToSocialCanLike returns true if this property is set and not an IRI.
|
||||
func (this GoToSocialCanLikePropertyIterator) IsGoToSocialCanLike() bool {
|
||||
return this.gotosocialCanLikeMember != nil
|
||||
}
|
||||
|
||||
// IsIRI returns true if this property is an IRI.
|
||||
func (this GoToSocialCanLikePropertyIterator) 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 GoToSocialCanLikePropertyIterator) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
var child map[string]string
|
||||
if this.IsGoToSocialCanLike() {
|
||||
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 GoToSocialCanLikePropertyIterator) KindIndex() int {
|
||||
if this.IsGoToSocialCanLike() {
|
||||
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 GoToSocialCanLikePropertyIterator) LessThan(o vocab.GoToSocialCanLikePropertyIterator) 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.IsGoToSocialCanLike() && !o.IsGoToSocialCanLike() {
|
||||
// Both are unknowns.
|
||||
return false
|
||||
} else if this.IsGoToSocialCanLike() && !o.IsGoToSocialCanLike() {
|
||||
// Values are always greater than unknown values.
|
||||
return false
|
||||
} else if !this.IsGoToSocialCanLike() && o.IsGoToSocialCanLike() {
|
||||
// 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: "GoToSocialCanLike".
|
||||
func (this GoToSocialCanLikePropertyIterator) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "GoToSocialCanLike"
|
||||
} else {
|
||||
return "GoToSocialCanLike"
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next iterator, or nil if there is no next iterator.
|
||||
func (this GoToSocialCanLikePropertyIterator) Next() vocab.GoToSocialCanLikePropertyIterator {
|
||||
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 GoToSocialCanLikePropertyIterator) Prev() vocab.GoToSocialCanLikePropertyIterator {
|
||||
if this.myIdx-1 < 0 {
|
||||
return nil
|
||||
} else {
|
||||
return this.parent.At(this.myIdx - 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Set sets the value of this property. Calling IsGoToSocialCanLike afterwards
|
||||
// will return true.
|
||||
func (this *GoToSocialCanLikePropertyIterator) Set(v vocab.GoToSocialCanLike) {
|
||||
this.clear()
|
||||
this.gotosocialCanLikeMember = v
|
||||
}
|
||||
|
||||
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
|
||||
// true.
|
||||
func (this *GoToSocialCanLikePropertyIterator) 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 *GoToSocialCanLikePropertyIterator) SetType(t vocab.Type) error {
|
||||
if v, ok := t.(vocab.GoToSocialCanLike); ok {
|
||||
this.Set(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("illegal type to set on GoToSocialCanLike property: %T", t)
|
||||
}
|
||||
|
||||
// clear ensures no value of this property is set. Calling IsGoToSocialCanLike
|
||||
// afterwards will return false.
|
||||
func (this *GoToSocialCanLikePropertyIterator) clear() {
|
||||
this.unknown = nil
|
||||
this.iri = nil
|
||||
this.gotosocialCanLikeMember = 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 GoToSocialCanLikePropertyIterator) serialize() (interface{}, error) {
|
||||
if this.IsGoToSocialCanLike() {
|
||||
return this.Get().Serialize()
|
||||
} else if this.IsIRI() {
|
||||
return this.iri.String(), nil
|
||||
}
|
||||
return this.unknown, nil
|
||||
}
|
||||
|
||||
// GoToSocialCanLikeProperty is the non-functional property "canLike". It is
|
||||
// permitted to have one or more values, and of different value types.
|
||||
type GoToSocialCanLikeProperty struct {
|
||||
properties []*GoToSocialCanLikePropertyIterator
|
||||
alias string
|
||||
}
|
||||
|
||||
// DeserializeCanLikeProperty creates a "canLike" property from an interface
|
||||
// representation that has been unmarshalled from a text or binary format.
|
||||
func DeserializeCanLikeProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.GoToSocialCanLikeProperty, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
propName := "canLike"
|
||||
if len(alias) > 0 {
|
||||
propName = fmt.Sprintf("%s:%s", alias, "canLike")
|
||||
}
|
||||
i, ok := m[propName]
|
||||
|
||||
if ok {
|
||||
this := &GoToSocialCanLikeProperty{
|
||||
alias: alias,
|
||||
properties: []*GoToSocialCanLikePropertyIterator{},
|
||||
}
|
||||
if list, ok := i.([]interface{}); ok {
|
||||
for _, iterator := range list {
|
||||
if p, err := deserializeGoToSocialCanLikePropertyIterator(iterator, aliasMap); err != nil {
|
||||
return this, err
|
||||
} else if p != nil {
|
||||
this.properties = append(this.properties, p)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if p, err := deserializeGoToSocialCanLikePropertyIterator(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
|
||||
}
|
||||
|
||||
// NewGoToSocialCanLikeProperty creates a new canLike property.
|
||||
func NewGoToSocialCanLikeProperty() *GoToSocialCanLikeProperty {
|
||||
return &GoToSocialCanLikeProperty{alias: ""}
|
||||
}
|
||||
|
||||
// AppendGoToSocialCanLike appends a CanLike value to the back of a list of the
|
||||
// property "canLike". Invalidates iterators that are traversing using Prev.
|
||||
func (this *GoToSocialCanLikeProperty) AppendGoToSocialCanLike(v vocab.GoToSocialCanLike) {
|
||||
this.properties = append(this.properties, &GoToSocialCanLikePropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanLikeMember: v,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
})
|
||||
}
|
||||
|
||||
// AppendIRI appends an IRI value to the back of a list of the property "canLike"
|
||||
func (this *GoToSocialCanLikeProperty) AppendIRI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialCanLikePropertyIterator{
|
||||
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 "canLike". 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 *GoToSocialCanLikeProperty) AppendType(t vocab.Type) error {
|
||||
n := &GoToSocialCanLikePropertyIterator{
|
||||
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 GoToSocialCanLikeProperty) At(index int) vocab.GoToSocialCanLikePropertyIterator {
|
||||
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 GoToSocialCanLikeProperty) Begin() vocab.GoToSocialCanLikePropertyIterator {
|
||||
if this.Empty() {
|
||||
return nil
|
||||
} else {
|
||||
return this.properties[0]
|
||||
}
|
||||
}
|
||||
|
||||
// Empty returns returns true if there are no elements.
|
||||
func (this GoToSocialCanLikeProperty) 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 GoToSocialCanLikeProperty) End() vocab.GoToSocialCanLikePropertyIterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertGoToSocialCanLike inserts a CanLike value at the specified index for a
|
||||
// property "canLike". Existing elements at that index and higher are shifted
|
||||
// back once. Invalidates all iterators.
|
||||
func (this *GoToSocialCanLikeProperty) InsertGoToSocialCanLike(idx int, v vocab.GoToSocialCanLike) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialCanLikePropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanLikeMember: v,
|
||||
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 "canLike".
|
||||
// Existing elements at that index and higher are shifted back once.
|
||||
// Invalidates all iterators.
|
||||
func (this *GoToSocialCanLikeProperty) InsertIRI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialCanLikePropertyIterator{
|
||||
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 "canLike". Invalidates all iterators. Returns an error if the type
|
||||
// is not a valid one to set for this property.
|
||||
func (this *GoToSocialCanLikeProperty) InsertType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialCanLikePropertyIterator{
|
||||
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 GoToSocialCanLikeProperty) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialCanLikeProperty) KindIndex(idx int) int {
|
||||
return this.properties[idx].KindIndex()
|
||||
}
|
||||
|
||||
// Len returns the number of values that exist for the "canLike" property.
|
||||
func (this GoToSocialCanLikeProperty) 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 GoToSocialCanLikeProperty) 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 GoToSocialCanLikeProperty) LessThan(o vocab.GoToSocialCanLikeProperty) 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 ("canLike") with any alias.
|
||||
func (this GoToSocialCanLikeProperty) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "canLike"
|
||||
} else {
|
||||
return "canLike"
|
||||
}
|
||||
}
|
||||
|
||||
// PrependGoToSocialCanLike prepends a CanLike value to the front of a list of the
|
||||
// property "canLike". Invalidates all iterators.
|
||||
func (this *GoToSocialCanLikeProperty) PrependGoToSocialCanLike(v vocab.GoToSocialCanLike) {
|
||||
this.properties = append([]*GoToSocialCanLikePropertyIterator{{
|
||||
alias: this.alias,
|
||||
gotosocialCanLikeMember: v,
|
||||
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
|
||||
// "canLike".
|
||||
func (this *GoToSocialCanLikeProperty) PrependIRI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialCanLikePropertyIterator{{
|
||||
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 "canLike". Invalidates all iterators. Returns an error if the type
|
||||
// is not a valid one to set for this property.
|
||||
func (this *GoToSocialCanLikeProperty) PrependType(t vocab.Type) error {
|
||||
n := &GoToSocialCanLikePropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
}
|
||||
if err := n.SetType(t); err != nil {
|
||||
return err
|
||||
}
|
||||
this.properties = append([]*GoToSocialCanLikePropertyIterator{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
|
||||
// "canLike", regardless of its type. Panics if the index is out of bounds.
|
||||
// Invalidates all iterators.
|
||||
func (this *GoToSocialCanLikeProperty) Remove(idx int) {
|
||||
(this.properties)[idx].parent = nil
|
||||
copy((this.properties)[idx:], (this.properties)[idx+1:])
|
||||
(this.properties)[len(this.properties)-1] = &GoToSocialCanLikePropertyIterator{}
|
||||
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 GoToSocialCanLikeProperty) 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 CanLike value to be at the specified index for the property
|
||||
// "canLike". Panics if the index is out of bounds. Invalidates all iterators.
|
||||
func (this *GoToSocialCanLikeProperty) Set(idx int, v vocab.GoToSocialCanLike) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialCanLikePropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanLikeMember: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetIRI sets an IRI value to be at the specified index for the property
|
||||
// "canLike". Panics if the index is out of bounds.
|
||||
func (this *GoToSocialCanLikeProperty) SetIRI(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialCanLikePropertyIterator{
|
||||
alias: this.alias,
|
||||
iri: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetType sets an arbitrary type value to the specified index of the property
|
||||
// "canLike". 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 *GoToSocialCanLikeProperty) SetType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialCanLikePropertyIterator{
|
||||
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 "canLike" property.
|
||||
func (this GoToSocialCanLikeProperty) Swap(i, j int) {
|
||||
this.properties[i], this.properties[j] = this.properties[j], this.properties[i]
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canreply/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canreply/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package propertycanreply contains the implementation for the canReply 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 propertycanreply
|
||||
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canreply/gen_pkg.go
generated
vendored
Normal file
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canreply/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertycanreply
|
||||
|
||||
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 {
|
||||
// DeserializeCanReplyGoToSocial returns the deserialization method for
|
||||
// the "GoToSocialCanReply" non-functional property in the vocabulary
|
||||
// "GoToSocial"
|
||||
DeserializeCanReplyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialCanReply, 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
|
||||
}
|
||||
618
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canreply/gen_property_gotosocial_canReply.go
generated
vendored
Normal file
618
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_canreply/gen_property_gotosocial_canReply.go
generated
vendored
Normal file
|
|
@ -0,0 +1,618 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertycanreply
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GoToSocialCanReplyPropertyIterator is an iterator for a property. It is
|
||||
// permitted to be a single nilable value type.
|
||||
type GoToSocialCanReplyPropertyIterator struct {
|
||||
gotosocialCanReplyMember vocab.GoToSocialCanReply
|
||||
unknown interface{}
|
||||
iri *url.URL
|
||||
alias string
|
||||
myIdx int
|
||||
parent vocab.GoToSocialCanReplyProperty
|
||||
}
|
||||
|
||||
// NewGoToSocialCanReplyPropertyIterator creates a new GoToSocialCanReply property.
|
||||
func NewGoToSocialCanReplyPropertyIterator() *GoToSocialCanReplyPropertyIterator {
|
||||
return &GoToSocialCanReplyPropertyIterator{alias: ""}
|
||||
}
|
||||
|
||||
// deserializeGoToSocialCanReplyPropertyIterator creates an iterator from an
|
||||
// element that has been unmarshalled from a text or binary format.
|
||||
func deserializeGoToSocialCanReplyPropertyIterator(i interface{}, aliasMap map[string]string) (*GoToSocialCanReplyPropertyIterator, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; 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 := &GoToSocialCanReplyPropertyIterator{
|
||||
alias: alias,
|
||||
iri: u,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
if m, ok := i.(map[string]interface{}); ok {
|
||||
if v, err := mgr.DeserializeCanReplyGoToSocial()(m, aliasMap); err == nil {
|
||||
this := &GoToSocialCanReplyPropertyIterator{
|
||||
alias: alias,
|
||||
gotosocialCanReplyMember: v,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
this := &GoToSocialCanReplyPropertyIterator{
|
||||
alias: alias,
|
||||
unknown: i,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// Get returns the value of this property. When IsGoToSocialCanReply returns
|
||||
// false, Get will return any arbitrary value.
|
||||
func (this GoToSocialCanReplyPropertyIterator) Get() vocab.GoToSocialCanReply {
|
||||
return this.gotosocialCanReplyMember
|
||||
}
|
||||
|
||||
// GetIRI returns the IRI of this property. When IsIRI returns false, GetIRI will
|
||||
// return any arbitrary value.
|
||||
func (this GoToSocialCanReplyPropertyIterator) 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 GoToSocialCanReplyPropertyIterator) GetType() vocab.Type {
|
||||
if this.IsGoToSocialCanReply() {
|
||||
return this.Get()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// HasAny returns true if the value or IRI is set.
|
||||
func (this GoToSocialCanReplyPropertyIterator) HasAny() bool {
|
||||
return this.IsGoToSocialCanReply() || this.iri != nil
|
||||
}
|
||||
|
||||
// IsGoToSocialCanReply returns true if this property is set and not an IRI.
|
||||
func (this GoToSocialCanReplyPropertyIterator) IsGoToSocialCanReply() bool {
|
||||
return this.gotosocialCanReplyMember != nil
|
||||
}
|
||||
|
||||
// IsIRI returns true if this property is an IRI.
|
||||
func (this GoToSocialCanReplyPropertyIterator) 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 GoToSocialCanReplyPropertyIterator) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
var child map[string]string
|
||||
if this.IsGoToSocialCanReply() {
|
||||
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 GoToSocialCanReplyPropertyIterator) KindIndex() int {
|
||||
if this.IsGoToSocialCanReply() {
|
||||
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 GoToSocialCanReplyPropertyIterator) LessThan(o vocab.GoToSocialCanReplyPropertyIterator) 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.IsGoToSocialCanReply() && !o.IsGoToSocialCanReply() {
|
||||
// Both are unknowns.
|
||||
return false
|
||||
} else if this.IsGoToSocialCanReply() && !o.IsGoToSocialCanReply() {
|
||||
// Values are always greater than unknown values.
|
||||
return false
|
||||
} else if !this.IsGoToSocialCanReply() && o.IsGoToSocialCanReply() {
|
||||
// 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: "GoToSocialCanReply".
|
||||
func (this GoToSocialCanReplyPropertyIterator) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "GoToSocialCanReply"
|
||||
} else {
|
||||
return "GoToSocialCanReply"
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next iterator, or nil if there is no next iterator.
|
||||
func (this GoToSocialCanReplyPropertyIterator) Next() vocab.GoToSocialCanReplyPropertyIterator {
|
||||
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 GoToSocialCanReplyPropertyIterator) Prev() vocab.GoToSocialCanReplyPropertyIterator {
|
||||
if this.myIdx-1 < 0 {
|
||||
return nil
|
||||
} else {
|
||||
return this.parent.At(this.myIdx - 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Set sets the value of this property. Calling IsGoToSocialCanReply afterwards
|
||||
// will return true.
|
||||
func (this *GoToSocialCanReplyPropertyIterator) Set(v vocab.GoToSocialCanReply) {
|
||||
this.clear()
|
||||
this.gotosocialCanReplyMember = v
|
||||
}
|
||||
|
||||
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
|
||||
// true.
|
||||
func (this *GoToSocialCanReplyPropertyIterator) 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 *GoToSocialCanReplyPropertyIterator) SetType(t vocab.Type) error {
|
||||
if v, ok := t.(vocab.GoToSocialCanReply); ok {
|
||||
this.Set(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("illegal type to set on GoToSocialCanReply property: %T", t)
|
||||
}
|
||||
|
||||
// clear ensures no value of this property is set. Calling IsGoToSocialCanReply
|
||||
// afterwards will return false.
|
||||
func (this *GoToSocialCanReplyPropertyIterator) clear() {
|
||||
this.unknown = nil
|
||||
this.iri = nil
|
||||
this.gotosocialCanReplyMember = 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 GoToSocialCanReplyPropertyIterator) serialize() (interface{}, error) {
|
||||
if this.IsGoToSocialCanReply() {
|
||||
return this.Get().Serialize()
|
||||
} else if this.IsIRI() {
|
||||
return this.iri.String(), nil
|
||||
}
|
||||
return this.unknown, nil
|
||||
}
|
||||
|
||||
// GoToSocialCanReplyProperty is the non-functional property "canReply". It is
|
||||
// permitted to have one or more values, and of different value types.
|
||||
type GoToSocialCanReplyProperty struct {
|
||||
properties []*GoToSocialCanReplyPropertyIterator
|
||||
alias string
|
||||
}
|
||||
|
||||
// DeserializeCanReplyProperty creates a "canReply" property from an interface
|
||||
// representation that has been unmarshalled from a text or binary format.
|
||||
func DeserializeCanReplyProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.GoToSocialCanReplyProperty, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
propName := "canReply"
|
||||
if len(alias) > 0 {
|
||||
propName = fmt.Sprintf("%s:%s", alias, "canReply")
|
||||
}
|
||||
i, ok := m[propName]
|
||||
|
||||
if ok {
|
||||
this := &GoToSocialCanReplyProperty{
|
||||
alias: alias,
|
||||
properties: []*GoToSocialCanReplyPropertyIterator{},
|
||||
}
|
||||
if list, ok := i.([]interface{}); ok {
|
||||
for _, iterator := range list {
|
||||
if p, err := deserializeGoToSocialCanReplyPropertyIterator(iterator, aliasMap); err != nil {
|
||||
return this, err
|
||||
} else if p != nil {
|
||||
this.properties = append(this.properties, p)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if p, err := deserializeGoToSocialCanReplyPropertyIterator(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
|
||||
}
|
||||
|
||||
// NewGoToSocialCanReplyProperty creates a new canReply property.
|
||||
func NewGoToSocialCanReplyProperty() *GoToSocialCanReplyProperty {
|
||||
return &GoToSocialCanReplyProperty{alias: ""}
|
||||
}
|
||||
|
||||
// AppendGoToSocialCanReply appends a CanReply value to the back of a list of the
|
||||
// property "canReply". Invalidates iterators that are traversing using Prev.
|
||||
func (this *GoToSocialCanReplyProperty) AppendGoToSocialCanReply(v vocab.GoToSocialCanReply) {
|
||||
this.properties = append(this.properties, &GoToSocialCanReplyPropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanReplyMember: v,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
})
|
||||
}
|
||||
|
||||
// AppendIRI appends an IRI value to the back of a list of the property "canReply"
|
||||
func (this *GoToSocialCanReplyProperty) AppendIRI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialCanReplyPropertyIterator{
|
||||
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 "canReply". 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 *GoToSocialCanReplyProperty) AppendType(t vocab.Type) error {
|
||||
n := &GoToSocialCanReplyPropertyIterator{
|
||||
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 GoToSocialCanReplyProperty) At(index int) vocab.GoToSocialCanReplyPropertyIterator {
|
||||
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 GoToSocialCanReplyProperty) Begin() vocab.GoToSocialCanReplyPropertyIterator {
|
||||
if this.Empty() {
|
||||
return nil
|
||||
} else {
|
||||
return this.properties[0]
|
||||
}
|
||||
}
|
||||
|
||||
// Empty returns returns true if there are no elements.
|
||||
func (this GoToSocialCanReplyProperty) 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 GoToSocialCanReplyProperty) End() vocab.GoToSocialCanReplyPropertyIterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertGoToSocialCanReply inserts a CanReply value at the specified index for a
|
||||
// property "canReply". Existing elements at that index and higher are shifted
|
||||
// back once. Invalidates all iterators.
|
||||
func (this *GoToSocialCanReplyProperty) InsertGoToSocialCanReply(idx int, v vocab.GoToSocialCanReply) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialCanReplyPropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanReplyMember: v,
|
||||
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 "canReply".
|
||||
// Existing elements at that index and higher are shifted back once.
|
||||
// Invalidates all iterators.
|
||||
func (this *GoToSocialCanReplyProperty) InsertIRI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialCanReplyPropertyIterator{
|
||||
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 "canReply". Invalidates all iterators. Returns an error if the
|
||||
// type is not a valid one to set for this property.
|
||||
func (this *GoToSocialCanReplyProperty) InsertType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialCanReplyPropertyIterator{
|
||||
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 GoToSocialCanReplyProperty) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialCanReplyProperty) KindIndex(idx int) int {
|
||||
return this.properties[idx].KindIndex()
|
||||
}
|
||||
|
||||
// Len returns the number of values that exist for the "canReply" property.
|
||||
func (this GoToSocialCanReplyProperty) 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 GoToSocialCanReplyProperty) 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 GoToSocialCanReplyProperty) LessThan(o vocab.GoToSocialCanReplyProperty) 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 ("canReply") with any alias.
|
||||
func (this GoToSocialCanReplyProperty) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "canReply"
|
||||
} else {
|
||||
return "canReply"
|
||||
}
|
||||
}
|
||||
|
||||
// PrependGoToSocialCanReply prepends a CanReply value to the front of a list of
|
||||
// the property "canReply". Invalidates all iterators.
|
||||
func (this *GoToSocialCanReplyProperty) PrependGoToSocialCanReply(v vocab.GoToSocialCanReply) {
|
||||
this.properties = append([]*GoToSocialCanReplyPropertyIterator{{
|
||||
alias: this.alias,
|
||||
gotosocialCanReplyMember: v,
|
||||
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
|
||||
// "canReply".
|
||||
func (this *GoToSocialCanReplyProperty) PrependIRI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialCanReplyPropertyIterator{{
|
||||
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 "canReply". Invalidates all iterators. Returns an error if the
|
||||
// type is not a valid one to set for this property.
|
||||
func (this *GoToSocialCanReplyProperty) PrependType(t vocab.Type) error {
|
||||
n := &GoToSocialCanReplyPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
}
|
||||
if err := n.SetType(t); err != nil {
|
||||
return err
|
||||
}
|
||||
this.properties = append([]*GoToSocialCanReplyPropertyIterator{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
|
||||
// "canReply", regardless of its type. Panics if the index is out of bounds.
|
||||
// Invalidates all iterators.
|
||||
func (this *GoToSocialCanReplyProperty) Remove(idx int) {
|
||||
(this.properties)[idx].parent = nil
|
||||
copy((this.properties)[idx:], (this.properties)[idx+1:])
|
||||
(this.properties)[len(this.properties)-1] = &GoToSocialCanReplyPropertyIterator{}
|
||||
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 GoToSocialCanReplyProperty) 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 CanReply value to be at the specified index for the property
|
||||
// "canReply". Panics if the index is out of bounds. Invalidates all iterators.
|
||||
func (this *GoToSocialCanReplyProperty) Set(idx int, v vocab.GoToSocialCanReply) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialCanReplyPropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialCanReplyMember: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetIRI sets an IRI value to be at the specified index for the property
|
||||
// "canReply". Panics if the index is out of bounds.
|
||||
func (this *GoToSocialCanReplyProperty) SetIRI(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialCanReplyPropertyIterator{
|
||||
alias: this.alias,
|
||||
iri: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetType sets an arbitrary type value to the specified index of the property
|
||||
// "canReply". 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 *GoToSocialCanReplyProperty) SetType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialCanReplyPropertyIterator{
|
||||
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 "canReply" property.
|
||||
func (this GoToSocialCanReplyProperty) Swap(i, j int) {
|
||||
this.properties[i], this.properties[j] = this.properties[j], this.properties[i]
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_interactionpolicy/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_interactionpolicy/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package propertyinteractionpolicy contains the implementation for the
|
||||
// interactionPolicy 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 propertyinteractionpolicy
|
||||
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_interactionpolicy/gen_pkg.go
generated
vendored
Normal file
22
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/property_interactionpolicy/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyinteractionpolicy
|
||||
|
||||
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 {
|
||||
// DeserializeInteractionPolicyGoToSocial returns the deserialization
|
||||
// method for the "GoToSocialInteractionPolicy" non-functional
|
||||
// property in the vocabulary "GoToSocial"
|
||||
DeserializeInteractionPolicyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialInteractionPolicy, 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
|
||||
}
|
||||
|
|
@ -0,0 +1,630 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package propertyinteractionpolicy
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// GoToSocialInteractionPolicyPropertyIterator is an iterator for a property. It
|
||||
// is permitted to be a single nilable value type.
|
||||
type GoToSocialInteractionPolicyPropertyIterator struct {
|
||||
gotosocialInteractionPolicyMember vocab.GoToSocialInteractionPolicy
|
||||
unknown interface{}
|
||||
iri *url.URL
|
||||
alias string
|
||||
myIdx int
|
||||
parent vocab.GoToSocialInteractionPolicyProperty
|
||||
}
|
||||
|
||||
// NewGoToSocialInteractionPolicyPropertyIterator creates a new
|
||||
// GoToSocialInteractionPolicy property.
|
||||
func NewGoToSocialInteractionPolicyPropertyIterator() *GoToSocialInteractionPolicyPropertyIterator {
|
||||
return &GoToSocialInteractionPolicyPropertyIterator{alias: ""}
|
||||
}
|
||||
|
||||
// deserializeGoToSocialInteractionPolicyPropertyIterator creates an iterator from
|
||||
// an element that has been unmarshalled from a text or binary format.
|
||||
func deserializeGoToSocialInteractionPolicyPropertyIterator(i interface{}, aliasMap map[string]string) (*GoToSocialInteractionPolicyPropertyIterator, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; 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 := &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: alias,
|
||||
iri: u,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
if m, ok := i.(map[string]interface{}); ok {
|
||||
if v, err := mgr.DeserializeInteractionPolicyGoToSocial()(m, aliasMap); err == nil {
|
||||
this := &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: alias,
|
||||
gotosocialInteractionPolicyMember: v,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
}
|
||||
this := &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: alias,
|
||||
unknown: i,
|
||||
}
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// Get returns the value of this property. When IsGoToSocialInteractionPolicy
|
||||
// returns false, Get will return any arbitrary value.
|
||||
func (this GoToSocialInteractionPolicyPropertyIterator) Get() vocab.GoToSocialInteractionPolicy {
|
||||
return this.gotosocialInteractionPolicyMember
|
||||
}
|
||||
|
||||
// GetIRI returns the IRI of this property. When IsIRI returns false, GetIRI will
|
||||
// return any arbitrary value.
|
||||
func (this GoToSocialInteractionPolicyPropertyIterator) 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 GoToSocialInteractionPolicyPropertyIterator) GetType() vocab.Type {
|
||||
if this.IsGoToSocialInteractionPolicy() {
|
||||
return this.Get()
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// HasAny returns true if the value or IRI is set.
|
||||
func (this GoToSocialInteractionPolicyPropertyIterator) HasAny() bool {
|
||||
return this.IsGoToSocialInteractionPolicy() || this.iri != nil
|
||||
}
|
||||
|
||||
// IsGoToSocialInteractionPolicy returns true if this property is set and not an
|
||||
// IRI.
|
||||
func (this GoToSocialInteractionPolicyPropertyIterator) IsGoToSocialInteractionPolicy() bool {
|
||||
return this.gotosocialInteractionPolicyMember != nil
|
||||
}
|
||||
|
||||
// IsIRI returns true if this property is an IRI.
|
||||
func (this GoToSocialInteractionPolicyPropertyIterator) 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 GoToSocialInteractionPolicyPropertyIterator) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
var child map[string]string
|
||||
if this.IsGoToSocialInteractionPolicy() {
|
||||
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 GoToSocialInteractionPolicyPropertyIterator) KindIndex() int {
|
||||
if this.IsGoToSocialInteractionPolicy() {
|
||||
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 GoToSocialInteractionPolicyPropertyIterator) LessThan(o vocab.GoToSocialInteractionPolicyPropertyIterator) 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.IsGoToSocialInteractionPolicy() && !o.IsGoToSocialInteractionPolicy() {
|
||||
// Both are unknowns.
|
||||
return false
|
||||
} else if this.IsGoToSocialInteractionPolicy() && !o.IsGoToSocialInteractionPolicy() {
|
||||
// Values are always greater than unknown values.
|
||||
return false
|
||||
} else if !this.IsGoToSocialInteractionPolicy() && o.IsGoToSocialInteractionPolicy() {
|
||||
// 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: "GoToSocialInteractionPolicy".
|
||||
func (this GoToSocialInteractionPolicyPropertyIterator) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "GoToSocialInteractionPolicy"
|
||||
} else {
|
||||
return "GoToSocialInteractionPolicy"
|
||||
}
|
||||
}
|
||||
|
||||
// Next returns the next iterator, or nil if there is no next iterator.
|
||||
func (this GoToSocialInteractionPolicyPropertyIterator) Next() vocab.GoToSocialInteractionPolicyPropertyIterator {
|
||||
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 GoToSocialInteractionPolicyPropertyIterator) Prev() vocab.GoToSocialInteractionPolicyPropertyIterator {
|
||||
if this.myIdx-1 < 0 {
|
||||
return nil
|
||||
} else {
|
||||
return this.parent.At(this.myIdx - 1)
|
||||
}
|
||||
}
|
||||
|
||||
// Set sets the value of this property. Calling IsGoToSocialInteractionPolicy
|
||||
// afterwards will return true.
|
||||
func (this *GoToSocialInteractionPolicyPropertyIterator) Set(v vocab.GoToSocialInteractionPolicy) {
|
||||
this.clear()
|
||||
this.gotosocialInteractionPolicyMember = v
|
||||
}
|
||||
|
||||
// SetIRI sets the value of this property. Calling IsIRI afterwards will return
|
||||
// true.
|
||||
func (this *GoToSocialInteractionPolicyPropertyIterator) 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 *GoToSocialInteractionPolicyPropertyIterator) SetType(t vocab.Type) error {
|
||||
if v, ok := t.(vocab.GoToSocialInteractionPolicy); ok {
|
||||
this.Set(v)
|
||||
return nil
|
||||
}
|
||||
|
||||
return fmt.Errorf("illegal type to set on GoToSocialInteractionPolicy property: %T", t)
|
||||
}
|
||||
|
||||
// clear ensures no value of this property is set. Calling
|
||||
// IsGoToSocialInteractionPolicy afterwards will return false.
|
||||
func (this *GoToSocialInteractionPolicyPropertyIterator) clear() {
|
||||
this.unknown = nil
|
||||
this.iri = nil
|
||||
this.gotosocialInteractionPolicyMember = 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 GoToSocialInteractionPolicyPropertyIterator) serialize() (interface{}, error) {
|
||||
if this.IsGoToSocialInteractionPolicy() {
|
||||
return this.Get().Serialize()
|
||||
} else if this.IsIRI() {
|
||||
return this.iri.String(), nil
|
||||
}
|
||||
return this.unknown, nil
|
||||
}
|
||||
|
||||
// GoToSocialInteractionPolicyProperty is the non-functional property
|
||||
// "interactionPolicy". It is permitted to have one or more values, and of
|
||||
// different value types.
|
||||
type GoToSocialInteractionPolicyProperty struct {
|
||||
properties []*GoToSocialInteractionPolicyPropertyIterator
|
||||
alias string
|
||||
}
|
||||
|
||||
// DeserializeInteractionPolicyProperty creates a "interactionPolicy" property
|
||||
// from an interface representation that has been unmarshalled from a text or
|
||||
// binary format.
|
||||
func DeserializeInteractionPolicyProperty(m map[string]interface{}, aliasMap map[string]string) (vocab.GoToSocialInteractionPolicyProperty, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
propName := "interactionPolicy"
|
||||
if len(alias) > 0 {
|
||||
propName = fmt.Sprintf("%s:%s", alias, "interactionPolicy")
|
||||
}
|
||||
i, ok := m[propName]
|
||||
|
||||
if ok {
|
||||
this := &GoToSocialInteractionPolicyProperty{
|
||||
alias: alias,
|
||||
properties: []*GoToSocialInteractionPolicyPropertyIterator{},
|
||||
}
|
||||
if list, ok := i.([]interface{}); ok {
|
||||
for _, iterator := range list {
|
||||
if p, err := deserializeGoToSocialInteractionPolicyPropertyIterator(iterator, aliasMap); err != nil {
|
||||
return this, err
|
||||
} else if p != nil {
|
||||
this.properties = append(this.properties, p)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if p, err := deserializeGoToSocialInteractionPolicyPropertyIterator(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
|
||||
}
|
||||
|
||||
// NewGoToSocialInteractionPolicyProperty creates a new interactionPolicy property.
|
||||
func NewGoToSocialInteractionPolicyProperty() *GoToSocialInteractionPolicyProperty {
|
||||
return &GoToSocialInteractionPolicyProperty{alias: ""}
|
||||
}
|
||||
|
||||
// AppendGoToSocialInteractionPolicy appends a InteractionPolicy value to the back
|
||||
// of a list of the property "interactionPolicy". Invalidates iterators that
|
||||
// are traversing using Prev.
|
||||
func (this *GoToSocialInteractionPolicyProperty) AppendGoToSocialInteractionPolicy(v vocab.GoToSocialInteractionPolicy) {
|
||||
this.properties = append(this.properties, &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialInteractionPolicyMember: v,
|
||||
myIdx: this.Len(),
|
||||
parent: this,
|
||||
})
|
||||
}
|
||||
|
||||
// AppendIRI appends an IRI value to the back of a list of the property
|
||||
// "interactionPolicy"
|
||||
func (this *GoToSocialInteractionPolicyProperty) AppendIRI(v *url.URL) {
|
||||
this.properties = append(this.properties, &GoToSocialInteractionPolicyPropertyIterator{
|
||||
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 "interactionPolicy". 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 *GoToSocialInteractionPolicyProperty) AppendType(t vocab.Type) error {
|
||||
n := &GoToSocialInteractionPolicyPropertyIterator{
|
||||
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 GoToSocialInteractionPolicyProperty) At(index int) vocab.GoToSocialInteractionPolicyPropertyIterator {
|
||||
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 GoToSocialInteractionPolicyProperty) Begin() vocab.GoToSocialInteractionPolicyPropertyIterator {
|
||||
if this.Empty() {
|
||||
return nil
|
||||
} else {
|
||||
return this.properties[0]
|
||||
}
|
||||
}
|
||||
|
||||
// Empty returns returns true if there are no elements.
|
||||
func (this GoToSocialInteractionPolicyProperty) 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 GoToSocialInteractionPolicyProperty) End() vocab.GoToSocialInteractionPolicyPropertyIterator {
|
||||
return nil
|
||||
}
|
||||
|
||||
// InsertGoToSocialInteractionPolicy inserts a InteractionPolicy value at the
|
||||
// specified index for a property "interactionPolicy". Existing elements at
|
||||
// that index and higher are shifted back once. Invalidates all iterators.
|
||||
func (this *GoToSocialInteractionPolicyProperty) InsertGoToSocialInteractionPolicy(idx int, v vocab.GoToSocialInteractionPolicy) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialInteractionPolicyMember: v,
|
||||
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
|
||||
// "interactionPolicy". Existing elements at that index and higher are shifted
|
||||
// back once. Invalidates all iterators.
|
||||
func (this *GoToSocialInteractionPolicyProperty) InsertIRI(idx int, v *url.URL) {
|
||||
this.properties = append(this.properties, nil)
|
||||
copy(this.properties[idx+1:], this.properties[idx:])
|
||||
this.properties[idx] = &GoToSocialInteractionPolicyPropertyIterator{
|
||||
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 "interactionPolicy". Invalidates all iterators. Returns an error
|
||||
// if the type is not a valid one to set for this property.
|
||||
func (this *GoToSocialInteractionPolicyProperty) InsertType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialInteractionPolicyPropertyIterator{
|
||||
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 GoToSocialInteractionPolicyProperty) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": 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 GoToSocialInteractionPolicyProperty) KindIndex(idx int) int {
|
||||
return this.properties[idx].KindIndex()
|
||||
}
|
||||
|
||||
// Len returns the number of values that exist for the "interactionPolicy"
|
||||
// property.
|
||||
func (this GoToSocialInteractionPolicyProperty) 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 GoToSocialInteractionPolicyProperty) 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 GoToSocialInteractionPolicyProperty) LessThan(o vocab.GoToSocialInteractionPolicyProperty) 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 ("interactionPolicy") with any alias.
|
||||
func (this GoToSocialInteractionPolicyProperty) Name() string {
|
||||
if len(this.alias) > 0 {
|
||||
return this.alias + ":" + "interactionPolicy"
|
||||
} else {
|
||||
return "interactionPolicy"
|
||||
}
|
||||
}
|
||||
|
||||
// PrependGoToSocialInteractionPolicy prepends a InteractionPolicy value to the
|
||||
// front of a list of the property "interactionPolicy". Invalidates all
|
||||
// iterators.
|
||||
func (this *GoToSocialInteractionPolicyProperty) PrependGoToSocialInteractionPolicy(v vocab.GoToSocialInteractionPolicy) {
|
||||
this.properties = append([]*GoToSocialInteractionPolicyPropertyIterator{{
|
||||
alias: this.alias,
|
||||
gotosocialInteractionPolicyMember: v,
|
||||
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
|
||||
// "interactionPolicy".
|
||||
func (this *GoToSocialInteractionPolicyProperty) PrependIRI(v *url.URL) {
|
||||
this.properties = append([]*GoToSocialInteractionPolicyPropertyIterator{{
|
||||
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 "interactionPolicy". Invalidates all iterators. Returns an error
|
||||
// if the type is not a valid one to set for this property.
|
||||
func (this *GoToSocialInteractionPolicyProperty) PrependType(t vocab.Type) error {
|
||||
n := &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: this.alias,
|
||||
myIdx: 0,
|
||||
parent: this,
|
||||
}
|
||||
if err := n.SetType(t); err != nil {
|
||||
return err
|
||||
}
|
||||
this.properties = append([]*GoToSocialInteractionPolicyPropertyIterator{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
|
||||
// "interactionPolicy", regardless of its type. Panics if the index is out of
|
||||
// bounds. Invalidates all iterators.
|
||||
func (this *GoToSocialInteractionPolicyProperty) Remove(idx int) {
|
||||
(this.properties)[idx].parent = nil
|
||||
copy((this.properties)[idx:], (this.properties)[idx+1:])
|
||||
(this.properties)[len(this.properties)-1] = &GoToSocialInteractionPolicyPropertyIterator{}
|
||||
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 GoToSocialInteractionPolicyProperty) 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 InteractionPolicy value to be at the specified index for the
|
||||
// property "interactionPolicy". Panics if the index is out of bounds.
|
||||
// Invalidates all iterators.
|
||||
func (this *GoToSocialInteractionPolicyProperty) Set(idx int, v vocab.GoToSocialInteractionPolicy) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: this.alias,
|
||||
gotosocialInteractionPolicyMember: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetIRI sets an IRI value to be at the specified index for the property
|
||||
// "interactionPolicy". Panics if the index is out of bounds.
|
||||
func (this *GoToSocialInteractionPolicyProperty) SetIRI(idx int, v *url.URL) {
|
||||
(this.properties)[idx].parent = nil
|
||||
(this.properties)[idx] = &GoToSocialInteractionPolicyPropertyIterator{
|
||||
alias: this.alias,
|
||||
iri: v,
|
||||
myIdx: idx,
|
||||
parent: this,
|
||||
}
|
||||
}
|
||||
|
||||
// SetType sets an arbitrary type value to the specified index of the property
|
||||
// "interactionPolicy". 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 *GoToSocialInteractionPolicyProperty) SetType(idx int, t vocab.Type) error {
|
||||
n := &GoToSocialInteractionPolicyPropertyIterator{
|
||||
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 "interactionPolicy"
|
||||
// property.
|
||||
func (this GoToSocialInteractionPolicyProperty) Swap(i, j int) {
|
||||
this.properties[i], this.properties[j] = this.properties[j], this.properties[i]
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canannounce/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canannounce/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package typecanannounce contains the implementation for the CanAnnounce 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 typecanannounce
|
||||
54
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canannounce/gen_pkg.go
generated
vendored
Normal file
54
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canannounce/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typecanannounce
|
||||
|
||||
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 {
|
||||
// DeserializeAlwaysPropertyGoToSocial returns the deserialization method
|
||||
// for the "GoToSocialAlwaysProperty" non-functional property in the
|
||||
// vocabulary "GoToSocial"
|
||||
DeserializeAlwaysPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialAlwaysProperty, error)
|
||||
// DeserializeApprovalRequiredPropertyGoToSocial returns the
|
||||
// deserialization method for the "GoToSocialApprovalRequiredProperty"
|
||||
// non-functional property in the vocabulary "GoToSocial"
|
||||
DeserializeApprovalRequiredPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialApprovalRequiredProperty, error)
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
288
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canannounce/gen_type_gotosocial_canannounce.go
generated
vendored
Normal file
288
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canannounce/gen_type_gotosocial_canannounce.go
generated
vendored
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typecanannounce
|
||||
|
||||
import vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
|
||||
type GoToSocialCanAnnounce struct {
|
||||
GoToSocialAlways vocab.GoToSocialAlwaysProperty
|
||||
GoToSocialApprovalRequired vocab.GoToSocialApprovalRequiredProperty
|
||||
JSONLDId vocab.JSONLDIdProperty
|
||||
alias string
|
||||
unknown map[string]interface{}
|
||||
}
|
||||
|
||||
// CanAnnounceIsDisjointWith returns true if the other provided type is disjoint
|
||||
// with the CanAnnounce type.
|
||||
func CanAnnounceIsDisjointWith(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not disjoint with anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// CanAnnounceIsExtendedBy returns true if the other provided type extends from
|
||||
// the CanAnnounce type. Note that it returns false if the types are the same;
|
||||
// see the "IsOrExtendsCanAnnounce" variant instead.
|
||||
func CanAnnounceIsExtendedBy(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not extended by anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// DeserializeCanAnnounce creates a CanAnnounce from a map representation that has
|
||||
// been unmarshalled from a text or binary format.
|
||||
func DeserializeCanAnnounce(m map[string]interface{}, aliasMap map[string]string) (*GoToSocialCanAnnounce, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
this := &GoToSocialCanAnnounce{
|
||||
alias: alias,
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
|
||||
// Begin: Known property deserialization
|
||||
if p, err := mgr.DeserializeAlwaysPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialAlways = p
|
||||
}
|
||||
if p, err := mgr.DeserializeApprovalRequiredPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialApprovalRequired = p
|
||||
}
|
||||
if p, err := mgr.DeserializeIdPropertyJSONLD()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.JSONLDId = p
|
||||
}
|
||||
// End: Known property deserialization
|
||||
|
||||
// Begin: Unknown deserialization
|
||||
for k, v := range m {
|
||||
// Begin: Code that ensures a property name is unknown
|
||||
if k == "always" {
|
||||
continue
|
||||
} else if k == "approvalRequired" {
|
||||
continue
|
||||
} else if k == "id" {
|
||||
continue
|
||||
} // End: Code that ensures a property name is unknown
|
||||
|
||||
this.unknown[k] = v
|
||||
}
|
||||
// End: Unknown deserialization
|
||||
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// GoToSocialCanAnnounceExtends returns true if the CanAnnounce type extends from
|
||||
// the other type.
|
||||
func GoToSocialCanAnnounceExtends(other vocab.Type) bool {
|
||||
// Shortcut implementation: this does not extend anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// IsOrExtendsCanAnnounce returns true if the other provided type is the
|
||||
// CanAnnounce type or extends from the CanAnnounce type.
|
||||
func IsOrExtendsCanAnnounce(other vocab.Type) bool {
|
||||
if other.GetTypeName() == "CanAnnounce" {
|
||||
return true
|
||||
}
|
||||
return CanAnnounceIsExtendedBy(other)
|
||||
}
|
||||
|
||||
// NewGoToSocialCanAnnounce creates a new CanAnnounce type
|
||||
func NewGoToSocialCanAnnounce() *GoToSocialCanAnnounce {
|
||||
return &GoToSocialCanAnnounce{
|
||||
alias: "",
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
}
|
||||
|
||||
// GetGoToSocialAlways returns the "always" property if it exists, and nil
|
||||
// otherwise.
|
||||
func (this GoToSocialCanAnnounce) GetGoToSocialAlways() vocab.GoToSocialAlwaysProperty {
|
||||
return this.GoToSocialAlways
|
||||
}
|
||||
|
||||
// GetGoToSocialApprovalRequired returns the "approvalRequired" property if it
|
||||
// exists, and nil otherwise.
|
||||
func (this GoToSocialCanAnnounce) GetGoToSocialApprovalRequired() vocab.GoToSocialApprovalRequiredProperty {
|
||||
return this.GoToSocialApprovalRequired
|
||||
}
|
||||
|
||||
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
|
||||
func (this GoToSocialCanAnnounce) GetJSONLDId() vocab.JSONLDIdProperty {
|
||||
return this.JSONLDId
|
||||
}
|
||||
|
||||
// GetTypeName returns the name of this type.
|
||||
func (this GoToSocialCanAnnounce) GetTypeName() string {
|
||||
return "CanAnnounce"
|
||||
}
|
||||
|
||||
// GetUnknownProperties returns the unknown properties for the CanAnnounce 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 GoToSocialCanAnnounce) GetUnknownProperties() map[string]interface{} {
|
||||
return this.unknown
|
||||
}
|
||||
|
||||
// IsExtending returns true if the CanAnnounce type extends from the other type.
|
||||
func (this GoToSocialCanAnnounce) IsExtending(other vocab.Type) bool {
|
||||
return GoToSocialCanAnnounceExtends(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 GoToSocialCanAnnounce) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
m = this.helperJSONLDContext(this.GoToSocialAlways, m)
|
||||
m = this.helperJSONLDContext(this.GoToSocialApprovalRequired, m)
|
||||
m = this.helperJSONLDContext(this.JSONLDId, m)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// LessThan computes if this CanAnnounce is lesser, with an arbitrary but stable
|
||||
// determination.
|
||||
func (this GoToSocialCanAnnounce) LessThan(o vocab.GoToSocialCanAnnounce) bool {
|
||||
// Begin: Compare known properties
|
||||
// Compare property "always"
|
||||
if lhs, rhs := this.GoToSocialAlways, o.GetGoToSocialAlways(); 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 "approvalRequired"
|
||||
if lhs, rhs := this.GoToSocialApprovalRequired, o.GetGoToSocialApprovalRequired(); 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 "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
|
||||
// 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 GoToSocialCanAnnounce) Serialize() (map[string]interface{}, error) {
|
||||
m := make(map[string]interface{})
|
||||
// Begin: Serialize known properties
|
||||
// Maybe serialize property "always"
|
||||
if this.GoToSocialAlways != nil {
|
||||
if i, err := this.GoToSocialAlways.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialAlways.Name()] = i
|
||||
}
|
||||
}
|
||||
// Maybe serialize property "approvalRequired"
|
||||
if this.GoToSocialApprovalRequired != nil {
|
||||
if i, err := this.GoToSocialApprovalRequired.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialApprovalRequired.Name()] = i
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
|
||||
// SetGoToSocialAlways sets the "always" property.
|
||||
func (this *GoToSocialCanAnnounce) SetGoToSocialAlways(i vocab.GoToSocialAlwaysProperty) {
|
||||
this.GoToSocialAlways = i
|
||||
}
|
||||
|
||||
// SetGoToSocialApprovalRequired sets the "approvalRequired" property.
|
||||
func (this *GoToSocialCanAnnounce) SetGoToSocialApprovalRequired(i vocab.GoToSocialApprovalRequiredProperty) {
|
||||
this.GoToSocialApprovalRequired = i
|
||||
}
|
||||
|
||||
// SetJSONLDId sets the "id" property.
|
||||
func (this *GoToSocialCanAnnounce) SetJSONLDId(i vocab.JSONLDIdProperty) {
|
||||
this.JSONLDId = i
|
||||
}
|
||||
|
||||
// VocabularyURI returns the vocabulary's URI as a string.
|
||||
func (this GoToSocialCanAnnounce) VocabularyURI() string {
|
||||
return "https://gotosocial.org/ns"
|
||||
}
|
||||
|
||||
// helperJSONLDContext obtains the context uris and their aliases from a property,
|
||||
// if it is not nil.
|
||||
func (this GoToSocialCanAnnounce) 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
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canlike/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canlike/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package typecanlike contains the implementation for the CanLike 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 typecanlike
|
||||
54
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canlike/gen_pkg.go
generated
vendored
Normal file
54
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canlike/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typecanlike
|
||||
|
||||
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 {
|
||||
// DeserializeAlwaysPropertyGoToSocial returns the deserialization method
|
||||
// for the "GoToSocialAlwaysProperty" non-functional property in the
|
||||
// vocabulary "GoToSocial"
|
||||
DeserializeAlwaysPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialAlwaysProperty, error)
|
||||
// DeserializeApprovalRequiredPropertyGoToSocial returns the
|
||||
// deserialization method for the "GoToSocialApprovalRequiredProperty"
|
||||
// non-functional property in the vocabulary "GoToSocial"
|
||||
DeserializeApprovalRequiredPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialApprovalRequiredProperty, error)
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
288
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canlike/gen_type_gotosocial_canlike.go
generated
vendored
Normal file
288
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canlike/gen_type_gotosocial_canlike.go
generated
vendored
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typecanlike
|
||||
|
||||
import vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
|
||||
type GoToSocialCanLike struct {
|
||||
GoToSocialAlways vocab.GoToSocialAlwaysProperty
|
||||
GoToSocialApprovalRequired vocab.GoToSocialApprovalRequiredProperty
|
||||
JSONLDId vocab.JSONLDIdProperty
|
||||
alias string
|
||||
unknown map[string]interface{}
|
||||
}
|
||||
|
||||
// CanLikeIsDisjointWith returns true if the other provided type is disjoint with
|
||||
// the CanLike type.
|
||||
func CanLikeIsDisjointWith(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not disjoint with anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// CanLikeIsExtendedBy returns true if the other provided type extends from the
|
||||
// CanLike type. Note that it returns false if the types are the same; see the
|
||||
// "IsOrExtendsCanLike" variant instead.
|
||||
func CanLikeIsExtendedBy(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not extended by anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// DeserializeCanLike creates a CanLike from a map representation that has been
|
||||
// unmarshalled from a text or binary format.
|
||||
func DeserializeCanLike(m map[string]interface{}, aliasMap map[string]string) (*GoToSocialCanLike, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
this := &GoToSocialCanLike{
|
||||
alias: alias,
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
|
||||
// Begin: Known property deserialization
|
||||
if p, err := mgr.DeserializeAlwaysPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialAlways = p
|
||||
}
|
||||
if p, err := mgr.DeserializeApprovalRequiredPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialApprovalRequired = p
|
||||
}
|
||||
if p, err := mgr.DeserializeIdPropertyJSONLD()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.JSONLDId = p
|
||||
}
|
||||
// End: Known property deserialization
|
||||
|
||||
// Begin: Unknown deserialization
|
||||
for k, v := range m {
|
||||
// Begin: Code that ensures a property name is unknown
|
||||
if k == "always" {
|
||||
continue
|
||||
} else if k == "approvalRequired" {
|
||||
continue
|
||||
} else if k == "id" {
|
||||
continue
|
||||
} // End: Code that ensures a property name is unknown
|
||||
|
||||
this.unknown[k] = v
|
||||
}
|
||||
// End: Unknown deserialization
|
||||
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// GoToSocialCanLikeExtends returns true if the CanLike type extends from the
|
||||
// other type.
|
||||
func GoToSocialCanLikeExtends(other vocab.Type) bool {
|
||||
// Shortcut implementation: this does not extend anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// IsOrExtendsCanLike returns true if the other provided type is the CanLike type
|
||||
// or extends from the CanLike type.
|
||||
func IsOrExtendsCanLike(other vocab.Type) bool {
|
||||
if other.GetTypeName() == "CanLike" {
|
||||
return true
|
||||
}
|
||||
return CanLikeIsExtendedBy(other)
|
||||
}
|
||||
|
||||
// NewGoToSocialCanLike creates a new CanLike type
|
||||
func NewGoToSocialCanLike() *GoToSocialCanLike {
|
||||
return &GoToSocialCanLike{
|
||||
alias: "",
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
}
|
||||
|
||||
// GetGoToSocialAlways returns the "always" property if it exists, and nil
|
||||
// otherwise.
|
||||
func (this GoToSocialCanLike) GetGoToSocialAlways() vocab.GoToSocialAlwaysProperty {
|
||||
return this.GoToSocialAlways
|
||||
}
|
||||
|
||||
// GetGoToSocialApprovalRequired returns the "approvalRequired" property if it
|
||||
// exists, and nil otherwise.
|
||||
func (this GoToSocialCanLike) GetGoToSocialApprovalRequired() vocab.GoToSocialApprovalRequiredProperty {
|
||||
return this.GoToSocialApprovalRequired
|
||||
}
|
||||
|
||||
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
|
||||
func (this GoToSocialCanLike) GetJSONLDId() vocab.JSONLDIdProperty {
|
||||
return this.JSONLDId
|
||||
}
|
||||
|
||||
// GetTypeName returns the name of this type.
|
||||
func (this GoToSocialCanLike) GetTypeName() string {
|
||||
return "CanLike"
|
||||
}
|
||||
|
||||
// GetUnknownProperties returns the unknown properties for the CanLike 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 GoToSocialCanLike) GetUnknownProperties() map[string]interface{} {
|
||||
return this.unknown
|
||||
}
|
||||
|
||||
// IsExtending returns true if the CanLike type extends from the other type.
|
||||
func (this GoToSocialCanLike) IsExtending(other vocab.Type) bool {
|
||||
return GoToSocialCanLikeExtends(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 GoToSocialCanLike) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
m = this.helperJSONLDContext(this.GoToSocialAlways, m)
|
||||
m = this.helperJSONLDContext(this.GoToSocialApprovalRequired, m)
|
||||
m = this.helperJSONLDContext(this.JSONLDId, m)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// LessThan computes if this CanLike is lesser, with an arbitrary but stable
|
||||
// determination.
|
||||
func (this GoToSocialCanLike) LessThan(o vocab.GoToSocialCanLike) bool {
|
||||
// Begin: Compare known properties
|
||||
// Compare property "always"
|
||||
if lhs, rhs := this.GoToSocialAlways, o.GetGoToSocialAlways(); 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 "approvalRequired"
|
||||
if lhs, rhs := this.GoToSocialApprovalRequired, o.GetGoToSocialApprovalRequired(); 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 "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
|
||||
// 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 GoToSocialCanLike) Serialize() (map[string]interface{}, error) {
|
||||
m := make(map[string]interface{})
|
||||
// Begin: Serialize known properties
|
||||
// Maybe serialize property "always"
|
||||
if this.GoToSocialAlways != nil {
|
||||
if i, err := this.GoToSocialAlways.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialAlways.Name()] = i
|
||||
}
|
||||
}
|
||||
// Maybe serialize property "approvalRequired"
|
||||
if this.GoToSocialApprovalRequired != nil {
|
||||
if i, err := this.GoToSocialApprovalRequired.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialApprovalRequired.Name()] = i
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
|
||||
// SetGoToSocialAlways sets the "always" property.
|
||||
func (this *GoToSocialCanLike) SetGoToSocialAlways(i vocab.GoToSocialAlwaysProperty) {
|
||||
this.GoToSocialAlways = i
|
||||
}
|
||||
|
||||
// SetGoToSocialApprovalRequired sets the "approvalRequired" property.
|
||||
func (this *GoToSocialCanLike) SetGoToSocialApprovalRequired(i vocab.GoToSocialApprovalRequiredProperty) {
|
||||
this.GoToSocialApprovalRequired = i
|
||||
}
|
||||
|
||||
// SetJSONLDId sets the "id" property.
|
||||
func (this *GoToSocialCanLike) SetJSONLDId(i vocab.JSONLDIdProperty) {
|
||||
this.JSONLDId = i
|
||||
}
|
||||
|
||||
// VocabularyURI returns the vocabulary's URI as a string.
|
||||
func (this GoToSocialCanLike) VocabularyURI() string {
|
||||
return "https://gotosocial.org/ns"
|
||||
}
|
||||
|
||||
// helperJSONLDContext obtains the context uris and their aliases from a property,
|
||||
// if it is not nil.
|
||||
func (this GoToSocialCanLike) 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
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canreply/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canreply/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package typecanreply contains the implementation for the CanReply 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 typecanreply
|
||||
54
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canreply/gen_pkg.go
generated
vendored
Normal file
54
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canreply/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typecanreply
|
||||
|
||||
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 {
|
||||
// DeserializeAlwaysPropertyGoToSocial returns the deserialization method
|
||||
// for the "GoToSocialAlwaysProperty" non-functional property in the
|
||||
// vocabulary "GoToSocial"
|
||||
DeserializeAlwaysPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialAlwaysProperty, error)
|
||||
// DeserializeApprovalRequiredPropertyGoToSocial returns the
|
||||
// deserialization method for the "GoToSocialApprovalRequiredProperty"
|
||||
// non-functional property in the vocabulary "GoToSocial"
|
||||
DeserializeApprovalRequiredPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialApprovalRequiredProperty, error)
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
288
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canreply/gen_type_gotosocial_canreply.go
generated
vendored
Normal file
288
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_canreply/gen_type_gotosocial_canreply.go
generated
vendored
Normal file
|
|
@ -0,0 +1,288 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typecanreply
|
||||
|
||||
import vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
|
||||
type GoToSocialCanReply struct {
|
||||
GoToSocialAlways vocab.GoToSocialAlwaysProperty
|
||||
GoToSocialApprovalRequired vocab.GoToSocialApprovalRequiredProperty
|
||||
JSONLDId vocab.JSONLDIdProperty
|
||||
alias string
|
||||
unknown map[string]interface{}
|
||||
}
|
||||
|
||||
// CanReplyIsDisjointWith returns true if the other provided type is disjoint with
|
||||
// the CanReply type.
|
||||
func CanReplyIsDisjointWith(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not disjoint with anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// CanReplyIsExtendedBy returns true if the other provided type extends from the
|
||||
// CanReply type. Note that it returns false if the types are the same; see
|
||||
// the "IsOrExtendsCanReply" variant instead.
|
||||
func CanReplyIsExtendedBy(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not extended by anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// DeserializeCanReply creates a CanReply from a map representation that has been
|
||||
// unmarshalled from a text or binary format.
|
||||
func DeserializeCanReply(m map[string]interface{}, aliasMap map[string]string) (*GoToSocialCanReply, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
this := &GoToSocialCanReply{
|
||||
alias: alias,
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
|
||||
// Begin: Known property deserialization
|
||||
if p, err := mgr.DeserializeAlwaysPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialAlways = p
|
||||
}
|
||||
if p, err := mgr.DeserializeApprovalRequiredPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialApprovalRequired = p
|
||||
}
|
||||
if p, err := mgr.DeserializeIdPropertyJSONLD()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.JSONLDId = p
|
||||
}
|
||||
// End: Known property deserialization
|
||||
|
||||
// Begin: Unknown deserialization
|
||||
for k, v := range m {
|
||||
// Begin: Code that ensures a property name is unknown
|
||||
if k == "always" {
|
||||
continue
|
||||
} else if k == "approvalRequired" {
|
||||
continue
|
||||
} else if k == "id" {
|
||||
continue
|
||||
} // End: Code that ensures a property name is unknown
|
||||
|
||||
this.unknown[k] = v
|
||||
}
|
||||
// End: Unknown deserialization
|
||||
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// GoToSocialCanReplyExtends returns true if the CanReply type extends from the
|
||||
// other type.
|
||||
func GoToSocialCanReplyExtends(other vocab.Type) bool {
|
||||
// Shortcut implementation: this does not extend anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// IsOrExtendsCanReply returns true if the other provided type is the CanReply
|
||||
// type or extends from the CanReply type.
|
||||
func IsOrExtendsCanReply(other vocab.Type) bool {
|
||||
if other.GetTypeName() == "CanReply" {
|
||||
return true
|
||||
}
|
||||
return CanReplyIsExtendedBy(other)
|
||||
}
|
||||
|
||||
// NewGoToSocialCanReply creates a new CanReply type
|
||||
func NewGoToSocialCanReply() *GoToSocialCanReply {
|
||||
return &GoToSocialCanReply{
|
||||
alias: "",
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
}
|
||||
|
||||
// GetGoToSocialAlways returns the "always" property if it exists, and nil
|
||||
// otherwise.
|
||||
func (this GoToSocialCanReply) GetGoToSocialAlways() vocab.GoToSocialAlwaysProperty {
|
||||
return this.GoToSocialAlways
|
||||
}
|
||||
|
||||
// GetGoToSocialApprovalRequired returns the "approvalRequired" property if it
|
||||
// exists, and nil otherwise.
|
||||
func (this GoToSocialCanReply) GetGoToSocialApprovalRequired() vocab.GoToSocialApprovalRequiredProperty {
|
||||
return this.GoToSocialApprovalRequired
|
||||
}
|
||||
|
||||
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
|
||||
func (this GoToSocialCanReply) GetJSONLDId() vocab.JSONLDIdProperty {
|
||||
return this.JSONLDId
|
||||
}
|
||||
|
||||
// GetTypeName returns the name of this type.
|
||||
func (this GoToSocialCanReply) GetTypeName() string {
|
||||
return "CanReply"
|
||||
}
|
||||
|
||||
// GetUnknownProperties returns the unknown properties for the CanReply 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 GoToSocialCanReply) GetUnknownProperties() map[string]interface{} {
|
||||
return this.unknown
|
||||
}
|
||||
|
||||
// IsExtending returns true if the CanReply type extends from the other type.
|
||||
func (this GoToSocialCanReply) IsExtending(other vocab.Type) bool {
|
||||
return GoToSocialCanReplyExtends(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 GoToSocialCanReply) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
m = this.helperJSONLDContext(this.GoToSocialAlways, m)
|
||||
m = this.helperJSONLDContext(this.GoToSocialApprovalRequired, m)
|
||||
m = this.helperJSONLDContext(this.JSONLDId, m)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// LessThan computes if this CanReply is lesser, with an arbitrary but stable
|
||||
// determination.
|
||||
func (this GoToSocialCanReply) LessThan(o vocab.GoToSocialCanReply) bool {
|
||||
// Begin: Compare known properties
|
||||
// Compare property "always"
|
||||
if lhs, rhs := this.GoToSocialAlways, o.GetGoToSocialAlways(); 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 "approvalRequired"
|
||||
if lhs, rhs := this.GoToSocialApprovalRequired, o.GetGoToSocialApprovalRequired(); 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 "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
|
||||
// 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 GoToSocialCanReply) Serialize() (map[string]interface{}, error) {
|
||||
m := make(map[string]interface{})
|
||||
// Begin: Serialize known properties
|
||||
// Maybe serialize property "always"
|
||||
if this.GoToSocialAlways != nil {
|
||||
if i, err := this.GoToSocialAlways.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialAlways.Name()] = i
|
||||
}
|
||||
}
|
||||
// Maybe serialize property "approvalRequired"
|
||||
if this.GoToSocialApprovalRequired != nil {
|
||||
if i, err := this.GoToSocialApprovalRequired.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialApprovalRequired.Name()] = i
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
|
||||
// SetGoToSocialAlways sets the "always" property.
|
||||
func (this *GoToSocialCanReply) SetGoToSocialAlways(i vocab.GoToSocialAlwaysProperty) {
|
||||
this.GoToSocialAlways = i
|
||||
}
|
||||
|
||||
// SetGoToSocialApprovalRequired sets the "approvalRequired" property.
|
||||
func (this *GoToSocialCanReply) SetGoToSocialApprovalRequired(i vocab.GoToSocialApprovalRequiredProperty) {
|
||||
this.GoToSocialApprovalRequired = i
|
||||
}
|
||||
|
||||
// SetJSONLDId sets the "id" property.
|
||||
func (this *GoToSocialCanReply) SetJSONLDId(i vocab.JSONLDIdProperty) {
|
||||
this.JSONLDId = i
|
||||
}
|
||||
|
||||
// VocabularyURI returns the vocabulary's URI as a string.
|
||||
func (this GoToSocialCanReply) VocabularyURI() string {
|
||||
return "https://gotosocial.org/ns"
|
||||
}
|
||||
|
||||
// helperJSONLDContext obtains the context uris and their aliases from a property,
|
||||
// if it is not nil.
|
||||
func (this GoToSocialCanReply) 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
|
||||
}
|
||||
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_interactionpolicy/gen_doc.go
generated
vendored
Normal file
17
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_interactionpolicy/gen_doc.go
generated
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
// Package typeinteractionpolicy contains the implementation for the
|
||||
// InteractionPolicy 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 typeinteractionpolicy
|
||||
58
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_interactionpolicy/gen_pkg.go
generated
vendored
Normal file
58
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_interactionpolicy/gen_pkg.go
generated
vendored
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typeinteractionpolicy
|
||||
|
||||
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 {
|
||||
// DeserializeCanAnnouncePropertyGoToSocial returns the deserialization
|
||||
// method for the "GoToSocialCanAnnounceProperty" non-functional
|
||||
// property in the vocabulary "GoToSocial"
|
||||
DeserializeCanAnnouncePropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialCanAnnounceProperty, error)
|
||||
// DeserializeCanLikePropertyGoToSocial returns the deserialization method
|
||||
// for the "GoToSocialCanLikeProperty" non-functional property in the
|
||||
// vocabulary "GoToSocial"
|
||||
DeserializeCanLikePropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialCanLikeProperty, error)
|
||||
// DeserializeCanReplyPropertyGoToSocial returns the deserialization
|
||||
// method for the "GoToSocialCanReplyProperty" non-functional property
|
||||
// in the vocabulary "GoToSocial"
|
||||
DeserializeCanReplyPropertyGoToSocial() func(map[string]interface{}, map[string]string) (vocab.GoToSocialCanReplyProperty, error)
|
||||
// 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)
|
||||
}
|
||||
|
||||
// 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
|
||||
}
|
||||
332
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_interactionpolicy/gen_type_gotosocial_interactionpolicy.go
generated
vendored
Normal file
332
vendor/github.com/superseriousbusiness/activity/streams/impl/gotosocial/type_interactionpolicy/gen_type_gotosocial_interactionpolicy.go
generated
vendored
Normal file
|
|
@ -0,0 +1,332 @@
|
|||
// Code generated by astool. DO NOT EDIT.
|
||||
|
||||
package typeinteractionpolicy
|
||||
|
||||
import vocab "github.com/superseriousbusiness/activity/streams/vocab"
|
||||
|
||||
// InteractionPolicy for an ActivityStreams Object.
|
||||
type GoToSocialInteractionPolicy struct {
|
||||
GoToSocialCanAnnounce vocab.GoToSocialCanAnnounceProperty
|
||||
GoToSocialCanLike vocab.GoToSocialCanLikeProperty
|
||||
GoToSocialCanReply vocab.GoToSocialCanReplyProperty
|
||||
JSONLDId vocab.JSONLDIdProperty
|
||||
alias string
|
||||
unknown map[string]interface{}
|
||||
}
|
||||
|
||||
// DeserializeInteractionPolicy creates a InteractionPolicy from a map
|
||||
// representation that has been unmarshalled from a text or binary format.
|
||||
func DeserializeInteractionPolicy(m map[string]interface{}, aliasMap map[string]string) (*GoToSocialInteractionPolicy, error) {
|
||||
alias := ""
|
||||
if a, ok := aliasMap["https://gotosocial.org/ns"]; ok {
|
||||
alias = a
|
||||
}
|
||||
this := &GoToSocialInteractionPolicy{
|
||||
alias: alias,
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
|
||||
// Begin: Known property deserialization
|
||||
if p, err := mgr.DeserializeCanAnnouncePropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialCanAnnounce = p
|
||||
}
|
||||
if p, err := mgr.DeserializeCanLikePropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialCanLike = p
|
||||
}
|
||||
if p, err := mgr.DeserializeCanReplyPropertyGoToSocial()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.GoToSocialCanReply = p
|
||||
}
|
||||
if p, err := mgr.DeserializeIdPropertyJSONLD()(m, aliasMap); err != nil {
|
||||
return nil, err
|
||||
} else if p != nil {
|
||||
this.JSONLDId = p
|
||||
}
|
||||
// End: Known property deserialization
|
||||
|
||||
// Begin: Unknown deserialization
|
||||
for k, v := range m {
|
||||
// Begin: Code that ensures a property name is unknown
|
||||
if k == "canAnnounce" {
|
||||
continue
|
||||
} else if k == "canLike" {
|
||||
continue
|
||||
} else if k == "canReply" {
|
||||
continue
|
||||
} else if k == "id" {
|
||||
continue
|
||||
} // End: Code that ensures a property name is unknown
|
||||
|
||||
this.unknown[k] = v
|
||||
}
|
||||
// End: Unknown deserialization
|
||||
|
||||
return this, nil
|
||||
}
|
||||
|
||||
// GoToSocialInteractionPolicyExtends returns true if the InteractionPolicy type
|
||||
// extends from the other type.
|
||||
func GoToSocialInteractionPolicyExtends(other vocab.Type) bool {
|
||||
// Shortcut implementation: this does not extend anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// InteractionPolicyIsDisjointWith returns true if the other provided type is
|
||||
// disjoint with the InteractionPolicy type.
|
||||
func InteractionPolicyIsDisjointWith(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not disjoint with anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// InteractionPolicyIsExtendedBy returns true if the other provided type extends
|
||||
// from the InteractionPolicy type. Note that it returns false if the types
|
||||
// are the same; see the "IsOrExtendsInteractionPolicy" variant instead.
|
||||
func InteractionPolicyIsExtendedBy(other vocab.Type) bool {
|
||||
// Shortcut implementation: is not extended by anything.
|
||||
return false
|
||||
}
|
||||
|
||||
// IsOrExtendsInteractionPolicy returns true if the other provided type is the
|
||||
// InteractionPolicy type or extends from the InteractionPolicy type.
|
||||
func IsOrExtendsInteractionPolicy(other vocab.Type) bool {
|
||||
if other.GetTypeName() == "InteractionPolicy" {
|
||||
return true
|
||||
}
|
||||
return InteractionPolicyIsExtendedBy(other)
|
||||
}
|
||||
|
||||
// NewGoToSocialInteractionPolicy creates a new InteractionPolicy type
|
||||
func NewGoToSocialInteractionPolicy() *GoToSocialInteractionPolicy {
|
||||
return &GoToSocialInteractionPolicy{
|
||||
alias: "",
|
||||
unknown: make(map[string]interface{}),
|
||||
}
|
||||
}
|
||||
|
||||
// GetGoToSocialCanAnnounce returns the "canAnnounce" property if it exists, and
|
||||
// nil otherwise.
|
||||
func (this GoToSocialInteractionPolicy) GetGoToSocialCanAnnounce() vocab.GoToSocialCanAnnounceProperty {
|
||||
return this.GoToSocialCanAnnounce
|
||||
}
|
||||
|
||||
// GetGoToSocialCanLike returns the "canLike" property if it exists, and nil
|
||||
// otherwise.
|
||||
func (this GoToSocialInteractionPolicy) GetGoToSocialCanLike() vocab.GoToSocialCanLikeProperty {
|
||||
return this.GoToSocialCanLike
|
||||
}
|
||||
|
||||
// GetGoToSocialCanReply returns the "canReply" property if it exists, and nil
|
||||
// otherwise.
|
||||
func (this GoToSocialInteractionPolicy) GetGoToSocialCanReply() vocab.GoToSocialCanReplyProperty {
|
||||
return this.GoToSocialCanReply
|
||||
}
|
||||
|
||||
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
|
||||
func (this GoToSocialInteractionPolicy) GetJSONLDId() vocab.JSONLDIdProperty {
|
||||
return this.JSONLDId
|
||||
}
|
||||
|
||||
// GetTypeName returns the name of this type.
|
||||
func (this GoToSocialInteractionPolicy) GetTypeName() string {
|
||||
return "InteractionPolicy"
|
||||
}
|
||||
|
||||
// GetUnknownProperties returns the unknown properties for the InteractionPolicy
|
||||
// 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 GoToSocialInteractionPolicy) GetUnknownProperties() map[string]interface{} {
|
||||
return this.unknown
|
||||
}
|
||||
|
||||
// IsExtending returns true if the InteractionPolicy type extends from the other
|
||||
// type.
|
||||
func (this GoToSocialInteractionPolicy) IsExtending(other vocab.Type) bool {
|
||||
return GoToSocialInteractionPolicyExtends(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 GoToSocialInteractionPolicy) JSONLDContext() map[string]string {
|
||||
m := map[string]string{"https://gotosocial.org/ns": this.alias}
|
||||
m = this.helperJSONLDContext(this.GoToSocialCanAnnounce, m)
|
||||
m = this.helperJSONLDContext(this.GoToSocialCanLike, m)
|
||||
m = this.helperJSONLDContext(this.GoToSocialCanReply, m)
|
||||
m = this.helperJSONLDContext(this.JSONLDId, m)
|
||||
|
||||
return m
|
||||
}
|
||||
|
||||
// LessThan computes if this InteractionPolicy is lesser, with an arbitrary but
|
||||
// stable determination.
|
||||
func (this GoToSocialInteractionPolicy) LessThan(o vocab.GoToSocialInteractionPolicy) bool {
|
||||
// Begin: Compare known properties
|
||||
// Compare property "canAnnounce"
|
||||
if lhs, rhs := this.GoToSocialCanAnnounce, o.GetGoToSocialCanAnnounce(); 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 "canLike"
|
||||
if lhs, rhs := this.GoToSocialCanLike, o.GetGoToSocialCanLike(); 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 "canReply"
|
||||
if lhs, rhs := this.GoToSocialCanReply, o.GetGoToSocialCanReply(); 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 "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
|
||||
// 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 GoToSocialInteractionPolicy) Serialize() (map[string]interface{}, error) {
|
||||
m := make(map[string]interface{})
|
||||
// Begin: Serialize known properties
|
||||
// Maybe serialize property "canAnnounce"
|
||||
if this.GoToSocialCanAnnounce != nil {
|
||||
if i, err := this.GoToSocialCanAnnounce.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialCanAnnounce.Name()] = i
|
||||
}
|
||||
}
|
||||
// Maybe serialize property "canLike"
|
||||
if this.GoToSocialCanLike != nil {
|
||||
if i, err := this.GoToSocialCanLike.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialCanLike.Name()] = i
|
||||
}
|
||||
}
|
||||
// Maybe serialize property "canReply"
|
||||
if this.GoToSocialCanReply != nil {
|
||||
if i, err := this.GoToSocialCanReply.Serialize(); err != nil {
|
||||
return nil, err
|
||||
} else if i != nil {
|
||||
m[this.GoToSocialCanReply.Name()] = i
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
}
|
||||
// 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
|
||||
}
|
||||
|
||||
// SetGoToSocialCanAnnounce sets the "canAnnounce" property.
|
||||
func (this *GoToSocialInteractionPolicy) SetGoToSocialCanAnnounce(i vocab.GoToSocialCanAnnounceProperty) {
|
||||
this.GoToSocialCanAnnounce = i
|
||||
}
|
||||
|
||||
// SetGoToSocialCanLike sets the "canLike" property.
|
||||
func (this *GoToSocialInteractionPolicy) SetGoToSocialCanLike(i vocab.GoToSocialCanLikeProperty) {
|
||||
this.GoToSocialCanLike = i
|
||||
}
|
||||
|
||||
// SetGoToSocialCanReply sets the "canReply" property.
|
||||
func (this *GoToSocialInteractionPolicy) SetGoToSocialCanReply(i vocab.GoToSocialCanReplyProperty) {
|
||||
this.GoToSocialCanReply = i
|
||||
}
|
||||
|
||||
// SetJSONLDId sets the "id" property.
|
||||
func (this *GoToSocialInteractionPolicy) SetJSONLDId(i vocab.JSONLDIdProperty) {
|
||||
this.JSONLDId = i
|
||||
}
|
||||
|
||||
// VocabularyURI returns the vocabulary's URI as a string.
|
||||
func (this GoToSocialInteractionPolicy) VocabularyURI() string {
|
||||
return "https://gotosocial.org/ns"
|
||||
}
|
||||
|
||||
// helperJSONLDContext obtains the context uris and their aliases from a property,
|
||||
// if it is not nil.
|
||||
func (this GoToSocialInteractionPolicy) 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue