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

* update Activity

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

* update activity version again

* add SharedInboxURI field to accounts

* serdes for endpoints/sharedInbox

* deliver to sharedInbox if one is available

* update tests

* only assign shared inbox if shared domain

* look for shared inbox if currently nil

* go fmt

* finger to get params.RemoteAccountID if necessary

* make comments clearer

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

View file

@ -23,4 +23,17 @@ instance-expose-peers: false
# Options: [true, false]
# Default: false
instance-expose-suspended: false
# Bool. This flag tweaks whether GoToSocial will deliver ActivityPub messages
# to the shared inbox of a recipient, if one is available, instead of delivering
# each message to each actor who should receive a message individually.
#
# Shared inbox delivery can significantly reduce network load when delivering
# to multiple recipients share an inbox (eg., on large Mastodon instances).
#
# See: https://www.w3.org/TR/activitypub/#shared-inbox-delivery
#
# Options: [true, false]
# Default: true
instance-deliver-to-shared-inboxes: true
```

View file

@ -186,6 +186,19 @@ instance-expose-peers: false
# Default: false
instance-expose-suspended: false
# Bool. This flag tweaks whether GoToSocial will deliver ActivityPub messages
# to the shared inbox of a recipient, if one is available, instead of delivering
# each message to each actor who should receive a message individually.
#
# Shared inbox delivery can significantly reduce network load when delivering
# to multiple recipients share an inbox (eg., on large Mastodon instances).
#
# See: https://www.w3.org/TR/activitypub/#shared-inbox-delivery
#
# Options: [true, false]
# Default: true
instance-deliver-to-shared-inboxes: true
###########################
##### ACCOUNTS CONFIG #####
###########################

4
go.mod
View file

@ -38,11 +38,11 @@ require (
github.com/spf13/cobra v1.4.0
github.com/spf13/viper v1.11.0
github.com/stretchr/testify v1.8.0
github.com/superseriousbusiness/activity v1.1.0-gts
github.com/superseriousbusiness/activity v1.2.1-gts
github.com/superseriousbusiness/exif-terminator v0.4.0
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB
github.com/ulule/limiter/v3 v3.10.0
github.com/tdewolff/minify/v2 v2.12.0
github.com/ulule/limiter/v3 v3.10.0
github.com/uptrace/bun v1.1.7
github.com/uptrace/bun/dialect/pgdialect v1.1.7
github.com/uptrace/bun/dialect/sqlitedialect v1.1.7

4
go.sum
View file

@ -511,8 +511,8 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/superseriousbusiness/activity v1.1.0-gts h1:BSnMzs/84s0Zme7BngE9iJAHV7g1Bv1nhLCP0aJtU3I=
github.com/superseriousbusiness/activity v1.1.0-gts/go.mod h1:AZw0Xb4Oju8rmaJCZ21gc5CPg47MmNgyac+Hx5jo8VM=
github.com/superseriousbusiness/activity v1.2.1-gts h1:wh7v0zYa1mJmqB35PSfvgl4cs51Dh5PyfKvcZLSxMQU=
github.com/superseriousbusiness/activity v1.2.1-gts/go.mod h1:AZw0Xb4Oju8rmaJCZ21gc5CPg47MmNgyac+Hx5jo8VM=
github.com/superseriousbusiness/exif-terminator v0.4.0 h1:pzAg7luCi8oc2LVDwgTLvTinh/+/2UuWgJZrM8MMaT4=
github.com/superseriousbusiness/exif-terminator v0.4.0/go.mod h1:OPfOSEDWjXaW3BILJBN89j0VLD8bglmHwHHwwwSLb5A=
github.com/superseriousbusiness/go-jpeg-image-structure/v2 v2.0.0-20220321154430-d89a106fdabe h1:ksl2oCx/Qo8sNDc3Grb8WGKBM9nkvhCm25uvlT86azE=

View file

@ -702,3 +702,33 @@ func ExtractSensitive(withSensitive WithSensitive) bool {
return false
}
// ExtractSharedInbox extracts the sharedInbox URI properly from an Actor.
// Returns nil if this property is not set.
func ExtractSharedInbox(withEndpoints WithEndpoints) *url.URL {
endpointsProp := withEndpoints.GetActivityStreamsEndpoints()
if endpointsProp == nil {
return nil
}
for iter := endpointsProp.Begin(); iter != endpointsProp.End(); iter = iter.Next() {
if iter.IsActivityStreamsEndpoints() {
endpoints := iter.Get()
if endpoints == nil {
return nil
}
sharedInboxProp := endpoints.GetActivityStreamsSharedInbox()
if sharedInboxProp == nil {
return nil
}
if !sharedInboxProp.IsIRI() {
return nil
}
return sharedInboxProp.GetIRI()
}
}
return nil
}

View file

@ -40,6 +40,7 @@ type Accountable interface {
WithFollowers
WithFeatured
WithManuallyApprovesFollowers
WithEndpoints
}
// Statusable represents the minimum activitypub interface for representing a 'status'.
@ -337,3 +338,8 @@ type WithItems interface {
type WithManuallyApprovesFollowers interface {
GetActivityStreamsManuallyApprovesFollowers() vocab.ActivityStreamsManuallyApprovesFollowersProperty
}
// WithEndpoints represents a Person or profile with the endpoints property
type WithEndpoints interface {
GetActivityStreamsEndpoints() vocab.ActivityStreamsEndpointsProperty
}

View file

@ -136,6 +136,7 @@ func copyAccount(account *gtsmodel.Account) *gtsmodel.Account {
URL: account.URL,
LastWebfingeredAt: account.LastWebfingeredAt,
InboxURI: account.InboxURI,
SharedInboxURI: account.SharedInboxURI,
OutboxURI: account.OutboxURI,
FollowingURI: account.FollowingURI,
FollowersURI: account.FollowersURI,

View file

@ -67,8 +67,9 @@ type Configuration struct {
WebTemplateBaseDir string `name:"web-template-base-dir" usage:"Basedir for html templating files for rendering pages and composing emails."`
WebAssetBaseDir string `name:"web-asset-base-dir" usage:"Directory to serve static assets from, accessible at example.org/assets/"`
InstanceExposePeers bool `name:"instance-expose-peers" usage:"Allow unauthenticated users to query /api/v1/instance/peers?filter=open"`
InstanceExposeSuspended bool `name:"instance-expose-suspended" usage:"Expose suspended instances via web UI, and allow unauthenticated users to query /api/v1/instance/peers?filter=suspended"`
InstanceExposePeers bool `name:"instance-expose-peers" usage:"Allow unauthenticated users to query /api/v1/instance/peers?filter=open"`
InstanceExposeSuspended bool `name:"instance-expose-suspended" usage:"Expose suspended instances via web UI, and allow unauthenticated users to query /api/v1/instance/peers?filter=suspended"`
InstanceDeliverToSharedInboxes bool `name:"instance-deliver-to-shared-inboxes" usage:"Deliver federated messages to shared inboxes, if they're available."`
AccountsRegistrationOpen bool `name:"accounts-registration-open" usage:"Allow anyone to submit an account signup request. If false, server will be invite-only."`
AccountsApprovalRequired bool `name:"accounts-approval-required" usage:"Do account signups require approval by an admin or moderator before user can log in? If false, new registrations will be automatically approved."`

View file

@ -46,8 +46,9 @@ var Defaults = Configuration{
WebTemplateBaseDir: "./web/template/",
WebAssetBaseDir: "./web/assets/",
InstanceExposePeers: false,
InstanceExposeSuspended: false,
InstanceExposePeers: false,
InstanceExposeSuspended: false,
InstanceDeliverToSharedInboxes: true,
AccountsRegistrationOpen: true,
AccountsApprovalRequired: true,

View file

@ -63,6 +63,7 @@ func AddServerFlags(cmd *cobra.Command) {
// Instance
cmd.Flags().Bool(InstanceExposePeersFlag(), cfg.InstanceExposePeers, fieldtag("InstanceExposePeers", "usage"))
cmd.Flags().Bool(InstanceExposeSuspendedFlag(), cfg.InstanceExposeSuspended, fieldtag("InstanceExposeSuspended", "usage"))
cmd.Flags().Bool(InstanceDeliverToSharedInboxesFlag(), cfg.InstanceDeliverToSharedInboxes, fieldtag("InstanceDeliverToSharedInboxes", "usage"))
// Accounts
cmd.Flags().Bool(AccountsRegistrationOpenFlag(), cfg.AccountsRegistrationOpen, fieldtag("AccountsRegistrationOpen", "usage"))

View file

@ -593,6 +593,31 @@ func GetInstanceExposeSuspended() bool { return global.GetInstanceExposeSuspende
// SetInstanceExposeSuspended safely sets the value for global configuration 'InstanceExposeSuspended' field
func SetInstanceExposeSuspended(v bool) { global.SetInstanceExposeSuspended(v) }
// GetInstanceDeliverToSharedInboxes safely fetches the Configuration value for state's 'InstanceDeliverToSharedInboxes' field
func (st *ConfigState) GetInstanceDeliverToSharedInboxes() (v bool) {
st.mutex.Lock()
v = st.config.InstanceDeliverToSharedInboxes
st.mutex.Unlock()
return
}
// SetInstanceDeliverToSharedInboxes safely sets the Configuration value for state's 'InstanceDeliverToSharedInboxes' field
func (st *ConfigState) SetInstanceDeliverToSharedInboxes(v bool) {
st.mutex.Lock()
defer st.mutex.Unlock()
st.config.InstanceDeliverToSharedInboxes = v
st.reloadToViper()
}
// InstanceDeliverToSharedInboxesFlag returns the flag name for the 'InstanceDeliverToSharedInboxes' field
func InstanceDeliverToSharedInboxesFlag() string { return "instance-deliver-to-shared-inboxes" }
// GetInstanceDeliverToSharedInboxes safely fetches the value for global configuration 'InstanceDeliverToSharedInboxes' field
func GetInstanceDeliverToSharedInboxes() bool { return global.GetInstanceDeliverToSharedInboxes() }
// SetInstanceDeliverToSharedInboxes safely sets the value for global configuration 'InstanceDeliverToSharedInboxes' field
func SetInstanceDeliverToSharedInboxes(v bool) { global.SetInstanceDeliverToSharedInboxes(v) }
// GetAccountsRegistrationOpen safely fetches the Configuration value for state's 'AccountsRegistrationOpen' field
func (st *ConfigState) GetAccountsRegistrationOpen() (v bool) {
st.mutex.Lock()

View file

@ -0,0 +1,46 @@
/*
GoToSocial
Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package migrations
import (
"context"
"strings"
"github.com/uptrace/bun"
)
func init() {
up := func(ctx context.Context, db *bun.DB) error {
_, err := db.ExecContext(ctx, "ALTER TABLE ? ADD COLUMN ? TEXT", bun.Ident("accounts"), bun.Ident("shared_inbox_uri"))
if err != nil && !(strings.Contains(err.Error(), "already exists") || strings.Contains(err.Error(), "duplicate column name") || strings.Contains(err.Error(), "SQLSTATE 42701")) {
return err
}
return nil
}
down := func(ctx context.Context, db *bun.DB) error {
return db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error {
return nil
})
}
if err := Migrations.Register(up, down); err != nil {
panic(err)
}
}

View file

@ -29,6 +29,7 @@ import (
"sync"
"time"
"github.com/miekg/dns"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap"
@ -197,10 +198,12 @@ func (d *deref) GetRemoteAccount(ctx context.Context, params GetRemoteAccountPar
accountDomain = params.RemoteAccountHost
}
// to save on remote calls: only webfinger if we don't have a remoteAccount yet, or if we haven't
// fingered the remote account for at least 2 days; don't finger instance accounts
// to save on remote calls, only webfinger if:
// - we don't know the remote account ActivityPub ID yet OR
// - we haven't found the account yet in some other way OR
// - we haven't webfingered the account for two days AND the account isn't an instance account
var fingered time.Time
if foundAccount == nil || (foundAccount.LastWebfingeredAt.Before(time.Now().Add(webfingerInterval)) && !instanceAccount(foundAccount)) {
if params.RemoteAccountID == nil || foundAccount == nil || (foundAccount.LastWebfingeredAt.Before(time.Now().Add(webfingerInterval)) && !instanceAccount(foundAccount)) {
accountDomain, params.RemoteAccountID, err = d.fingerRemoteAccount(ctx, params.RequestingUsername, params.RemoteAccountUsername, params.RemoteAccountHost)
if err != nil {
err = fmt.Errorf("GetRemoteAccount: error while fingering: %s", err)
@ -279,6 +282,37 @@ func (d *deref) GetRemoteAccount(ctx context.Context, params GetRemoteAccountPar
}
}
// if SharedInboxURI is nil, that means we don't know yet if this account has
// a shared inbox available for it, so we need to check this here
var sharedInboxChanged bool
if foundAccount.SharedInboxURI == nil {
// we need the accountable for this, so get it if we don't have it yet
if accountable == nil {
accountable, err = d.dereferenceAccountable(ctx, params.RequestingUsername, params.RemoteAccountID)
if err != nil {
err = fmt.Errorf("GetRemoteAccount: error dereferencing accountable: %s", err)
return
}
}
// This can be:
// - an empty string (we know it doesn't have a shared inbox) OR
// - a string URL (we know it does a shared inbox).
// Set it either way!
var sharedInbox string
if sharedInboxURI := ap.ExtractSharedInbox(accountable); sharedInboxURI != nil {
// only trust shared inbox if it has at least two domains,
// from the right, in common with the domain of the account
if dns.CompareDomainName(foundAccount.Domain, sharedInboxURI.Host) >= 2 {
sharedInbox = sharedInboxURI.String()
}
}
sharedInboxChanged = true
foundAccount.SharedInboxURI = &sharedInbox
}
// make sure the account fields are populated before returning:
// the caller might want to block until everything is loaded
var fieldsChanged bool
@ -293,7 +327,7 @@ func (d *deref) GetRemoteAccount(ctx context.Context, params GetRemoteAccountPar
foundAccount.LastWebfingeredAt = fingered
}
if fieldsChanged || fingeredChanged {
if fieldsChanged || fingeredChanged || sharedInboxChanged {
foundAccount.UpdatedAt = time.Now()
foundAccount, err = d.db.UpdateAccount(ctx, foundAccount)
if err != nil {

View file

@ -101,6 +101,24 @@ func (suite *AccountTestSuite) TestDereferenceLocalAccountAsRemoteURL() {
suite.Empty(fetchedAccount.Domain)
}
func (suite *AccountTestSuite) TestDereferenceLocalAccountAsRemoteURLNoSharedInboxYet() {
fetchingAccount := suite.testAccounts["local_account_1"]
targetAccount := suite.testAccounts["local_account_2"]
targetAccount.SharedInboxURI = nil
if _, err := suite.db.UpdateAccount(context.Background(), targetAccount); err != nil {
suite.FailNow(err.Error())
}
fetchedAccount, err := suite.dereferencer.GetRemoteAccount(context.Background(), dereferencing.GetRemoteAccountParams{
RequestingUsername: fetchingAccount.Username,
RemoteAccountID: testrig.URLMustParse(targetAccount.URI),
})
suite.NoError(err)
suite.NotNil(fetchedAccount)
suite.Empty(fetchedAccount.Domain)
}
func (suite *AccountTestSuite) TestDereferenceLocalAccountAsUsername() {
fetchingAccount := suite.testAccounts["local_account_1"]
targetAccount := suite.testAccounts["local_account_2"]

View file

@ -117,7 +117,7 @@ func (suite *FederatingActorTestSuite) TestSendRemoteFollower() {
// because we added 1 remote follower for zork, there should be a url in sentMessage
var sent [][]byte
if !testrig.WaitFor(func() bool {
sentI, ok := httpClient.SentMessages.Load(testRemoteAccount.InboxURI)
sentI, ok := httpClient.SentMessages.Load(*testRemoteAccount.SharedInboxURI)
if ok {
sent, ok = sentI.([][]byte)
if !ok {

View file

@ -108,7 +108,15 @@ func (f *federatingDB) InboxesForIRI(c context.Context, iri *url.URL) (inboxIRIs
follow.Account = followingAccount
}
inboxIRI, err := url.Parse(follow.Account.InboxURI)
// deliver to a shared inbox if we have that option
var inbox string
if config.GetInstanceDeliverToSharedInboxes() && follow.Account.SharedInboxURI != nil && *follow.Account.SharedInboxURI != "" {
inbox = *follow.Account.SharedInboxURI
} else {
inbox = follow.Account.InboxURI
}
inboxIRI, err := url.Parse(inbox)
if err != nil {
return nil, fmt.Errorf("error parsing inbox uri of following account %s: %s", follow.Account.InboxURI, err)
}
@ -119,7 +127,15 @@ func (f *federatingDB) InboxesForIRI(c context.Context, iri *url.URL) (inboxIRIs
// check if this is just an account IRI...
if account, err := f.db.GetAccountByURI(c, iri.String()); err == nil {
inboxIRI, err := url.Parse(account.InboxURI)
// deliver to a shared inbox if we have that option
var inbox string
if config.GetInstanceDeliverToSharedInboxes() && account.SharedInboxURI != nil && *account.SharedInboxURI != "" {
inbox = *account.SharedInboxURI
} else {
inbox = account.InboxURI
}
inboxIRI, err := url.Parse(inbox)
if err != nil {
return nil, fmt.Errorf("error parsing account inbox uri %s: %s", account.InboxURI, account.InboxURI)
}

View file

@ -63,6 +63,27 @@ func (suite *InboxTestSuite) TestInboxesForAccountIRI() {
suite.Contains(asStrings, suite.testAccounts["local_account_1"].InboxURI)
}
func (suite *InboxTestSuite) TestInboxesForAccountIRIWithSharedInbox() {
ctx := context.Background()
testAccount := suite.testAccounts["local_account_1"]
sharedInbox := "http://some-inbox-iri/weeeeeeeeeeeee"
testAccount.SharedInboxURI = &sharedInbox
if _, err := suite.db.UpdateAccount(ctx, testAccount); err != nil {
suite.FailNow("error updating account")
}
inboxIRIs, err := suite.federatingDB.InboxesForIRI(ctx, testrig.URLMustParse(testAccount.URI))
suite.NoError(err)
asStrings := []string{}
for _, i := range inboxIRIs {
asStrings = append(asStrings, i.String())
}
suite.Len(asStrings, 1)
suite.Contains(asStrings, "http://some-inbox-iri/weeeeeeeeeeeee")
}
func TestInboxTestSuite(t *testing.T) {
suite.Run(t, &InboxTestSuite{})
}

View file

@ -60,6 +60,7 @@ type Account struct {
URL string `validate:"required_without=Domain,omitempty,url" bun:",nullzero,unique"` // Web URL for this account's profile
LastWebfingeredAt time.Time `validate:"required_with=Domain" bun:"type:timestamptz,nullzero"` // Last time this account was refreshed/located with webfinger.
InboxURI string `validate:"required_without=Domain,omitempty,url" bun:",nullzero,unique"` // Address of this account's ActivityPub inbox, for sending activity to
SharedInboxURI *string `validate:"-" bun:""` // Address of this account's ActivityPub sharedInbox. Gotcha warning: this is a string pointer because it has three possible states: 1. We don't know yet if the account has a shared inbox -- null. 2. We know it doesn't have a shared inbox -- empty string. 3. We know it does have a shared inbox -- url string.
OutboxURI string `validate:"required_without=Domain,omitempty,url" bun:",nullzero,unique"` // Address of this account's activitypub outbox
FollowingURI string `validate:"required_without=Domain,omitempty,url" bun:",nullzero,unique"` // URI for getting the following list of this account
FollowersURI string `validate:"required_without=Domain,omitempty,url" bun:",nullzero,unique"` // URI for getting the followers list of this account

View file

@ -71,7 +71,7 @@ func (suite *AccountTestSuite) TestAccountDeleteLocal() {
})
if !testrig.WaitFor(func() bool {
sentI, ok := suite.httpClient.SentMessages.Load(followingAccount.InboxURI)
sentI, ok := suite.httpClient.SentMessages.Load(*followingAccount.SharedInboxURI)
if ok {
sent, ok = sentI.([][]byte)
if !ok {

View file

@ -488,7 +488,7 @@ func (suite *FromFederatorTestSuite) TestProcessFollowRequestUnlocked() {
// an accept message should be sent to satan's inbox
var sent [][]byte
if !testrig.WaitFor(func() bool {
sentI, ok := suite.httpClient.SentMessages.Load(originAccount.InboxURI)
sentI, ok := suite.httpClient.SentMessages.Load(*originAccount.SharedInboxURI)
if ok {
sent, ok = sentI.([][]byte)
if !ok {

View file

@ -23,6 +23,7 @@ import (
"errors"
"fmt"
"github.com/miekg/dns"
"github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
@ -156,6 +157,19 @@ func (c *converter) ASRepresentationToAccount(ctx context.Context, accountable a
acct.InboxURI = accountable.GetActivityStreamsInbox().GetIRI().String()
}
// SharedInboxURI
if sharedInboxURI := ap.ExtractSharedInbox(accountable); sharedInboxURI != nil {
var sharedInbox string
// only trust shared inbox if it has at least two domains,
// from the right, in common with the domain of the account
if dns.CompareDomainName(acct.Domain, sharedInboxURI.Host) >= 2 {
sharedInbox = sharedInboxURI.String()
}
acct.SharedInboxURI = &sharedInbox
}
// OutboxURI
if accountable.GetActivityStreamsOutbox() != nil && accountable.GetActivityStreamsOutbox().GetIRI() != nil {
acct.OutboxURI = accountable.GetActivityStreamsOutbox().GetIRI().String()

View file

@ -45,6 +45,7 @@ func (suite *ASToInternalTestSuite) TestParsePerson() {
suite.Equal("https://unknown-instance.com/users/brand_new_person/following", acct.FollowingURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/followers", acct.FollowersURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/inbox", acct.InboxURI)
suite.Nil(acct.SharedInboxURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/outbox", acct.OutboxURI)
suite.Equal("https://unknown-instance.com/users/brand_new_person/collections/featured", acct.FeaturedCollectionURI)
suite.Equal("brand_new_person", acct.Username)
@ -56,6 +57,28 @@ func (suite *ASToInternalTestSuite) TestParsePerson() {
suite.False(*acct.Locked)
}
func (suite *ASToInternalTestSuite) TestParsePersonWithSharedInbox() {
testPerson := suite.testPeople["https://turnip.farm/users/turniplover6969"]
acct, err := suite.typeconverter.ASRepresentationToAccount(context.Background(), testPerson, "", false)
suite.NoError(err)
suite.Equal("https://turnip.farm/users/turniplover6969", acct.URI)
suite.Equal("https://turnip.farm/users/turniplover6969/following", acct.FollowingURI)
suite.Equal("https://turnip.farm/users/turniplover6969/followers", acct.FollowersURI)
suite.Equal("https://turnip.farm/users/turniplover6969/inbox", acct.InboxURI)
suite.Equal("https://turnip.farm/sharedInbox", *acct.SharedInboxURI)
suite.Equal("https://turnip.farm/users/turniplover6969/outbox", acct.OutboxURI)
suite.Equal("https://turnip.farm/users/turniplover6969/collections/featured", acct.FeaturedCollectionURI)
suite.Equal("turniplover6969", acct.Username)
suite.Equal("Turnip Lover 6969", acct.DisplayName)
suite.Equal("I just think they're neat", acct.Note)
suite.Equal("https://turnip.farm/@turniplover6969", acct.URL)
suite.True(*acct.Discoverable)
suite.Equal("https://turnip.farm/users/turniplover6969#main-key", acct.PublicKeyURI)
suite.False(*acct.Locked)
}
func (suite *ASToInternalTestSuite) TestParsePublicStatus() {
m := make(map[string]interface{})
err := json.Unmarshal([]byte(publicStatusActivityJson), &m)
@ -109,6 +132,8 @@ func (suite *ASToInternalTestSuite) TestParseGargron() {
acct, err := suite.typeconverter.ASRepresentationToAccount(context.Background(), rep, "", false)
suite.NoError(err)
suite.Equal("https://mastodon.social/inbox", *acct.SharedInboxURI)
fmt.Printf("%+v", acct)
// TODO: write assertions here, rn we're just eyeballing the output
}

View file

@ -85,6 +85,21 @@ func (c *converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab
inboxProp.SetIRI(inboxURI)
person.SetActivityStreamsInbox(inboxProp)
// shared inbox -- only add this if we know for sure it has one
if a.SharedInboxURI != nil && *a.SharedInboxURI != "" {
sharedInboxURI, err := url.Parse(*a.SharedInboxURI)
if err != nil {
return nil, err
}
endpointsProp := streams.NewActivityStreamsEndpointsProperty()
endpoints := streams.NewActivityStreamsEndpoints()
sharedInboxProp := streams.NewActivityStreamsSharedInboxProperty()
sharedInboxProp.SetIRI(sharedInboxURI)
endpoints.SetActivityStreamsSharedInbox(sharedInboxProp)
endpointsProp.AppendActivityStreamsEndpoints(endpoints)
person.SetActivityStreamsEndpoints(endpointsProp)
}
// outbox
// the activitypub outbox of this user for serving messages
outboxURI, err := url.Parse(a.OutboxURI)

View file

@ -52,6 +52,27 @@ func (suite *InternalToASTestSuite) TestAccountToAS() {
suite.Equal(`:true,"featured":"http://localhost:8080/users/the_mighty_zork/collections/featured","followers":"http://localhost:8080/users/the_mighty_zork/followers","following":"http://localhost:8080/users/the_mighty_zork/following","icon":{"mediaType":"image/jpeg","type":"Image","url":"http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpeg"},"id":"http://localhost:8080/users/the_mighty_zork","image":{"mediaType":"image/jpeg","type":"Image","url":"http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpeg"},"inbox":"http://localhost:8080/users/the_mighty_zork/inbox","manuallyApprovesFollowers":false,"name":"original zork (he/they)","outbox":"http://localhost:8080/users/the_mighty_zork/outbox","preferredUsername":"the_mighty_zork","publicKey":{"id":"http://localhost:8080/users/the_mighty_zork/main-key","owner":"http://localhost:8080/users/the_mighty_zork","publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwXTcOAvM1Jiw5Ffpk0qn\nr0cwbNvFe/5zQ+Tp7tumK/ZnT37o7X0FUEXrxNi+dkhmeJ0gsaiN+JQGNUewvpSk\nPIAXKvi908aSfCGjs7bGlJCJCuDuL5d6m7hZnP9rt9fJc70GElPpG0jc9fXwlz7T\nlsPb2ecatmG05Y4jPwdC+oN4MNCv9yQzEvCVMzl76EJaM602kIHC1CISn0rDFmYd\n9rSN7XPlNJw1F6PbpJ/BWQ+pXHKw3OEwNTETAUNYiVGnZU+B7a7bZC9f6/aPbJuV\nt8Qmg+UnDvW1Y8gmfHnxaWG2f5TDBvCHmcYtucIZPLQD4trAozC4ryqlmCWQNKbt\n0wIDAQAB\n-----END PUBLIC KEY-----\n"},"summary":"\u003cp\u003ehey yo this is my profile!\u003c/p\u003e","type":"Person","url":"http://localhost:8080/@the_mighty_zork"}`, trimmed)
}
func (suite *InternalToASTestSuite) TestAccountToASWithSharedInbox() {
testAccount := suite.testAccounts["local_account_1"] // take zork for this test
sharedInbox := "http://localhost:8080/sharedInbox"
testAccount.SharedInboxURI = &sharedInbox
asPerson, err := suite.typeconverter.AccountToAS(context.Background(), testAccount)
suite.NoError(err)
ser, err := streams.Serialize(asPerson)
suite.NoError(err)
bytes, err := json.Marshal(ser)
suite.NoError(err)
// trim off everything up to 'discoverable';
// this is necessary because the order of multiple 'context' entries is not determinate
trimmed := strings.Split(string(bytes), "\"discoverable\"")[1]
suite.Equal(`:true,"endpoints":{"sharedInbox":"http://localhost:8080/sharedInbox"},"featured":"http://localhost:8080/users/the_mighty_zork/collections/featured","followers":"http://localhost:8080/users/the_mighty_zork/followers","following":"http://localhost:8080/users/the_mighty_zork/following","icon":{"mediaType":"image/jpeg","type":"Image","url":"http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpeg"},"id":"http://localhost:8080/users/the_mighty_zork","image":{"mediaType":"image/jpeg","type":"Image","url":"http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpeg"},"inbox":"http://localhost:8080/users/the_mighty_zork/inbox","manuallyApprovesFollowers":false,"name":"original zork (he/they)","outbox":"http://localhost:8080/users/the_mighty_zork/outbox","preferredUsername":"the_mighty_zork","publicKey":{"id":"http://localhost:8080/users/the_mighty_zork/main-key","owner":"http://localhost:8080/users/the_mighty_zork","publicKeyPem":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwXTcOAvM1Jiw5Ffpk0qn\nr0cwbNvFe/5zQ+Tp7tumK/ZnT37o7X0FUEXrxNi+dkhmeJ0gsaiN+JQGNUewvpSk\nPIAXKvi908aSfCGjs7bGlJCJCuDuL5d6m7hZnP9rt9fJc70GElPpG0jc9fXwlz7T\nlsPb2ecatmG05Y4jPwdC+oN4MNCv9yQzEvCVMzl76EJaM602kIHC1CISn0rDFmYd\n9rSN7XPlNJw1F6PbpJ/BWQ+pXHKw3OEwNTETAUNYiVGnZU+B7a7bZC9f6/aPbJuV\nt8Qmg+UnDvW1Y8gmfHnxaWG2f5TDBvCHmcYtucIZPLQD4trAozC4ryqlmCWQNKbt\n0wIDAQAB\n-----END PUBLIC KEY-----\n"},"summary":"\u003cp\u003ehey yo this is my profile!\u003c/p\u003e","type":"Person","url":"http://localhost:8080/@the_mighty_zork"}`, trimmed)
}
func (suite *InternalToASTestSuite) TestOutboxToASCollection() {
testAccount := suite.testAccounts["admin_account"]
ctx := context.Background()

View file

@ -5,7 +5,7 @@ set -e
echo "STARTING CLI TESTS"
echo "TEST_1 Make sure defaults are set correctly."
TEST_1_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_1_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_1="$(go run ./cmd/gotosocial/... debug config)"
if [ "${TEST_1}" != "${TEST_1_EXPECTED}" ]; then
echo "TEST_1 not equal TEST_1_EXPECTED"
@ -15,7 +15,7 @@ else
fi
echo "TEST_2 Override db-address from default using cli flag."
TEST_2_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"some.db.address","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_2_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"some.db.address","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_2="$(go run ./cmd/gotosocial/... --db-address some.db.address debug config)"
if [ "${TEST_2}" != "${TEST_2_EXPECTED}" ]; then
echo "TEST_2 not equal TEST_2_EXPECTED"
@ -25,7 +25,7 @@ else
fi
echo "TEST_3 Override db-address from default using env var."
TEST_3_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"some.db.address","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_3_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"some.db.address","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_3="$(GTS_DB_ADDRESS=some.db.address go run ./cmd/gotosocial/... debug config)"
if [ "${TEST_3}" != "${TEST_3_EXPECTED}" ]; then
echo "TEST_3 not equal TEST_3_EXPECTED"
@ -35,7 +35,7 @@ else
fi
echo "TEST_4 Override db-address from default using both env var and cli flag. The cli flag should take priority."
TEST_4_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"some.other.db.address","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_4_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"","db-address":"some.other.db.address","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_4="$(GTS_DB_ADDRESS=some.db.address go run ./cmd/gotosocial/... --db-address some.other.db.address debug config)"
if [ "${TEST_4}" != "${TEST_4_EXPECTED}" ]; then
echo "TEST_4 not equal TEST_4_EXPECTED"
@ -45,7 +45,7 @@ else
fi
echo "TEST_5 Test loading a config file by passing an env var."
TEST_5_EXPECTED='{"account-domain":"example.org","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_5_EXPECTED='{"account-domain":"example.org","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_5="$(GTS_CONFIG_PATH=./test/test.yaml go run ./cmd/gotosocial/... debug config)"
if [ "${TEST_5}" != "${TEST_5_EXPECTED}" ]; then
echo "TEST_5 not equal TEST_5_EXPECTED"
@ -55,7 +55,7 @@ else
fi
echo "TEST_6 Test loading a config file by passing cli flag."
TEST_6_EXPECTED='{"account-domain":"example.org","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_6_EXPECTED='{"account-domain":"example.org","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_6="$(go run ./cmd/gotosocial/... --config-path ./test/test.yaml debug config)"
if [ "${TEST_6}" != "${TEST_6_EXPECTED}" ]; then
echo "TEST_6 not equal TEST_6_EXPECTED"
@ -65,7 +65,7 @@ else
fi
echo "TEST_7 Test loading a config file and overriding one of the variables with a cli flag."
TEST_7_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_7_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_7="$(go run ./cmd/gotosocial/... --config-path ./test/test.yaml --account-domain '' debug config)"
if [ "${TEST_7}" != "${TEST_7_EXPECTED}" ]; then
echo "TEST_7 not equal TEST_7_EXPECTED"
@ -75,7 +75,7 @@ else
fi
echo "TEST_8 Test loading a config file and overriding one of the variables with an env var."
TEST_8_EXPECTED='{"account-domain":"peepee","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_8_EXPECTED='{"account-domain":"peepee","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_8="$(GTS_ACCOUNT_DOMAIN='peepee' go run ./cmd/gotosocial/... --config-path ./test/test.yaml debug config)"
if [ "${TEST_8}" != "${TEST_8_EXPECTED}" ]; then
echo "TEST_8 not equal TEST_8_EXPECTED"
@ -85,7 +85,7 @@ else
fi
echo "TEST_9 Test loading a config file and overriding one of the variables with both an env var and a cli flag. The cli flag should have priority."
TEST_9_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_9_EXPECTED='{"account-domain":"","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.yaml","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_9="$(GTS_ACCOUNT_DOMAIN='peepee' go run ./cmd/gotosocial/... --config-path ./test/test.yaml --account-domain '' debug config)"
if [ "${TEST_9}" != "${TEST_9_EXPECTED}" ]; then
echo "TEST_9 not equal TEST_9_EXPECTED"
@ -95,7 +95,7 @@ else
fi
echo "TEST_10 Test loading a config file from json."
TEST_10_EXPECTED='{"account-domain":"example.org","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.json","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_10_EXPECTED='{"account-domain":"example.org","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test.json","db-address":"127.0.0.1","db-database":"postgres","db-password":"postgres","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"postgres","email":"","host":"gts.example.org","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":false,"log-level":"info","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","email","profile","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"someone@example.org","smtp-host":"verycoolemailhost.mail","smtp-password":"smtp-password","smtp-port":8888,"smtp-username":"smtp-username","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_10="$(go run ./cmd/gotosocial/... --config-path ./test/test.json debug config)"
if [ "${TEST_10}" != "${TEST_10_EXPECTED}" ]; then
echo "TEST_10 not equal TEST_10_EXPECTED"
@ -105,7 +105,7 @@ else
fi
echo "TEST_11 Test loading a partial config file. Default values should be used apart from those set in the config file."
TEST_11_EXPECTED='{"account-domain":"peepee.poopoo","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test2.yaml","db-address":"","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"trace","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_11_EXPECTED='{"account-domain":"peepee.poopoo","accounts-allow-custom-css":false,"accounts-approval-required":true,"accounts-reason-required":true,"accounts-registration-open":true,"advanced-cookies-samesite":"lax","application-name":"gotosocial","bind-address":"0.0.0.0","config-path":"./test/test2.yaml","db-address":"","db-database":"gotosocial","db-password":"","db-port":5432,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"postgres","db-user":"","email":"","host":"","instance-deliver-to-shared-inboxes":true,"instance-expose-peers":false,"instance-expose-suspended":false,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":false,"letsencrypt-port":80,"log-db-queries":false,"log-level":"trace","media-description-max-chars":500,"media-description-min-chars":0,"media-emoji-local-max-size":51200,"media-emoji-remote-max-size":102400,"media-image-max-size":10485760,"media-remote-cache-days":30,"media-video-max-size":41943040,"oidc-client-id":"","oidc-client-secret":"","oidc-enabled":false,"oidc-idp-name":"","oidc-issuer":"","oidc-scopes":["openid","profile","email","groups"],"oidc-skip-verification":false,"password":"","path":"","port":8080,"protocol":"https","smtp-from":"GoToSocial","smtp-host":"","smtp-password":"","smtp-port":0,"smtp-username":"","software-version":"","statuses-cw-max-chars":100,"statuses-max-chars":5000,"statuses-media-max-files":6,"statuses-poll-max-options":6,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/gotosocial/storage","storage-s3-access-key":"","storage-s3-bucket":"","storage-s3-endpoint":"","storage-s3-secret-key":"","storage-s3-use-ssl":true,"syslog-address":"localhost:514","syslog-enabled":false,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32"],"username":"","web-asset-base-dir":"./web/assets/","web-template-base-dir":"./web/template/"}'
TEST_11="$(go run ./cmd/gotosocial/... --config-path ./test/test2.yaml debug config)"
if [ "${TEST_11}" != "${TEST_11_EXPECTED}" ]; then
echo "TEST_11 not equal TEST_11_EXPECTED"

View file

@ -2,7 +2,7 @@
set -eu
EXPECTED='{"account-domain":"peepee","accounts-allow-custom-css":true,"accounts-approval-required":false,"accounts-reason-required":false,"accounts-registration-open":true,"advanced-cookies-samesite":"strict","application-name":"gts","bind-address":"127.0.0.1","config-path":"./test/test.yaml","db-address":":memory:","db-database":"gotosocial_prod","db-password":"hunter2","db-port":6969,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"sqlite","db-user":"sex-haver","email":"","host":"example.com","instance-expose-peers":true,"instance-expose-suspended":true,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":true,"log-level":"info","media-description-max-chars":5000,"media-description-min-chars":69,"media-emoji-local-max-size":420,"media-emoji-remote-max-size":420,"media-image-max-size":420,"media-remote-cache-days":30,"media-video-max-size":420,"oidc-client-id":"1234","oidc-client-secret":"shhhh its a secret","oidc-enabled":true,"oidc-idp-name":"sex-haver","oidc-issuer":"whoknows","oidc-scopes":["read","write"],"oidc-skip-verification":true,"password":"","path":"","port":6969,"protocol":"http","smtp-from":"queen@terfisland.org","smtp-host":"example.com","smtp-password":"hunter2","smtp-port":4269,"smtp-username":"sex-haver","software-version":"","statuses-cw-max-chars":420,"statuses-max-chars":69,"statuses-media-max-files":1,"statuses-poll-max-options":1,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/root/store","storage-s3-access-key":"minio","storage-s3-bucket":"gts","storage-s3-endpoint":"localhost:9000","storage-s3-secret-key":"miniostorage","storage-s3-use-ssl":false,"syslog-address":"127.0.0.1:6969","syslog-enabled":true,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"/root","web-template-base-dir":"/root"}'
EXPECTED='{"account-domain":"peepee","accounts-allow-custom-css":true,"accounts-approval-required":false,"accounts-reason-required":false,"accounts-registration-open":true,"advanced-cookies-samesite":"strict","application-name":"gts","bind-address":"127.0.0.1","config-path":"./test/test.yaml","db-address":":memory:","db-database":"gotosocial_prod","db-password":"hunter2","db-port":6969,"db-tls-ca-cert":"","db-tls-mode":"disable","db-type":"sqlite","db-user":"sex-haver","email":"","host":"example.com","instance-deliver-to-shared-inboxes":false,"instance-expose-peers":true,"instance-expose-suspended":true,"letsencrypt-cert-dir":"/gotosocial/storage/certs","letsencrypt-email-address":"","letsencrypt-enabled":true,"letsencrypt-port":80,"log-db-queries":true,"log-level":"info","media-description-max-chars":5000,"media-description-min-chars":69,"media-emoji-local-max-size":420,"media-emoji-remote-max-size":420,"media-image-max-size":420,"media-remote-cache-days":30,"media-video-max-size":420,"oidc-client-id":"1234","oidc-client-secret":"shhhh its a secret","oidc-enabled":true,"oidc-idp-name":"sex-haver","oidc-issuer":"whoknows","oidc-scopes":["read","write"],"oidc-skip-verification":true,"password":"","path":"","port":6969,"protocol":"http","smtp-from":"queen@terfisland.org","smtp-host":"example.com","smtp-password":"hunter2","smtp-port":4269,"smtp-username":"sex-haver","software-version":"","statuses-cw-max-chars":420,"statuses-max-chars":69,"statuses-media-max-files":1,"statuses-poll-max-options":1,"statuses-poll-option-max-chars":50,"storage-backend":"local","storage-local-base-path":"/root/store","storage-s3-access-key":"minio","storage-s3-bucket":"gts","storage-s3-endpoint":"localhost:9000","storage-s3-secret-key":"miniostorage","storage-s3-use-ssl":false,"syslog-address":"127.0.0.1:6969","syslog-enabled":true,"syslog-protocol":"udp","trusted-proxies":["127.0.0.1/32","0.0.0.0/0"],"username":"","web-asset-base-dir":"/root","web-template-base-dir":"/root"}'
# Set all the environment variables to
# ensure that these are parsed without panic
@ -27,6 +27,7 @@ GTS_WEB_TEMPLATE_BASE_DIR='/root' \
GTS_WEB_ASSET_BASE_DIR='/root' \
GTS_INSTANCE_EXPOSE_PEERS=true \
GTS_INSTANCE_EXPOSE_SUSPENDED=true \
GTS_INSTANCE_DELIVER_TO_SHARED_INBOXES=false \
GTS_ACCOUNTS_ALLOW_CUSTOM_CSS=true \
GTS_ACCOUNTS_REGISTRATION_OPEN=true \
GTS_ACCOUNTS_APPROVAL_REQUIRED=false \

View file

@ -52,8 +52,9 @@ var testDefaults = config.Configuration{
WebTemplateBaseDir: "./web/template/",
WebAssetBaseDir: "./web/assets/",
InstanceExposePeers: true,
InstanceExposeSuspended: true,
InstanceExposePeers: true,
InstanceExposeSuspended: true,
InstanceDeliverToSharedInboxes: true,
AccountsRegistrationOpen: true,
AccountsApprovalRequired: true,

View file

@ -55,6 +55,11 @@ func FalseBool() *bool {
return new(bool)
}
// StringPtr returns a pointer to the given string.
func StringPtr(in string) *string {
return &in
}
// NewTestTokens returns a map of tokens keyed according to which account the token belongs to.
func NewTestTokens() map[string]*gtsmodel.Token {
tokens := map[string]*gtsmodel.Token{
@ -474,6 +479,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
URL: "http://fossbros-anonymous.io/@foss_satan",
LastWebfingeredAt: time.Time{},
InboxURI: "http://fossbros-anonymous.io/users/foss_satan/inbox",
SharedInboxURI: StringPtr("http://fossbros-anonymous.io/inbox"),
OutboxURI: "http://fossbros-anonymous.io/users/foss_satan/outbox",
FollowersURI: "http://fossbros-anonymous.io/users/foss_satan/followers",
FollowingURI: "http://fossbros-anonymous.io/users/foss_satan/following",
@ -509,6 +515,7 @@ func NewTestAccounts() map[string]*gtsmodel.Account {
URL: "http://example.org/@some_user",
LastWebfingeredAt: time.Time{},
InboxURI: "http://example.org/users/some_user/inbox",
SharedInboxURI: StringPtr(""),
OutboxURI: "http://example.org/users/some_user/outbox",
FollowersURI: "http://example.org/users/some_user/followers",
FollowingURI: "http://example.org/users/some_user/following",
@ -1832,6 +1839,7 @@ func NewTestFediPeople() map[string]vocab.ActivityStreamsPerson {
URLMustParse("https://unknown-instance.com/users/brand_new_person/following"),
URLMustParse("https://unknown-instance.com/users/brand_new_person/followers"),
URLMustParse("https://unknown-instance.com/users/brand_new_person/inbox"),
nil,
URLMustParse("https://unknown-instance.com/users/brand_new_person/outbox"),
URLMustParse("https://unknown-instance.com/users/brand_new_person/collections/featured"),
"brand_new_person",
@ -1852,6 +1860,7 @@ func NewTestFediPeople() map[string]vocab.ActivityStreamsPerson {
URLMustParse("https://turnip.farm/users/turniplover6969/following"),
URLMustParse("https://turnip.farm/users/turniplover6969/followers"),
URLMustParse("https://turnip.farm/users/turniplover6969/inbox"),
URLMustParse("https://turnip.farm/sharedInbox"),
URLMustParse("https://turnip.farm/users/turniplover6969/outbox"),
URLMustParse("https://turnip.farm/users/turniplover6969/collections/featured"),
"turniplover6969",
@ -2245,6 +2254,7 @@ func newAPPerson(
followingURI *url.URL,
followersURI *url.URL,
inboxURI *url.URL,
sharedInboxIRI *url.URL,
outboxURI *url.URL,
featuredURI *url.URL,
username string,
@ -2286,6 +2296,17 @@ func newAPPerson(
inboxProp.SetIRI(inboxURI)
person.SetActivityStreamsInbox(inboxProp)
// shared inbox
if sharedInboxIRI != nil {
endpointsProp := streams.NewActivityStreamsEndpointsProperty()
endpoints := streams.NewActivityStreamsEndpoints()
sharedInboxProp := streams.NewActivityStreamsSharedInboxProperty()
sharedInboxProp.SetIRI(sharedInboxIRI)
endpoints.SetActivityStreamsSharedInbox(sharedInboxProp)
endpointsProp.AppendActivityStreamsEndpoints(endpoints)
person.SetActivityStreamsEndpoints(endpointsProp)
}
// outbox
// the activitypub outbox of this user for serving messages
outboxProp := streams.NewActivityStreamsOutboxProperty()

View file

@ -56,6 +56,9 @@ var ActivityStreamsDocumentName string = "Document"
// TootEmojiName is the string literal of the name for the Emoji type in the Toot vocabulary.
var TootEmojiName string = "Emoji"
// ActivityStreamsEndpointsName is the string literal of the name for the Endpoints type in the ActivityStreams vocabulary.
var ActivityStreamsEndpointsName string = "Endpoints"
// ActivityStreamsEventName is the string literal of the name for the Event type in the ActivityStreams vocabulary.
var ActivityStreamsEventName string = "Event"
@ -281,6 +284,9 @@ var ForgeFedEarlyItemsPropertyName string = "earlyItems"
// ActivityStreamsEndTimePropertyName is the string literal of the name for the endTime property in the ActivityStreams vocabulary.
var ActivityStreamsEndTimePropertyName string = "endTime"
// ActivityStreamsEndpointsPropertyName is the string literal of the name for the endpoints property in the ActivityStreams vocabulary.
var ActivityStreamsEndpointsPropertyName string = "endpoints"
// TootFeaturedPropertyName is the string literal of the name for the featured property in the Toot vocabulary.
var TootFeaturedPropertyName string = "featured"
@ -440,6 +446,9 @@ var ActivityStreamsResultPropertyName string = "result"
// ActivityStreamsSensitivePropertyName is the string literal of the name for the sensitive property in the ActivityStreams vocabulary.
var ActivityStreamsSensitivePropertyName string = "sensitive"
// ActivityStreamsSharedInboxPropertyName is the string literal of the name for the sharedInbox property in the ActivityStreams vocabulary.
var ActivityStreamsSharedInboxPropertyName string = "sharedInbox"
// ActivityStreamsSharesPropertyName is the string literal of the name for the shares property in the ActivityStreams vocabulary.
var ActivityStreamsSharesPropertyName string = "shares"

View file

@ -20,6 +20,7 @@ import (
propertydeleted "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_deleted"
propertydescribes "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_describes"
propertyduration "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_duration"
propertyendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endpoints"
propertyendtime "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endtime"
propertyfirst "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_first"
propertyfollowers "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_followers"
@ -61,6 +62,7 @@ import (
propertyreplies "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_replies"
propertyresult "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_result"
propertysensitive "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sensitive"
propertysharedinbox "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sharedinbox"
propertyshares "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_shares"
propertysource "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_source"
propertystartindex "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_startindex"
@ -91,6 +93,7 @@ import (
typedelete "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document"
typeendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints"
typeevent "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow"
@ -199,6 +202,7 @@ func init() {
propertydeleted.SetManager(mgr)
propertydescribes.SetManager(mgr)
propertyduration.SetManager(mgr)
propertyendpoints.SetManager(mgr)
propertyendtime.SetManager(mgr)
propertyfirst.SetManager(mgr)
propertyfollowers.SetManager(mgr)
@ -240,6 +244,7 @@ func init() {
propertyreplies.SetManager(mgr)
propertyresult.SetManager(mgr)
propertysensitive.SetManager(mgr)
propertysharedinbox.SetManager(mgr)
propertyshares.SetManager(mgr)
propertysource.SetManager(mgr)
propertystartindex.SetManager(mgr)
@ -270,6 +275,7 @@ func init() {
typedelete.SetManager(mgr)
typedislike.SetManager(mgr)
typedocument.SetManager(mgr)
typeendpoints.SetManager(mgr)
typeevent.SetManager(mgr)
typeflag.SetManager(mgr)
typefollow.SetManager(mgr)
@ -361,6 +367,7 @@ func init() {
typedelete.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typedislike.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typedocument.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeendpoints.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeevent.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeflag.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typefollow.SetTypePropertyConstructor(NewJSONLDTypeProperty)

View file

@ -67,6 +67,8 @@ func NewJSONResolver(callbacks ...interface{}) (*JSONResolver, error) {
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.TootEmoji) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsEndpoints) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsEvent) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsFlag) error:
@ -456,6 +458,17 @@ func (this JSONResolver) Resolve(ctx context.Context, m map[string]interface{})
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Endpoints" {
v, err := mgr.DeserializeEndpointsActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsEndpoints) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Event" {
v, err := mgr.DeserializeEventActivityStreams()(m, aliasMap)
if err != nil {

View file

@ -20,6 +20,7 @@ import (
propertydeleted "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_deleted"
propertydescribes "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_describes"
propertyduration "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_duration"
propertyendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endpoints"
propertyendtime "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endtime"
propertyfirst "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_first"
propertyfollowers "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_followers"
@ -61,6 +62,7 @@ import (
propertyreplies "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_replies"
propertyresult "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_result"
propertysensitive "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sensitive"
propertysharedinbox "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sharedinbox"
propertyshares "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_shares"
propertysource "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_source"
propertystartindex "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_startindex"
@ -91,6 +93,7 @@ import (
typedelete "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document"
typeendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints"
typeevent "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow"
@ -784,6 +787,32 @@ func (this Manager) DeserializeEndTimePropertyActivityStreams() func(map[string]
}
}
// DeserializeEndpointsActivityStreams returns the deserialization method for the
// "ActivityStreamsEndpoints" non-functional property in the vocabulary
// "ActivityStreams"
func (this Manager) DeserializeEndpointsActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpoints, error) {
return func(m map[string]interface{}, aliasMap map[string]string) (vocab.ActivityStreamsEndpoints, error) {
i, err := typeendpoints.DeserializeEndpoints(m, aliasMap)
if i == nil {
return nil, err
}
return i, err
}
}
// DeserializeEndpointsPropertyActivityStreams returns the deserialization method
// for the "ActivityStreamsEndpointsProperty" non-functional property in the
// vocabulary "ActivityStreams"
func (this Manager) DeserializeEndpointsPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsEndpointsProperty, error) {
return func(m map[string]interface{}, aliasMap map[string]string) (vocab.ActivityStreamsEndpointsProperty, error) {
i, err := propertyendpoints.DeserializeEndpointsProperty(m, aliasMap)
if i == nil {
return nil, err
}
return i, err
}
}
// DeserializeEventActivityStreams returns the deserialization method for the
// "ActivityStreamsEvent" non-functional property in the vocabulary
// "ActivityStreams"
@ -1908,6 +1937,19 @@ func (this Manager) DeserializeServiceActivityStreams() func(map[string]interfac
}
}
// DeserializeSharedInboxPropertyActivityStreams returns the deserialization
// method for the "ActivityStreamsSharedInboxProperty" non-functional property
// in the vocabulary "ActivityStreams"
func (this Manager) DeserializeSharedInboxPropertyActivityStreams() func(map[string]interface{}, map[string]string) (vocab.ActivityStreamsSharedInboxProperty, error) {
return func(m map[string]interface{}, aliasMap map[string]string) (vocab.ActivityStreamsSharedInboxProperty, error) {
i, err := propertysharedinbox.DeserializeSharedInboxProperty(m, aliasMap)
if i == nil {
return nil, err
}
return i, err
}
}
// DeserializeSharesPropertyActivityStreams returns the deserialization method for
// the "ActivityStreamsSharesProperty" non-functional property in the
// vocabulary "ActivityStreams"

View file

@ -18,6 +18,7 @@ import (
typedelete "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document"
typeendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints"
typeevent "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow"
@ -150,6 +151,12 @@ func ActivityStreamsDocumentIsDisjointWith(other vocab.Type) bool {
return typedocument.DocumentIsDisjointWith(other)
}
// ActivityStreamsEndpointsIsDisjointWith returns true if Endpoints is disjoint
// with the other's type.
func ActivityStreamsEndpointsIsDisjointWith(other vocab.Type) bool {
return typeendpoints.EndpointsIsDisjointWith(other)
}
// ActivityStreamsEventIsDisjointWith returns true if Event is disjoint with the
// other's type.
func ActivityStreamsEventIsDisjointWith(other vocab.Type) bool {

View file

@ -18,6 +18,7 @@ import (
typedelete "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document"
typeendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints"
typeevent "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow"
@ -165,6 +166,13 @@ func ActivityStreamsDocumentIsExtendedBy(other vocab.Type) bool {
return typedocument.DocumentIsExtendedBy(other)
}
// ActivityStreamsEndpointsIsExtendedBy returns true if the other's type extends
// from Endpoints. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsEndpointsIsExtendedBy(other vocab.Type) bool {
return typeendpoints.EndpointsIsExtendedBy(other)
}
// ActivityStreamsEventIsExtendedBy returns true if the other's type extends from
// Event. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.

View file

@ -18,6 +18,7 @@ import (
typedelete "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document"
typeendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints"
typeevent "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow"
@ -150,6 +151,12 @@ func ActivityStreamsActivityStreamsDocumentExtends(other vocab.Type) bool {
return typedocument.ActivityStreamsDocumentExtends(other)
}
// ActivityStreamsActivityStreamsEndpointsExtends returns true if Endpoints
// extends from the other's type.
func ActivityStreamsActivityStreamsEndpointsExtends(other vocab.Type) bool {
return typeendpoints.ActivityStreamsEndpointsExtends(other)
}
// ActivityStreamsActivityStreamsEventExtends returns true if Event extends from
// the other's type.
func ActivityStreamsActivityStreamsEventExtends(other vocab.Type) bool {

View file

@ -18,6 +18,7 @@ import (
typedelete "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document"
typeendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints"
typeevent "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow"
@ -150,6 +151,12 @@ func IsOrExtendsActivityStreamsDocument(other vocab.Type) bool {
return typedocument.IsOrExtendsDocument(other)
}
// IsOrExtendsActivityStreamsEndpoints returns true if the other provided type is
// the Endpoints type or extends from the Endpoints type.
func IsOrExtendsActivityStreamsEndpoints(other vocab.Type) bool {
return typeendpoints.IsOrExtendsEndpoints(other)
}
// IsOrExtendsActivityStreamsEvent returns true if the other provided type is the
// Event type or extends from the Event type.
func IsOrExtendsActivityStreamsEvent(other vocab.Type) bool {

View file

@ -20,6 +20,7 @@ import (
propertydeleted "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_deleted"
propertydescribes "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_describes"
propertyduration "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_duration"
propertyendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endpoints"
propertyendtime "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endtime"
propertyfirst "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_first"
propertyfollowers "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_followers"
@ -61,6 +62,7 @@ import (
propertyreplies "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_replies"
propertyresult "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_result"
propertysensitive "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sensitive"
propertysharedinbox "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sharedinbox"
propertyshares "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_shares"
propertysource "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_source"
propertystartindex "github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_startindex"
@ -187,6 +189,12 @@ func NewActivityStreamsEndTimeProperty() vocab.ActivityStreamsEndTimeProperty {
return propertyendtime.NewActivityStreamsEndTimeProperty()
}
// NewActivityStreamsActivityStreamsEndpointsProperty creates a new
// ActivityStreamsEndpointsProperty
func NewActivityStreamsEndpointsProperty() vocab.ActivityStreamsEndpointsProperty {
return propertyendpoints.NewActivityStreamsEndpointsProperty()
}
// NewActivityStreamsActivityStreamsFirstProperty creates a new
// ActivityStreamsFirstProperty
func NewActivityStreamsFirstProperty() vocab.ActivityStreamsFirstProperty {
@ -427,6 +435,12 @@ func NewActivityStreamsSensitiveProperty() vocab.ActivityStreamsSensitivePropert
return propertysensitive.NewActivityStreamsSensitiveProperty()
}
// NewActivityStreamsActivityStreamsSharedInboxProperty creates a new
// ActivityStreamsSharedInboxProperty
func NewActivityStreamsSharedInboxProperty() vocab.ActivityStreamsSharedInboxProperty {
return propertysharedinbox.NewActivityStreamsSharedInboxProperty()
}
// NewActivityStreamsActivityStreamsSharesProperty creates a new
// ActivityStreamsSharesProperty
func NewActivityStreamsSharesProperty() vocab.ActivityStreamsSharesProperty {

View file

@ -18,6 +18,7 @@ import (
typedelete "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document"
typeendpoints "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints"
typeevent "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow"
@ -135,6 +136,11 @@ func NewActivityStreamsDocument() vocab.ActivityStreamsDocument {
return typedocument.NewActivityStreamsDocument()
}
// NewActivityStreamsEndpoints creates a new ActivityStreamsEndpoints
func NewActivityStreamsEndpoints() vocab.ActivityStreamsEndpoints {
return typeendpoints.NewActivityStreamsEndpoints()
}
// NewActivityStreamsEvent creates a new ActivityStreamsEvent
func NewActivityStreamsEvent() vocab.ActivityStreamsEvent {
return typeevent.NewActivityStreamsEvent()

View file

@ -100,6 +100,9 @@ func ToType(c context.Context, m map[string]interface{}) (t vocab.Type, err erro
}, func(ctx context.Context, i vocab.TootEmoji) error {
t = i
return nil
}, func(ctx context.Context, i vocab.ActivityStreamsEndpoints) error {
t = i
return nil
}, func(ctx context.Context, i vocab.ActivityStreamsEvent) error {
t = i
return nil

View file

@ -65,6 +65,8 @@ func NewTypePredicatedResolver(delegate Resolver, predicate interface{}) (*TypeP
// Do nothing, this predicate has a correct signature.
case func(context.Context, vocab.TootEmoji) (bool, error):
// Do nothing, this predicate has a correct signature.
case func(context.Context, vocab.ActivityStreamsEndpoints) (bool, error):
// Do nothing, this predicate has a correct signature.
case func(context.Context, vocab.ActivityStreamsEvent) (bool, error):
// Do nothing, this predicate has a correct signature.
case func(context.Context, vocab.ActivityStreamsFlag) (bool, error):
@ -372,6 +374,17 @@ func (this TypePredicatedResolver) Apply(ctx context.Context, o ActivityStreamsI
} else {
return false, ErrPredicateUnmatched
}
} else if o.VocabularyURI() == "https://www.w3.org/ns/activitystreams" && o.GetTypeName() == "Endpoints" {
if fn, ok := this.predicate.(func(context.Context, vocab.ActivityStreamsEndpoints) (bool, error)); ok {
if v, ok := o.(vocab.ActivityStreamsEndpoints); ok {
predicatePasses, err = fn(ctx, v)
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return false, errCannotTypeAssertType
}
} else {
return false, ErrPredicateUnmatched
}
} else if o.VocabularyURI() == "https://www.w3.org/ns/activitystreams" && o.GetTypeName() == "Event" {
if fn, ok := this.predicate.(func(context.Context, vocab.ActivityStreamsEvent) (bool, error)); ok {
if v, ok := o.(vocab.ActivityStreamsEvent); ok {

View file

@ -64,6 +64,8 @@ func NewTypeResolver(callbacks ...interface{}) (*TypeResolver, error) {
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.TootEmoji) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsEndpoints) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsEvent) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsFlag) error:
@ -331,6 +333,15 @@ func (this TypeResolver) Resolve(ctx context.Context, o ActivityStreamsInterface
return errCannotTypeAssertType
}
}
} else if o.VocabularyURI() == "https://www.w3.org/ns/activitystreams" && o.GetTypeName() == "Endpoints" {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsEndpoints) error); ok {
if v, ok := o.(vocab.ActivityStreamsEndpoints); ok {
return fn(ctx, v)
} else {
// This occurs when the value is either not a go-fed type and is improperly satisfying various interfaces, or there is a bug in the go-fed generated code.
return errCannotTypeAssertType
}
}
} else if o.VocabularyURI() == "https://www.w3.org/ns/activitystreams" && o.GetTypeName() == "Event" {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsEvent) error); ok {
if v, ok := o.(vocab.ActivityStreamsEvent); ok {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -0,0 +1,159 @@
// Code generated by astool. DO NOT EDIT.
package vocab
import "net/url"
// ActivityStreamsEndpointsPropertyIterator represents a single value for the
// "endpoints" property.
type ActivityStreamsEndpointsPropertyIterator interface {
// Get returns the value of this property. When IsActivityStreamsEndpoints
// returns false, Get will return any arbitrary value.
Get() ActivityStreamsEndpoints
// GetIRI returns the IRI of this property. When IsIRI returns false,
// GetIRI will return any arbitrary value.
GetIRI() *url.URL
// 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.
GetType() Type
// HasAny returns true if the value or IRI is set.
HasAny() bool
// IsActivityStreamsEndpoints returns true if this property is set and not
// an IRI.
IsActivityStreamsEndpoints() bool
// IsIRI returns true if this property is an IRI.
IsIRI() bool
// 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
// 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.
KindIndex() int
// 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.
LessThan(o ActivityStreamsEndpointsPropertyIterator) bool
// Name returns the name of this property: "ActivityStreamsEndpoints".
Name() string
// Next returns the next iterator, or nil if there is no next iterator.
Next() ActivityStreamsEndpointsPropertyIterator
// Prev returns the previous iterator, or nil if there is no previous
// iterator.
Prev() ActivityStreamsEndpointsPropertyIterator
// Set sets the value of this property. Calling IsActivityStreamsEndpoints
// afterwards will return true.
Set(v ActivityStreamsEndpoints)
// SetIRI sets the value of this property. Calling IsIRI afterwards will
// return true.
SetIRI(v *url.URL)
// 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.
SetType(t Type) error
}
// Endpoints for an ActivityStreams actor.
//
// null
type ActivityStreamsEndpointsProperty interface {
// AppendActivityStreamsEndpoints appends a Endpoints value to the back of
// a list of the property "endpoints". Invalidates iterators that are
// traversing using Prev.
AppendActivityStreamsEndpoints(v ActivityStreamsEndpoints)
// AppendIRI appends an IRI value to the back of a list of the property
// "endpoints"
AppendIRI(v *url.URL)
// PrependType prepends an arbitrary type value to the front of a list of
// the property "endpoints". Invalidates iterators that are traversing
// using Prev. Returns an error if the type is not a valid one to set
// for this property.
AppendType(t Type) error
// At returns the property value for the specified index. Panics if the
// index is out of bounds.
At(index int) ActivityStreamsEndpointsPropertyIterator
// 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.
Begin() ActivityStreamsEndpointsPropertyIterator
// Empty returns returns true if there are no elements.
Empty() bool
// 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.
End() ActivityStreamsEndpointsPropertyIterator
// InsertActivityStreamsEndpoints inserts a Endpoints value at the
// specified index for a property "endpoints". Existing elements at
// that index and higher are shifted back once. Invalidates all
// iterators.
InsertActivityStreamsEndpoints(idx int, v ActivityStreamsEndpoints)
// Insert inserts an IRI value at the specified index for a property
// "endpoints". Existing elements at that index and higher are shifted
// back once. Invalidates all iterators.
InsertIRI(idx int, v *url.URL)
// PrependType prepends an arbitrary type value to the front of a list of
// the property "endpoints". Invalidates all iterators. Returns an
// error if the type is not a valid one to set for this property.
InsertType(idx int, t Type) error
// 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
// 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.
KindIndex(idx int) int
// Len returns the number of values that exist for the "endpoints"
// property.
Len() (length int)
// Less computes whether another property is less than this one. Mixing
// types results in a consistent but arbitrary ordering
Less(i, j int) bool
// 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.
LessThan(o ActivityStreamsEndpointsProperty) bool
// Name returns the name of this property ("endpoints") with any alias.
Name() string
// PrependActivityStreamsEndpoints prepends a Endpoints value to the front
// of a list of the property "endpoints". Invalidates all iterators.
PrependActivityStreamsEndpoints(v ActivityStreamsEndpoints)
// PrependIRI prepends an IRI value to the front of a list of the property
// "endpoints".
PrependIRI(v *url.URL)
// PrependType prepends an arbitrary type value to the front of a list of
// the property "endpoints". Invalidates all iterators. Returns an
// error if the type is not a valid one to set for this property.
PrependType(t Type) error
// Remove deletes an element at the specified index from a list of the
// property "endpoints", regardless of its type. Panics if the index
// is out of bounds. Invalidates all iterators.
Remove(idx int)
// 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.
Serialize() (interface{}, error)
// Set sets a Endpoints value to be at the specified index for the
// property "endpoints". Panics if the index is out of bounds.
// Invalidates all iterators.
Set(idx int, v ActivityStreamsEndpoints)
// SetIRI sets an IRI value to be at the specified index for the property
// "endpoints". Panics if the index is out of bounds.
SetIRI(idx int, v *url.URL)
// SetType sets an arbitrary type value to the specified index of the
// property "endpoints". Invalidates all iterators. Returns an error
// if the type is not a valid one to set for this property. Panics if
// the index is out of bounds.
SetType(idx int, t Type) error
// Swap swaps the location of values at two indices for the "endpoints"
// property.
Swap(i, j int)
}

View file

@ -0,0 +1,56 @@
// Code generated by astool. DO NOT EDIT.
package vocab
import "net/url"
// An optional endpoint used for wide delivery of publicly addressed activities
// and activities sent to followers. sharedInbox endpoints SHOULD also be
// publicly readable OrderedCollection objects containing objects addressed to
// the Public special collection. Reading from the sharedInbox endpoint MUST
// NOT present objects which are not addressed to the Public endpoint.
type ActivityStreamsSharedInboxProperty interface {
// Clear ensures no value of this property is set. Calling
// IsXMLSchemaAnyURI afterwards will return false.
Clear()
// Get returns the value of this property. When IsXMLSchemaAnyURI returns
// false, Get will return any arbitrary value.
Get() *url.URL
// GetIRI returns the IRI of this property. When IsIRI returns false,
// GetIRI will return any arbitrary value.
GetIRI() *url.URL
// HasAny returns true if the value or IRI is set.
HasAny() bool
// IsIRI returns true if this property is an IRI.
IsIRI() bool
// IsXMLSchemaAnyURI returns true if this property is set and not an IRI.
IsXMLSchemaAnyURI() bool
// 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
// 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.
KindIndex() int
// 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.
LessThan(o ActivityStreamsSharedInboxProperty) bool
// Name returns the name of this property: "sharedInbox".
Name() string
// 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.
Serialize() (interface{}, error)
// Set sets the value of this property. Calling IsXMLSchemaAnyURI
// afterwards will return true.
Set(v *url.URL)
// SetIRI sets the value of this property. Calling IsIRI afterwards will
// return true.
SetIRI(v *url.URL)
}

View file

@ -43,6 +43,9 @@ type ActivityStreamsApplication interface {
// GetActivityStreamsEndTime returns the "endTime" property if it exists,
// and nil otherwise.
GetActivityStreamsEndTime() ActivityStreamsEndTimeProperty
// GetActivityStreamsEndpoints returns the "endpoints" property if it
// exists, and nil otherwise.
GetActivityStreamsEndpoints() ActivityStreamsEndpointsProperty
// GetActivityStreamsFollowers returns the "followers" property if it
// exists, and nil otherwise.
GetActivityStreamsFollowers() ActivityStreamsFollowersProperty
@ -199,6 +202,8 @@ type ActivityStreamsApplication interface {
SetActivityStreamsDuration(i ActivityStreamsDurationProperty)
// SetActivityStreamsEndTime sets the "endTime" property.
SetActivityStreamsEndTime(i ActivityStreamsEndTimeProperty)
// SetActivityStreamsEndpoints sets the "endpoints" property.
SetActivityStreamsEndpoints(i ActivityStreamsEndpointsProperty)
// SetActivityStreamsFollowers sets the "followers" property.
SetActivityStreamsFollowers(i ActivityStreamsFollowersProperty)
// SetActivityStreamsFollowing sets the "following" property.

View file

@ -0,0 +1,44 @@
// Code generated by astool. DO NOT EDIT.
package vocab
// A json object which maps additional (typically server/domain-wide) endpoints
// which may be useful either for this actor or someone referencing this
// actor. This mapping may be nested inside the actor document as the value or
// may be a link to a JSON-LD document with these properties.
type ActivityStreamsEndpoints interface {
// GetActivityStreamsSharedInbox returns the "sharedInbox" property if it
// exists, and nil otherwise.
GetActivityStreamsSharedInbox() ActivityStreamsSharedInboxProperty
// GetJSONLDId returns the "id" property if it exists, and nil otherwise.
GetJSONLDId() JSONLDIdProperty
// GetTypeName returns the name of this type.
GetTypeName() string
// GetUnknownProperties returns the unknown properties for the Endpoints
// type. Note that this should not be used by app developers. It is
// only used to help determine which implementation is LessThan the
// other. Developers who are creating a different implementation of
// this type's interface can use this method in their LessThan
// implementation, but routine ActivityPub applications should not use
// this to bypass the code generation tool.
GetUnknownProperties() map[string]interface{}
// IsExtending returns true if the Endpoints type extends from the other
// type.
IsExtending(other Type) bool
// 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.
JSONLDContext() map[string]string
// LessThan computes if this Endpoints is lesser, with an arbitrary but
// stable determination.
LessThan(o ActivityStreamsEndpoints) bool
// Serialize converts this into an interface representation suitable for
// marshalling into a text or binary format.
Serialize() (map[string]interface{}, error)
// SetActivityStreamsSharedInbox sets the "sharedInbox" property.
SetActivityStreamsSharedInbox(i ActivityStreamsSharedInboxProperty)
// SetJSONLDId sets the "id" property.
SetJSONLDId(i JSONLDIdProperty)
// VocabularyURI returns the vocabulary's URI as a string.
VocabularyURI() string
}

View file

@ -43,6 +43,9 @@ type ActivityStreamsGroup interface {
// GetActivityStreamsEndTime returns the "endTime" property if it exists,
// and nil otherwise.
GetActivityStreamsEndTime() ActivityStreamsEndTimeProperty
// GetActivityStreamsEndpoints returns the "endpoints" property if it
// exists, and nil otherwise.
GetActivityStreamsEndpoints() ActivityStreamsEndpointsProperty
// GetActivityStreamsFollowers returns the "followers" property if it
// exists, and nil otherwise.
GetActivityStreamsFollowers() ActivityStreamsFollowersProperty
@ -198,6 +201,8 @@ type ActivityStreamsGroup interface {
SetActivityStreamsDuration(i ActivityStreamsDurationProperty)
// SetActivityStreamsEndTime sets the "endTime" property.
SetActivityStreamsEndTime(i ActivityStreamsEndTimeProperty)
// SetActivityStreamsEndpoints sets the "endpoints" property.
SetActivityStreamsEndpoints(i ActivityStreamsEndpointsProperty)
// SetActivityStreamsFollowers sets the "followers" property.
SetActivityStreamsFollowers(i ActivityStreamsFollowersProperty)
// SetActivityStreamsFollowing sets the "following" property.

View file

@ -43,6 +43,9 @@ type ActivityStreamsOrganization interface {
// GetActivityStreamsEndTime returns the "endTime" property if it exists,
// and nil otherwise.
GetActivityStreamsEndTime() ActivityStreamsEndTimeProperty
// GetActivityStreamsEndpoints returns the "endpoints" property if it
// exists, and nil otherwise.
GetActivityStreamsEndpoints() ActivityStreamsEndpointsProperty
// GetActivityStreamsFollowers returns the "followers" property if it
// exists, and nil otherwise.
GetActivityStreamsFollowers() ActivityStreamsFollowersProperty
@ -199,6 +202,8 @@ type ActivityStreamsOrganization interface {
SetActivityStreamsDuration(i ActivityStreamsDurationProperty)
// SetActivityStreamsEndTime sets the "endTime" property.
SetActivityStreamsEndTime(i ActivityStreamsEndTimeProperty)
// SetActivityStreamsEndpoints sets the "endpoints" property.
SetActivityStreamsEndpoints(i ActivityStreamsEndpointsProperty)
// SetActivityStreamsFollowers sets the "followers" property.
SetActivityStreamsFollowers(i ActivityStreamsFollowersProperty)
// SetActivityStreamsFollowing sets the "following" property.

View file

@ -43,6 +43,9 @@ type ActivityStreamsPerson interface {
// GetActivityStreamsEndTime returns the "endTime" property if it exists,
// and nil otherwise.
GetActivityStreamsEndTime() ActivityStreamsEndTimeProperty
// GetActivityStreamsEndpoints returns the "endpoints" property if it
// exists, and nil otherwise.
GetActivityStreamsEndpoints() ActivityStreamsEndpointsProperty
// GetActivityStreamsFollowers returns the "followers" property if it
// exists, and nil otherwise.
GetActivityStreamsFollowers() ActivityStreamsFollowersProperty
@ -198,6 +201,8 @@ type ActivityStreamsPerson interface {
SetActivityStreamsDuration(i ActivityStreamsDurationProperty)
// SetActivityStreamsEndTime sets the "endTime" property.
SetActivityStreamsEndTime(i ActivityStreamsEndTimeProperty)
// SetActivityStreamsEndpoints sets the "endpoints" property.
SetActivityStreamsEndpoints(i ActivityStreamsEndpointsProperty)
// SetActivityStreamsFollowers sets the "followers" property.
SetActivityStreamsFollowers(i ActivityStreamsFollowersProperty)
// SetActivityStreamsFollowing sets the "following" property.

View file

@ -43,6 +43,9 @@ type ActivityStreamsService interface {
// GetActivityStreamsEndTime returns the "endTime" property if it exists,
// and nil otherwise.
GetActivityStreamsEndTime() ActivityStreamsEndTimeProperty
// GetActivityStreamsEndpoints returns the "endpoints" property if it
// exists, and nil otherwise.
GetActivityStreamsEndpoints() ActivityStreamsEndpointsProperty
// GetActivityStreamsFollowers returns the "followers" property if it
// exists, and nil otherwise.
GetActivityStreamsFollowers() ActivityStreamsFollowersProperty
@ -199,6 +202,8 @@ type ActivityStreamsService interface {
SetActivityStreamsDuration(i ActivityStreamsDurationProperty)
// SetActivityStreamsEndTime sets the "endTime" property.
SetActivityStreamsEndTime(i ActivityStreamsEndTimeProperty)
// SetActivityStreamsEndpoints sets the "endpoints" property.
SetActivityStreamsEndpoints(i ActivityStreamsEndpointsProperty)
// SetActivityStreamsFollowers sets the "followers" property.
SetActivityStreamsFollowers(i ActivityStreamsFollowersProperty)
// SetActivityStreamsFollowing sets the "following" property.

5
vendor/modules.txt vendored
View file

@ -354,7 +354,7 @@ github.com/stretchr/testify/suite
# github.com/subosito/gotenv v1.2.0
## explicit
github.com/subosito/gotenv
# github.com/superseriousbusiness/activity v1.1.0-gts
# github.com/superseriousbusiness/activity v1.2.1-gts
## explicit; go 1.18
github.com/superseriousbusiness/activity/pub
github.com/superseriousbusiness/activity/streams
@ -375,6 +375,7 @@ github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_c
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_deleted
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_describes
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_duration
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endpoints
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_endtime
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_first
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_followers
@ -416,6 +417,7 @@ github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_r
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_replies
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_result
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sensitive
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_sharedinbox
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_shares
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_source
github.com/superseriousbusiness/activity/streams/impl/activitystreams/property_startindex
@ -446,6 +448,7 @@ github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_creat
github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_delete
github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_dislike
github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_document
github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_endpoints
github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_event
github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_flag
github.com/superseriousbusiness/activity/streams/impl/activitystreams/type_follow