move to ssb gofed fork (#298)

This commit is contained in:
tobi 2021-11-13 17:29:43 +01:00 committed by GitHub
parent 829a934d23
commit 09ef9e639e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1191 changed files with 411640 additions and 407657 deletions

2
go.mod
View file

@ -10,7 +10,6 @@ require (
github.com/gin-contrib/cors v1.3.1 github.com/gin-contrib/cors v1.3.1
github.com/gin-contrib/sessions v0.0.3 github.com/gin-contrib/sessions v0.0.3
github.com/gin-gonic/gin v1.7.2-0.20210908033055-3a6f18f32f22 github.com/gin-gonic/gin v1.7.2-0.20210908033055-3a6f18f32f22
github.com/go-fed/activity v1.0.1-0.20210803212804-d866ba75dd0f
github.com/go-fed/httpsig v1.1.0 github.com/go-fed/httpsig v1.1.0
github.com/go-playground/validator/v10 v10.9.0 github.com/go-playground/validator/v10 v10.9.0
github.com/google/uuid v1.3.0 github.com/google/uuid v1.3.0
@ -25,6 +24,7 @@ require (
github.com/russross/blackfriday/v2 v2.1.0 github.com/russross/blackfriday/v2 v2.1.0
github.com/sirupsen/logrus v1.8.1 github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.7.0 github.com/stretchr/testify v1.7.0
github.com/superseriousbusiness/activity v1.0.1-0.20211113133524-56560b73ace8
github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203 github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB
github.com/tdewolff/minify/v2 v2.9.21 github.com/tdewolff/minify/v2 v2.9.21

4
go.sum
View file

@ -151,8 +151,6 @@ github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWE
github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs= github.com/go-errors/errors v1.1.1/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
github.com/go-errors/errors v1.4.0 h1:2OA7MFw38+e9na72T1xgkomPb6GzZzzxvJ5U630FoRM= github.com/go-errors/errors v1.4.0 h1:2OA7MFw38+e9na72T1xgkomPb6GzZzzxvJ5U630FoRM=
github.com/go-errors/errors v1.4.0/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= github.com/go-errors/errors v1.4.0/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
github.com/go-fed/activity v1.0.1-0.20210803212804-d866ba75dd0f h1:etNMc6V75EEoPVbFxXjMb7r6bmIoodXN4McXuPuljLY=
github.com/go-fed/activity v1.0.1-0.20210803212804-d866ba75dd0f/go.mod h1:v4QoPaAzjWZ8zN2VFVGL5ep9C02mst0hQYHUpQwso4Q=
github.com/go-fed/httpsig v0.1.1-0.20190914113940-c2de3672e5b5/go.mod h1:T56HUNYZUQ1AGUzhAYPugZfp36sKApVnGBgKlIY+aIE= github.com/go-fed/httpsig v0.1.1-0.20190914113940-c2de3672e5b5/go.mod h1:T56HUNYZUQ1AGUzhAYPugZfp36sKApVnGBgKlIY+aIE=
github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI= github.com/go-fed/httpsig v1.1.0 h1:9M+hb0jkEICD8/cAiNqEB66R87tTINszBRTjwjQzWcI=
github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM= github.com/go-fed/httpsig v1.1.0/go.mod h1:RCMrTZvN1bJYtofsG4rd5NaO5obxQ5xBkdiS7xsT7bM=
@ -445,6 +443,8 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/superseriousbusiness/activity v1.0.1-0.20211113133524-56560b73ace8 h1:8Bwy6CSsT33/sF5FhjND4vr7jiJCaq4elNTAW4rUzVc=
github.com/superseriousbusiness/activity v1.0.1-0.20211113133524-56560b73ace8/go.mod h1:ZY9xwFDucvp6zTvM6FQZGl8PSOofPBFIAy6gSc85XkY=
github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203 h1:1SWXcTphBQjYGWRRxLFIAR1LVtQEj4eR7xPtyeOVM/c= github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203 h1:1SWXcTphBQjYGWRRxLFIAR1LVtQEj4eR7xPtyeOVM/c=
github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203/go.mod h1:0Xw5cYMOYpgaWs+OOSx41ugycl2qvKTi9tlMMcZhFyY= github.com/superseriousbusiness/exifremove v0.0.0-20210330092427-6acd27eac203/go.mod h1:0Xw5cYMOYpgaWs+OOSx41ugycl2qvKTi9tlMMcZhFyY=
github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB h1:PtW2w6budTvRV2J5QAoSvThTHBuvh8t/+BXIZFAaBSc= github.com/superseriousbusiness/oauth2/v4 v4.3.2-SSB h1:PtW2w6budTvRV2J5QAoSvThTHBuvh8t/+BXIZFAaBSc=

View file

@ -31,7 +31,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/util"
) )
@ -671,3 +671,21 @@ func isFollowers(uris []*url.URL, followersURI string) bool {
} }
return false return false
} }
// ExtractSensitive extracts whether or not an item is 'sensitive'.
// If no sensitive property is set on the item at all, or if this property
// isn't a boolean, then false will be returned by default.
func ExtractSensitive(withSensitive WithSensitive) bool {
sensitiveProp := withSensitive.GetActivityStreamsSensitive()
if sensitiveProp == nil {
return false
}
for iter := sensitiveProp.Begin(); iter != sensitiveProp.End(); iter = iter.Next() {
if iter.IsXMLSchemaBoolean() {
return iter.Get()
}
}
return false
}

View file

@ -22,10 +22,10 @@ import (
"context" "context"
"encoding/json" "encoding/json"
"github.com/go-fed/activity/pub"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/testrig" "github.com/superseriousbusiness/gotosocial/testrig"
) )
@ -49,6 +49,10 @@ func document1() vocab.ActivityStreamsDocument {
dBlurhash.Set("UxQ0EkRP_4tRxtRjWBt7%hozM_ayV@oLf6WB") dBlurhash.Set("UxQ0EkRP_4tRxtRjWBt7%hozM_ayV@oLf6WB")
d.SetTootBlurhash(dBlurhash) d.SetTootBlurhash(dBlurhash)
dSensitive := streams.NewActivityStreamsSensitiveProperty()
dSensitive.AppendXMLSchemaBoolean(true)
d.SetActivityStreamsSensitive(dSensitive)
return d return d
} }

View file

@ -21,8 +21,8 @@ package ap_test
import ( import (
"testing" "testing"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
) )

View file

@ -0,0 +1,42 @@
/*
GoToSocial
Copyright (C) 2021 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 ap_test
import (
"testing"
"github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/gotosocial/internal/ap"
)
type ExtractSensitiveTestSuite struct {
ExtractTestSuite
}
func (suite *ExtractMentionsTestSuite) TestExtractSensitive() {
d := suite.document1
suite.True(ap.ExtractSensitive(d))
n := suite.noteWithMentions1
suite.False(ap.ExtractSensitive(n))
}
func TestExtractSensitiveTestSuite(t *testing.T) {
suite.Run(t, &ExtractSensitiveTestSuite{})
}

View file

@ -18,7 +18,7 @@
package ap package ap
import "github.com/go-fed/activity/streams/vocab" import "github.com/superseriousbusiness/activity/streams/vocab"
// Accountable represents the minimum activitypub interface for representing an 'account'. // Accountable represents the minimum activitypub interface for representing an 'account'.
// This interface is fulfilled by: Person, Application, Organization, Service, and Group // This interface is fulfilled by: Person, Application, Organization, Service, and Group
@ -249,9 +249,9 @@ type WithCC interface {
GetActivityStreamsCc() vocab.ActivityStreamsCcProperty GetActivityStreamsCc() vocab.ActivityStreamsCcProperty
} }
// WithSensitive ... // WithSensitive represents an activity with ActivityStreamsSensitiveProperty
type WithSensitive interface { type WithSensitive interface {
// TODO GetActivityStreamsSensitive() vocab.ActivityStreamsSensitiveProperty
} }
// WithConversation ... // WithConversation ...

View file

@ -29,9 +29,9 @@ import (
"time" "time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-fed/activity/pub"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/api/s2s/user" "github.com/superseriousbusiness/gotosocial/internal/api/s2s/user"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -27,9 +27,9 @@ import (
"testing" "testing"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/api/s2s/user" "github.com/superseriousbusiness/gotosocial/internal/api/s2s/user"
"github.com/superseriousbusiness/gotosocial/testrig" "github.com/superseriousbusiness/gotosocial/testrig"
) )

View file

@ -28,10 +28,10 @@ import (
"testing" "testing"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/api/s2s/user" "github.com/superseriousbusiness/gotosocial/internal/api/s2s/user"
"github.com/superseriousbusiness/gotosocial/testrig" "github.com/superseriousbusiness/gotosocial/testrig"
) )

View file

@ -27,10 +27,10 @@ import (
"testing" "testing"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/api/s2s/user" "github.com/superseriousbusiness/gotosocial/internal/api/s2s/user"
"github.com/superseriousbusiness/gotosocial/testrig" "github.com/superseriousbusiness/gotosocial/testrig"
) )

View file

@ -25,14 +25,15 @@ import (
"encoding/pem" "encoding/pem"
"errors" "errors"
"fmt" "fmt"
"github.com/sirupsen/logrus"
"net/url" "net/url"
"strings" "strings"
"github.com/go-fed/activity/pub" "github.com/sirupsen/logrus"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/go-fed/httpsig" "github.com/go-fed/httpsig"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/util"

View file

@ -21,7 +21,7 @@ package federation
import ( import (
"time" "time"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
) )
/* /*

View file

@ -22,8 +22,8 @@ import (
"context" "context"
"net/http" "net/http"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
) )
/* /*

View file

@ -26,9 +26,9 @@ import (
"net/url" "net/url"
"strings" "strings"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/id"

View file

@ -25,8 +25,8 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
) )

View file

@ -25,10 +25,10 @@ import (
"net/http" "net/http"
"codeberg.org/gruf/go-store/kv" "codeberg.org/gruf/go-store/kv"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation/dereferencing" "github.com/superseriousbusiness/gotosocial/internal/federation/dereferencing"

View file

@ -26,9 +26,9 @@ import (
"net/url" "net/url"
"strings" "strings"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/id"

View file

@ -23,8 +23,8 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
) )
// federatingActor implements the go-fed federating protocol interface // federatingActor implements the go-fed federating protocol interface

View file

@ -23,8 +23,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -22,8 +22,8 @@ import (
"context" "context"
"fmt" "fmt"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/messages"
) )

View file

@ -24,8 +24,8 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -23,8 +23,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/typeutils" "github.com/superseriousbusiness/gotosocial/internal/typeutils"

View file

@ -5,8 +5,8 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
) )

View file

@ -23,8 +23,8 @@ import (
"encoding/json" "encoding/json"
"testing" "testing"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/testrig" "github.com/superseriousbusiness/gotosocial/testrig"
) )

View file

@ -5,8 +5,8 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
) )

View file

@ -23,8 +23,8 @@ import (
"encoding/json" "encoding/json"
"testing" "testing"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/testrig" "github.com/superseriousbusiness/gotosocial/testrig"
) )

View file

@ -23,8 +23,8 @@ import (
"errors" "errors"
"net/url" "net/url"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/util"
) )

View file

@ -22,8 +22,9 @@ import (
"context" "context"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/db"
) )
// InboxContains returns true if the OrderedCollection at 'inbox' // InboxContains returns true if the OrderedCollection at 'inbox'
@ -56,3 +57,25 @@ func (f *federatingDB) GetInbox(c context.Context, inboxIRI *url.URL) (inbox voc
func (f *federatingDB) SetInbox(c context.Context, inbox vocab.ActivityStreamsOrderedCollectionPage) error { func (f *federatingDB) SetInbox(c context.Context, inbox vocab.ActivityStreamsOrderedCollectionPage) error {
return nil return nil
} }
// InboxForActor fetches the inbox corresponding to the given actorIRI.
//
// It is acceptable to just return nil for the inboxIRI. In this case, the library will
// attempt to resolve the inbox of the actor by remote dereferencing instead.
//
// The library makes this call only after acquiring a lock first.
func (f *federatingDB) InboxForActor(c context.Context, actorIRI *url.URL) (inboxIRI *url.URL, err error) {
account, err := f.db.GetAccountByURI(c, actorIRI.String())
if err != nil {
// if there are just no entries for this account yet it's fine, return nil
// and go-fed will try to dereference it instead
if err == db.ErrNoEntries {
return nil, nil
}
// there's been an actual error...
return nil, err
}
// we got it!
return url.Parse(account.InboxURI)
}

View file

@ -22,8 +22,8 @@ import (
"context" "context"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
) )
// Liked obtains the Liked Collection for an actor with the // Liked obtains the Liked Collection for an actor with the

View file

@ -22,8 +22,8 @@ import (
"context" "context"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
) )
// GetOutbox returns the first ordered collection page of the outbox // GetOutbox returns the first ordered collection page of the outbox

View file

@ -23,8 +23,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -22,8 +22,8 @@ import (
"testing" "testing"
"time" "time"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/messages"

View file

@ -23,8 +23,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -23,8 +23,8 @@ import (
"errors" "errors"
"fmt" "fmt"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/messages" "github.com/superseriousbusiness/gotosocial/internal/messages"

View file

@ -25,9 +25,9 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -25,10 +25,10 @@ import (
"net/http" "net/http"
"net/url" "net/url"
"github.com/go-fed/activity/pub"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/sirupsen/logrus" "github.com/sirupsen/logrus"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/util"

View file

@ -22,7 +22,7 @@ import (
"context" "context"
"net/url" "net/url"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"

View file

@ -25,10 +25,10 @@ import (
"testing" "testing"
"codeberg.org/gruf/go-store/kv" "codeberg.org/gruf/go-store/kv"
"github.com/go-fed/activity/pub"
"github.com/go-fed/httpsig" "github.com/go-fed/httpsig"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"

View file

@ -23,7 +23,7 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/util"
) )

View file

@ -20,8 +20,8 @@ package account_test
import ( import (
"codeberg.org/gruf/go-store/kv" "codeberg.org/gruf/go-store/kv"
"github.com/go-fed/activity/pub"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email" "github.com/superseriousbusiness/gotosocial/internal/email"

View file

@ -24,7 +24,7 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
) )

View file

@ -24,7 +24,7 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
) )

View file

@ -24,7 +24,7 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
) )

View file

@ -24,7 +24,7 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -24,7 +24,7 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -24,8 +24,8 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/util" "github.com/superseriousbusiness/gotosocial/internal/util"
) )

View file

@ -24,7 +24,7 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -27,8 +27,8 @@ import (
"net/http" "net/http"
"codeberg.org/gruf/go-store/kv" "codeberg.org/gruf/go-store/kv"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/email" "github.com/superseriousbusiness/gotosocial/internal/email"

View file

@ -24,8 +24,8 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/go-fed/activity/pub"
"github.com/go-fed/httpsig" "github.com/go-fed/httpsig"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
) )

View file

@ -24,8 +24,8 @@ import (
"net/url" "net/url"
"sync" "sync"
"github.com/go-fed/activity/pub"
"github.com/go-fed/httpsig" "github.com/go-fed/httpsig"
"github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
) )

View file

@ -294,7 +294,7 @@ func (c *converter) ASStatusToStatus(ctx context.Context, statusable ap.Statusab
status.Likeable = true status.Likeable = true
// sensitive // sensitive
// TODO: this is a bool status.Sensitive = ap.ExtractSensitive(statusable)
// language // language
// we might be able to extract this from the contentMap field // we might be able to extract this from the contentMap field

View file

@ -24,10 +24,10 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
) )

View file

@ -22,7 +22,7 @@ import (
"context" "context"
"net/url" "net/url"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/api/model" "github.com/superseriousbusiness/gotosocial/internal/api/model"
"github.com/superseriousbusiness/gotosocial/internal/cache" "github.com/superseriousbusiness/gotosocial/internal/cache"

View file

@ -19,8 +19,8 @@
package typeutils_test package typeutils_test
import ( import (
"github.com/go-fed/activity/streams/vocab"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/config"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"

View file

@ -25,9 +25,9 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/gtserror" "github.com/superseriousbusiness/gotosocial/internal/gtserror"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
) )
@ -537,6 +537,11 @@ func (c *converter) StatusToAS(ctx context.Context, s *gtsmodel.Status) (vocab.A
repliesProp.SetActivityStreamsCollection(repliesCollection) repliesProp.SetActivityStreamsCollection(repliesCollection)
status.SetActivityStreamsReplies(repliesProp) status.SetActivityStreamsReplies(repliesProp)
// sensitive
sensitiveProp := streams.NewActivityStreamsSensitiveProperty()
sensitiveProp.AppendXMLSchemaBoolean(s.Sensitive)
status.SetActivityStreamsSensitive(sensitiveProp)
// put the note in our cache in case we need it again soon // put the note in our cache in case we need it again soon
if err := c.asCache.Store(s.ID, status); err != nil { if err := c.asCache.Store(s.ID, status); err != nil {
return nil, err return nil, err

View file

@ -24,9 +24,9 @@ import (
"fmt" "fmt"
"testing" "testing"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
) )
type InternalToASTestSuite struct { type InternalToASTestSuite struct {
@ -75,6 +75,39 @@ func (suite *InternalToASTestSuite) TestOutboxToASCollection() {
suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","first":"http://localhost:8080/users/admin/outbox?page=true","id":"http://localhost:8080/users/admin/outbox","type":"OrderedCollection"}`, string(bytes)) suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","first":"http://localhost:8080/users/admin/outbox?page=true","id":"http://localhost:8080/users/admin/outbox","type":"OrderedCollection"}`, string(bytes))
} }
func (suite *InternalToASTestSuite) TestStatusToAS() {
testStatus := suite.testStatuses["local_account_1_status_1"]
ctx := context.Background()
asStatus, err := suite.typeconverter.StatusToAS(ctx, testStatus)
suite.NoError(err)
ser, err := streams.Serialize(asStatus)
assert.NoError(suite.T(), err)
bytes, err := json.Marshal(ser)
suite.NoError(err)
suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","attachment":[],"attributedTo":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","content":"hello everyone!","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY","published":"2021-10-20T12:40:37+02:00","replies":{"first":{"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?page=true","next":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?only_other_accounts=false\u0026page=true","partOf":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"CollectionPage"},"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"Collection"},"sensitive":true,"summary":"introduction post","tag":[],"to":"https://www.w3.org/ns/activitystreams#Public","type":"Note","url":"http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY"}`, string(bytes))
}
func (suite *InternalToASTestSuite) TestStatusToASNotSensitive() {
testStatus := suite.testStatuses["admin_account_status_1"]
ctx := context.Background()
asStatus, err := suite.typeconverter.StatusToAS(ctx, testStatus)
suite.NoError(err)
ser, err := streams.Serialize(asStatus)
assert.NoError(suite.T(), err)
bytes, err := json.Marshal(ser)
suite.NoError(err)
suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","attachment":[],"attributedTo":"http://localhost:8080/users/admin","cc":"http://localhost:8080/users/admin/followers","content":"hello world! #welcome ! first post on the instance :rainbow: !","id":"http://localhost:8080/users/admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R","published":"2021-10-20T11:36:45Z","replies":{"first":{"id":"http://localhost:8080/users/admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R/replies?page=true","next":"http://localhost:8080/users/admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R/replies?only_other_accounts=false\u0026page=true","partOf":"http://localhost:8080/users/admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R/replies","type":"CollectionPage"},"id":"http://localhost:8080/users/admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R/replies","type":"Collection"},"sensitive":false,"summary":"","tag":[],"to":"https://www.w3.org/ns/activitystreams#Public","type":"Note","url":"http://localhost:8080/@admin/statuses/01F8MH75CBF9JFX4ZAD54N0W0R"}`, string(bytes))
}
func (suite *InternalToASTestSuite) TestStatusesToASOutboxPage() { func (suite *InternalToASTestSuite) TestStatusesToASOutboxPage() {
testAccount := suite.testAccounts["admin_account"] testAccount := suite.testAccounts["admin_account"]
ctx := context.Background() ctx := context.Background()

View file

@ -4,9 +4,9 @@ import (
"fmt" "fmt"
"net/url" "net/url"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
"github.com/superseriousbusiness/gotosocial/internal/id" "github.com/superseriousbusiness/gotosocial/internal/id"

View file

@ -23,8 +23,8 @@ import (
"encoding/json" "encoding/json"
"testing" "testing"
"github.com/go-fed/activity/streams"
"github.com/stretchr/testify/suite" "github.com/stretchr/testify/suite"
"github.com/superseriousbusiness/activity/streams"
) )
type WrapTestSuite struct { type WrapTestSuite struct {
@ -66,7 +66,7 @@ func (suite *WrapTestSuite) TestWrapNoteInCreate() {
bytes, err := json.Marshal(createI) bytes, err := json.Marshal(createI)
suite.NoError(err) suite.NoError(err)
suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","actor":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity","object":{"attachment":[],"attributedTo":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","content":"hello everyone!","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY","published":"2021-10-20T12:40:37+02:00","replies":{"first":{"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?page=true","next":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?only_other_accounts=false\u0026page=true","partOf":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"CollectionPage"},"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"Collection"},"summary":"introduction post","tag":[],"to":"https://www.w3.org/ns/activitystreams#Public","type":"Note","url":"http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY"},"published":"2021-10-20T12:40:37+02:00","to":"https://www.w3.org/ns/activitystreams#Public","type":"Create"}`, string(bytes)) suite.Equal(`{"@context":"https://www.w3.org/ns/activitystreams","actor":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/activity","object":{"attachment":[],"attributedTo":"http://localhost:8080/users/the_mighty_zork","cc":"http://localhost:8080/users/the_mighty_zork/followers","content":"hello everyone!","id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY","published":"2021-10-20T12:40:37+02:00","replies":{"first":{"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?page=true","next":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies?only_other_accounts=false\u0026page=true","partOf":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"CollectionPage"},"id":"http://localhost:8080/users/the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY/replies","type":"Collection"},"sensitive":true,"summary":"introduction post","tag":[],"to":"https://www.w3.org/ns/activitystreams#Public","type":"Note","url":"http://localhost:8080/@the_mighty_zork/statuses/01F8MHAMCHF6Y650WCRSCP4WMY"},"published":"2021-10-20T12:40:37+02:00","to":"https://www.w3.org/ns/activitystreams#Public","type":"Create"}`, string(bytes))
} }
func TestWrapTestSuite(t *testing.T) { func TestWrapTestSuite(t *testing.T) {

View file

@ -36,9 +36,9 @@ import (
"os" "os"
"time" "time"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/go-fed/activity/streams" "github.com/superseriousbusiness/activity/streams"
"github.com/go-fed/activity/streams/vocab" "github.com/superseriousbusiness/activity/streams/vocab"
"github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/ap"
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
) )

View file

@ -23,7 +23,7 @@ import (
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"github.com/go-fed/activity/pub" "github.com/superseriousbusiness/activity/pub"
"github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/db"
"github.com/superseriousbusiness/gotosocial/internal/federation" "github.com/superseriousbusiness/gotosocial/internal/federation"
"github.com/superseriousbusiness/gotosocial/internal/transport" "github.com/superseriousbusiness/gotosocial/internal/transport"

View file

@ -1,270 +0,0 @@
# pub
Implements the Social and Federating Protocols in the ActivityPub specification.
## Reference & Tutorial
The [go-fed website](https://go-fed.org/) contains tutorials and reference
materials, in addition to the rest of this README.
## How To Use
```
go get github.com/go-fed/activity
```
The root of all ActivityPub behavior is the `Actor`, which requires you to
implement a few interfaces:
```golang
import (
"github.com/go-fed/activity/pub"
)
type myActivityPubApp struct { /* ... */ }
type myAppsDatabase struct { /* ... */ }
type myAppsClock struct { /* ... */ }
var (
// Your app will implement pub.CommonBehavior, and either
// pub.SocialProtocol, pub.FederatingProtocol, or both.
myApp = &myActivityPubApp{}
myCommonBehavior pub.CommonBehavior = myApp
mySocialProtocol pub.SocialProtocol = myApp
myFederatingProtocol pub.FederatingProtocol = myApp
// Your app's database implementation.
myDatabase pub.Database = &myAppsDatabase{}
// Your app's clock.
myClock pub.Clock = &myAppsClock{}
)
// Only support the C2S Social protocol
actor := pub.NewSocialActor(
myCommonBehavior,
mySocialProtocol,
myDatabase,
myClock)
// OR
//
// Only support S2S Federating protocol
actor = pub.NewFederatingActor(
myCommonBehavior,
myFederatingProtocol,
myDatabase,
myClock)
// OR
//
// Support both C2S Social and S2S Federating protocol.
actor = pub.NewActor(
myCommonBehavior,
mySocialProtocol,
myFederatingProtocol,
myDatabase,
myClock)
```
Next, hook the `Actor` into your web server:
```golang
// The application's actor
var actor pub.Actor
var outboxHandler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
c := context.Background()
// Populate c with request-specific information
if handled, err := actor.PostOutbox(c, w, r); err != nil {
// Write to w
return
} else if handled {
return
} else if handled, err = actor.GetOutbox(c, w, r); err != nil {
// Write to w
return
} else if handled {
return
}
// else:
//
// Handle non-ActivityPub request, such as serving a webpage.
}
var inboxHandler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
c := context.Background()
// Populate c with request-specific information
if handled, err := actor.PostInbox(c, w, r); err != nil {
// Write to w
return
} else if handled {
return
} else if handled, err = actor.GetInbox(c, w, r); err != nil {
// Write to w
return
} else if handled {
return
}
// else:
//
// Handle non-ActivityPub request, such as serving a webpage.
}
// Add the handlers to a HTTP server
serveMux := http.NewServeMux()
serveMux.HandleFunc("/actor/outbox", outboxHandler)
serveMux.HandleFunc("/actor/inbox", inboxHandler)
var server http.Server
server.Handler = serveMux
```
To serve ActivityStreams data:
```golang
myHander := pub.NewActivityStreamsHandler(myDatabase, myClock)
var activityStreamsHandler http.HandlerFunc = func(w http.ResponseWriter, r *http.Request) {
c := context.Background()
// Populate c with request-specific information
if handled, err := myHandler(c, w, r); err != nil {
// Write to w
return
} else if handled {
return
}
// else:
//
// Handle non-ActivityPub request, such as serving a webpage.
}
serveMux.HandleFunc("/some/data/like/a/note", activityStreamsHandler)
```
### Dependency Injection
Package `pub` relies on dependency injection to provide out-of-the-box support
for ActivityPub. The interfaces to be satisfied are:
* `CommonBehavior` - Behavior needed regardless of which Protocol is used.
* `SocialProtocol` - Behavior needed for the Social Protocol.
* `FederatingProtocol` - Behavior needed for the Federating Protocol.
* `Database` - The data store abstraction, not tied to the `database/sql`
package.
* `Clock` - The server's internal clock.
* `Transport` - Responsible for the network that serves requests and deliveries
of ActivityStreams data. A `HttpSigTransport` type is provided.
These implementations form the core of an application's behavior without
worrying about the particulars and pitfalls of the ActivityPub protocol.
Implementing these interfaces gives you greater assurance about being
ActivityPub compliant.
### Application Logic
The `SocialProtocol` and `FederatingProtocol` are responsible for returning
callback functions compatible with `streams.TypeResolver`. They also return
`SocialWrappedCallbacks` and `FederatingWrappedCallbacks`, which are nothing
more than a bundle of default behaviors for types like `Create`, `Update`, and
so on.
Applications will want to focus on implementing their specific behaviors in the
callbacks, and have fine-grained control over customization:
```golang
// Implements the FederatingProtocol interface.
//
// This illustration can also be applied for the Social Protocol.
func (m *myAppsFederatingProtocol) Callbacks(c context.Context) (wrapped pub.FederatingWrappedCallbacks, other []interface{}) {
// The context 'c' has request-specific logic and can be used to apply complex
// logic building the right behaviors, if desired.
//
// 'c' will later be passed through to the callbacks created below.
wrapped = pub.FederatingWrappedCallbacks{
Create: func(ctx context.Context, create vocab.ActivityStreamsCreate) error {
// This function is wrapped by default behavior.
//
// More application specific logic can be written here.
//
// 'ctx' will have request-specific information from the HTTP handler. It
// is the same as the 'c' passed to the Callbacks method.
// 'create' has, at this point, already triggered the recommended
// ActivityPub side effect behavior. The application can process it
// further as needed.
return nil
},
}
// The 'other' must contain functions that satisfy the signature pattern
// required by streams.JSONResolver.
//
// If they are not, at runtime errors will be returned to indicate this.
other = []interface{}{
// The FederatingWrappedCallbacks has default behavior for an "Update" type,
// but since we are providing this behavior in "other" and not in the
// FederatingWrappedCallbacks.Update member, we will entirely replace the
// default behavior provided by go-fed. Be careful that this still
// implements ActivityPub properly.
func(ctx context.Context, update vocab.ActivityStreamsUpdate) error {
// This function is NOT wrapped by default behavior.
//
// Application specific logic can be written here.
//
// 'ctx' will have request-specific information from the HTTP handler. It
// is the same as the 'c' passed to the Callbacks method.
// 'update' will NOT trigger the recommended ActivityPub side effect
// behavior. The application should do so in addition to any other custom
// side effects required.
return nil
},
// The "Listen" type has no default suggested behavior in ActivityPub, so
// this just makes this application able to handle "Listen" activities.
func(ctx context.Context, listen vocab.ActivityStreamsListen) error {
// This function is NOT wrapped by default behavior. There's not a
// FederatingWrappedCallbacks.Listen member to wrap.
//
// Application specific logic can be written here.
//
// 'ctx' will have request-specific information from the HTTP handler. It
// is the same as the 'c' passed to the Callbacks method.
// 'listen' can be processed with side effects as the application needs.
return nil
},
}
return
}
```
The `pub` package supports applications that grow into more custom solutions by
overriding the default behaviors as needed.
### ActivityStreams Extensions: Future-Proofing An Application
Package `pub` relies on the `streams.TypeResolver` and `streams.JSONResolver`
code generated types. As new ActivityStreams extensions are developed and their
code is generated, `pub` will automatically pick up support for these
extensions.
The steps to rapidly implement a new extension in a `pub` application are:
1. Generate an OWL definition of the ActivityStreams extension. This definition
could be the same one defining the vocabulary at the `@context` IRI.
2. Run `astool` to autogenerate the golang types in the `streams` package.
3. Implement the application's callbacks in the `FederatingProtocol.Callbacks`
or `SocialProtocol.Callbacks` for the new behaviors needed.
4. Build the application, which builds `pub`, with the newly generated `streams`
code. No code changes in `pub` are required.
Whether an author of an ActivityStreams extension or an application developer,
these quick steps should reduce the barrier to adopion in a statically-typed
environment.
### DelegateActor
For those that need a near-complete custom ActivityPub solution, or want to have
that possibility in the future after adopting go-fed, the `DelegateActor`
interface can be used to obtain an `Actor`:
```golang
// Use custom ActivityPub implementation
actor = pub.NewCustomActor(
myDelegateActor,
isSocialProtocolEnabled,
isFederatedProtocolEnabled,
myAppsClock)
```
It does not guarantee that an implementation adheres to the ActivityPub
specification. It acts as a stepping stone for applications that want to build
up to a fully custom solution and not be locked into the `pub` package
implementation.

View file

@ -1,49 +0,0 @@
package pub
import (
"github.com/go-fed/activity/streams/vocab"
)
// Activity represents any ActivityStreams Activity type.
//
// The Activity types provided in the streams package implement this.
type Activity interface {
// Activity is also a vocab.Type
vocab.Type
// GetActivityStreamsActor returns the "actor" property if it exists, and
// nil otherwise.
GetActivityStreamsActor() vocab.ActivityStreamsActorProperty
// GetActivityStreamsAudience returns the "audience" property if it
// exists, and nil otherwise.
GetActivityStreamsAudience() vocab.ActivityStreamsAudienceProperty
// GetActivityStreamsBcc returns the "bcc" property if it exists, and nil
// otherwise.
GetActivityStreamsBcc() vocab.ActivityStreamsBccProperty
// GetActivityStreamsBto returns the "bto" property if it exists, and nil
// otherwise.
GetActivityStreamsBto() vocab.ActivityStreamsBtoProperty
// GetActivityStreamsCc returns the "cc" property if it exists, and nil
// otherwise.
GetActivityStreamsCc() vocab.ActivityStreamsCcProperty
// GetActivityStreamsTo returns the "to" property if it exists, and nil
// otherwise.
GetActivityStreamsTo() vocab.ActivityStreamsToProperty
// GetActivityStreamsAttributedTo returns the "attributedTo" property if
// it exists, and nil otherwise.
GetActivityStreamsAttributedTo() vocab.ActivityStreamsAttributedToProperty
// GetActivityStreamsObject returns the "object" property if it exists,
// and nil otherwise.
GetActivityStreamsObject() vocab.ActivityStreamsObjectProperty
// SetActivityStreamsActor sets the "actor" property.
SetActivityStreamsActor(i vocab.ActivityStreamsActorProperty)
// SetActivityStreamsObject sets the "object" property.
SetActivityStreamsObject(i vocab.ActivityStreamsObjectProperty)
// SetActivityStreamsTo sets the "to" property.
SetActivityStreamsTo(i vocab.ActivityStreamsToProperty)
// SetActivityStreamsBto sets the "bto" property.
SetActivityStreamsBto(i vocab.ActivityStreamsBtoProperty)
// SetActivityStreamsBcc sets the "bcc" property.
SetActivityStreamsBcc(i vocab.ActivityStreamsBccProperty)
// SetActivityStreamsAttributedTo sets the "attributedTo" property.
SetActivityStreamsAttributedTo(i vocab.ActivityStreamsAttributedToProperty)
}

View file

@ -1,127 +0,0 @@
package pub
import (
"context"
"github.com/go-fed/activity/streams/vocab"
"net/http"
"net/url"
)
// Actor represents ActivityPub's actor concept. It conceptually has an inbox
// and outbox that receives either a POST or GET request, which triggers side
// effects in the federating application.
//
// An Actor within an application may federate server-to-server (Federation
// Protocol), client-to-server (Social API), or both. The Actor represents the
// server in either use case.
//
// An actor can be created by calling NewSocialActor (only the Social Protocol
// is supported), NewFederatingActor (only the Federating Protocol is
// supported), NewActor (both are supported), or NewCustomActor (neither are).
//
// Not all Actors have the same behaviors depending on the constructor used to
// create them. Refer to the constructor's documentation to determine the exact
// behavior of the Actor on an application.
//
// The behaviors documented here are common to all Actors returned by any
// constructor.
type Actor interface {
// PostInbox returns true if the request was handled as an ActivityPub
// POST to an actor's inbox. If false, the request was not an
// ActivityPub request and may still be handled by the caller in
// another way, such as serving a web page.
//
// If the error is nil, then the ResponseWriter's headers and response
// has already been written. If a non-nil error is returned, then no
// response has been written.
//
// If the Actor was constructed with the Federated Protocol enabled,
// side effects will occur.
//
// If the Federated Protocol is not enabled, writes the
// http.StatusMethodNotAllowed status code in the response. No side
// effects occur.
//
// The request and data of your application will be interpreted as
// having an HTTPS protocol scheme.
PostInbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error)
// PostInboxScheme is similar to PostInbox, except clients are able to
// specify which protocol scheme to handle the incoming request and the
// data stored within the application (HTTP, HTTPS, etc).
PostInboxScheme(c context.Context, w http.ResponseWriter, r *http.Request, scheme string) (bool, error)
// GetInbox returns true if the request was handled as an ActivityPub
// GET to an actor's inbox. If false, the request was not an ActivityPub
// request and may still be handled by the caller in another way, such
// as serving a web page.
//
// If the error is nil, then the ResponseWriter's headers and response
// has already been written. If a non-nil error is returned, then no
// response has been written.
//
// If the request is an ActivityPub request, the Actor will defer to the
// application to determine the correct authorization of the request and
// the resulting OrderedCollection to respond with. The Actor handles
// serializing this OrderedCollection and responding with the correct
// headers and http.StatusOK.
GetInbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error)
// PostOutbox returns true if the request was handled as an ActivityPub
// POST to an actor's outbox. If false, the request was not an
// ActivityPub request and may still be handled by the caller in another
// way, such as serving a web page.
//
// If the error is nil, then the ResponseWriter's headers and response
// has already been written. If a non-nil error is returned, then no
// response has been written.
//
// If the Actor was constructed with the Social Protocol enabled, side
// effects will occur.
//
// If the Social Protocol is not enabled, writes the
// http.StatusMethodNotAllowed status code in the response. No side
// effects occur.
//
// If the Social and Federated Protocol are both enabled, it will handle
// the side effects of receiving an ActivityStream Activity, and then
// federate the Activity to peers.
//
// The request will be interpreted as having an HTTPS scheme.
PostOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error)
// PostOutboxScheme is similar to PostOutbox, except clients are able to
// specify which protocol scheme to handle the incoming request and the
// data stored within the application (HTTP, HTTPS, etc).
PostOutboxScheme(c context.Context, w http.ResponseWriter, r *http.Request, scheme string) (bool, error)
// GetOutbox returns true if the request was handled as an ActivityPub
// GET to an actor's outbox. If false, the request was not an
// ActivityPub request.
//
// If the error is nil, then the ResponseWriter's headers and response
// has already been written. If a non-nil error is returned, then no
// response has been written.
//
// If the request is an ActivityPub request, the Actor will defer to the
// application to determine the correct authorization of the request and
// the resulting OrderedCollection to respond with. The Actor handles
// serializing this OrderedCollection and responding with the correct
// headers and http.StatusOK.
GetOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error)
}
// FederatingActor is an Actor that allows programmatically delivering an
// Activity to a federating peer.
type FederatingActor interface {
Actor
// Send a federated activity.
//
// The provided url must be the outbox of the sender. All processing of
// the activity occurs similarly to the C2S flow:
// - If t is not an Activity, it is wrapped in a Create activity.
// - A new ID is generated for the activity.
// - The activity is added to the specified outbox.
// - The activity is prepared and delivered to recipients.
//
// Note that this function will only behave as expected if the
// implementation has been constructed to support federation. This
// method will guaranteed work for non-custom Actors. For custom actors,
// care should be used to not call this method if only C2S is supported.
Send(c context.Context, outbox *url.URL, t vocab.Type) (Activity, error)
}

View file

@ -1,494 +0,0 @@
package pub
import (
"context"
"encoding/json"
"fmt"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"io/ioutil"
"net/http"
"net/url"
)
// baseActor must satisfy the Actor interface.
var _ Actor = &baseActor{}
// baseActor is an application-independent ActivityPub implementation. It does
// not implement the entire protocol, and relies on a delegate to do so. It
// only implements the part of the protocol that is side-effect-free, allowing
// an existing application to write a DelegateActor that glues their application
// into the ActivityPub world.
//
// It is preferred to use a DelegateActor provided by this library, so that the
// application does not need to worry about the ActivityPub implementation.
type baseActor struct {
// delegate contains application-specific delegation logic.
delegate DelegateActor
// enableSocialProtocol enables or disables the Social API, the client to
// server part of ActivityPub. Useful if permitting remote clients to
// act on behalf of the users of the client application.
enableSocialProtocol bool
// enableFederatedProtocol enables or disables the Federated Protocol, or the
// server to server part of ActivityPub. Useful to permit integrating
// with the rest of the federative web.
enableFederatedProtocol bool
// clock simply tracks the current time.
clock Clock
}
// baseActorFederating must satisfy the FederatingActor interface.
var _ FederatingActor = &baseActorFederating{}
// baseActorFederating is a baseActor that also satisfies the FederatingActor
// interface.
//
// The baseActor is preserved as an Actor which will not successfully cast to a
// FederatingActor.
type baseActorFederating struct {
baseActor
}
// NewSocialActor builds a new Actor concept that handles only the Social
// Protocol part of ActivityPub.
//
// This Actor can be created once in an application and reused to handle
// multiple requests concurrently and for different endpoints.
//
// It leverages as much of go-fed as possible to ensure the implementation is
// compliant with the ActivityPub specification, while providing enough freedom
// to be productive without shooting one's self in the foot.
//
// Do not try to use NewSocialActor and NewFederatingActor together to cover
// both the Social and Federating parts of the protocol. Instead, use NewActor.
func NewSocialActor(c CommonBehavior,
c2s SocialProtocol,
db Database,
clock Clock) Actor {
return &baseActor{
delegate: &sideEffectActor{
common: c,
c2s: c2s,
db: db,
clock: clock,
},
enableSocialProtocol: true,
clock: clock,
}
}
// NewFederatingActor builds a new Actor concept that handles only the Federating
// Protocol part of ActivityPub.
//
// This Actor can be created once in an application and reused to handle
// multiple requests concurrently and for different endpoints.
//
// It leverages as much of go-fed as possible to ensure the implementation is
// compliant with the ActivityPub specification, while providing enough freedom
// to be productive without shooting one's self in the foot.
//
// Do not try to use NewSocialActor and NewFederatingActor together to cover
// both the Social and Federating parts of the protocol. Instead, use NewActor.
func NewFederatingActor(c CommonBehavior,
s2s FederatingProtocol,
db Database,
clock Clock) FederatingActor {
return &baseActorFederating{
baseActor{
delegate: &sideEffectActor{
common: c,
s2s: s2s,
db: db,
clock: clock,
},
enableFederatedProtocol: true,
clock: clock,
},
}
}
// NewActor builds a new Actor concept that handles both the Social and
// Federating Protocol parts of ActivityPub.
//
// This Actor can be created once in an application and reused to handle
// multiple requests concurrently and for different endpoints.
//
// It leverages as much of go-fed as possible to ensure the implementation is
// compliant with the ActivityPub specification, while providing enough freedom
// to be productive without shooting one's self in the foot.
func NewActor(c CommonBehavior,
c2s SocialProtocol,
s2s FederatingProtocol,
db Database,
clock Clock) FederatingActor {
return &baseActorFederating{
baseActor{
delegate: &sideEffectActor{
common: c,
c2s: c2s,
s2s: s2s,
db: db,
clock: clock,
},
enableSocialProtocol: true,
enableFederatedProtocol: true,
clock: clock,
},
}
}
// NewCustomActor allows clients to create a custom ActivityPub implementation
// for the Social Protocol, Federating Protocol, or both.
//
// It still uses the library as a high-level scaffold, which has the benefit of
// allowing applications to grow into a custom ActivityPub solution without
// having to refactor the code that passes HTTP requests into the Actor.
//
// It is possible to create a DelegateActor that is not ActivityPub compliant.
// Use with due care.
func NewCustomActor(delegate DelegateActor,
enableSocialProtocol, enableFederatedProtocol bool,
clock Clock) FederatingActor {
return &baseActorFederating{
baseActor{
delegate: delegate,
enableSocialProtocol: enableSocialProtocol,
enableFederatedProtocol: enableFederatedProtocol,
clock: clock,
},
}
}
// PostInbox implements the generic algorithm for handling a POST request to an
// actor's inbox independent on an application. It relies on a delegate to
// implement application specific functionality.
//
// Only supports serving data with identifiers having the HTTPS scheme.
func (b *baseActor) PostInbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error) {
return b.PostInboxScheme(c, w, r, "https")
}
// PostInbox implements the generic algorithm for handling a POST request to an
// actor's inbox independent on an application. It relies on a delegate to
// implement application specific functionality.
//
// Specifying the "scheme" allows for retrieving ActivityStreams content with
// identifiers such as HTTP, HTTPS, or other protocol schemes.
func (b *baseActor) PostInboxScheme(c context.Context, w http.ResponseWriter, r *http.Request, scheme string) (bool, error) {
// Do nothing if it is not an ActivityPub POST request.
if !isActivityPubPost(r) {
return false, nil
}
// If the Federated Protocol is not enabled, then this endpoint is not
// enabled.
if !b.enableFederatedProtocol {
w.WriteHeader(http.StatusMethodNotAllowed)
return true, nil
}
// Check the peer request is authentic.
c, authenticated, err := b.delegate.AuthenticatePostInbox(c, w, r)
if err != nil {
return true, err
} else if !authenticated {
return true, nil
}
// Begin processing the request, but have not yet applied
// authorization (ex: blocks). Obtain the activity reject unknown
// activities.
raw, err := ioutil.ReadAll(r.Body)
if err != nil {
return true, err
}
var m map[string]interface{}
if err = json.Unmarshal(raw, &m); err != nil {
return true, err
}
asValue, err := streams.ToType(c, m)
if err != nil && !streams.IsUnmatchedErr(err) {
return true, err
} else if streams.IsUnmatchedErr(err) {
// Respond with bad request -- we do not understand the type.
w.WriteHeader(http.StatusBadRequest)
return true, nil
}
activity, ok := asValue.(Activity)
if !ok {
return true, fmt.Errorf("activity streams value is not an Activity: %T", asValue)
}
if activity.GetJSONLDId() == nil {
w.WriteHeader(http.StatusBadRequest)
return true, nil
}
// Allow server implementations to set context data with a hook.
c, err = b.delegate.PostInboxRequestBodyHook(c, r, activity)
if err != nil {
return true, err
}
// Check authorization of the activity.
authorized, err := b.delegate.AuthorizePostInbox(c, w, activity)
if err != nil {
return true, err
} else if !authorized {
return true, nil
}
// Post the activity to the actor's inbox and trigger side effects for
// that particular Activity type. It is up to the delegate to resolve
// the given map.
inboxId := requestId(r, scheme)
err = b.delegate.PostInbox(c, inboxId, activity)
if err != nil {
// Special case: We know it is a bad request if the object or
// target properties needed to be populated, but weren't.
//
// Send the rejection to the peer.
if err == ErrObjectRequired || err == ErrTargetRequired {
w.WriteHeader(http.StatusBadRequest)
return true, nil
}
return true, err
}
// Our side effects are complete, now delegate determining whether to
// do inbox forwarding, as well as the action to do it.
if err := b.delegate.InboxForwarding(c, inboxId, activity); err != nil {
return true, err
}
// Request has been processed. Begin responding to the request.
//
// Simply respond with an OK status to the peer.
w.WriteHeader(http.StatusOK)
return true, nil
}
// GetInbox implements the generic algorithm for handling a GET request to an
// actor's inbox independent on an application. It relies on a delegate to
// implement application specific functionality.
func (b *baseActor) GetInbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error) {
// Do nothing if it is not an ActivityPub GET request.
if !isActivityPubGet(r) {
return false, nil
}
// Delegate authenticating and authorizing the request.
c, authenticated, err := b.delegate.AuthenticateGetInbox(c, w, r)
if err != nil {
return true, err
} else if !authenticated {
return true, nil
}
// Everything is good to begin processing the request.
oc, err := b.delegate.GetInbox(c, r)
if err != nil {
return true, err
}
// Deduplicate the 'orderedItems' property by ID.
err = dedupeOrderedItems(oc)
if err != nil {
return true, err
}
// Request has been processed. Begin responding to the request.
//
// Serialize the OrderedCollection.
m, err := streams.Serialize(oc)
if err != nil {
return true, err
}
raw, err := json.Marshal(m)
if err != nil {
return true, err
}
// Write the response.
addResponseHeaders(w.Header(), b.clock, raw)
w.WriteHeader(http.StatusOK)
n, err := w.Write(raw)
if err != nil {
return true, err
} else if n != len(raw) {
return true, fmt.Errorf("ResponseWriter.Write wrote %d of %d bytes", n, len(raw))
}
return true, nil
}
// PostOutbox implements the generic algorithm for handling a POST request to an
// actor's outbox independent on an application. It relies on a delegate to
// implement application specific functionality.
//
// Only supports serving data with identifiers having the HTTPS scheme.
func (b *baseActor) PostOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error) {
return b.PostOutboxScheme(c, w, r, "https")
}
// PostOutbox implements the generic algorithm for handling a POST request to an
// actor's outbox independent on an application. It relies on a delegate to
// implement application specific functionality.
//
// Specifying the "scheme" allows for retrieving ActivityStreams content with
// identifiers such as HTTP, HTTPS, or other protocol schemes.
func (b *baseActor) PostOutboxScheme(c context.Context, w http.ResponseWriter, r *http.Request, scheme string) (bool, error) {
// Do nothing if it is not an ActivityPub POST request.
if !isActivityPubPost(r) {
return false, nil
}
// If the Social API is not enabled, then this endpoint is not enabled.
if !b.enableSocialProtocol {
w.WriteHeader(http.StatusMethodNotAllowed)
return true, nil
}
// Delegate authenticating and authorizing the request.
c, authenticated, err := b.delegate.AuthenticatePostOutbox(c, w, r)
if err != nil {
return true, err
} else if !authenticated {
return true, nil
}
// Everything is good to begin processing the request.
raw, err := ioutil.ReadAll(r.Body)
if err != nil {
return true, err
}
var m map[string]interface{}
if err = json.Unmarshal(raw, &m); err != nil {
return true, err
}
// Note that converting to a Type will NOT successfully convert types
// not known to go-fed. This prevents accidentally wrapping an Activity
// type unknown to go-fed in a Create below. Instead,
// streams.ErrUnhandledType will be returned here.
asValue, err := streams.ToType(c, m)
if err != nil && !streams.IsUnmatchedErr(err) {
return true, err
} else if streams.IsUnmatchedErr(err) {
// Respond with bad request -- we do not understand the type.
w.WriteHeader(http.StatusBadRequest)
return true, nil
}
// Allow server implementations to set context data with a hook.
c, err = b.delegate.PostOutboxRequestBodyHook(c, r, asValue)
if err != nil {
return true, err
}
// The HTTP request steps are complete, complete the rest of the outbox
// and delivery process.
outboxId := requestId(r, scheme)
activity, err := b.deliver(c, outboxId, asValue, m)
// Special case: We know it is a bad request if the object or
// target properties needed to be populated, but weren't.
//
// Send the rejection to the client.
if err == ErrObjectRequired || err == ErrTargetRequired {
w.WriteHeader(http.StatusBadRequest)
return true, nil
} else if err != nil {
return true, err
}
// Respond to the request with the new Activity's IRI location.
w.Header().Set(locationHeader, activity.GetJSONLDId().Get().String())
w.WriteHeader(http.StatusCreated)
return true, nil
}
// GetOutbox implements the generic algorithm for handling a Get request to an
// actor's outbox independent on an application. It relies on a delegate to
// implement application specific functionality.
func (b *baseActor) GetOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (bool, error) {
// Do nothing if it is not an ActivityPub GET request.
if !isActivityPubGet(r) {
return false, nil
}
// Delegate authenticating and authorizing the request.
c, authenticated, err := b.delegate.AuthenticateGetOutbox(c, w, r)
if err != nil {
return true, err
} else if !authenticated {
return true, nil
}
// Everything is good to begin processing the request.
oc, err := b.delegate.GetOutbox(c, r)
if err != nil {
return true, err
}
// Request has been processed. Begin responding to the request.
//
// Serialize the OrderedCollection.
m, err := streams.Serialize(oc)
if err != nil {
return true, err
}
raw, err := json.Marshal(m)
if err != nil {
return true, err
}
// Write the response.
addResponseHeaders(w.Header(), b.clock, raw)
w.WriteHeader(http.StatusOK)
n, err := w.Write(raw)
if err != nil {
return true, err
} else if n != len(raw) {
return true, fmt.Errorf("ResponseWriter.Write wrote %d of %d bytes", n, len(raw))
}
return true, nil
}
// deliver delegates all outbox handling steps and optionally will federate the
// activity if the federated protocol is enabled.
//
// This function is not exported so an Actor that only supports C2S cannot be
// type casted to a FederatingActor. It doesn't exactly fit the Send method
// signature anyways.
//
// Note: 'm' is nilable.
func (b *baseActor) deliver(c context.Context, outbox *url.URL, asValue vocab.Type, m map[string]interface{}) (activity Activity, err error) {
// If the value is not an Activity or type extending from Activity, then
// we need to wrap it in a Create Activity.
if !streams.IsOrExtendsActivityStreamsActivity(asValue) {
asValue, err = b.delegate.WrapInCreate(c, asValue, outbox)
if err != nil {
return
}
}
// At this point, this should be a safe conversion. If this error is
// triggered, then there is either a bug in the delegation of
// WrapInCreate, behavior is not lining up in the generated ExtendedBy
// code, or something else is incorrect with the type system.
var ok bool
activity, ok = asValue.(Activity)
if !ok {
err = fmt.Errorf("activity streams value is not an Activity: %T", asValue)
return
}
// Delegate generating new IDs for the activity and all new objects.
if err = b.delegate.AddNewIDs(c, activity); err != nil {
return
}
// Post the activity to the actor's outbox and trigger side effects for
// that particular Activity type.
//
// Since 'm' is nil-able and side effects may need access to literal nil
// values, such as for Update activities, ensure 'm' is non-nil.
if m == nil {
m, err = asValue.Serialize()
if err != nil {
return
}
}
deliverable, err := b.delegate.PostOutbox(c, activity, outbox, m)
if err != nil {
return
}
// Request has been processed and all side effects internal to this
// application server have finished. Begin side effects affecting other
// servers and/or the client who sent this request.
//
// If we are federating and the type is a deliverable one, then deliver
// the activity to federating peers.
if b.enableFederatedProtocol && deliverable {
if err = b.delegate.Deliver(c, outbox, activity); err != nil {
return
}
}
return
}
// Send is programmatically accessible if the federated protocol is enabled.
func (b *baseActorFederating) Send(c context.Context, outbox *url.URL, t vocab.Type) (Activity, error) {
return b.deliver(c, outbox, t, nil)
}

View file

@ -1,89 +0,0 @@
package pub
import (
"context"
"github.com/go-fed/activity/streams/vocab"
"net/http"
"net/url"
)
// Common contains functions required for both the Social API and Federating
// Protocol.
//
// It is passed to the library as a dependency injection from the client
// application.
type CommonBehavior interface {
// AuthenticateGetInbox delegates the authentication of a GET to an
// inbox.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
//
// If an error is returned, it is passed back to the caller of
// GetInbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticateGetInbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// AuthenticateGetOutbox delegates the authentication of a GET to an
// outbox.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
//
// If an error is returned, it is passed back to the caller of
// GetOutbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticateGetOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// GetOutbox returns the OrderedCollection inbox of the actor for this
// context. It is up to the implementation to provide the correct
// collection for the kind of authorization given in the request.
//
// AuthenticateGetOutbox will be called prior to this.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
GetOutbox(c context.Context, r *http.Request) (vocab.ActivityStreamsOrderedCollectionPage, error)
// NewTransport returns a new Transport on behalf of a specific actor.
//
// The actorBoxIRI will be either the inbox or outbox of an actor who is
// attempting to do the dereferencing or delivery. Any authentication
// scheme applied on the request must be based on this actor. The
// request must contain some sort of credential of the user, such as a
// HTTP Signature.
//
// The gofedAgent passed in should be used by the Transport
// implementation in the User-Agent, as well as the application-specific
// user agent string. The gofedAgent will indicate this library's use as
// well as the library's version number.
//
// Any server-wide rate-limiting that needs to occur should happen in a
// Transport implementation. This factory function allows this to be
// created, so peer servers are not DOS'd.
//
// Any retry logic should also be handled by the Transport
// implementation.
//
// Note that the library will not maintain a long-lived pointer to the
// returned Transport so that any private credentials are able to be
// garbage collected.
NewTransport(c context.Context, actorBoxIRI *url.URL, gofedAgent string) (t Transport, err error)
}

View file

@ -1,139 +0,0 @@
package pub
import (
"context"
"github.com/go-fed/activity/streams/vocab"
"net/url"
)
type Database interface {
// Lock takes a lock for the object at the specified id. If an error
// is returned, the lock must not have been taken.
//
// The lock must be able to succeed for an id that does not exist in
// the database. This means acquiring the lock does not guarantee the
// entry exists in the database.
//
// Locks are encouraged to be lightweight and in the Go layer, as some
// processes require tight loops acquiring and releasing locks.
//
// Used to ensure race conditions in multiple requests do not occur.
Lock(c context.Context, id *url.URL) error
// Unlock makes the lock for the object at the specified id available.
// If an error is returned, the lock must have still been freed.
//
// Used to ensure race conditions in multiple requests do not occur.
Unlock(c context.Context, id *url.URL) error
// InboxContains returns true if the OrderedCollection at 'inbox'
// contains the specified 'id'.
//
// The library makes this call only after acquiring a lock first.
InboxContains(c context.Context, inbox, id *url.URL) (contains bool, err error)
// GetInbox returns the first ordered collection page of the outbox at
// the specified IRI, for prepending new items.
//
// The library makes this call only after acquiring a lock first.
GetInbox(c context.Context, inboxIRI *url.URL) (inbox vocab.ActivityStreamsOrderedCollectionPage, err error)
// SetInbox saves the inbox value given from GetInbox, with new items
// prepended. Note that the new items must not be added as independent
// database entries. Separate calls to Create will do that.
//
// The library makes this call only after acquiring a lock first.
SetInbox(c context.Context, inbox vocab.ActivityStreamsOrderedCollectionPage) error
// Owns returns true if the database has an entry for the IRI and it
// exists in the database.
//
// The library makes this call only after acquiring a lock first.
Owns(c context.Context, id *url.URL) (owns bool, err error)
// ActorForOutbox fetches the actor's IRI for the given outbox IRI.
//
// The library makes this call only after acquiring a lock first.
ActorForOutbox(c context.Context, outboxIRI *url.URL) (actorIRI *url.URL, err error)
// ActorForInbox fetches the actor's IRI for the given outbox IRI.
//
// The library makes this call only after acquiring a lock first.
ActorForInbox(c context.Context, inboxIRI *url.URL) (actorIRI *url.URL, err error)
// OutboxForInbox fetches the corresponding actor's outbox IRI for the
// actor's inbox IRI.
//
// The library makes this call only after acquiring a lock first.
OutboxForInbox(c context.Context, inboxIRI *url.URL) (outboxIRI *url.URL, err error)
// Exists returns true if the database has an entry for the specified
// id. It may not be owned by this application instance.
//
// The library makes this call only after acquiring a lock first.
Exists(c context.Context, id *url.URL) (exists bool, err error)
// Get returns the database entry for the specified id.
//
// The library makes this call only after acquiring a lock first.
Get(c context.Context, id *url.URL) (value vocab.Type, err error)
// Create adds a new entry to the database which must be able to be
// keyed by its id.
//
// Note that Activity values received from federated peers may also be
// created in the database this way if the Federating Protocol is
// enabled. The client may freely decide to store only the id instead of
// the entire value.
//
// The library makes this call only after acquiring a lock first.
//
// Under certain conditions and network activities, Create may be called
// multiple times for the same ActivityStreams object.
Create(c context.Context, asType vocab.Type) error
// Update sets an existing entry to the database based on the value's
// id.
//
// Note that Activity values received from federated peers may also be
// updated in the database this way if the Federating Protocol is
// enabled. The client may freely decide to store only the id instead of
// the entire value.
//
// The library makes this call only after acquiring a lock first.
Update(c context.Context, asType vocab.Type) error
// Delete removes the entry with the given id.
//
// Delete is only called for federated objects. Deletes from the Social
// Protocol instead call Update to create a Tombstone.
//
// The library makes this call only after acquiring a lock first.
Delete(c context.Context, id *url.URL) error
// GetOutbox returns the first ordered collection page of the outbox
// at the specified IRI, for prepending new items.
//
// The library makes this call only after acquiring a lock first.
GetOutbox(c context.Context, outboxIRI *url.URL) (outbox vocab.ActivityStreamsOrderedCollectionPage, err error)
// SetOutbox saves the outbox value given from GetOutbox, with new items
// prepended. Note that the new items must not be added as independent
// database entries. Separate calls to Create will do that.
//
// The library makes this call only after acquiring a lock first.
SetOutbox(c context.Context, outbox vocab.ActivityStreamsOrderedCollectionPage) error
// NewID creates a new IRI id for the provided activity or object. The
// implementation does not need to set the 'id' property and simply
// needs to determine the value.
//
// The go-fed library will handle setting the 'id' property on the
// activity or object provided with the value returned.
NewID(c context.Context, t vocab.Type) (id *url.URL, err error)
// Followers obtains the Followers Collection for an actor with the
// given id.
//
// If modified, the library will then call Update.
//
// The library makes this call only after acquiring a lock first.
Followers(c context.Context, actorIRI *url.URL) (followers vocab.ActivityStreamsCollection, err error)
// Following obtains the Following Collection for an actor with the
// given id.
//
// If modified, the library will then call Update.
//
// The library makes this call only after acquiring a lock first.
Following(c context.Context, actorIRI *url.URL) (following vocab.ActivityStreamsCollection, err error)
// Liked obtains the Liked Collection for an actor with the
// given id.
//
// If modified, the library will then call Update.
//
// The library makes this call only after acquiring a lock first.
Liked(c context.Context, actorIRI *url.URL) (liked vocab.ActivityStreamsCollection, err error)
}

View file

@ -1,248 +0,0 @@
package pub
import (
"context"
"github.com/go-fed/activity/streams/vocab"
"net/http"
"net/url"
)
// DelegateActor contains the detailed interface an application must satisfy in
// order to implement the ActivityPub specification.
//
// Note that an implementation of this interface is implicitly provided in the
// calls to NewActor, NewSocialActor, and NewFederatingActor.
//
// Implementing the DelegateActor requires familiarity with the ActivityPub
// specification because it does not a strong enough abstraction for the client
// application to ignore the ActivityPub spec. It is very possible to implement
// this interface and build a foot-gun that trashes the fediverse without being
// ActivityPub compliant. Please use with due consideration.
//
// Alternatively, build an application that uses the parts of the pub library
// that do not require implementing a DelegateActor so that the ActivityPub
// implementation is completely provided out of the box.
type DelegateActor interface {
// Hook callback after parsing the request body for a federated request
// to the Actor's inbox.
//
// Can be used to set contextual information based on the Activity
// received.
//
// Only called if the Federated Protocol is enabled.
//
// Warning: Neither authentication nor authorization has taken place at
// this time. Doing anything beyond setting contextual information is
// strongly discouraged.
//
// If an error is returned, it is passed back to the caller of
// PostInbox. In this case, the DelegateActor implementation must not
// write a response to the ResponseWriter as is expected that the caller
// to PostInbox will do so when handling the error.
PostInboxRequestBodyHook(c context.Context, r *http.Request, activity Activity) (context.Context, error)
// Hook callback after parsing the request body for a client request
// to the Actor's outbox.
//
// Can be used to set contextual information based on the
// ActivityStreams object received.
//
// Only called if the Social API is enabled.
//
// Warning: Neither authentication nor authorization has taken place at
// this time. Doing anything beyond setting contextual information is
// strongly discouraged.
//
// If an error is returned, it is passed back to the caller of
// PostOutbox. In this case, the DelegateActor implementation must not
// write a response to the ResponseWriter as is expected that the caller
// to PostOutbox will do so when handling the error.
PostOutboxRequestBodyHook(c context.Context, r *http.Request, data vocab.Type) (context.Context, error)
// AuthenticatePostInbox delegates the authentication of a POST to an
// inbox.
//
// Only called if the Federated Protocol is enabled.
//
// If an error is returned, it is passed back to the caller of
// PostInbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticatePostInbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// AuthenticateGetInbox delegates the authentication of a GET to an
// inbox.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
//
// If an error is returned, it is passed back to the caller of
// GetInbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticateGetInbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// AuthorizePostInbox delegates the authorization of an activity that
// has been sent by POST to an inbox.
//
// Only called if the Federated Protocol is enabled.
//
// If an error is returned, it is passed back to the caller of
// PostInbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authorized' is ignored.
//
// If no error is returned, but authorization fails, then authorized
// must be false and error nil. It is expected that the implementation
// handles writing to the ResponseWriter in this case.
//
// Finally, if the authentication and authorization succeeds, then
// authorized must be true and error nil. The request will continue
// to be processed.
AuthorizePostInbox(c context.Context, w http.ResponseWriter, activity Activity) (authorized bool, err error)
// PostInbox delegates the side effects of adding to the inbox and
// determining if it is a request that should be blocked.
//
// Only called if the Federated Protocol is enabled.
//
// As a side effect, PostInbox sets the federated data in the inbox, but
// not on its own in the database, as InboxForwarding (which is called
// later) must decide whether it has seen this activity before in order
// to determine whether to do the forwarding algorithm.
//
// If the error is ErrObjectRequired or ErrTargetRequired, then a Bad
// Request status is sent in the response.
PostInbox(c context.Context, inboxIRI *url.URL, activity Activity) error
// InboxForwarding delegates inbox forwarding logic when a POST request
// is received in the Actor's inbox.
//
// Only called if the Federated Protocol is enabled.
//
// The delegate is responsible for determining whether to do the inbox
// forwarding, as well as actually conducting it if it determines it
// needs to.
//
// As a side effect, InboxForwarding must set the federated data in the
// database, independently of the inbox, however it sees fit in order to
// determine whether it has seen the activity before.
//
// The provided url is the inbox of the recipient of the Activity. The
// Activity is examined for the information about who to inbox forward
// to.
//
// If an error is returned, it is returned to the caller of PostInbox.
InboxForwarding(c context.Context, inboxIRI *url.URL, activity Activity) error
// PostOutbox delegates the logic for side effects and adding to the
// outbox.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled. In the case of the Social API being enabled, side
// effects of the Activity must occur.
//
// The delegate is responsible for adding the activity to the database's
// general storage for independent retrieval, and not just within the
// actor's outbox.
//
// If the error is ErrObjectRequired or ErrTargetRequired, then a Bad
// Request status is sent in the response.
//
// Note that 'rawJSON' is an unfortunate consequence where an 'Update'
// Activity is the only one that explicitly cares about 'null' values in
// JSON. Since go-fed does not differentiate between 'null' values and
// values that are simply not present, the 'rawJSON' map is ONLY needed
// for this narrow and specific use case.
PostOutbox(c context.Context, a Activity, outboxIRI *url.URL, rawJSON map[string]interface{}) (deliverable bool, e error)
// AddNewIDs sets new URL ids on the activity. It also does so for all
// 'object' properties if the Activity is a Create type.
//
// Only called if the Social API is enabled.
//
// If an error is returned, it is returned to the caller of PostOutbox.
AddNewIDs(c context.Context, a Activity) error
// Deliver sends a federated message. Called only if federation is
// enabled.
//
// Called if the Federated Protocol is enabled.
//
// The provided url is the outbox of the sender. The Activity contains
// the information about the intended recipients.
//
// If an error is returned, it is returned to the caller of PostOutbox.
Deliver(c context.Context, outbox *url.URL, activity Activity) error
// AuthenticatePostOutbox delegates the authentication and authorization
// of a POST to an outbox.
//
// Only called if the Social API is enabled.
//
// If an error is returned, it is passed back to the caller of
// PostOutbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticatePostOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// AuthenticateGetOutbox delegates the authentication of a GET to an
// outbox.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
//
// If an error is returned, it is passed back to the caller of
// GetOutbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticateGetOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// WrapInCreate wraps the provided object in a Create ActivityStreams
// activity. The provided URL is the actor's outbox endpoint.
//
// Only called if the Social API is enabled.
WrapInCreate(c context.Context, value vocab.Type, outboxIRI *url.URL) (vocab.ActivityStreamsCreate, error)
// GetOutbox returns the OrderedCollection inbox of the actor for this
// context. It is up to the implementation to provide the correct
// collection for the kind of authorization given in the request.
//
// AuthenticateGetOutbox will be called prior to this.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
GetOutbox(c context.Context, r *http.Request) (vocab.ActivityStreamsOrderedCollectionPage, error)
// GetInbox returns the OrderedCollection inbox of the actor for this
// context. It is up to the implementation to provide the correct
// collection for the kind of authorization given in the request.
//
// AuthenticateGetInbox will be called prior to this.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
GetInbox(c context.Context, r *http.Request) (vocab.ActivityStreamsOrderedCollectionPage, error)
}

View file

@ -1,124 +0,0 @@
package pub
import (
"context"
"github.com/go-fed/activity/streams/vocab"
"net/http"
"net/url"
)
// FederatingProtocol contains behaviors an application needs to satisfy for the
// full ActivityPub S2S implementation to be supported by this library.
//
// It is only required if the client application wants to support the server-to-
// server, or federating, protocol.
//
// It is passed to the library as a dependency injection from the client
// application.
type FederatingProtocol interface {
// Hook callback after parsing the request body for a federated request
// to the Actor's inbox.
//
// Can be used to set contextual information based on the Activity
// received.
//
// Only called if the Federated Protocol is enabled.
//
// Warning: Neither authentication nor authorization has taken place at
// this time. Doing anything beyond setting contextual information is
// strongly discouraged.
//
// If an error is returned, it is passed back to the caller of
// PostInbox. In this case, the DelegateActor implementation must not
// write a response to the ResponseWriter as is expected that the caller
// to PostInbox will do so when handling the error.
PostInboxRequestBodyHook(c context.Context, r *http.Request, activity Activity) (context.Context, error)
// AuthenticatePostInbox delegates the authentication of a POST to an
// inbox.
//
// If an error is returned, it is passed back to the caller of
// PostInbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticatePostInbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// Blocked should determine whether to permit a set of actors given by
// their ids are able to interact with this particular end user due to
// being blocked or other application-specific logic.
//
// If an error is returned, it is passed back to the caller of
// PostInbox.
//
// If no error is returned, but authentication or authorization fails,
// then blocked must be true and error nil. An http.StatusForbidden
// will be written in the wresponse.
//
// Finally, if the authentication and authorization succeeds, then
// blocked must be false and error nil. The request will continue
// to be processed.
Blocked(c context.Context, actorIRIs []*url.URL) (blocked bool, err error)
// FederatingCallbacks returns the application logic that handles
// ActivityStreams received from federating peers.
//
// Note that certain types of callbacks will be 'wrapped' with default
// behaviors supported natively by the library. Other callbacks
// compatible with streams.TypeResolver can be specified by 'other'.
//
// For example, setting the 'Create' field in the
// FederatingWrappedCallbacks lets an application dependency inject
// additional behaviors they want to take place, including the default
// behavior supplied by this library. This is guaranteed to be compliant
// with the ActivityPub Social protocol.
//
// To override the default behavior, instead supply the function in
// 'other', which does not guarantee the application will be compliant
// with the ActivityPub Social Protocol.
//
// Applications are not expected to handle every single ActivityStreams
// type and extension. The unhandled ones are passed to DefaultCallback.
FederatingCallbacks(c context.Context) (wrapped FederatingWrappedCallbacks, other []interface{}, err error)
// DefaultCallback is called for types that go-fed can deserialize but
// are not handled by the application's callbacks returned in the
// Callbacks method.
//
// Applications are not expected to handle every single ActivityStreams
// type and extension, so the unhandled ones are passed to
// DefaultCallback.
DefaultCallback(c context.Context, activity Activity) error
// MaxInboxForwardingRecursionDepth determines how deep to search within
// an activity to determine if inbox forwarding needs to occur.
//
// Zero or negative numbers indicate infinite recursion.
MaxInboxForwardingRecursionDepth(c context.Context) int
// MaxDeliveryRecursionDepth determines how deep to search within
// collections owned by peers when they are targeted to receive a
// delivery.
//
// Zero or negative numbers indicate infinite recursion.
MaxDeliveryRecursionDepth(c context.Context) int
// FilterForwarding allows the implementation to apply business logic
// such as blocks, spam filtering, and so on to a list of potential
// Collections and OrderedCollections of recipients when inbox
// forwarding has been triggered.
//
// The activity is provided as a reference for more intelligent
// logic to be used, but the implementation must not modify it.
FilterForwarding(c context.Context, potentialRecipients []*url.URL, a Activity) (filteredRecipients []*url.URL, err error)
// GetInbox returns the OrderedCollection inbox of the actor for this
// context. It is up to the implementation to provide the correct
// collection for the kind of authorization given in the request.
//
// AuthenticateGetInbox will be called prior to this.
//
// Always called, regardless whether the Federated Protocol or Social
// API is enabled.
GetInbox(c context.Context, r *http.Request) (vocab.ActivityStreamsOrderedCollectionPage, error)
}

View file

@ -1,907 +0,0 @@
package pub
import (
"context"
"encoding/json"
"fmt"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"net/url"
)
// OnFollowBehavior enumerates the different default actions that the go-fed
// library can provide when receiving a Follow Activity from a peer.
type OnFollowBehavior int
const (
// OnFollowDoNothing does not take any action when a Follow Activity
// is received.
OnFollowDoNothing OnFollowBehavior = iota
// OnFollowAutomaticallyAccept triggers the side effect of sending an
// Accept of this Follow request in response.
OnFollowAutomaticallyAccept
// OnFollowAutomaticallyAccept triggers the side effect of sending a
// Reject of this Follow request in response.
OnFollowAutomaticallyReject
)
// FederatingWrappedCallbacks lists the callback functions that already have
// some side effect behavior provided by the pub library.
//
// These functions are wrapped for the Federating Protocol.
type FederatingWrappedCallbacks struct {
// Create handles additional side effects for the Create ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping callback for the Federating Protocol ensures the
// 'object' property is created in the database.
//
// Create calls Create for each object in the federated Activity.
Create func(context.Context, vocab.ActivityStreamsCreate) error
// Update handles additional side effects for the Update ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping callback for the Federating Protocol ensures the
// 'object' property is updated in the database.
//
// Update calls Update on the federated entry from the database, with a
// new value.
Update func(context.Context, vocab.ActivityStreamsUpdate) error
// Delete handles additional side effects for the Delete ActivityStreams
// type, specific to the application using go-fed.
//
// Delete removes the federated entry from the database.
Delete func(context.Context, vocab.ActivityStreamsDelete) error
// Follow handles additional side effects for the Follow ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function can have one of several default behaviors,
// depending on the value of the OnFollow setting.
Follow func(context.Context, vocab.ActivityStreamsFollow) error
// OnFollow determines what action to take for this particular callback
// if a Follow Activity is handled.
OnFollow OnFollowBehavior
// Accept handles additional side effects for the Accept ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function determines if this 'Accept' is in response to a
// 'Follow'. If so, then the 'actor' is added to the original 'actor's
// 'following' collection.
//
// Otherwise, no side effects are done by go-fed.
Accept func(context.Context, vocab.ActivityStreamsAccept) error
// Reject handles additional side effects for the Reject ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function has no default side effects. However, if this
// 'Reject' is in response to a 'Follow' then the client MUST NOT go
// forward with adding the 'actor' to the original 'actor's 'following'
// collection by the client application.
Reject func(context.Context, vocab.ActivityStreamsReject) error
// Add handles additional side effects for the Add ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function will add the 'object' IRIs to a specific
// 'target' collection if the 'target' collection(s) live on this
// server.
Add func(context.Context, vocab.ActivityStreamsAdd) error
// Remove handles additional side effects for the Remove ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function will remove all 'object' IRIs from a specific
// 'target' collection if the 'target' collection(s) live on this
// server.
Remove func(context.Context, vocab.ActivityStreamsRemove) error
// Like handles additional side effects for the Like ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function will add the activity to the "likes" collection
// on all 'object' targets owned by this server.
Like func(context.Context, vocab.ActivityStreamsLike) error
// Announce handles additional side effects for the Announce
// ActivityStreams type, specific to the application using go-fed.
//
// The wrapping function will add the activity to the "shares"
// collection on all 'object' targets owned by this server.
Announce func(context.Context, vocab.ActivityStreamsAnnounce) error
// Undo handles additional side effects for the Undo ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function ensures the 'actor' on the 'Undo'
// is be the same as the 'actor' on all Activities being undone.
// It enforces that the actors on the Undo must correspond to all of the
// 'object' actors in some manner.
//
// It is expected that the application will implement the proper
// reversal of activities that are being undone.
Undo func(context.Context, vocab.ActivityStreamsUndo) error
// Block handles additional side effects for the Block ActivityStreams
// type, specific to the application using go-fed.
//
// The wrapping function provides no default side effects. It simply
// calls the wrapped function. However, note that Blocks should not be
// received from a federated peer, as delivering Blocks explicitly
// deviates from the original ActivityPub specification.
Block func(context.Context, vocab.ActivityStreamsBlock) error
// Sidechannel data -- this is set at request handling time. These must
// be set before the callbacks are used.
// db is the Database the FederatingWrappedCallbacks should use.
db Database
// inboxIRI is the inboxIRI that is handling this callback.
inboxIRI *url.URL
// addNewIds creates new 'id' entries on an activity and its objects if
// it is a Create activity.
addNewIds func(c context.Context, activity Activity) error
// deliver delivers an outgoing message.
deliver func(c context.Context, outboxIRI *url.URL, activity Activity) error
// newTransport creates a new Transport.
newTransport func(c context.Context, actorBoxIRI *url.URL, gofedAgent string) (t Transport, err error)
}
// callbacks returns the WrappedCallbacks members into a single interface slice
// for use in streams.Resolver callbacks.
//
// If the given functions have a type that collides with the default behavior,
// then disable our default behavior
func (w FederatingWrappedCallbacks) callbacks(fns []interface{}) []interface{} {
enableCreate := true
enableUpdate := true
enableDelete := true
enableFollow := true
enableAccept := true
enableReject := true
enableAdd := true
enableRemove := true
enableLike := true
enableAnnounce := true
enableUndo := true
enableBlock := true
for _, fn := range fns {
switch fn.(type) {
default:
continue
case func(context.Context, vocab.ActivityStreamsCreate) error:
enableCreate = false
case func(context.Context, vocab.ActivityStreamsUpdate) error:
enableUpdate = false
case func(context.Context, vocab.ActivityStreamsDelete) error:
enableDelete = false
case func(context.Context, vocab.ActivityStreamsFollow) error:
enableFollow = false
case func(context.Context, vocab.ActivityStreamsAccept) error:
enableAccept = false
case func(context.Context, vocab.ActivityStreamsReject) error:
enableReject = false
case func(context.Context, vocab.ActivityStreamsAdd) error:
enableAdd = false
case func(context.Context, vocab.ActivityStreamsRemove) error:
enableRemove = false
case func(context.Context, vocab.ActivityStreamsLike) error:
enableLike = false
case func(context.Context, vocab.ActivityStreamsAnnounce) error:
enableAnnounce = false
case func(context.Context, vocab.ActivityStreamsUndo) error:
enableUndo = false
case func(context.Context, vocab.ActivityStreamsBlock) error:
enableBlock = false
}
}
if enableCreate {
fns = append(fns, w.create)
}
if enableUpdate {
fns = append(fns, w.update)
}
if enableDelete {
fns = append(fns, w.deleteFn)
}
if enableFollow {
fns = append(fns, w.follow)
}
if enableAccept {
fns = append(fns, w.accept)
}
if enableReject {
fns = append(fns, w.reject)
}
if enableAdd {
fns = append(fns, w.add)
}
if enableRemove {
fns = append(fns, w.remove)
}
if enableLike {
fns = append(fns, w.like)
}
if enableAnnounce {
fns = append(fns, w.announce)
}
if enableUndo {
fns = append(fns, w.undo)
}
if enableBlock {
fns = append(fns, w.block)
}
return fns
}
// create implements the federating Create activity side effects.
func (w FederatingWrappedCallbacks) create(c context.Context, a vocab.ActivityStreamsCreate) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(iter vocab.ActivityStreamsObjectPropertyIterator) error {
t := iter.GetType()
if t == nil && iter.IsIRI() {
// Attempt to dereference the IRI instead
tport, err := w.newTransport(c, w.inboxIRI, goFedUserAgent())
if err != nil {
return err
}
b, err := tport.Dereference(c, iter.GetIRI())
if err != nil {
return err
}
var m map[string]interface{}
if err = json.Unmarshal(b, &m); err != nil {
return err
}
t, err = streams.ToType(c, m)
if err != nil {
return err
}
} else if t == nil {
return fmt.Errorf("cannot handle federated create: object is neither a value nor IRI")
}
id, err := GetId(t)
if err != nil {
return err
}
err = w.db.Lock(c, id)
if err != nil {
return err
}
defer w.db.Unlock(c, id)
if err := w.db.Create(c, t); err != nil {
return err
}
return nil
}
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
if err := loopFn(iter); err != nil {
return err
}
}
if w.Create != nil {
return w.Create(c, a)
}
return nil
}
// update implements the federating Update activity side effects.
func (w FederatingWrappedCallbacks) update(c context.Context, a vocab.ActivityStreamsUpdate) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
if err := mustHaveActivityOriginMatchObjects(a); err != nil {
return err
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(iter vocab.ActivityStreamsObjectPropertyIterator) error {
t := iter.GetType()
if t == nil {
return fmt.Errorf("update requires an object to be wholly provided")
}
id, err := GetId(t)
if err != nil {
return err
}
err = w.db.Lock(c, id)
if err != nil {
return err
}
defer w.db.Unlock(c, id)
if err := w.db.Update(c, t); err != nil {
return err
}
return nil
}
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
if err := loopFn(iter); err != nil {
return err
}
}
if w.Update != nil {
return w.Update(c, a)
}
return nil
}
// deleteFn implements the federating Delete activity side effects.
func (w FederatingWrappedCallbacks) deleteFn(c context.Context, a vocab.ActivityStreamsDelete) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
if err := mustHaveActivityOriginMatchObjects(a); err != nil {
return err
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(iter vocab.ActivityStreamsObjectPropertyIterator) error {
id, err := ToId(iter)
if err != nil {
return err
}
err = w.db.Lock(c, id)
if err != nil {
return err
}
defer w.db.Unlock(c, id)
if err := w.db.Delete(c, id); err != nil {
return err
}
return nil
}
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
if err := loopFn(iter); err != nil {
return err
}
}
if w.Delete != nil {
return w.Delete(c, a)
}
return nil
}
// follow implements the federating Follow activity side effects.
func (w FederatingWrappedCallbacks) follow(c context.Context, a vocab.ActivityStreamsFollow) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
// Check that we own at least one of the 'object' properties, and ensure
// it is to the actor that owns this inbox.
//
// If not then don't send a response. It was federated to us as an FYI,
// by mistake, or some other reason.
if err := w.db.Lock(c, w.inboxIRI); err != nil {
return err
}
// WARNING: Unlock not deferred.
actorIRI, err := w.db.ActorForInbox(c, w.inboxIRI)
if err != nil {
w.db.Unlock(c, w.inboxIRI)
return err
}
w.db.Unlock(c, w.inboxIRI)
// Unlock must be called by now and every branch above.
isMe := false
if w.OnFollow != OnFollowDoNothing {
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
if id.String() == actorIRI.String() {
isMe = true
break
}
}
}
if isMe {
// Prepare the response.
var response Activity
if w.OnFollow == OnFollowAutomaticallyAccept {
response = streams.NewActivityStreamsAccept()
} else if w.OnFollow == OnFollowAutomaticallyReject {
response = streams.NewActivityStreamsReject()
} else {
return fmt.Errorf("unknown OnFollowBehavior: %d", w.OnFollow)
}
// Set us as the 'actor'.
me := streams.NewActivityStreamsActorProperty()
response.SetActivityStreamsActor(me)
me.AppendIRI(actorIRI)
// Set the Follow as the 'object' property.
op := streams.NewActivityStreamsObjectProperty()
response.SetActivityStreamsObject(op)
op.AppendActivityStreamsFollow(a)
// Add all actors on the original Follow to the 'to' property.
recipients := make([]*url.URL, 0)
to := streams.NewActivityStreamsToProperty()
response.SetActivityStreamsTo(to)
followActors := a.GetActivityStreamsActor()
for iter := followActors.Begin(); iter != followActors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
to.AppendIRI(id)
recipients = append(recipients, id)
}
if w.OnFollow == OnFollowAutomaticallyAccept {
// If automatically accepting, then also update our
// followers collection with the new actors.
//
// If automatically rejecting, do not update the
// followers collection.
if err := w.db.Lock(c, actorIRI); err != nil {
return err
}
// WARNING: Unlock not deferred.
followers, err := w.db.Followers(c, actorIRI)
if err != nil {
w.db.Unlock(c, actorIRI)
return err
}
items := followers.GetActivityStreamsItems()
if items == nil {
items = streams.NewActivityStreamsItemsProperty()
followers.SetActivityStreamsItems(items)
}
for _, elem := range recipients {
items.PrependIRI(elem)
}
if err = w.db.Update(c, followers); err != nil {
w.db.Unlock(c, actorIRI)
return err
}
w.db.Unlock(c, actorIRI)
// Unlock must be called by now and every branch above.
}
// Lock without defer!
w.db.Lock(c, w.inboxIRI)
outboxIRI, err := w.db.OutboxForInbox(c, w.inboxIRI)
if err != nil {
w.db.Unlock(c, w.inboxIRI)
return err
}
w.db.Unlock(c, w.inboxIRI)
// Everything must be unlocked by now.
if err := w.addNewIds(c, response); err != nil {
return err
} else if err := w.deliver(c, outboxIRI, response); err != nil {
return err
}
}
if w.Follow != nil {
return w.Follow(c, a)
}
return nil
}
// accept implements the federating Accept activity side effects.
func (w FederatingWrappedCallbacks) accept(c context.Context, a vocab.ActivityStreamsAccept) error {
op := a.GetActivityStreamsObject()
if op != nil && op.Len() > 0 {
// Get this actor's id.
if err := w.db.Lock(c, w.inboxIRI); err != nil {
return err
}
// WARNING: Unlock not deferred.
actorIRI, err := w.db.ActorForInbox(c, w.inboxIRI)
if err != nil {
w.db.Unlock(c, w.inboxIRI)
return err
}
w.db.Unlock(c, w.inboxIRI)
// Unlock must be called by now and every branch above.
//
// Determine if we are in a follow on the 'object' property.
//
// TODO: Handle Accept multiple Follow.
var maybeMyFollowIRI *url.URL
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
t := iter.GetType()
if t == nil && iter.IsIRI() {
// Attempt to dereference the IRI instead
tport, err := w.newTransport(c, w.inboxIRI, goFedUserAgent())
if err != nil {
return err
}
b, err := tport.Dereference(c, iter.GetIRI())
if err != nil {
return err
}
var m map[string]interface{}
if err = json.Unmarshal(b, &m); err != nil {
return err
}
t, err = streams.ToType(c, m)
if err != nil {
return err
}
} else if t == nil {
return fmt.Errorf("cannot handle federated create: object is neither a value nor IRI")
}
// Ensure it is a Follow.
if !streams.IsOrExtendsActivityStreamsFollow(t) {
continue
}
follow, ok := t.(Activity)
if !ok {
return fmt.Errorf("a Follow in an Accept does not satisfy the Activity interface")
}
followId, err := GetId(follow)
if err != nil {
return err
}
// Ensure that we are one of the actors on the Follow.
actors := follow.GetActivityStreamsActor()
for iter := actors.Begin(); iter != actors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
if id.String() == actorIRI.String() {
maybeMyFollowIRI = followId
break
}
}
// Continue breaking if we found ourselves
if maybeMyFollowIRI != nil {
break
}
}
// If we received an Accept whose 'object' is a Follow with an
// Accept that we sent, add to the following collection.
if maybeMyFollowIRI != nil {
// Verify our Follow request exists and the peer didn't
// fabricate it.
activityActors := a.GetActivityStreamsActor()
if activityActors == nil || activityActors.Len() == 0 {
return fmt.Errorf("an Accept with a Follow has no actors")
}
// This may be a duplicate check if we dereferenced the
// Follow above. TODO: Separate this logic to avoid
// redundancy.
//
// Use an anonymous function to properly scope the
// database lock, immediately call it.
err = func() error {
if err := w.db.Lock(c, maybeMyFollowIRI); err != nil {
return err
}
defer w.db.Unlock(c, maybeMyFollowIRI)
t, err := w.db.Get(c, maybeMyFollowIRI)
if err != nil {
return err
}
if !streams.IsOrExtendsActivityStreamsFollow(t) {
return fmt.Errorf("peer gave an Accept wrapping a Follow but provided a non-Follow id")
}
follow, ok := t.(Activity)
if !ok {
return fmt.Errorf("a Follow in an Accept does not satisfy the Activity interface")
}
// Ensure that we are one of the actors on the Follow.
ok = false
actors := follow.GetActivityStreamsActor()
for iter := actors.Begin(); iter != actors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
if id.String() == actorIRI.String() {
ok = true
break
}
}
if !ok {
return fmt.Errorf("peer gave an Accept wrapping a Follow but we are not the actor on that Follow")
}
// Build map of original Accept actors
acceptActors := make(map[string]bool)
for iter := activityActors.Begin(); iter != activityActors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
acceptActors[id.String()] = false
}
// Verify all actor(s) were on the original Follow.
followObj := follow.GetActivityStreamsObject()
for iter := followObj.Begin(); iter != followObj.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
if _, ok := acceptActors[id.String()]; ok {
acceptActors[id.String()] = true
}
}
for _, found := range acceptActors {
if !found {
return fmt.Errorf("peer gave an Accept wrapping a Follow but was not an object in the original Follow")
}
}
return nil
}()
if err != nil {
return err
}
// Add the peer to our following collection.
if err := w.db.Lock(c, actorIRI); err != nil {
return err
}
// WARNING: Unlock not deferred.
following, err := w.db.Following(c, actorIRI)
if err != nil {
w.db.Unlock(c, actorIRI)
return err
}
items := following.GetActivityStreamsItems()
if items == nil {
items = streams.NewActivityStreamsItemsProperty()
following.SetActivityStreamsItems(items)
}
for iter := activityActors.Begin(); iter != activityActors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
w.db.Unlock(c, actorIRI)
return err
}
items.PrependIRI(id)
}
if err = w.db.Update(c, following); err != nil {
w.db.Unlock(c, actorIRI)
return err
}
w.db.Unlock(c, actorIRI)
// Unlock must be called by now and every branch above.
}
}
if w.Accept != nil {
return w.Accept(c, a)
}
return nil
}
// reject implements the federating Reject activity side effects.
func (w FederatingWrappedCallbacks) reject(c context.Context, a vocab.ActivityStreamsReject) error {
if w.Reject != nil {
return w.Reject(c, a)
}
return nil
}
// add implements the federating Add activity side effects.
func (w FederatingWrappedCallbacks) add(c context.Context, a vocab.ActivityStreamsAdd) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
target := a.GetActivityStreamsTarget()
if target == nil || target.Len() == 0 {
return ErrTargetRequired
}
if err := add(c, op, target, w.db); err != nil {
return err
}
if w.Add != nil {
return w.Add(c, a)
}
return nil
}
// remove implements the federating Remove activity side effects.
func (w FederatingWrappedCallbacks) remove(c context.Context, a vocab.ActivityStreamsRemove) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
target := a.GetActivityStreamsTarget()
if target == nil || target.Len() == 0 {
return ErrTargetRequired
}
if err := remove(c, op, target, w.db); err != nil {
return err
}
if w.Remove != nil {
return w.Remove(c, a)
}
return nil
}
// like implements the federating Like activity side effects.
func (w FederatingWrappedCallbacks) like(c context.Context, a vocab.ActivityStreamsLike) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
id, err := GetId(a)
if err != nil {
return err
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(iter vocab.ActivityStreamsObjectPropertyIterator) error {
objId, err := ToId(iter)
if err != nil {
return err
}
if err := w.db.Lock(c, objId); err != nil {
return err
}
defer w.db.Unlock(c, objId)
if owns, err := w.db.Owns(c, objId); err != nil {
return err
} else if !owns {
return nil
}
t, err := w.db.Get(c, objId)
if err != nil {
return err
}
l, ok := t.(likeser)
if !ok {
return fmt.Errorf("cannot add Like to likes collection for type %T", t)
}
// Get 'likes' property on the object, creating default if
// necessary.
likes := l.GetActivityStreamsLikes()
if likes == nil {
likes = streams.NewActivityStreamsLikesProperty()
l.SetActivityStreamsLikes(likes)
}
// Get 'likes' value, defaulting to a collection.
likesT := likes.GetType()
if likesT == nil {
col := streams.NewActivityStreamsCollection()
likesT = col
likes.SetActivityStreamsCollection(col)
}
// Prepend the activity's 'id' on the 'likes' Collection or
// OrderedCollection.
if col, ok := likesT.(itemser); ok {
items := col.GetActivityStreamsItems()
if items == nil {
items = streams.NewActivityStreamsItemsProperty()
col.SetActivityStreamsItems(items)
}
items.PrependIRI(id)
} else if oCol, ok := likesT.(orderedItemser); ok {
oItems := oCol.GetActivityStreamsOrderedItems()
if oItems == nil {
oItems = streams.NewActivityStreamsOrderedItemsProperty()
oCol.SetActivityStreamsOrderedItems(oItems)
}
oItems.PrependIRI(id)
} else {
return fmt.Errorf("likes type is neither a Collection nor an OrderedCollection: %T", likesT)
}
err = w.db.Update(c, t)
if err != nil {
return err
}
return nil
}
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
if err := loopFn(iter); err != nil {
return err
}
}
if w.Like != nil {
return w.Like(c, a)
}
return nil
}
// announce implements the federating Announce activity side effects.
func (w FederatingWrappedCallbacks) announce(c context.Context, a vocab.ActivityStreamsAnnounce) error {
id, err := GetId(a)
if err != nil {
return err
}
op := a.GetActivityStreamsObject()
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(iter vocab.ActivityStreamsObjectPropertyIterator) error {
objId, err := ToId(iter)
if err != nil {
return err
}
if err := w.db.Lock(c, objId); err != nil {
return err
}
defer w.db.Unlock(c, objId)
if owns, err := w.db.Owns(c, objId); err != nil {
return err
} else if !owns {
return nil
}
t, err := w.db.Get(c, objId)
if err != nil {
return err
}
s, ok := t.(shareser)
if !ok {
return fmt.Errorf("cannot add Announce to Shares collection for type %T", t)
}
// Get 'shares' property on the object, creating default if
// necessary.
shares := s.GetActivityStreamsShares()
if shares == nil {
shares = streams.NewActivityStreamsSharesProperty()
s.SetActivityStreamsShares(shares)
}
// Get 'shares' value, defaulting to a collection.
sharesT := shares.GetType()
if sharesT == nil {
col := streams.NewActivityStreamsCollection()
sharesT = col
shares.SetActivityStreamsCollection(col)
}
// Prepend the activity's 'id' on the 'shares' Collection or
// OrderedCollection.
if col, ok := sharesT.(itemser); ok {
items := col.GetActivityStreamsItems()
if items == nil {
items = streams.NewActivityStreamsItemsProperty()
col.SetActivityStreamsItems(items)
}
items.PrependIRI(id)
} else if oCol, ok := sharesT.(orderedItemser); ok {
oItems := oCol.GetActivityStreamsOrderedItems()
if oItems == nil {
oItems = streams.NewActivityStreamsOrderedItemsProperty()
oCol.SetActivityStreamsOrderedItems(oItems)
}
oItems.PrependIRI(id)
} else {
return fmt.Errorf("shares type is neither a Collection nor an OrderedCollection: %T", sharesT)
}
err = w.db.Update(c, t)
if err != nil {
return err
}
return nil
}
if op != nil {
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
if err := loopFn(iter); err != nil {
return err
}
}
}
if w.Announce != nil {
return w.Announce(c, a)
}
return nil
}
// undo implements the federating Undo activity side effects.
func (w FederatingWrappedCallbacks) undo(c context.Context, a vocab.ActivityStreamsUndo) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
actors := a.GetActivityStreamsActor()
if err := mustHaveActivityActorsMatchObjectActors(c, actors, op, w.newTransport, w.inboxIRI); err != nil {
return err
}
if w.Undo != nil {
return w.Undo(c, a)
}
return nil
}
// block implements the federating Block activity side effects.
func (w FederatingWrappedCallbacks) block(c context.Context, a vocab.ActivityStreamsBlock) error {
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
if w.Block != nil {
return w.Block(c, a)
}
return nil
}

View file

@ -1,113 +0,0 @@
package pub
import (
"context"
"encoding/json"
"errors"
"fmt"
"net/http"
"github.com/go-fed/activity/streams"
)
var ErrNotFound = errors.New("go-fed/activity: ActivityStreams data not found")
// HandlerFunc determines whether an incoming HTTP request is an ActivityStreams
// GET request, and if so attempts to serve ActivityStreams data.
//
// If an error is returned, then the calling function is responsible for writing
// to the ResponseWriter as part of error handling.
//
// If 'isASRequest' is false and there is no error, then the calling function
// may continue processing the request, and the HandlerFunc will not have
// written anything to the ResponseWriter. For example, a webpage may be served
// instead.
//
// If 'isASRequest' is true and there is no error, then the HandlerFunc
// successfully served the request and wrote to the ResponseWriter.
//
// Callers are responsible for authorized access to this resource.
type HandlerFunc func(c context.Context, w http.ResponseWriter, r *http.Request) (isASRequest bool, err error)
// NewActivityStreamsHandler creates a HandlerFunc to serve ActivityStreams
// requests which are coming from other clients or servers that wish to obtain
// an ActivityStreams representation of data.
//
// Strips retrieved ActivityStreams values of sensitive fields ('bto' and 'bcc')
// before responding with them. Sets the appropriate HTTP status code for
// Tombstone Activities as well.
//
// Defaults to supporting content to be retrieved by HTTPS only.
func NewActivityStreamsHandler(db Database, clock Clock) HandlerFunc {
return NewActivityStreamsHandlerScheme(db, clock, "https")
}
// NewActivityStreamsHandlerScheme creates a HandlerFunc to serve
// ActivityStreams requests which are coming from other clients or servers that
// wish to obtain an ActivityStreams representation of data provided by the
// specified protocol scheme.
//
// Strips retrieved ActivityStreams values of sensitive fields ('bto' and 'bcc')
// before responding with them. Sets the appropriate HTTP status code for
// Tombstone Activities as well.
//
// Specifying the "scheme" allows for retrieving ActivityStreams content with
// identifiers such as HTTP, HTTPS, or other protocol schemes.
//
// Returns ErrNotFound when the database does not retrieve any data and no
// errors occurred during retrieval.
func NewActivityStreamsHandlerScheme(db Database, clock Clock, scheme string) HandlerFunc {
return func(c context.Context, w http.ResponseWriter, r *http.Request) (isASRequest bool, err error) {
// Do nothing if it is not an ActivityPub GET request
if !isActivityPubGet(r) {
return
}
isASRequest = true
id := requestId(r, scheme)
// Lock and obtain a copy of the requested ActivityStreams value
err = db.Lock(c, id)
if err != nil {
return
}
// WARNING: Unlock not deferred
t, err := db.Get(c, id)
if err != nil {
db.Unlock(c, id)
return
}
db.Unlock(c, id)
// Unlock must have been called by this point and in every
// branch above
if t == nil {
err = ErrNotFound
return
}
// Remove sensitive fields.
clearSensitiveFields(t)
// Serialize the fetched value.
m, err := streams.Serialize(t)
if err != nil {
return
}
raw, err := json.Marshal(m)
if err != nil {
return
}
// Construct the response.
addResponseHeaders(w.Header(), clock, raw)
// Write the response.
if streams.IsOrExtendsActivityStreamsTombstone(t) {
w.WriteHeader(http.StatusGone)
} else {
w.WriteHeader(http.StatusOK)
}
n, err := w.Write(raw)
if err != nil {
return
} else if n != len(raw) {
err = fmt.Errorf("only wrote %d of %d bytes", n, len(raw))
return
}
return
}
}

View file

@ -1,117 +0,0 @@
package pub
import (
"github.com/go-fed/activity/streams/vocab"
"net/url"
)
// inReplyToer is an ActivityStreams type with an 'inReplyTo' property
type inReplyToer interface {
GetActivityStreamsInReplyTo() vocab.ActivityStreamsInReplyToProperty
}
// objecter is an ActivityStreams type with an 'object' property
type objecter interface {
GetActivityStreamsObject() vocab.ActivityStreamsObjectProperty
}
// targeter is an ActivityStreams type with a 'target' property
type targeter interface {
GetActivityStreamsTarget() vocab.ActivityStreamsTargetProperty
}
// tagger is an ActivityStreams type with a 'tag' property
type tagger interface {
GetActivityStreamsTag() vocab.ActivityStreamsTagProperty
}
// hrefer is an ActivityStreams type with a 'href' property
type hrefer interface {
GetActivityStreamsHref() vocab.ActivityStreamsHrefProperty
}
// itemser is an ActivityStreams type with an 'items' property
type itemser interface {
GetActivityStreamsItems() vocab.ActivityStreamsItemsProperty
SetActivityStreamsItems(vocab.ActivityStreamsItemsProperty)
}
// orderedItemser is an ActivityStreams type with an 'orderedItems' property
type orderedItemser interface {
GetActivityStreamsOrderedItems() vocab.ActivityStreamsOrderedItemsProperty
SetActivityStreamsOrderedItems(vocab.ActivityStreamsOrderedItemsProperty)
}
// publisheder is an ActivityStreams type with a 'published' property
type publisheder interface {
GetActivityStreamsPublished() vocab.ActivityStreamsPublishedProperty
}
// updateder is an ActivityStreams type with an 'updateder' property
type updateder interface {
GetActivityStreamsUpdated() vocab.ActivityStreamsUpdatedProperty
}
// toer is an ActivityStreams type with a 'to' property
type toer interface {
GetActivityStreamsTo() vocab.ActivityStreamsToProperty
SetActivityStreamsTo(i vocab.ActivityStreamsToProperty)
}
// btoer is an ActivityStreams type with a 'bto' property
type btoer interface {
GetActivityStreamsBto() vocab.ActivityStreamsBtoProperty
SetActivityStreamsBto(i vocab.ActivityStreamsBtoProperty)
}
// ccer is an ActivityStreams type with a 'cc' property
type ccer interface {
GetActivityStreamsCc() vocab.ActivityStreamsCcProperty
SetActivityStreamsCc(i vocab.ActivityStreamsCcProperty)
}
// bccer is an ActivityStreams type with a 'bcc' property
type bccer interface {
GetActivityStreamsBcc() vocab.ActivityStreamsBccProperty
SetActivityStreamsBcc(i vocab.ActivityStreamsBccProperty)
}
// audiencer is an ActivityStreams type with an 'audience' property
type audiencer interface {
GetActivityStreamsAudience() vocab.ActivityStreamsAudienceProperty
SetActivityStreamsAudience(i vocab.ActivityStreamsAudienceProperty)
}
// inboxer is an ActivityStreams type with an 'inbox' property
type inboxer interface {
GetActivityStreamsInbox() vocab.ActivityStreamsInboxProperty
}
// attributedToer is an ActivityStreams type with an 'attributedTo' property
type attributedToer interface {
GetActivityStreamsAttributedTo() vocab.ActivityStreamsAttributedToProperty
SetActivityStreamsAttributedTo(i vocab.ActivityStreamsAttributedToProperty)
}
// likeser is an ActivityStreams type with a 'likes' property
type likeser interface {
GetActivityStreamsLikes() vocab.ActivityStreamsLikesProperty
SetActivityStreamsLikes(i vocab.ActivityStreamsLikesProperty)
}
// shareser is an ActivityStreams type with a 'shares' property
type shareser interface {
GetActivityStreamsShares() vocab.ActivityStreamsSharesProperty
SetActivityStreamsShares(i vocab.ActivityStreamsSharesProperty)
}
// actorer is an ActivityStreams type with an 'actor' property
type actorer interface {
GetActivityStreamsActor() vocab.ActivityStreamsActorProperty
SetActivityStreamsActor(i vocab.ActivityStreamsActorProperty)
}
// appendIRIer is an ActivityStreams type that can Append IRIs.
type appendIRIer interface {
AppendIRI(v *url.URL)
}

View file

@ -1,810 +0,0 @@
package pub
import (
"context"
"encoding/json"
"fmt"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"net/http"
"net/url"
)
// sideEffectActor must satisfy the DelegateActor interface.
var _ DelegateActor = &sideEffectActor{}
// sideEffectActor is a DelegateActor that handles the ActivityPub
// implementation side effects, but requires a more opinionated application to
// be written.
//
// Note that when using the sideEffectActor with an application that good-faith
// implements its required interfaces, the ActivityPub specification is
// guaranteed to be correctly followed.
type sideEffectActor struct {
common CommonBehavior
s2s FederatingProtocol
c2s SocialProtocol
db Database
clock Clock
}
// PostInboxRequestBodyHook defers to the delegate.
func (a *sideEffectActor) PostInboxRequestBodyHook(c context.Context, r *http.Request, activity Activity) (context.Context, error) {
return a.s2s.PostInboxRequestBodyHook(c, r, activity)
}
// PostOutboxRequestBodyHook defers to the delegate.
func (a *sideEffectActor) PostOutboxRequestBodyHook(c context.Context, r *http.Request, data vocab.Type) (context.Context, error) {
return a.c2s.PostOutboxRequestBodyHook(c, r, data)
}
// AuthenticatePostInbox defers to the delegate to authenticate the request.
func (a *sideEffectActor) AuthenticatePostInbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error) {
return a.s2s.AuthenticatePostInbox(c, w, r)
}
// AuthenticateGetInbox defers to the delegate to authenticate the request.
func (a *sideEffectActor) AuthenticateGetInbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error) {
return a.common.AuthenticateGetInbox(c, w, r)
}
// AuthenticatePostOutbox defers to the delegate to authenticate the request.
func (a *sideEffectActor) AuthenticatePostOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error) {
return a.c2s.AuthenticatePostOutbox(c, w, r)
}
// AuthenticateGetOutbox defers to the delegate to authenticate the request.
func (a *sideEffectActor) AuthenticateGetOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error) {
return a.common.AuthenticateGetOutbox(c, w, r)
}
// GetOutbox delegates to the SocialProtocol.
func (a *sideEffectActor) GetOutbox(c context.Context, r *http.Request) (vocab.ActivityStreamsOrderedCollectionPage, error) {
return a.common.GetOutbox(c, r)
}
// GetInbox delegates to the FederatingProtocol.
func (a *sideEffectActor) GetInbox(c context.Context, r *http.Request) (vocab.ActivityStreamsOrderedCollectionPage, error) {
return a.s2s.GetInbox(c, r)
}
// AuthorizePostInbox defers to the federating protocol whether the peer request
// is authorized based on the actors' ids.
func (a *sideEffectActor) AuthorizePostInbox(c context.Context, w http.ResponseWriter, activity Activity) (authorized bool, err error) {
authorized = false
actor := activity.GetActivityStreamsActor()
if actor == nil {
err = fmt.Errorf("no actors in post to inbox")
return
}
var iris []*url.URL
for i := 0; i < actor.Len(); i++ {
iter := actor.At(i)
if iter.IsIRI() {
iris = append(iris, iter.GetIRI())
} else if t := iter.GetType(); t != nil {
iris = append(iris, activity.GetJSONLDId().Get())
} else {
err = fmt.Errorf("actor at index %d is missing an id", i)
return
}
}
// Determine if the actor(s) sending this request are blocked.
var blocked bool
if blocked, err = a.s2s.Blocked(c, iris); err != nil {
return
} else if blocked {
w.WriteHeader(http.StatusForbidden)
return
}
authorized = true
return
}
// PostInbox handles the side effects of determining whether to block the peer's
// request, adding the activity to the actor's inbox, and triggering side
// effects based on the activity's type.
func (a *sideEffectActor) PostInbox(c context.Context, inboxIRI *url.URL, activity Activity) error {
isNew, err := a.addToInboxIfNew(c, inboxIRI, activity)
if err != nil {
return err
}
if isNew {
wrapped, other, err := a.s2s.FederatingCallbacks(c)
if err != nil {
return err
}
// Populate side channels.
wrapped.db = a.db
wrapped.inboxIRI = inboxIRI
wrapped.newTransport = a.common.NewTransport
wrapped.deliver = a.Deliver
wrapped.addNewIds = a.AddNewIDs
res, err := streams.NewTypeResolver(wrapped.callbacks(other)...)
if err != nil {
return err
}
if err = res.Resolve(c, activity); err != nil && !streams.IsUnmatchedErr(err) {
return err
} else if streams.IsUnmatchedErr(err) {
err = a.s2s.DefaultCallback(c, activity)
if err != nil {
return err
}
}
}
return nil
}
// InboxForwarding implements the 3-part inbox forwarding algorithm specified in
// the ActivityPub specification. Does not modify the Activity, but may send
// outbound requests as a side effect.
//
// InboxForwarding sets the federated data in the database.
func (a *sideEffectActor) InboxForwarding(c context.Context, inboxIRI *url.URL, activity Activity) error {
// 1. Must be first time we have seen this Activity.
//
// Obtain the id of the activity
id := activity.GetJSONLDId()
// Acquire a lock for the id. To be held for the rest of execution.
err := a.db.Lock(c, id.Get())
if err != nil {
return err
}
// WARNING: Unlock is not deferred
//
// If the database already contains the activity, exit early.
exists, err := a.db.Exists(c, id.Get())
if err != nil {
a.db.Unlock(c, id.Get())
return err
} else if exists {
a.db.Unlock(c, id.Get())
return nil
}
// Attempt to create the activity entry.
err = a.db.Create(c, activity)
if err != nil {
a.db.Unlock(c, id.Get())
return err
}
a.db.Unlock(c, id.Get())
// Unlock by this point and in every branch above.
//
// 2. The values of 'to', 'cc', or 'audience' are Collections owned by
// this server.
var r []*url.URL
to := activity.GetActivityStreamsTo()
if to != nil {
for iter := to.Begin(); iter != to.End(); iter = iter.Next() {
val, err := ToId(iter)
if err != nil {
return err
}
r = append(r, val)
}
}
cc := activity.GetActivityStreamsCc()
if cc != nil {
for iter := cc.Begin(); iter != cc.End(); iter = iter.Next() {
val, err := ToId(iter)
if err != nil {
return err
}
r = append(r, val)
}
}
audience := activity.GetActivityStreamsAudience()
if audience != nil {
for iter := audience.Begin(); iter != audience.End(); iter = iter.Next() {
val, err := ToId(iter)
if err != nil {
return err
}
r = append(r, val)
}
}
// Find all IRIs owned by this server. We need to find all of them so
// that forwarding can properly occur.
var myIRIs []*url.URL
for _, iri := range r {
if err != nil {
return err
}
err = a.db.Lock(c, iri)
if err != nil {
return err
}
// WARNING: Unlock is not deferred
if owns, err := a.db.Owns(c, iri); err != nil {
a.db.Unlock(c, iri)
return err
} else if !owns {
a.db.Unlock(c, iri)
continue
}
a.db.Unlock(c, iri)
// Unlock by this point and in every branch above.
myIRIs = append(myIRIs, iri)
}
// Finally, load our IRIs to determine if they are a Collection or
// OrderedCollection.
//
// Load the unfiltered IRIs.
var colIRIs []*url.URL
col := make(map[string]itemser)
oCol := make(map[string]orderedItemser)
for _, iri := range myIRIs {
err = a.db.Lock(c, iri)
if err != nil {
return err
}
// WARNING: Not Unlocked
t, err := a.db.Get(c, iri)
if err != nil {
return err
}
if streams.IsOrExtendsActivityStreamsOrderedCollection(t) {
if im, ok := t.(orderedItemser); ok {
oCol[iri.String()] = im
colIRIs = append(colIRIs, iri)
defer a.db.Unlock(c, iri)
} else {
a.db.Unlock(c, iri)
}
} else if streams.IsOrExtendsActivityStreamsCollection(t) {
if im, ok := t.(itemser); ok {
col[iri.String()] = im
colIRIs = append(colIRIs, iri)
defer a.db.Unlock(c, iri)
} else {
a.db.Unlock(c, iri)
}
} else {
a.db.Unlock(c, iri)
}
}
// If we own none of the Collection IRIs in 'to', 'cc', or 'audience'
// then no need to do inbox forwarding. We have nothing to forward to.
if len(colIRIs) == 0 {
return nil
}
// 3. The values of 'inReplyTo', 'object', 'target', or 'tag' are owned
// by this server. This is only a boolean trigger: As soon as we get
// a hit that we own something, then we should do inbox forwarding.
maxDepth := a.s2s.MaxInboxForwardingRecursionDepth(c)
ownsValue, err := a.hasInboxForwardingValues(c, inboxIRI, activity, maxDepth, 0)
if err != nil {
return err
}
// If we don't own any of the 'inReplyTo', 'object', 'target', or 'tag'
// values, then no need to do inbox forwarding.
if !ownsValue {
return nil
}
// Do the inbox forwarding since the above conditions hold true. Support
// the behavior of letting the application filter out the resulting
// collections to be targeted.
toSend, err := a.s2s.FilterForwarding(c, colIRIs, activity)
if err != nil {
return err
}
recipients := make([]*url.URL, 0, len(toSend))
for _, iri := range toSend {
if c, ok := col[iri.String()]; ok {
if it := c.GetActivityStreamsItems(); it != nil {
for iter := it.Begin(); iter != it.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
recipients = append(recipients, id)
}
}
} else if oc, ok := oCol[iri.String()]; ok {
if oit := oc.GetActivityStreamsOrderedItems(); oit != nil {
for iter := oit.Begin(); iter != oit.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
recipients = append(recipients, id)
}
}
}
}
return a.deliverToRecipients(c, inboxIRI, activity, recipients)
}
// PostOutbox handles the side effects of adding the activity to the actor's
// outbox, and triggering side effects based on the activity's type.
//
// This implementation assumes all types are meant to be delivered except for
// the ActivityStreams Block type.
func (a *sideEffectActor) PostOutbox(c context.Context, activity Activity, outboxIRI *url.URL, rawJSON map[string]interface{}) (deliverable bool, err error) {
// TODO: Determine this if c2s is nil
deliverable = true
if a.c2s != nil {
var wrapped SocialWrappedCallbacks
var other []interface{}
wrapped, other, err = a.c2s.SocialCallbacks(c)
if err != nil {
return
}
// Populate side channels.
wrapped.db = a.db
wrapped.outboxIRI = outboxIRI
wrapped.rawActivity = rawJSON
wrapped.clock = a.clock
wrapped.newTransport = a.common.NewTransport
undeliverable := false
wrapped.undeliverable = &undeliverable
var res *streams.TypeResolver
res, err = streams.NewTypeResolver(wrapped.callbacks(other)...)
if err != nil {
return
}
if err = res.Resolve(c, activity); err != nil && !streams.IsUnmatchedErr(err) {
return
} else if streams.IsUnmatchedErr(err) {
deliverable = true
err = a.c2s.DefaultCallback(c, activity)
if err != nil {
return
}
} else {
deliverable = !undeliverable
}
}
err = a.addToOutbox(c, outboxIRI, activity)
return
}
// AddNewIDs creates new 'id' entries on an activity and its objects if it is a
// Create activity.
func (a *sideEffectActor) AddNewIDs(c context.Context, activity Activity) error {
id, err := a.db.NewID(c, activity)
if err != nil {
return err
}
activityId := streams.NewJSONLDIdProperty()
activityId.Set(id)
activity.SetJSONLDId(activityId)
if streams.IsOrExtendsActivityStreamsCreate(activity) {
o, ok := activity.(objecter)
if !ok {
return fmt.Errorf("cannot add new id for Create: %T has no object property", activity)
}
if oProp := o.GetActivityStreamsObject(); oProp != nil {
for iter := oProp.Begin(); iter != oProp.End(); iter = iter.Next() {
t := iter.GetType()
if t == nil {
return fmt.Errorf("cannot add new id for object in Create: object is not embedded as a value literal")
}
id, err = a.db.NewID(c, t)
if err != nil {
return err
}
objId := streams.NewJSONLDIdProperty()
objId.Set(id)
t.SetJSONLDId(objId)
}
}
}
return nil
}
// deliver will complete the peer-to-peer sending of a federated message to
// another server.
//
// Must be called if at least the federated protocol is supported.
func (a *sideEffectActor) Deliver(c context.Context, outboxIRI *url.URL, activity Activity) error {
recipients, err := a.prepare(c, outboxIRI, activity)
if err != nil {
return err
}
return a.deliverToRecipients(c, outboxIRI, activity, recipients)
}
// WrapInCreate wraps an object with a Create activity.
func (a *sideEffectActor) WrapInCreate(c context.Context, obj vocab.Type, outboxIRI *url.URL) (create vocab.ActivityStreamsCreate, err error) {
err = a.db.Lock(c, outboxIRI)
if err != nil {
return
}
// WARNING: No deferring the Unlock
actorIRI, err := a.db.ActorForOutbox(c, outboxIRI)
if err != nil {
a.db.Unlock(c, outboxIRI)
return
}
a.db.Unlock(c, outboxIRI)
// Unlock the lock at this point and every branch above
return wrapInCreate(c, obj, actorIRI)
}
// deliverToRecipients will take a prepared Activity and send it to specific
// recipients on behalf of an actor.
func (a *sideEffectActor) deliverToRecipients(c context.Context, boxIRI *url.URL, activity Activity, recipients []*url.URL) error {
m, err := streams.Serialize(activity)
if err != nil {
return err
}
b, err := json.Marshal(m)
if err != nil {
return err
}
tp, err := a.common.NewTransport(c, boxIRI, goFedUserAgent())
if err != nil {
return err
}
return tp.BatchDeliver(c, b, recipients)
}
// addToOutbox adds the activity to the outbox and creates the activity in the
// internal database as its own entry.
func (a *sideEffectActor) addToOutbox(c context.Context, outboxIRI *url.URL, activity Activity) error {
// Set the activity in the database first.
id := activity.GetJSONLDId()
err := a.db.Lock(c, id.Get())
if err != nil {
return err
}
// WARNING: Unlock not deferred
err = a.db.Create(c, activity)
if err != nil {
a.db.Unlock(c, id.Get())
return err
}
a.db.Unlock(c, id.Get())
// WARNING: Unlock(c, id) should be called by this point and in every
// return before here.
//
// Acquire a lock to read the outbox. Defer release.
err = a.db.Lock(c, outboxIRI)
if err != nil {
return err
}
defer a.db.Unlock(c, outboxIRI)
outbox, err := a.db.GetOutbox(c, outboxIRI)
if err != nil {
return err
}
// Prepend the activity to the list of 'orderedItems'.
oi := outbox.GetActivityStreamsOrderedItems()
if oi == nil {
oi = streams.NewActivityStreamsOrderedItemsProperty()
}
oi.PrependIRI(id.Get())
outbox.SetActivityStreamsOrderedItems(oi)
// Save in the database.
err = a.db.SetOutbox(c, outbox)
return err
}
// addToInboxIfNew will add the activity to the inbox at the specified IRI if
// the activity's ID has not yet been added to the inbox.
//
// It does not add the activity to this database's know federated data.
//
// Returns true when the activity is novel.
func (a *sideEffectActor) addToInboxIfNew(c context.Context, inboxIRI *url.URL, activity Activity) (isNew bool, err error) {
// Acquire a lock to read the inbox. Defer release.
err = a.db.Lock(c, inboxIRI)
if err != nil {
return
}
defer a.db.Unlock(c, inboxIRI)
// Obtain the id of the activity
id := activity.GetJSONLDId()
// If the inbox already contains the URL, early exit.
contains, err := a.db.InboxContains(c, inboxIRI, id.Get())
if err != nil {
return
} else if contains {
return
}
// It is a new id, acquire the inbox.
isNew = true
inbox, err := a.db.GetInbox(c, inboxIRI)
if err != nil {
return
}
// Prepend the activity to the list of 'orderedItems'.
oi := inbox.GetActivityStreamsOrderedItems()
if oi == nil {
oi = streams.NewActivityStreamsOrderedItemsProperty()
}
oi.PrependIRI(id.Get())
inbox.SetActivityStreamsOrderedItems(oi)
// Save in the database.
err = a.db.SetInbox(c, inbox)
return
}
// Given an ActivityStreams value, recursively examines ownership of the id or
// href and the ones on properties applicable to inbox forwarding.
//
// Recursion may be limited by providing a 'maxDepth' greater than zero. A
// value of zero or a negative number will result in infinite recursion.
func (a *sideEffectActor) hasInboxForwardingValues(c context.Context, inboxIRI *url.URL, val vocab.Type, maxDepth, currDepth int) (bool, error) {
// Stop recurring if we are exceeding the maximum depth and the maximum
// is a positive number.
if maxDepth > 0 && currDepth >= maxDepth {
return false, nil
}
// Determine if we own the 'id' of any values on the properties we care
// about.
types, iris := getInboxForwardingValues(val)
// For IRIs, simply check if we own them.
for _, iri := range iris {
err := a.db.Lock(c, iri)
if err != nil {
return false, err
}
// WARNING: Unlock is not deferred
if owns, err := a.db.Owns(c, iri); err != nil {
a.db.Unlock(c, iri)
return false, err
} else if owns {
a.db.Unlock(c, iri)
return true, nil
}
a.db.Unlock(c, iri)
// Unlock by this point and in every branch above
}
// For embedded literals, check the id.
for _, val := range types {
id, err := GetId(val)
if err != nil {
return false, err
}
err = a.db.Lock(c, id)
if err != nil {
return false, err
}
// WARNING: Unlock is not deferred
if owns, err := a.db.Owns(c, id); err != nil {
a.db.Unlock(c, id)
return false, err
} else if owns {
a.db.Unlock(c, id)
return true, nil
}
a.db.Unlock(c, id)
// Unlock by this point and in every branch above
}
// Recur Preparation: Try fetching the IRIs so we can recur into them.
for _, iri := range iris {
// Dereferencing the IRI.
tport, err := a.common.NewTransport(c, inboxIRI, goFedUserAgent())
if err != nil {
return false, err
}
b, err := tport.Dereference(c, iri)
if err != nil {
// Do not fail the entire process if the data is
// missing.
continue
}
var m map[string]interface{}
if err = json.Unmarshal(b, &m); err != nil {
return false, err
}
t, err := streams.ToType(c, m)
if err != nil {
// Do not fail the entire process if we cannot handle
// the type.
continue
}
types = append(types, t)
}
// Recur.
for _, nextVal := range types {
if has, err := a.hasInboxForwardingValues(c, inboxIRI, nextVal, maxDepth, currDepth+1); err != nil {
return false, err
} else if has {
return true, nil
}
}
return false, nil
}
// prepare takes a deliverableObject and returns a list of the proper recipient
// target URIs. Additionally, the deliverableObject will have any hidden
// hidden recipients ("bto" and "bcc") stripped from it.
//
// Only call if both the social and federated protocol are supported.
func (a *sideEffectActor) prepare(c context.Context, outboxIRI *url.URL, activity Activity) (r []*url.URL, err error) {
// Get inboxes of recipients
if to := activity.GetActivityStreamsTo(); to != nil {
for iter := to.Begin(); iter != to.End(); iter = iter.Next() {
var val *url.URL
val, err = ToId(iter)
if err != nil {
return
}
r = append(r, val)
}
}
if bto := activity.GetActivityStreamsBto(); bto != nil {
for iter := bto.Begin(); iter != bto.End(); iter = iter.Next() {
var val *url.URL
val, err = ToId(iter)
if err != nil {
return
}
r = append(r, val)
}
}
if cc := activity.GetActivityStreamsCc(); cc != nil {
for iter := cc.Begin(); iter != cc.End(); iter = iter.Next() {
var val *url.URL
val, err = ToId(iter)
if err != nil {
return
}
r = append(r, val)
}
}
if bcc := activity.GetActivityStreamsBcc(); bcc != nil {
for iter := bcc.Begin(); iter != bcc.End(); iter = iter.Next() {
var val *url.URL
val, err = ToId(iter)
if err != nil {
return
}
r = append(r, val)
}
}
if audience := activity.GetActivityStreamsAudience(); audience != nil {
for iter := audience.Begin(); iter != audience.End(); iter = iter.Next() {
var val *url.URL
val, err = ToId(iter)
if err != nil {
return
}
r = append(r, val)
}
}
// 1. When an object is being delivered to the originating actor's
// followers, a server MAY reduce the number of receiving actors
// delivered to by identifying all followers which share the same
// sharedInbox who would otherwise be individual recipients and
// instead deliver objects to said sharedInbox.
// 2. If an object is addressed to the Public special collection, a
// server MAY deliver that object to all known sharedInbox endpoints
// on the network.
r = filterURLs(r, IsPublic)
t, err := a.common.NewTransport(c, outboxIRI, goFedUserAgent())
if err != nil {
return nil, err
}
receiverActors, err := a.resolveInboxes(c, t, r, 0, a.s2s.MaxDeliveryRecursionDepth(c))
if err != nil {
return nil, err
}
targets, err := getInboxes(receiverActors)
if err != nil {
return nil, err
}
// Get inboxes of sender.
err = a.db.Lock(c, outboxIRI)
if err != nil {
return
}
// WARNING: No deferring the Unlock
actorIRI, err := a.db.ActorForOutbox(c, outboxIRI)
if err != nil {
a.db.Unlock(c, outboxIRI)
return
}
a.db.Unlock(c, outboxIRI)
// Get the inbox on the sender.
err = a.db.Lock(c, actorIRI)
if err != nil {
return nil, err
}
// BEGIN LOCK
thisActor, err := a.db.Get(c, actorIRI)
a.db.Unlock(c, actorIRI)
// END LOCK -- Still need to handle err
if err != nil {
return nil, err
}
// Post-processing
var ignore *url.URL
ignore, err = getInbox(thisActor)
if err != nil {
return nil, err
}
r = dedupeIRIs(targets, []*url.URL{ignore})
stripHiddenRecipients(activity)
return r, nil
}
// resolveInboxes takes a list of Actor id URIs and returns them as concrete
// instances of actorObject. It attempts to apply recursively when it encounters
// a target that is a Collection or OrderedCollection.
//
// If maxDepth is zero or negative, then recursion is infinitely applied.
//
// If a recipient is a Collection or OrderedCollection, then the server MUST
// dereference the collection, WITH the user's credentials.
//
// Note that this also applies to CollectionPage and OrderedCollectionPage.
func (a *sideEffectActor) resolveInboxes(c context.Context, t Transport, r []*url.URL, depth, maxDepth int) (actors []vocab.Type, err error) {
if maxDepth > 0 && depth >= maxDepth {
return
}
for _, u := range r {
var act vocab.Type
var more []*url.URL
// TODO: Determine if more logic is needed here for inaccessible
// collections owned by peer servers.
act, more, err = a.dereferenceForResolvingInboxes(c, t, u)
if err != nil {
// Missing recipient -- skip.
continue
}
var recurActors []vocab.Type
recurActors, err = a.resolveInboxes(c, t, more, depth+1, maxDepth)
if err != nil {
return
}
if act != nil {
actors = append(actors, act)
}
actors = append(actors, recurActors...)
}
return
}
// dereferenceForResolvingInboxes dereferences an IRI solely for finding an
// actor's inbox IRI to deliver to.
//
// The returned actor could be nil, if it wasn't an actor (ex: a Collection or
// OrderedCollection).
func (a *sideEffectActor) dereferenceForResolvingInboxes(c context.Context, t Transport, actorIRI *url.URL) (actor vocab.Type, moreActorIRIs []*url.URL, err error) {
var resp []byte
resp, err = t.Dereference(c, actorIRI)
if err != nil {
return
}
var m map[string]interface{}
if err = json.Unmarshal(resp, &m); err != nil {
return
}
actor, err = streams.ToType(c, m)
if err != nil {
return
}
// Attempt to see if the 'actor' is really some sort of type that has
// an 'items' or 'orderedItems' property.
if v, ok := actor.(itemser); ok {
if i := v.GetActivityStreamsItems(); i != nil {
for iter := i.Begin(); iter != i.End(); iter = iter.Next() {
var id *url.URL
id, err = ToId(iter)
if err != nil {
return
}
moreActorIRIs = append(moreActorIRIs, id)
}
}
actor = nil
} else if v, ok := actor.(orderedItemser); ok {
if i := v.GetActivityStreamsOrderedItems(); i != nil {
for iter := i.Begin(); iter != i.End(); iter = iter.Next() {
var id *url.URL
id, err = ToId(iter)
if err != nil {
return
}
moreActorIRIs = append(moreActorIRIs, id)
}
}
actor = nil
}
return
}

View file

@ -1,82 +0,0 @@
package pub
import (
"context"
"github.com/go-fed/activity/streams/vocab"
"net/http"
)
// SocialProtocol contains behaviors an application needs to satisfy for the
// full ActivityPub C2S implementation to be supported by this library.
//
// It is only required if the client application wants to support the client-to-
// server, or social, protocol.
//
// It is passed to the library as a dependency injection from the client
// application.
type SocialProtocol interface {
// Hook callback after parsing the request body for a client request
// to the Actor's outbox.
//
// Can be used to set contextual information based on the
// ActivityStreams object received.
//
// Only called if the Social API is enabled.
//
// Warning: Neither authentication nor authorization has taken place at
// this time. Doing anything beyond setting contextual information is
// strongly discouraged.
//
// If an error is returned, it is passed back to the caller of
// PostOutbox. In this case, the DelegateActor implementation must not
// write a response to the ResponseWriter as is expected that the caller
// to PostOutbox will do so when handling the error.
PostOutboxRequestBodyHook(c context.Context, r *http.Request, data vocab.Type) (context.Context, error)
// AuthenticatePostOutbox delegates the authentication of a POST to an
// outbox.
//
// Only called if the Social API is enabled.
//
// If an error is returned, it is passed back to the caller of
// PostOutbox. In this case, the implementation must not write a
// response to the ResponseWriter as is expected that the client will
// do so when handling the error. The 'authenticated' is ignored.
//
// If no error is returned, but authentication or authorization fails,
// then authenticated must be false and error nil. It is expected that
// the implementation handles writing to the ResponseWriter in this
// case.
//
// Finally, if the authentication and authorization succeeds, then
// authenticated must be true and error nil. The request will continue
// to be processed.
AuthenticatePostOutbox(c context.Context, w http.ResponseWriter, r *http.Request) (out context.Context, authenticated bool, err error)
// SocialCallbacks returns the application logic that handles
// ActivityStreams received from C2S clients.
//
// Note that certain types of callbacks will be 'wrapped' with default
// behaviors supported natively by the library. Other callbacks
// compatible with streams.TypeResolver can be specified by 'other'.
//
// For example, setting the 'Create' field in the SocialWrappedCallbacks
// lets an application dependency inject additional behaviors they want
// to take place, including the default behavior supplied by this
// library. This is guaranteed to be compliant with the ActivityPub
// Social protocol.
//
// To override the default behavior, instead supply the function in
// 'other', which does not guarantee the application will be compliant
// with the ActivityPub Social Protocol.
//
// Applications are not expected to handle every single ActivityStreams
// type and extension. The unhandled ones are passed to DefaultCallback.
SocialCallbacks(c context.Context) (wrapped SocialWrappedCallbacks, other []interface{}, err error)
// DefaultCallback is called for types that go-fed can deserialize but
// are not handled by the application's callbacks returned in the
// Callbacks method.
//
// Applications are not expected to handle every single ActivityStreams
// type and extension, so the unhandled ones are passed to
// DefaultCallback.
DefaultCallback(c context.Context, activity Activity) error
}

View file

@ -1,531 +0,0 @@
package pub
import (
"context"
"fmt"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"net/url"
)
// SocialWrappedCallbacks lists the callback functions that already have some
// side effect behavior provided by the pub library.
//
// These functions are wrapped for the Social Protocol.
type SocialWrappedCallbacks struct {
// Create handles additional side effects for the Create ActivityStreams
// type.
//
// The wrapping callback copies the actor(s) to the 'attributedTo'
// property and copies recipients between the Create activity and all
// objects. It then saves the entry in the database.
Create func(context.Context, vocab.ActivityStreamsCreate) error
// Update handles additional side effects for the Update ActivityStreams
// type.
//
// The wrapping callback applies new top-level values on an object to
// the stored objects. Any top-level null literals will be deleted on
// the stored objects as well.
Update func(context.Context, vocab.ActivityStreamsUpdate) error
// Delete handles additional side effects for the Delete ActivityStreams
// type.
//
// The wrapping callback replaces the object(s) with tombstones in the
// database.
Delete func(context.Context, vocab.ActivityStreamsDelete) error
// Follow handles additional side effects for the Follow ActivityStreams
// type.
//
// The wrapping callback only ensures the 'Follow' has at least one
// 'object' entry, but otherwise has no default side effect.
Follow func(context.Context, vocab.ActivityStreamsFollow) error
// Add handles additional side effects for the Add ActivityStreams
// type.
//
//
// The wrapping function will add the 'object' IRIs to a specific
// 'target' collection if the 'target' collection(s) live on this
// server.
Add func(context.Context, vocab.ActivityStreamsAdd) error
// Remove handles additional side effects for the Remove ActivityStreams
// type.
//
// The wrapping function will remove all 'object' IRIs from a specific
// 'target' collection if the 'target' collection(s) live on this
// server.
Remove func(context.Context, vocab.ActivityStreamsRemove) error
// Like handles additional side effects for the Like ActivityStreams
// type.
//
// The wrapping function will add the objects on the activity to the
// "liked" collection of this actor.
Like func(context.Context, vocab.ActivityStreamsLike) error
// Undo handles additional side effects for the Undo ActivityStreams
// type.
//
//
// The wrapping function ensures the 'actor' on the 'Undo'
// is be the same as the 'actor' on all Activities being undone.
// It enforces that the actors on the Undo must correspond to all of the
// 'object' actors in some manner.
//
// It is expected that the application will implement the proper
// reversal of activities that are being undone.
Undo func(context.Context, vocab.ActivityStreamsUndo) error
// Block handles additional side effects for the Block ActivityStreams
// type.
//
// The wrapping callback only ensures the 'Block' has at least one
// 'object' entry, but otherwise has no default side effect. It is up
// to the wrapped application function to properly enforce the new
// blocking behavior.
//
// Note that go-fed does not federate 'Block' activities received in the
// Social Protocol.
Block func(context.Context, vocab.ActivityStreamsBlock) error
// Sidechannel data -- this is set at request handling time. These must
// be set before the callbacks are used.
// db is the Database the SocialWrappedCallbacks should use. It must be
// set before calling the callbacks.
db Database
// outboxIRI is the outboxIRI that is handling this callback.
outboxIRI *url.URL
// rawActivity is the JSON map literal received when deserializing the
// request body.
rawActivity map[string]interface{}
// clock is the server's clock.
clock Clock
// newTransport creates a new Transport.
newTransport func(c context.Context, actorBoxIRI *url.URL, gofedAgent string) (t Transport, err error)
// undeliverable is a sidechannel out, indicating if the handled activity
// should not be delivered to a peer.
//
// Its provided default value will always be used when a custom function
// is called.
undeliverable *bool
}
// callbacks returns the WrappedCallbacks members into a single interface slice
// for use in streams.Resolver callbacks.
//
// If the given functions have a type that collides with the default behavior,
// then disable our default behavior
func (w SocialWrappedCallbacks) callbacks(fns []interface{}) []interface{} {
enableCreate := true
enableUpdate := true
enableDelete := true
enableFollow := true
enableAdd := true
enableRemove := true
enableLike := true
enableUndo := true
enableBlock := true
for _, fn := range fns {
switch fn.(type) {
default:
continue
case func(context.Context, vocab.ActivityStreamsCreate) error:
enableCreate = false
case func(context.Context, vocab.ActivityStreamsUpdate) error:
enableUpdate = false
case func(context.Context, vocab.ActivityStreamsDelete) error:
enableDelete = false
case func(context.Context, vocab.ActivityStreamsFollow) error:
enableFollow = false
case func(context.Context, vocab.ActivityStreamsAdd) error:
enableAdd = false
case func(context.Context, vocab.ActivityStreamsRemove) error:
enableRemove = false
case func(context.Context, vocab.ActivityStreamsLike) error:
enableLike = false
case func(context.Context, vocab.ActivityStreamsUndo) error:
enableUndo = false
case func(context.Context, vocab.ActivityStreamsBlock) error:
enableBlock = false
}
}
if enableCreate {
fns = append(fns, w.create)
}
if enableUpdate {
fns = append(fns, w.update)
}
if enableDelete {
fns = append(fns, w.deleteFn)
}
if enableFollow {
fns = append(fns, w.follow)
}
if enableAdd {
fns = append(fns, w.add)
}
if enableRemove {
fns = append(fns, w.remove)
}
if enableLike {
fns = append(fns, w.like)
}
if enableUndo {
fns = append(fns, w.undo)
}
if enableBlock {
fns = append(fns, w.block)
}
return fns
}
// create implements the social Create activity side effects.
func (w SocialWrappedCallbacks) create(c context.Context, a vocab.ActivityStreamsCreate) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
// Obtain all actor IRIs.
actors := a.GetActivityStreamsActor()
createActorIds := make(map[string]*url.URL)
if actors != nil {
createActorIds = make(map[string]*url.URL, actors.Len())
for iter := actors.Begin(); iter != actors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
createActorIds[id.String()] = id
}
}
// Obtain each object's 'attributedTo' IRIs.
objectAttributedToIds := make([]map[string]*url.URL, op.Len())
for i := range objectAttributedToIds {
objectAttributedToIds[i] = make(map[string]*url.URL)
}
for i := 0; i < op.Len(); i++ {
t := op.At(i).GetType()
attrToer, ok := t.(attributedToer)
if !ok {
continue
}
attr := attrToer.GetActivityStreamsAttributedTo()
if attr == nil {
attr = streams.NewActivityStreamsAttributedToProperty()
attrToer.SetActivityStreamsAttributedTo(attr)
}
for iter := attr.Begin(); iter != attr.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objectAttributedToIds[i][id.String()] = id
}
}
// Put all missing actor IRIs onto all object attributedTo properties.
for k, v := range createActorIds {
for i, attributedToMap := range objectAttributedToIds {
if _, ok := attributedToMap[k]; !ok {
t := op.At(i).GetType()
attrToer, ok := t.(attributedToer)
if !ok {
continue
}
attr := attrToer.GetActivityStreamsAttributedTo()
attr.AppendIRI(v)
}
}
}
// Put all missing object attributedTo IRIs onto the actor property
// if there is one.
if actors != nil {
for _, attributedToMap := range objectAttributedToIds {
for k, v := range attributedToMap {
if _, ok := createActorIds[k]; !ok {
actors.AppendIRI(v)
}
}
}
}
// Copy over the 'to', 'bto', 'cc', 'bcc', and 'audience' recipients
// between the activity and all child objects and vice versa.
if err := normalizeRecipients(a); err != nil {
return err
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(i int) error {
obj := op.At(i).GetType()
id, err := GetId(obj)
if err != nil {
return err
}
err = w.db.Lock(c, id)
if err != nil {
return err
}
defer w.db.Unlock(c, id)
if err := w.db.Create(c, obj); err != nil {
return err
}
return nil
}
// Persist all objects we've created, which will include sensitive
// recipients such as 'bcc' and 'bto'.
for i := 0; i < op.Len(); i++ {
if err := loopFn(i); err != nil {
return err
}
}
if w.Create != nil {
return w.Create(c, a)
}
return nil
}
// update implements the social Update activity side effects.
func (w SocialWrappedCallbacks) update(c context.Context, a vocab.ActivityStreamsUpdate) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
// Obtain all object ids, which should be owned by this server.
objIds := make([]*url.URL, 0, op.Len())
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objIds = append(objIds, id)
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(idx int, loopId *url.URL) error {
err := w.db.Lock(c, loopId)
if err != nil {
return err
}
defer w.db.Unlock(c, loopId)
t, err := w.db.Get(c, loopId)
if err != nil {
return err
}
m, err := t.Serialize()
if err != nil {
return err
}
// Copy over new top-level values.
objType := op.At(idx).GetType()
if objType == nil {
return fmt.Errorf("object at index %d is not a literal type value", idx)
}
newM, err := objType.Serialize()
if err != nil {
return err
}
for k, v := range newM {
m[k] = v
}
// Delete top-level values where the raw Activity had nils.
for k, v := range w.rawActivity {
if _, ok := m[k]; v == nil && ok {
delete(m, k)
}
}
newT, err := streams.ToType(c, m)
if err != nil {
return err
}
if err = w.db.Update(c, newT); err != nil {
return err
}
return nil
}
for i, id := range objIds {
if err := loopFn(i, id); err != nil {
return err
}
}
if w.Update != nil {
return w.Update(c, a)
}
return nil
}
// deleteFn implements the social Delete activity side effects.
func (w SocialWrappedCallbacks) deleteFn(c context.Context, a vocab.ActivityStreamsDelete) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
// Obtain all object ids, which should be owned by this server.
objIds := make([]*url.URL, 0, op.Len())
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objIds = append(objIds, id)
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(idx int, loopId *url.URL) error {
err := w.db.Lock(c, loopId)
if err != nil {
return err
}
defer w.db.Unlock(c, loopId)
t, err := w.db.Get(c, loopId)
if err != nil {
return err
}
tomb := toTombstone(t, loopId, w.clock.Now())
if err := w.db.Update(c, tomb); err != nil {
return err
}
return nil
}
for i, id := range objIds {
if err := loopFn(i, id); err != nil {
return err
}
}
if w.Delete != nil {
return w.Delete(c, a)
}
return nil
}
// follow implements the social Follow activity side effects.
func (w SocialWrappedCallbacks) follow(c context.Context, a vocab.ActivityStreamsFollow) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
if w.Follow != nil {
return w.Follow(c, a)
}
return nil
}
// add implements the social Add activity side effects.
func (w SocialWrappedCallbacks) add(c context.Context, a vocab.ActivityStreamsAdd) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
target := a.GetActivityStreamsTarget()
if target == nil || target.Len() == 0 {
return ErrTargetRequired
}
if err := add(c, op, target, w.db); err != nil {
return err
}
if w.Add != nil {
return w.Add(c, a)
}
return nil
}
// remove implements the social Remove activity side effects.
func (w SocialWrappedCallbacks) remove(c context.Context, a vocab.ActivityStreamsRemove) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
target := a.GetActivityStreamsTarget()
if target == nil || target.Len() == 0 {
return ErrTargetRequired
}
if err := remove(c, op, target, w.db); err != nil {
return err
}
if w.Remove != nil {
return w.Remove(c, a)
}
return nil
}
// like implements the social Like activity side effects.
func (w SocialWrappedCallbacks) like(c context.Context, a vocab.ActivityStreamsLike) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
// Get this actor's IRI.
if err := w.db.Lock(c, w.outboxIRI); err != nil {
return err
}
// WARNING: Unlock not deferred.
actorIRI, err := w.db.ActorForOutbox(c, w.outboxIRI)
if err != nil {
w.db.Unlock(c, w.outboxIRI)
return err
}
w.db.Unlock(c, w.outboxIRI)
// Unlock must be called by now and every branch above.
//
// Now obtain this actor's 'liked' collection.
if err := w.db.Lock(c, actorIRI); err != nil {
return err
}
defer w.db.Unlock(c, actorIRI)
liked, err := w.db.Liked(c, actorIRI)
if err != nil {
return err
}
likedItems := liked.GetActivityStreamsItems()
if likedItems == nil {
likedItems = streams.NewActivityStreamsItemsProperty()
liked.SetActivityStreamsItems(likedItems)
}
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
objId, err := ToId(iter)
if err != nil {
return err
}
likedItems.PrependIRI(objId)
}
err = w.db.Update(c, liked)
if err != nil {
return err
}
if w.Like != nil {
return w.Like(c, a)
}
return nil
}
// undo implements the social Undo activity side effects.
func (w SocialWrappedCallbacks) undo(c context.Context, a vocab.ActivityStreamsUndo) error {
*w.undeliverable = false
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
actors := a.GetActivityStreamsActor()
if err := mustHaveActivityActorsMatchObjectActors(c, actors, op, w.newTransport, w.outboxIRI); err != nil {
return err
}
if w.Undo != nil {
return w.Undo(c, a)
}
return nil
}
// block implements the social Block activity side effects.
func (w SocialWrappedCallbacks) block(c context.Context, a vocab.ActivityStreamsBlock) error {
*w.undeliverable = true
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return ErrObjectRequired
}
if w.Block != nil {
return w.Block(c, a)
}
return nil
}

View file

@ -1,995 +0,0 @@
package pub
import (
"bytes"
"context"
"crypto/sha256"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
"github.com/go-fed/activity/streams"
"github.com/go-fed/activity/streams/vocab"
"net/http"
"net/url"
"strings"
"time"
)
var (
// ErrObjectRequired indicates the activity needs its object property
// set. Can be returned by DelegateActor's PostInbox or PostOutbox so a
// Bad Request response is set.
ErrObjectRequired = errors.New("object property required on the provided activity")
// ErrTargetRequired indicates the activity needs its target property
// set. Can be returned by DelegateActor's PostInbox or PostOutbox so a
// Bad Request response is set.
ErrTargetRequired = errors.New("target property required on the provided activity")
)
// activityStreamsMediaTypes contains all of the accepted ActivityStreams media
// types. Generated at init time.
var activityStreamsMediaTypes []string
func init() {
activityStreamsMediaTypes = []string{
"application/activity+json",
}
jsonLdType := "application/ld+json"
for _, semi := range []string{";", " ;", " ; ", "; "} {
for _, profile := range []string{
"profile=https://www.w3.org/ns/activitystreams",
"profile=\"https://www.w3.org/ns/activitystreams\"",
} {
activityStreamsMediaTypes = append(
activityStreamsMediaTypes,
fmt.Sprintf("%s%s%s", jsonLdType, semi, profile))
}
}
}
// headerIsActivityPubMediaType returns true if the header string contains one
// of the accepted ActivityStreams media types.
//
// Note we don't try to build a comprehensive parser and instead accept a
// tolerable amount of whitespace since the HTTP specification is ambiguous
// about the format and significance of whitespace.
func headerIsActivityPubMediaType(header string) bool {
for _, mediaType := range activityStreamsMediaTypes {
if strings.Contains(header, mediaType) {
return true
}
}
return false
}
const (
// The Content-Type header.
contentTypeHeader = "Content-Type"
// The Accept header.
acceptHeader = "Accept"
)
// isActivityPubPost returns true if the request is a POST request that has the
// ActivityStreams content type header
func isActivityPubPost(r *http.Request) bool {
return r.Method == "POST" && headerIsActivityPubMediaType(r.Header.Get(contentTypeHeader))
}
// isActivityPubGet returns true if the request is a GET request that has the
// ActivityStreams content type header
func isActivityPubGet(r *http.Request) bool {
return r.Method == "GET" && headerIsActivityPubMediaType(r.Header.Get(acceptHeader))
}
// dedupeOrderedItems deduplicates the 'orderedItems' within an ordered
// collection type. Deduplication happens by the 'id' property.
func dedupeOrderedItems(oc orderedItemser) error {
oi := oc.GetActivityStreamsOrderedItems()
if oi == nil {
return nil
}
seen := make(map[string]bool, oi.Len())
for i := 0; i < oi.Len(); {
var id *url.URL
iter := oi.At(i)
asType := iter.GetType()
if asType != nil {
var err error
id, err = GetId(asType)
if err != nil {
return err
}
} else if iter.IsIRI() {
id = iter.GetIRI()
} else {
return fmt.Errorf("element %d in OrderedCollection does not have an ID nor is an IRI", i)
}
if seen[id.String()] {
oi.Remove(i)
} else {
seen[id.String()] = true
i++
}
}
return nil
}
const (
// The Location header
locationHeader = "Location"
// Contains the ActivityStreams Content-Type value.
contentTypeHeaderValue = "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\""
// The Date header.
dateHeader = "Date"
// The Digest header.
digestHeader = "Digest"
// The delimiter used in the Digest header.
digestDelimiter = "="
// SHA-256 string for the Digest header.
sha256Digest = "SHA-256"
)
// addResponseHeaders sets headers needed in the HTTP response, such but not
// limited to the Content-Type, Date, and Digest headers.
func addResponseHeaders(h http.Header, c Clock, responseContent []byte) {
h.Set(contentTypeHeader, contentTypeHeaderValue)
// RFC 7231 §7.1.1.2
h.Set(dateHeader, c.Now().UTC().Format("Mon, 02 Jan 2006 15:04:05")+" GMT")
// RFC 3230 and RFC 5843
var b bytes.Buffer
b.WriteString(sha256Digest)
b.WriteString(digestDelimiter)
hashed := sha256.Sum256(responseContent)
b.WriteString(base64.StdEncoding.EncodeToString(hashed[:]))
h.Set(digestHeader, b.String())
}
// IdProperty is a property that can readily have its id obtained
type IdProperty interface {
// GetIRI returns the IRI of this property. When IsIRI returns false,
// GetIRI will return an 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() vocab.Type
// IsIRI returns true if this property is an IRI.
IsIRI() bool
}
// ToId returns an IdProperty's id.
func ToId(i IdProperty) (*url.URL, error) {
if i.GetType() != nil {
return GetId(i.GetType())
} else if i.IsIRI() {
return i.GetIRI(), nil
}
return nil, fmt.Errorf("cannot determine id of activitystreams property")
}
// GetId will attempt to find the 'id' property or, if it happens to be a
// Link or derived from Link type, the 'href' property instead.
//
// Returns an error if the id is not set and either the 'href' property is not
// valid on this type, or it is also not set.
func GetId(t vocab.Type) (*url.URL, error) {
if id := t.GetJSONLDId(); id != nil {
return id.Get(), nil
} else if h, ok := t.(hrefer); ok {
if href := h.GetActivityStreamsHref(); href != nil {
return href.Get(), nil
}
}
return nil, fmt.Errorf("cannot determine id of activitystreams value")
}
// getInboxForwardingValues obtains the 'inReplyTo', 'object', 'target', and
// 'tag' values on an ActivityStreams value.
func getInboxForwardingValues(o vocab.Type) (t []vocab.Type, iri []*url.URL) {
// 'inReplyTo'
if i, ok := o.(inReplyToer); ok {
if irt := i.GetActivityStreamsInReplyTo(); irt != nil {
for iter := irt.Begin(); iter != irt.End(); iter = iter.Next() {
if tv := iter.GetType(); tv != nil {
t = append(t, tv)
} else {
iri = append(iri, iter.GetIRI())
}
}
}
}
// 'tag'
if i, ok := o.(tagger); ok {
if tag := i.GetActivityStreamsTag(); tag != nil {
for iter := tag.Begin(); iter != tag.End(); iter = iter.Next() {
if tv := iter.GetType(); tv != nil {
t = append(t, tv)
} else {
iri = append(iri, iter.GetIRI())
}
}
}
}
// 'object'
if i, ok := o.(objecter); ok {
if obj := i.GetActivityStreamsObject(); obj != nil {
for iter := obj.Begin(); iter != obj.End(); iter = iter.Next() {
if tv := iter.GetType(); tv != nil {
t = append(t, tv)
} else {
iri = append(iri, iter.GetIRI())
}
}
}
}
// 'target'
if i, ok := o.(targeter); ok {
if tar := i.GetActivityStreamsTarget(); tar != nil {
for iter := tar.Begin(); iter != tar.End(); iter = iter.Next() {
if tv := iter.GetType(); tv != nil {
t = append(t, tv)
} else {
iri = append(iri, iter.GetIRI())
}
}
}
}
return
}
// wrapInCreate will automatically wrap the provided object in a Create
// activity. This will copy over the 'to', 'bto', 'cc', 'bcc', and 'audience'
// properties. It will also copy over the published time if present.
func wrapInCreate(ctx context.Context, o vocab.Type, actor *url.URL) (c vocab.ActivityStreamsCreate, err error) {
c = streams.NewActivityStreamsCreate()
// Object property
oProp := streams.NewActivityStreamsObjectProperty()
oProp.AppendType(o)
c.SetActivityStreamsObject(oProp)
// Actor Property
actorProp := streams.NewActivityStreamsActorProperty()
actorProp.AppendIRI(actor)
c.SetActivityStreamsActor(actorProp)
// Published Property
if v, ok := o.(publisheder); ok {
c.SetActivityStreamsPublished(v.GetActivityStreamsPublished())
}
// Copying over properties.
if v, ok := o.(toer); ok {
if to := v.GetActivityStreamsTo(); to != nil {
activityTo := streams.NewActivityStreamsToProperty()
for iter := to.Begin(); iter != to.End(); iter = iter.Next() {
var id *url.URL
id, err = ToId(iter)
if err != nil {
return
}
activityTo.AppendIRI(id)
}
c.SetActivityStreamsTo(activityTo)
}
}
if v, ok := o.(btoer); ok {
if bto := v.GetActivityStreamsBto(); bto != nil {
activityBto := streams.NewActivityStreamsBtoProperty()
for iter := bto.Begin(); iter != bto.End(); iter = iter.Next() {
var id *url.URL
id, err = ToId(iter)
if err != nil {
return
}
activityBto.AppendIRI(id)
}
c.SetActivityStreamsBto(activityBto)
}
}
if v, ok := o.(ccer); ok {
if cc := v.GetActivityStreamsCc(); cc != nil {
activityCc := streams.NewActivityStreamsCcProperty()
for iter := cc.Begin(); iter != cc.End(); iter = iter.Next() {
var id *url.URL
id, err = ToId(iter)
if err != nil {
return
}
activityCc.AppendIRI(id)
}
c.SetActivityStreamsCc(activityCc)
}
}
if v, ok := o.(bccer); ok {
if bcc := v.GetActivityStreamsBcc(); bcc != nil {
activityBcc := streams.NewActivityStreamsBccProperty()
for iter := bcc.Begin(); iter != bcc.End(); iter = iter.Next() {
var id *url.URL
id, err = ToId(iter)
if err != nil {
return
}
activityBcc.AppendIRI(id)
}
c.SetActivityStreamsBcc(activityBcc)
}
}
if v, ok := o.(audiencer); ok {
if aud := v.GetActivityStreamsAudience(); aud != nil {
activityAudience := streams.NewActivityStreamsAudienceProperty()
for iter := aud.Begin(); iter != aud.End(); iter = iter.Next() {
var id *url.URL
id, err = ToId(iter)
if err != nil {
return
}
activityAudience.AppendIRI(id)
}
c.SetActivityStreamsAudience(activityAudience)
}
}
return
}
// filterURLs removes urls whose strings match the provided filter
func filterURLs(u []*url.URL, fn func(s string) bool) []*url.URL {
i := 0
for i < len(u) {
if fn(u[i].String()) {
u = append(u[:i], u[i+1:]...)
} else {
i++
}
}
return u
}
const (
// PublicActivityPubIRI is the IRI that indicates an Activity is meant
// to be visible for general public consumption.
PublicActivityPubIRI = "https://www.w3.org/ns/activitystreams#Public"
publicJsonLD = "Public"
publicJsonLDAS = "as:Public"
)
// IsPublic determines if an IRI string is the Public collection as defined in
// the spec, including JSON-LD compliant collections.
func IsPublic(s string) bool {
return s == PublicActivityPubIRI || s == publicJsonLD || s == publicJsonLDAS
}
// getInboxes extracts the 'inbox' IRIs from actor types.
func getInboxes(t []vocab.Type) (u []*url.URL, err error) {
for _, elem := range t {
var iri *url.URL
iri, err = getInbox(elem)
if err != nil {
return
}
u = append(u, iri)
}
return
}
// getInbox extracts the 'inbox' IRI from an actor type.
func getInbox(t vocab.Type) (u *url.URL, err error) {
ib, ok := t.(inboxer)
if !ok {
err = fmt.Errorf("actor type %T has no inbox", t)
return
}
inbox := ib.GetActivityStreamsInbox()
return ToId(inbox)
}
// dedupeIRIs will deduplicate final inbox IRIs. The ignore list is applied to
// the final list.
func dedupeIRIs(recipients, ignored []*url.URL) (out []*url.URL) {
ignoredMap := make(map[string]bool, len(ignored))
for _, elem := range ignored {
ignoredMap[elem.String()] = true
}
outMap := make(map[string]bool, len(recipients))
for _, k := range recipients {
kStr := k.String()
if !ignoredMap[kStr] && !outMap[kStr] {
out = append(out, k)
outMap[kStr] = true
}
}
return
}
// stripHiddenRecipients removes "bto" and "bcc" from the activity.
//
// Note that this requirement of the specification is under "Section 6: Client
// to Server Interactions", the Social API, and not the Federative API.
func stripHiddenRecipients(activity Activity) {
activity.SetActivityStreamsBto(nil)
activity.SetActivityStreamsBcc(nil)
op := activity.GetActivityStreamsObject()
if op != nil {
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
if v, ok := iter.GetType().(btoer); ok {
v.SetActivityStreamsBto(nil)
}
if v, ok := iter.GetType().(bccer); ok {
v.SetActivityStreamsBcc(nil)
}
}
}
}
// mustHaveActivityOriginMatchObjects ensures that the Host in the activity id
// IRI matches all of the Hosts in the object id IRIs.
func mustHaveActivityOriginMatchObjects(a Activity) error {
originIRI, err := GetId(a)
if err != nil {
return err
}
originHost := originIRI.Host
op := a.GetActivityStreamsObject()
if op == nil || op.Len() == 0 {
return nil
}
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
iri, err := ToId(iter)
if err != nil {
return err
}
if originHost != iri.Host {
return fmt.Errorf("object %q: not in activity origin", iri)
}
}
return nil
}
// normalizeRecipients ensures the activity and object have the same 'to',
// 'bto', 'cc', 'bcc', and 'audience' properties. Copy the Activity's recipients
// to objects, and the objects to the activity, but does NOT copy objects'
// recipients to each other.
func normalizeRecipients(a vocab.ActivityStreamsCreate) error {
// Phase 0: Acquire all recipients on the activity.
//
// Obtain the actorTo map
actorToMap := make(map[string]*url.URL)
actorTo := a.GetActivityStreamsTo()
if actorTo == nil {
actorTo = streams.NewActivityStreamsToProperty()
a.SetActivityStreamsTo(actorTo)
}
for iter := actorTo.Begin(); iter != actorTo.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
actorToMap[id.String()] = id
}
// Obtain the actorBto map
actorBtoMap := make(map[string]*url.URL)
actorBto := a.GetActivityStreamsBto()
if actorBto == nil {
actorBto = streams.NewActivityStreamsBtoProperty()
a.SetActivityStreamsBto(actorBto)
}
for iter := actorBto.Begin(); iter != actorBto.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
actorBtoMap[id.String()] = id
}
// Obtain the actorCc map
actorCcMap := make(map[string]*url.URL)
actorCc := a.GetActivityStreamsCc()
if actorCc == nil {
actorCc = streams.NewActivityStreamsCcProperty()
a.SetActivityStreamsCc(actorCc)
}
for iter := actorCc.Begin(); iter != actorCc.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
actorCcMap[id.String()] = id
}
// Obtain the actorBcc map
actorBccMap := make(map[string]*url.URL)
actorBcc := a.GetActivityStreamsBcc()
if actorBcc == nil {
actorBcc = streams.NewActivityStreamsBccProperty()
a.SetActivityStreamsBcc(actorBcc)
}
for iter := actorBcc.Begin(); iter != actorBcc.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
actorBccMap[id.String()] = id
}
// Obtain the actorAudience map
actorAudienceMap := make(map[string]*url.URL)
actorAudience := a.GetActivityStreamsAudience()
if actorAudience == nil {
actorAudience = streams.NewActivityStreamsAudienceProperty()
a.SetActivityStreamsAudience(actorAudience)
}
for iter := actorAudience.Begin(); iter != actorAudience.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
actorAudienceMap[id.String()] = id
}
// Obtain the objects maps for each recipient type.
o := a.GetActivityStreamsObject()
objsTo := make([]map[string]*url.URL, o.Len())
objsBto := make([]map[string]*url.URL, o.Len())
objsCc := make([]map[string]*url.URL, o.Len())
objsBcc := make([]map[string]*url.URL, o.Len())
objsAudience := make([]map[string]*url.URL, o.Len())
for i := 0; i < o.Len(); i++ {
iter := o.At(i)
// Phase 1: Acquire all existing recipients on the object.
//
// Object to
objsTo[i] = make(map[string]*url.URL)
var oTo vocab.ActivityStreamsToProperty
if tr, ok := iter.GetType().(toer); !ok {
return fmt.Errorf("the Create object at %d has no 'to' property", i)
} else {
oTo = tr.GetActivityStreamsTo()
if oTo == nil {
oTo = streams.NewActivityStreamsToProperty()
tr.SetActivityStreamsTo(oTo)
}
}
for iter := oTo.Begin(); iter != oTo.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objsTo[i][id.String()] = id
}
// Object bto
objsBto[i] = make(map[string]*url.URL)
var oBto vocab.ActivityStreamsBtoProperty
if tr, ok := iter.GetType().(btoer); !ok {
return fmt.Errorf("the Create object at %d has no 'bto' property", i)
} else {
oBto = tr.GetActivityStreamsBto()
if oBto == nil {
oBto = streams.NewActivityStreamsBtoProperty()
tr.SetActivityStreamsBto(oBto)
}
}
for iter := oBto.Begin(); iter != oBto.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objsBto[i][id.String()] = id
}
// Object cc
objsCc[i] = make(map[string]*url.URL)
var oCc vocab.ActivityStreamsCcProperty
if tr, ok := iter.GetType().(ccer); !ok {
return fmt.Errorf("the Create object at %d has no 'cc' property", i)
} else {
oCc = tr.GetActivityStreamsCc()
if oCc == nil {
oCc = streams.NewActivityStreamsCcProperty()
tr.SetActivityStreamsCc(oCc)
}
}
for iter := oCc.Begin(); iter != oCc.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objsCc[i][id.String()] = id
}
// Object bcc
objsBcc[i] = make(map[string]*url.URL)
var oBcc vocab.ActivityStreamsBccProperty
if tr, ok := iter.GetType().(bccer); !ok {
return fmt.Errorf("the Create object at %d has no 'bcc' property", i)
} else {
oBcc = tr.GetActivityStreamsBcc()
if oBcc == nil {
oBcc = streams.NewActivityStreamsBccProperty()
tr.SetActivityStreamsBcc(oBcc)
}
}
for iter := oBcc.Begin(); iter != oBcc.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objsBcc[i][id.String()] = id
}
// Object audience
objsAudience[i] = make(map[string]*url.URL)
var oAudience vocab.ActivityStreamsAudienceProperty
if tr, ok := iter.GetType().(audiencer); !ok {
return fmt.Errorf("the Create object at %d has no 'audience' property", i)
} else {
oAudience = tr.GetActivityStreamsAudience()
if oAudience == nil {
oAudience = streams.NewActivityStreamsAudienceProperty()
tr.SetActivityStreamsAudience(oAudience)
}
}
for iter := oAudience.Begin(); iter != oAudience.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
objsAudience[i][id.String()] = id
}
// Phase 2: Apply missing recipients to the object from the
// activity.
//
// Activity to -> Object to
for k, v := range actorToMap {
if _, ok := objsTo[i][k]; !ok {
oTo.AppendIRI(v)
}
}
// Activity bto -> Object bto
for k, v := range actorBtoMap {
if _, ok := objsBto[i][k]; !ok {
oBto.AppendIRI(v)
}
}
// Activity cc -> Object cc
for k, v := range actorCcMap {
if _, ok := objsCc[i][k]; !ok {
oCc.AppendIRI(v)
}
}
// Activity bcc -> Object bcc
for k, v := range actorBccMap {
if _, ok := objsBcc[i][k]; !ok {
oBcc.AppendIRI(v)
}
}
// Activity audience -> Object audience
for k, v := range actorAudienceMap {
if _, ok := objsAudience[i][k]; !ok {
oAudience.AppendIRI(v)
}
}
}
// Phase 3: Apply missing recipients to the activity from the objects.
//
// Object to -> Activity to
for i := 0; i < len(objsTo); i++ {
for k, v := range objsTo[i] {
if _, ok := actorToMap[k]; !ok {
actorTo.AppendIRI(v)
}
}
}
// Object bto -> Activity bto
for i := 0; i < len(objsBto); i++ {
for k, v := range objsBto[i] {
if _, ok := actorBtoMap[k]; !ok {
actorBto.AppendIRI(v)
}
}
}
// Object cc -> Activity cc
for i := 0; i < len(objsCc); i++ {
for k, v := range objsCc[i] {
if _, ok := actorCcMap[k]; !ok {
actorCc.AppendIRI(v)
}
}
}
// Object bcc -> Activity bcc
for i := 0; i < len(objsBcc); i++ {
for k, v := range objsBcc[i] {
if _, ok := actorBccMap[k]; !ok {
actorBcc.AppendIRI(v)
}
}
}
// Object audience -> Activity audience
for i := 0; i < len(objsAudience); i++ {
for k, v := range objsAudience[i] {
if _, ok := actorAudienceMap[k]; !ok {
actorAudience.AppendIRI(v)
}
}
}
return nil
}
// toTombstone creates a Tombstone object for the given ActivityStreams value.
func toTombstone(obj vocab.Type, id *url.URL, now time.Time) vocab.ActivityStreamsTombstone {
tomb := streams.NewActivityStreamsTombstone()
// id property
idProp := streams.NewJSONLDIdProperty()
idProp.Set(id)
tomb.SetJSONLDId(idProp)
// formerType property
former := streams.NewActivityStreamsFormerTypeProperty()
tomb.SetActivityStreamsFormerType(former)
// Populate Former Type
former.AppendXMLSchemaString(obj.GetTypeName())
// Copy over the published property if it existed
if pubber, ok := obj.(publisheder); ok {
if pub := pubber.GetActivityStreamsPublished(); pub != nil {
tomb.SetActivityStreamsPublished(pub)
}
}
// Copy over the updated property if it existed
if upder, ok := obj.(updateder); ok {
if upd := upder.GetActivityStreamsUpdated(); upd != nil {
tomb.SetActivityStreamsUpdated(upd)
}
}
// Set deleted time to now.
deleted := streams.NewActivityStreamsDeletedProperty()
deleted.Set(now)
tomb.SetActivityStreamsDeleted(deleted)
return tomb
}
// mustHaveActivityActorsMatchObjectActors ensures that the actors on types in
// the 'object' property are all listed in the 'actor' property.
func mustHaveActivityActorsMatchObjectActors(c context.Context,
actors vocab.ActivityStreamsActorProperty,
op vocab.ActivityStreamsObjectProperty,
newTransport func(c context.Context, actorBoxIRI *url.URL, gofedAgent string) (t Transport, err error),
boxIRI *url.URL) error {
activityActorMap := make(map[string]bool, actors.Len())
for iter := actors.Begin(); iter != actors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
activityActorMap[id.String()] = true
}
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
iri, err := ToId(iter)
if err != nil {
return err
}
// Attempt to dereference the IRI, regardless whether it is a
// type or IRI
tport, err := newTransport(c, boxIRI, goFedUserAgent())
if err != nil {
return err
}
b, err := tport.Dereference(c, iri)
if err != nil {
return err
}
var m map[string]interface{}
if err = json.Unmarshal(b, &m); err != nil {
return err
}
t, err := streams.ToType(c, m)
if err != nil {
return err
}
ac, ok := t.(actorer)
if !ok {
return fmt.Errorf("cannot verify actors: object value has no 'actor' property")
}
objActors := ac.GetActivityStreamsActor()
for iter := objActors.Begin(); iter != objActors.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
if !activityActorMap[id.String()] {
return fmt.Errorf("activity does not have all actors from its object's actors")
}
}
}
return nil
}
// add implements the logic of adding object ids to a target Collection or
// OrderedCollection. This logic is shared by both the C2S and S2S protocols.
func add(c context.Context,
op vocab.ActivityStreamsObjectProperty,
target vocab.ActivityStreamsTargetProperty,
db Database) error {
opIds := make([]*url.URL, 0, op.Len())
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
opIds = append(opIds, id)
}
targetIds := make([]*url.URL, 0, op.Len())
for iter := target.Begin(); iter != target.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
targetIds = append(targetIds, id)
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(t *url.URL) error {
if err := db.Lock(c, t); err != nil {
return err
}
defer db.Unlock(c, t)
if owns, err := db.Owns(c, t); err != nil {
return err
} else if !owns {
return nil
}
tp, err := db.Get(c, t)
if err != nil {
return err
}
if streams.IsOrExtendsActivityStreamsOrderedCollection(tp) {
oi, ok := tp.(orderedItemser)
if !ok {
return fmt.Errorf("type extending from OrderedCollection cannot convert to orderedItemser interface")
}
oiProp := oi.GetActivityStreamsOrderedItems()
if oiProp == nil {
oiProp = streams.NewActivityStreamsOrderedItemsProperty()
oi.SetActivityStreamsOrderedItems(oiProp)
}
for _, objId := range opIds {
oiProp.AppendIRI(objId)
}
} else if streams.IsOrExtendsActivityStreamsCollection(tp) {
i, ok := tp.(itemser)
if !ok {
return fmt.Errorf("type extending from Collection cannot convert to itemser interface")
}
iProp := i.GetActivityStreamsItems()
if iProp == nil {
iProp = streams.NewActivityStreamsItemsProperty()
i.SetActivityStreamsItems(iProp)
}
for _, objId := range opIds {
iProp.AppendIRI(objId)
}
} else {
return fmt.Errorf("target in Add is neither a Collection nor an OrderedCollection")
}
err = db.Update(c, tp)
if err != nil {
return err
}
return nil
}
for _, t := range targetIds {
if err := loopFn(t); err != nil {
return err
}
}
return nil
}
// remove implements the logic of removing object ids to a target Collection or
// OrderedCollection. This logic is shared by both the C2S and S2S protocols.
func remove(c context.Context,
op vocab.ActivityStreamsObjectProperty,
target vocab.ActivityStreamsTargetProperty,
db Database) error {
opIds := make(map[string]bool, op.Len())
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
opIds[id.String()] = true
}
targetIds := make([]*url.URL, 0, op.Len())
for iter := target.Begin(); iter != target.End(); iter = iter.Next() {
id, err := ToId(iter)
if err != nil {
return err
}
targetIds = append(targetIds, id)
}
// Create anonymous loop function to be able to properly scope the defer
// for the database lock at each iteration.
loopFn := func(t *url.URL) error {
if err := db.Lock(c, t); err != nil {
return err
}
defer db.Unlock(c, t)
if owns, err := db.Owns(c, t); err != nil {
return err
} else if !owns {
return nil
}
tp, err := db.Get(c, t)
if err != nil {
return err
}
if streams.IsOrExtendsActivityStreamsOrderedCollection(tp) {
oi, ok := tp.(orderedItemser)
if !ok {
return fmt.Errorf("type extending from OrderedCollection cannot convert to orderedItemser interface")
}
oiProp := oi.GetActivityStreamsOrderedItems()
if oiProp != nil {
for i := 0; i < oiProp.Len(); /*Conditional*/ {
id, err := ToId(oiProp.At(i))
if err != nil {
return err
}
if opIds[id.String()] {
oiProp.Remove(i)
} else {
i++
}
}
}
} else if streams.IsOrExtendsActivityStreamsCollection(tp) {
i, ok := tp.(itemser)
if !ok {
return fmt.Errorf("type extending from Collection cannot convert to itemser interface")
}
iProp := i.GetActivityStreamsItems()
if iProp != nil {
for i := 0; i < iProp.Len(); /*Conditional*/ {
id, err := ToId(iProp.At(i))
if err != nil {
return err
}
if opIds[id.String()] {
iProp.Remove(i)
} else {
i++
}
}
}
} else {
return fmt.Errorf("target in Remove is neither a Collection nor an OrderedCollection")
}
err = db.Update(c, tp)
if err != nil {
return err
}
return nil
}
for _, t := range targetIds {
if err := loopFn(t); err != nil {
return err
}
}
return nil
}
// clearSensitiveFields removes the 'bto' and 'bcc' entries on the given value
// and recursively on every 'object' property value.
func clearSensitiveFields(obj vocab.Type) {
if t, ok := obj.(btoer); ok {
t.SetActivityStreamsBto(nil)
}
if t, ok := obj.(bccer); ok {
t.SetActivityStreamsBcc(nil)
}
if t, ok := obj.(objecter); ok {
op := t.GetActivityStreamsObject()
if op != nil {
for iter := op.Begin(); iter != op.End(); iter = iter.Next() {
clearSensitiveFields(iter.GetType())
}
}
}
}
// requestId forms an ActivityPub id based on the HTTP request. Always assumes
// that the id is HTTPS.
func requestId(r *http.Request, scheme string) *url.URL {
id := r.URL
id.Host = r.Host
id.Scheme = scheme
return id
}

View file

@ -1,504 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
// ActivityStreamsAcceptName is the string literal of the name for the Accept type in the ActivityStreams vocabulary.
var ActivityStreamsAcceptName string = "Accept"
// ActivityStreamsActivityName is the string literal of the name for the Activity type in the ActivityStreams vocabulary.
var ActivityStreamsActivityName string = "Activity"
// ActivityStreamsAddName is the string literal of the name for the Add type in the ActivityStreams vocabulary.
var ActivityStreamsAddName string = "Add"
// ActivityStreamsAnnounceName is the string literal of the name for the Announce type in the ActivityStreams vocabulary.
var ActivityStreamsAnnounceName string = "Announce"
// ActivityStreamsApplicationName is the string literal of the name for the Application type in the ActivityStreams vocabulary.
var ActivityStreamsApplicationName string = "Application"
// ActivityStreamsArriveName is the string literal of the name for the Arrive type in the ActivityStreams vocabulary.
var ActivityStreamsArriveName string = "Arrive"
// ActivityStreamsArticleName is the string literal of the name for the Article type in the ActivityStreams vocabulary.
var ActivityStreamsArticleName string = "Article"
// ActivityStreamsAudioName is the string literal of the name for the Audio type in the ActivityStreams vocabulary.
var ActivityStreamsAudioName string = "Audio"
// ActivityStreamsBlockName is the string literal of the name for the Block type in the ActivityStreams vocabulary.
var ActivityStreamsBlockName string = "Block"
// ForgeFedBranchName is the string literal of the name for the Branch type in the ForgeFed vocabulary.
var ForgeFedBranchName string = "Branch"
// ActivityStreamsCollectionName is the string literal of the name for the Collection type in the ActivityStreams vocabulary.
var ActivityStreamsCollectionName string = "Collection"
// ActivityStreamsCollectionPageName is the string literal of the name for the CollectionPage type in the ActivityStreams vocabulary.
var ActivityStreamsCollectionPageName string = "CollectionPage"
// ForgeFedCommitName is the string literal of the name for the Commit type in the ForgeFed vocabulary.
var ForgeFedCommitName string = "Commit"
// ActivityStreamsCreateName is the string literal of the name for the Create type in the ActivityStreams vocabulary.
var ActivityStreamsCreateName string = "Create"
// ActivityStreamsDeleteName is the string literal of the name for the Delete type in the ActivityStreams vocabulary.
var ActivityStreamsDeleteName string = "Delete"
// ActivityStreamsDislikeName is the string literal of the name for the Dislike type in the ActivityStreams vocabulary.
var ActivityStreamsDislikeName string = "Dislike"
// ActivityStreamsDocumentName is the string literal of the name for the Document type in the ActivityStreams vocabulary.
var ActivityStreamsDocumentName string = "Document"
// TootEmojiName is the string literal of the name for the Emoji type in the Toot vocabulary.
var TootEmojiName string = "Emoji"
// ActivityStreamsEventName is the string literal of the name for the Event type in the ActivityStreams vocabulary.
var ActivityStreamsEventName string = "Event"
// ActivityStreamsFlagName is the string literal of the name for the Flag type in the ActivityStreams vocabulary.
var ActivityStreamsFlagName string = "Flag"
// ActivityStreamsFollowName is the string literal of the name for the Follow type in the ActivityStreams vocabulary.
var ActivityStreamsFollowName string = "Follow"
// ActivityStreamsGroupName is the string literal of the name for the Group type in the ActivityStreams vocabulary.
var ActivityStreamsGroupName string = "Group"
// TootIdentityProofName is the string literal of the name for the IdentityProof type in the Toot vocabulary.
var TootIdentityProofName string = "IdentityProof"
// ActivityStreamsIgnoreName is the string literal of the name for the Ignore type in the ActivityStreams vocabulary.
var ActivityStreamsIgnoreName string = "Ignore"
// ActivityStreamsImageName is the string literal of the name for the Image type in the ActivityStreams vocabulary.
var ActivityStreamsImageName string = "Image"
// ActivityStreamsIntransitiveActivityName is the string literal of the name for the IntransitiveActivity type in the ActivityStreams vocabulary.
var ActivityStreamsIntransitiveActivityName string = "IntransitiveActivity"
// ActivityStreamsInviteName is the string literal of the name for the Invite type in the ActivityStreams vocabulary.
var ActivityStreamsInviteName string = "Invite"
// ActivityStreamsJoinName is the string literal of the name for the Join type in the ActivityStreams vocabulary.
var ActivityStreamsJoinName string = "Join"
// ActivityStreamsLeaveName is the string literal of the name for the Leave type in the ActivityStreams vocabulary.
var ActivityStreamsLeaveName string = "Leave"
// ActivityStreamsLikeName is the string literal of the name for the Like type in the ActivityStreams vocabulary.
var ActivityStreamsLikeName string = "Like"
// ActivityStreamsLinkName is the string literal of the name for the Link type in the ActivityStreams vocabulary.
var ActivityStreamsLinkName string = "Link"
// ActivityStreamsListenName is the string literal of the name for the Listen type in the ActivityStreams vocabulary.
var ActivityStreamsListenName string = "Listen"
// ActivityStreamsMentionName is the string literal of the name for the Mention type in the ActivityStreams vocabulary.
var ActivityStreamsMentionName string = "Mention"
// ActivityStreamsMoveName is the string literal of the name for the Move type in the ActivityStreams vocabulary.
var ActivityStreamsMoveName string = "Move"
// ActivityStreamsNoteName is the string literal of the name for the Note type in the ActivityStreams vocabulary.
var ActivityStreamsNoteName string = "Note"
// ActivityStreamsObjectName is the string literal of the name for the Object type in the ActivityStreams vocabulary.
var ActivityStreamsObjectName string = "Object"
// ActivityStreamsOfferName is the string literal of the name for the Offer type in the ActivityStreams vocabulary.
var ActivityStreamsOfferName string = "Offer"
// ActivityStreamsOrderedCollectionName is the string literal of the name for the OrderedCollection type in the ActivityStreams vocabulary.
var ActivityStreamsOrderedCollectionName string = "OrderedCollection"
// ActivityStreamsOrderedCollectionPageName is the string literal of the name for the OrderedCollectionPage type in the ActivityStreams vocabulary.
var ActivityStreamsOrderedCollectionPageName string = "OrderedCollectionPage"
// ActivityStreamsOrganizationName is the string literal of the name for the Organization type in the ActivityStreams vocabulary.
var ActivityStreamsOrganizationName string = "Organization"
// ActivityStreamsPageName is the string literal of the name for the Page type in the ActivityStreams vocabulary.
var ActivityStreamsPageName string = "Page"
// ActivityStreamsPersonName is the string literal of the name for the Person type in the ActivityStreams vocabulary.
var ActivityStreamsPersonName string = "Person"
// ActivityStreamsPlaceName is the string literal of the name for the Place type in the ActivityStreams vocabulary.
var ActivityStreamsPlaceName string = "Place"
// ActivityStreamsProfileName is the string literal of the name for the Profile type in the ActivityStreams vocabulary.
var ActivityStreamsProfileName string = "Profile"
// W3IDSecurityV1PublicKeyName is the string literal of the name for the PublicKey type in the W3IDSecurityV1 vocabulary.
var W3IDSecurityV1PublicKeyName string = "PublicKey"
// ForgeFedPushName is the string literal of the name for the Push type in the ForgeFed vocabulary.
var ForgeFedPushName string = "Push"
// ActivityStreamsQuestionName is the string literal of the name for the Question type in the ActivityStreams vocabulary.
var ActivityStreamsQuestionName string = "Question"
// ActivityStreamsReadName is the string literal of the name for the Read type in the ActivityStreams vocabulary.
var ActivityStreamsReadName string = "Read"
// ActivityStreamsRejectName is the string literal of the name for the Reject type in the ActivityStreams vocabulary.
var ActivityStreamsRejectName string = "Reject"
// ActivityStreamsRelationshipName is the string literal of the name for the Relationship type in the ActivityStreams vocabulary.
var ActivityStreamsRelationshipName string = "Relationship"
// ActivityStreamsRemoveName is the string literal of the name for the Remove type in the ActivityStreams vocabulary.
var ActivityStreamsRemoveName string = "Remove"
// ForgeFedRepositoryName is the string literal of the name for the Repository type in the ForgeFed vocabulary.
var ForgeFedRepositoryName string = "Repository"
// ActivityStreamsServiceName is the string literal of the name for the Service type in the ActivityStreams vocabulary.
var ActivityStreamsServiceName string = "Service"
// ActivityStreamsTentativeAcceptName is the string literal of the name for the TentativeAccept type in the ActivityStreams vocabulary.
var ActivityStreamsTentativeAcceptName string = "TentativeAccept"
// ActivityStreamsTentativeRejectName is the string literal of the name for the TentativeReject type in the ActivityStreams vocabulary.
var ActivityStreamsTentativeRejectName string = "TentativeReject"
// ForgeFedTicketName is the string literal of the name for the Ticket type in the ForgeFed vocabulary.
var ForgeFedTicketName string = "Ticket"
// ForgeFedTicketDependencyName is the string literal of the name for the TicketDependency type in the ForgeFed vocabulary.
var ForgeFedTicketDependencyName string = "TicketDependency"
// ActivityStreamsTombstoneName is the string literal of the name for the Tombstone type in the ActivityStreams vocabulary.
var ActivityStreamsTombstoneName string = "Tombstone"
// ActivityStreamsTravelName is the string literal of the name for the Travel type in the ActivityStreams vocabulary.
var ActivityStreamsTravelName string = "Travel"
// ActivityStreamsUndoName is the string literal of the name for the Undo type in the ActivityStreams vocabulary.
var ActivityStreamsUndoName string = "Undo"
// ActivityStreamsUpdateName is the string literal of the name for the Update type in the ActivityStreams vocabulary.
var ActivityStreamsUpdateName string = "Update"
// ActivityStreamsVideoName is the string literal of the name for the Video type in the ActivityStreams vocabulary.
var ActivityStreamsVideoName string = "Video"
// ActivityStreamsViewName is the string literal of the name for the View type in the ActivityStreams vocabulary.
var ActivityStreamsViewName string = "View"
// ActivityStreamsAccuracyPropertyName is the string literal of the name for the accuracy property in the ActivityStreams vocabulary.
var ActivityStreamsAccuracyPropertyName string = "accuracy"
// ActivityStreamsActorPropertyName is the string literal of the name for the actor property in the ActivityStreams vocabulary.
var ActivityStreamsActorPropertyName string = "actor"
// ActivityStreamsAltitudePropertyName is the string literal of the name for the altitude property in the ActivityStreams vocabulary.
var ActivityStreamsAltitudePropertyName string = "altitude"
// ActivityStreamsAnyOfPropertyName is the string literal of the name for the anyOf property in the ActivityStreams vocabulary.
var ActivityStreamsAnyOfPropertyName string = "anyOf"
// ForgeFedAssignedToPropertyName is the string literal of the name for the assignedTo property in the ForgeFed vocabulary.
var ForgeFedAssignedToPropertyName string = "assignedTo"
// ActivityStreamsAttachmentPropertyName is the string literal of the name for the attachment property in the ActivityStreams vocabulary.
var ActivityStreamsAttachmentPropertyName string = "attachment"
// ActivityStreamsAttributedToPropertyName is the string literal of the name for the attributedTo property in the ActivityStreams vocabulary.
var ActivityStreamsAttributedToPropertyName string = "attributedTo"
// ActivityStreamsAudiencePropertyName is the string literal of the name for the audience property in the ActivityStreams vocabulary.
var ActivityStreamsAudiencePropertyName string = "audience"
// ActivityStreamsBccPropertyName is the string literal of the name for the bcc property in the ActivityStreams vocabulary.
var ActivityStreamsBccPropertyName string = "bcc"
// TootBlurhashPropertyName is the string literal of the name for the blurhash property in the Toot vocabulary.
var TootBlurhashPropertyName string = "blurhash"
// ActivityStreamsBtoPropertyName is the string literal of the name for the bto property in the ActivityStreams vocabulary.
var ActivityStreamsBtoPropertyName string = "bto"
// ActivityStreamsCcPropertyName is the string literal of the name for the cc property in the ActivityStreams vocabulary.
var ActivityStreamsCcPropertyName string = "cc"
// ActivityStreamsClosedPropertyName is the string literal of the name for the closed property in the ActivityStreams vocabulary.
var ActivityStreamsClosedPropertyName string = "closed"
// ForgeFedCommittedPropertyName is the string literal of the name for the committed property in the ForgeFed vocabulary.
var ForgeFedCommittedPropertyName string = "committed"
// ForgeFedCommittedByPropertyName is the string literal of the name for the committedBy property in the ForgeFed vocabulary.
var ForgeFedCommittedByPropertyName string = "committedBy"
// ActivityStreamsContentPropertyName is the string literal of the name for the content property in the ActivityStreams vocabulary.
var ActivityStreamsContentPropertyName string = "content"
// ActivityStreamsContentPropertyMapName is the string literal of the name for the content property in the ActivityStreams vocabulary when it is a natural language map.
var ActivityStreamsContentPropertyMapName string = "contentMap"
// ActivityStreamsContextPropertyName is the string literal of the name for the context property in the ActivityStreams vocabulary.
var ActivityStreamsContextPropertyName string = "context"
// ActivityStreamsCurrentPropertyName is the string literal of the name for the current property in the ActivityStreams vocabulary.
var ActivityStreamsCurrentPropertyName string = "current"
// ActivityStreamsDeletedPropertyName is the string literal of the name for the deleted property in the ActivityStreams vocabulary.
var ActivityStreamsDeletedPropertyName string = "deleted"
// ForgeFedDependantsPropertyName is the string literal of the name for the dependants property in the ForgeFed vocabulary.
var ForgeFedDependantsPropertyName string = "dependants"
// ForgeFedDependedByPropertyName is the string literal of the name for the dependedBy property in the ForgeFed vocabulary.
var ForgeFedDependedByPropertyName string = "dependedBy"
// ForgeFedDependenciesPropertyName is the string literal of the name for the dependencies property in the ForgeFed vocabulary.
var ForgeFedDependenciesPropertyName string = "dependencies"
// ForgeFedDependsOnPropertyName is the string literal of the name for the dependsOn property in the ForgeFed vocabulary.
var ForgeFedDependsOnPropertyName string = "dependsOn"
// ActivityStreamsDescribesPropertyName is the string literal of the name for the describes property in the ActivityStreams vocabulary.
var ActivityStreamsDescribesPropertyName string = "describes"
// ForgeFedDescriptionPropertyName is the string literal of the name for the description property in the ForgeFed vocabulary.
var ForgeFedDescriptionPropertyName string = "description"
// TootDiscoverablePropertyName is the string literal of the name for the discoverable property in the Toot vocabulary.
var TootDiscoverablePropertyName string = "discoverable"
// ActivityStreamsDurationPropertyName is the string literal of the name for the duration property in the ActivityStreams vocabulary.
var ActivityStreamsDurationPropertyName string = "duration"
// ForgeFedEarlyItemsPropertyName is the string literal of the name for the earlyItems property in the ForgeFed vocabulary.
var ForgeFedEarlyItemsPropertyName string = "earlyItems"
// ActivityStreamsEndTimePropertyName is the string literal of the name for the endTime property in the ActivityStreams vocabulary.
var ActivityStreamsEndTimePropertyName string = "endTime"
// TootFeaturedPropertyName is the string literal of the name for the featured property in the Toot vocabulary.
var TootFeaturedPropertyName string = "featured"
// ForgeFedFilesAddedPropertyName is the string literal of the name for the filesAdded property in the ForgeFed vocabulary.
var ForgeFedFilesAddedPropertyName string = "filesAdded"
// ForgeFedFilesModifiedPropertyName is the string literal of the name for the filesModified property in the ForgeFed vocabulary.
var ForgeFedFilesModifiedPropertyName string = "filesModified"
// ForgeFedFilesRemovedPropertyName is the string literal of the name for the filesRemoved property in the ForgeFed vocabulary.
var ForgeFedFilesRemovedPropertyName string = "filesRemoved"
// ActivityStreamsFirstPropertyName is the string literal of the name for the first property in the ActivityStreams vocabulary.
var ActivityStreamsFirstPropertyName string = "first"
// ActivityStreamsFollowersPropertyName is the string literal of the name for the followers property in the ActivityStreams vocabulary.
var ActivityStreamsFollowersPropertyName string = "followers"
// ActivityStreamsFollowingPropertyName is the string literal of the name for the following property in the ActivityStreams vocabulary.
var ActivityStreamsFollowingPropertyName string = "following"
// ForgeFedForksPropertyName is the string literal of the name for the forks property in the ForgeFed vocabulary.
var ForgeFedForksPropertyName string = "forks"
// ActivityStreamsFormerTypePropertyName is the string literal of the name for the formerType property in the ActivityStreams vocabulary.
var ActivityStreamsFormerTypePropertyName string = "formerType"
// ActivityStreamsGeneratorPropertyName is the string literal of the name for the generator property in the ActivityStreams vocabulary.
var ActivityStreamsGeneratorPropertyName string = "generator"
// ForgeFedHashPropertyName is the string literal of the name for the hash property in the ForgeFed vocabulary.
var ForgeFedHashPropertyName string = "hash"
// ActivityStreamsHeightPropertyName is the string literal of the name for the height property in the ActivityStreams vocabulary.
var ActivityStreamsHeightPropertyName string = "height"
// ActivityStreamsHrefPropertyName is the string literal of the name for the href property in the ActivityStreams vocabulary.
var ActivityStreamsHrefPropertyName string = "href"
// ActivityStreamsHreflangPropertyName is the string literal of the name for the hreflang property in the ActivityStreams vocabulary.
var ActivityStreamsHreflangPropertyName string = "hreflang"
// ActivityStreamsIconPropertyName is the string literal of the name for the icon property in the ActivityStreams vocabulary.
var ActivityStreamsIconPropertyName string = "icon"
// ActivityStreamsImagePropertyName is the string literal of the name for the image property in the ActivityStreams vocabulary.
var ActivityStreamsImagePropertyName string = "image"
// ActivityStreamsInReplyToPropertyName is the string literal of the name for the inReplyTo property in the ActivityStreams vocabulary.
var ActivityStreamsInReplyToPropertyName string = "inReplyTo"
// ActivityStreamsInboxPropertyName is the string literal of the name for the inbox property in the ActivityStreams vocabulary.
var ActivityStreamsInboxPropertyName string = "inbox"
// ActivityStreamsInstrumentPropertyName is the string literal of the name for the instrument property in the ActivityStreams vocabulary.
var ActivityStreamsInstrumentPropertyName string = "instrument"
// ForgeFedIsResolvedPropertyName is the string literal of the name for the isResolved property in the ForgeFed vocabulary.
var ForgeFedIsResolvedPropertyName string = "isResolved"
// ActivityStreamsItemsPropertyName is the string literal of the name for the items property in the ActivityStreams vocabulary.
var ActivityStreamsItemsPropertyName string = "items"
// ActivityStreamsLastPropertyName is the string literal of the name for the last property in the ActivityStreams vocabulary.
var ActivityStreamsLastPropertyName string = "last"
// ActivityStreamsLatitudePropertyName is the string literal of the name for the latitude property in the ActivityStreams vocabulary.
var ActivityStreamsLatitudePropertyName string = "latitude"
// ActivityStreamsLikedPropertyName is the string literal of the name for the liked property in the ActivityStreams vocabulary.
var ActivityStreamsLikedPropertyName string = "liked"
// ActivityStreamsLikesPropertyName is the string literal of the name for the likes property in the ActivityStreams vocabulary.
var ActivityStreamsLikesPropertyName string = "likes"
// ActivityStreamsLocationPropertyName is the string literal of the name for the location property in the ActivityStreams vocabulary.
var ActivityStreamsLocationPropertyName string = "location"
// ActivityStreamsLongitudePropertyName is the string literal of the name for the longitude property in the ActivityStreams vocabulary.
var ActivityStreamsLongitudePropertyName string = "longitude"
// ActivityStreamsManuallyApprovesFollowersPropertyName is the string literal of the name for the manuallyApprovesFollowers property in the ActivityStreams vocabulary.
var ActivityStreamsManuallyApprovesFollowersPropertyName string = "manuallyApprovesFollowers"
// ActivityStreamsMediaTypePropertyName is the string literal of the name for the mediaType property in the ActivityStreams vocabulary.
var ActivityStreamsMediaTypePropertyName string = "mediaType"
// ActivityStreamsNamePropertyName is the string literal of the name for the name property in the ActivityStreams vocabulary.
var ActivityStreamsNamePropertyName string = "name"
// ActivityStreamsNamePropertyMapName is the string literal of the name for the name property in the ActivityStreams vocabulary when it is a natural language map.
var ActivityStreamsNamePropertyMapName string = "nameMap"
// ActivityStreamsNextPropertyName is the string literal of the name for the next property in the ActivityStreams vocabulary.
var ActivityStreamsNextPropertyName string = "next"
// ActivityStreamsObjectPropertyName is the string literal of the name for the object property in the ActivityStreams vocabulary.
var ActivityStreamsObjectPropertyName string = "object"
// ActivityStreamsOneOfPropertyName is the string literal of the name for the oneOf property in the ActivityStreams vocabulary.
var ActivityStreamsOneOfPropertyName string = "oneOf"
// ActivityStreamsOrderedItemsPropertyName is the string literal of the name for the orderedItems property in the ActivityStreams vocabulary.
var ActivityStreamsOrderedItemsPropertyName string = "orderedItems"
// ActivityStreamsOriginPropertyName is the string literal of the name for the origin property in the ActivityStreams vocabulary.
var ActivityStreamsOriginPropertyName string = "origin"
// ActivityStreamsOutboxPropertyName is the string literal of the name for the outbox property in the ActivityStreams vocabulary.
var ActivityStreamsOutboxPropertyName string = "outbox"
// W3IDSecurityV1OwnerPropertyName is the string literal of the name for the owner property in the W3IDSecurityV1 vocabulary.
var W3IDSecurityV1OwnerPropertyName string = "owner"
// ActivityStreamsPartOfPropertyName is the string literal of the name for the partOf property in the ActivityStreams vocabulary.
var ActivityStreamsPartOfPropertyName string = "partOf"
// ActivityStreamsPreferredUsernamePropertyName is the string literal of the name for the preferredUsername property in the ActivityStreams vocabulary.
var ActivityStreamsPreferredUsernamePropertyName string = "preferredUsername"
// ActivityStreamsPreferredUsernamePropertyMapName is the string literal of the name for the preferredUsername property in the ActivityStreams vocabulary when it is a natural language map.
var ActivityStreamsPreferredUsernamePropertyMapName string = "preferredUsernameMap"
// ActivityStreamsPrevPropertyName is the string literal of the name for the prev property in the ActivityStreams vocabulary.
var ActivityStreamsPrevPropertyName string = "prev"
// ActivityStreamsPreviewPropertyName is the string literal of the name for the preview property in the ActivityStreams vocabulary.
var ActivityStreamsPreviewPropertyName string = "preview"
// W3IDSecurityV1PublicKeyPropertyName is the string literal of the name for the publicKey property in the W3IDSecurityV1 vocabulary.
var W3IDSecurityV1PublicKeyPropertyName string = "publicKey"
// W3IDSecurityV1PublicKeyPemPropertyName is the string literal of the name for the publicKeyPem property in the W3IDSecurityV1 vocabulary.
var W3IDSecurityV1PublicKeyPemPropertyName string = "publicKeyPem"
// ActivityStreamsPublishedPropertyName is the string literal of the name for the published property in the ActivityStreams vocabulary.
var ActivityStreamsPublishedPropertyName string = "published"
// ActivityStreamsRadiusPropertyName is the string literal of the name for the radius property in the ActivityStreams vocabulary.
var ActivityStreamsRadiusPropertyName string = "radius"
// ForgeFedRefPropertyName is the string literal of the name for the ref property in the ForgeFed vocabulary.
var ForgeFedRefPropertyName string = "ref"
// ActivityStreamsRelPropertyName is the string literal of the name for the rel property in the ActivityStreams vocabulary.
var ActivityStreamsRelPropertyName string = "rel"
// ActivityStreamsRelationshipPropertyName is the string literal of the name for the relationship property in the ActivityStreams vocabulary.
var ActivityStreamsRelationshipPropertyName string = "relationship"
// ActivityStreamsRepliesPropertyName is the string literal of the name for the replies property in the ActivityStreams vocabulary.
var ActivityStreamsRepliesPropertyName string = "replies"
// ActivityStreamsResultPropertyName is the string literal of the name for the result property in the ActivityStreams vocabulary.
var ActivityStreamsResultPropertyName string = "result"
// ActivityStreamsSharesPropertyName is the string literal of the name for the shares property in the ActivityStreams vocabulary.
var ActivityStreamsSharesPropertyName string = "shares"
// TootSignatureAlgorithmPropertyName is the string literal of the name for the signatureAlgorithm property in the Toot vocabulary.
var TootSignatureAlgorithmPropertyName string = "signatureAlgorithm"
// TootSignatureValuePropertyName is the string literal of the name for the signatureValue property in the Toot vocabulary.
var TootSignatureValuePropertyName string = "signatureValue"
// ActivityStreamsSourcePropertyName is the string literal of the name for the source property in the ActivityStreams vocabulary.
var ActivityStreamsSourcePropertyName string = "source"
// ActivityStreamsStartIndexPropertyName is the string literal of the name for the startIndex property in the ActivityStreams vocabulary.
var ActivityStreamsStartIndexPropertyName string = "startIndex"
// ActivityStreamsStartTimePropertyName is the string literal of the name for the startTime property in the ActivityStreams vocabulary.
var ActivityStreamsStartTimePropertyName string = "startTime"
// ActivityStreamsStreamsPropertyName is the string literal of the name for the streams property in the ActivityStreams vocabulary.
var ActivityStreamsStreamsPropertyName string = "streams"
// ActivityStreamsSubjectPropertyName is the string literal of the name for the subject property in the ActivityStreams vocabulary.
var ActivityStreamsSubjectPropertyName string = "subject"
// ActivityStreamsSummaryPropertyName is the string literal of the name for the summary property in the ActivityStreams vocabulary.
var ActivityStreamsSummaryPropertyName string = "summary"
// ActivityStreamsSummaryPropertyMapName is the string literal of the name for the summary property in the ActivityStreams vocabulary when it is a natural language map.
var ActivityStreamsSummaryPropertyMapName string = "summaryMap"
// ActivityStreamsTagPropertyName is the string literal of the name for the tag property in the ActivityStreams vocabulary.
var ActivityStreamsTagPropertyName string = "tag"
// ActivityStreamsTargetPropertyName is the string literal of the name for the target property in the ActivityStreams vocabulary.
var ActivityStreamsTargetPropertyName string = "target"
// ForgeFedTeamPropertyName is the string literal of the name for the team property in the ForgeFed vocabulary.
var ForgeFedTeamPropertyName string = "team"
// ForgeFedTicketsTrackedByPropertyName is the string literal of the name for the ticketsTrackedBy property in the ForgeFed vocabulary.
var ForgeFedTicketsTrackedByPropertyName string = "ticketsTrackedBy"
// ActivityStreamsToPropertyName is the string literal of the name for the to property in the ActivityStreams vocabulary.
var ActivityStreamsToPropertyName string = "to"
// ActivityStreamsTotalItemsPropertyName is the string literal of the name for the totalItems property in the ActivityStreams vocabulary.
var ActivityStreamsTotalItemsPropertyName string = "totalItems"
// ForgeFedTracksTicketsForPropertyName is the string literal of the name for the tracksTicketsFor property in the ForgeFed vocabulary.
var ForgeFedTracksTicketsForPropertyName string = "tracksTicketsFor"
// ActivityStreamsUnitsPropertyName is the string literal of the name for the units property in the ActivityStreams vocabulary.
var ActivityStreamsUnitsPropertyName string = "units"
// ActivityStreamsUpdatedPropertyName is the string literal of the name for the updated property in the ActivityStreams vocabulary.
var ActivityStreamsUpdatedPropertyName string = "updated"
// ActivityStreamsUrlPropertyName is the string literal of the name for the url property in the ActivityStreams vocabulary.
var ActivityStreamsUrlPropertyName string = "url"
// TootVotersCountPropertyName is the string literal of the name for the votersCount property in the Toot vocabulary.
var TootVotersCountPropertyName string = "votersCount"
// ActivityStreamsWidthPropertyName is the string literal of the name for the width property in the ActivityStreams vocabulary.
var ActivityStreamsWidthPropertyName string = "width"

View file

@ -1,410 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
propertyaccuracy "github.com/go-fed/activity/streams/impl/activitystreams/property_accuracy"
propertyactor "github.com/go-fed/activity/streams/impl/activitystreams/property_actor"
propertyaltitude "github.com/go-fed/activity/streams/impl/activitystreams/property_altitude"
propertyanyof "github.com/go-fed/activity/streams/impl/activitystreams/property_anyof"
propertyattachment "github.com/go-fed/activity/streams/impl/activitystreams/property_attachment"
propertyattributedto "github.com/go-fed/activity/streams/impl/activitystreams/property_attributedto"
propertyaudience "github.com/go-fed/activity/streams/impl/activitystreams/property_audience"
propertybcc "github.com/go-fed/activity/streams/impl/activitystreams/property_bcc"
propertybto "github.com/go-fed/activity/streams/impl/activitystreams/property_bto"
propertycc "github.com/go-fed/activity/streams/impl/activitystreams/property_cc"
propertyclosed "github.com/go-fed/activity/streams/impl/activitystreams/property_closed"
propertycontent "github.com/go-fed/activity/streams/impl/activitystreams/property_content"
propertycontext "github.com/go-fed/activity/streams/impl/activitystreams/property_context"
propertycurrent "github.com/go-fed/activity/streams/impl/activitystreams/property_current"
propertydeleted "github.com/go-fed/activity/streams/impl/activitystreams/property_deleted"
propertydescribes "github.com/go-fed/activity/streams/impl/activitystreams/property_describes"
propertyduration "github.com/go-fed/activity/streams/impl/activitystreams/property_duration"
propertyendtime "github.com/go-fed/activity/streams/impl/activitystreams/property_endtime"
propertyfirst "github.com/go-fed/activity/streams/impl/activitystreams/property_first"
propertyfollowers "github.com/go-fed/activity/streams/impl/activitystreams/property_followers"
propertyfollowing "github.com/go-fed/activity/streams/impl/activitystreams/property_following"
propertyformertype "github.com/go-fed/activity/streams/impl/activitystreams/property_formertype"
propertygenerator "github.com/go-fed/activity/streams/impl/activitystreams/property_generator"
propertyheight "github.com/go-fed/activity/streams/impl/activitystreams/property_height"
propertyhref "github.com/go-fed/activity/streams/impl/activitystreams/property_href"
propertyhreflang "github.com/go-fed/activity/streams/impl/activitystreams/property_hreflang"
propertyicon "github.com/go-fed/activity/streams/impl/activitystreams/property_icon"
propertyimage "github.com/go-fed/activity/streams/impl/activitystreams/property_image"
propertyinbox "github.com/go-fed/activity/streams/impl/activitystreams/property_inbox"
propertyinreplyto "github.com/go-fed/activity/streams/impl/activitystreams/property_inreplyto"
propertyinstrument "github.com/go-fed/activity/streams/impl/activitystreams/property_instrument"
propertyitems "github.com/go-fed/activity/streams/impl/activitystreams/property_items"
propertylast "github.com/go-fed/activity/streams/impl/activitystreams/property_last"
propertylatitude "github.com/go-fed/activity/streams/impl/activitystreams/property_latitude"
propertyliked "github.com/go-fed/activity/streams/impl/activitystreams/property_liked"
propertylikes "github.com/go-fed/activity/streams/impl/activitystreams/property_likes"
propertylocation "github.com/go-fed/activity/streams/impl/activitystreams/property_location"
propertylongitude "github.com/go-fed/activity/streams/impl/activitystreams/property_longitude"
propertymanuallyapprovesfollowers "github.com/go-fed/activity/streams/impl/activitystreams/property_manuallyapprovesfollowers"
propertymediatype "github.com/go-fed/activity/streams/impl/activitystreams/property_mediatype"
propertyname "github.com/go-fed/activity/streams/impl/activitystreams/property_name"
propertynext "github.com/go-fed/activity/streams/impl/activitystreams/property_next"
propertyobject "github.com/go-fed/activity/streams/impl/activitystreams/property_object"
propertyoneof "github.com/go-fed/activity/streams/impl/activitystreams/property_oneof"
propertyordereditems "github.com/go-fed/activity/streams/impl/activitystreams/property_ordereditems"
propertyorigin "github.com/go-fed/activity/streams/impl/activitystreams/property_origin"
propertyoutbox "github.com/go-fed/activity/streams/impl/activitystreams/property_outbox"
propertypartof "github.com/go-fed/activity/streams/impl/activitystreams/property_partof"
propertypreferredusername "github.com/go-fed/activity/streams/impl/activitystreams/property_preferredusername"
propertyprev "github.com/go-fed/activity/streams/impl/activitystreams/property_prev"
propertypreview "github.com/go-fed/activity/streams/impl/activitystreams/property_preview"
propertypublished "github.com/go-fed/activity/streams/impl/activitystreams/property_published"
propertyradius "github.com/go-fed/activity/streams/impl/activitystreams/property_radius"
propertyrel "github.com/go-fed/activity/streams/impl/activitystreams/property_rel"
propertyrelationship "github.com/go-fed/activity/streams/impl/activitystreams/property_relationship"
propertyreplies "github.com/go-fed/activity/streams/impl/activitystreams/property_replies"
propertyresult "github.com/go-fed/activity/streams/impl/activitystreams/property_result"
propertyshares "github.com/go-fed/activity/streams/impl/activitystreams/property_shares"
propertysource "github.com/go-fed/activity/streams/impl/activitystreams/property_source"
propertystartindex "github.com/go-fed/activity/streams/impl/activitystreams/property_startindex"
propertystarttime "github.com/go-fed/activity/streams/impl/activitystreams/property_starttime"
propertystreams "github.com/go-fed/activity/streams/impl/activitystreams/property_streams"
propertysubject "github.com/go-fed/activity/streams/impl/activitystreams/property_subject"
propertysummary "github.com/go-fed/activity/streams/impl/activitystreams/property_summary"
propertytag "github.com/go-fed/activity/streams/impl/activitystreams/property_tag"
propertytarget "github.com/go-fed/activity/streams/impl/activitystreams/property_target"
propertyto "github.com/go-fed/activity/streams/impl/activitystreams/property_to"
propertytotalitems "github.com/go-fed/activity/streams/impl/activitystreams/property_totalitems"
propertyunits "github.com/go-fed/activity/streams/impl/activitystreams/property_units"
propertyupdated "github.com/go-fed/activity/streams/impl/activitystreams/property_updated"
propertyurl "github.com/go-fed/activity/streams/impl/activitystreams/property_url"
propertywidth "github.com/go-fed/activity/streams/impl/activitystreams/property_width"
typeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_accept"
typeactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_activity"
typeadd "github.com/go-fed/activity/streams/impl/activitystreams/type_add"
typeannounce "github.com/go-fed/activity/streams/impl/activitystreams/type_announce"
typeapplication "github.com/go-fed/activity/streams/impl/activitystreams/type_application"
typearrive "github.com/go-fed/activity/streams/impl/activitystreams/type_arrive"
typearticle "github.com/go-fed/activity/streams/impl/activitystreams/type_article"
typeaudio "github.com/go-fed/activity/streams/impl/activitystreams/type_audio"
typeblock "github.com/go-fed/activity/streams/impl/activitystreams/type_block"
typecollection "github.com/go-fed/activity/streams/impl/activitystreams/type_collection"
typecollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_collectionpage"
typecreate "github.com/go-fed/activity/streams/impl/activitystreams/type_create"
typedelete "github.com/go-fed/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/go-fed/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/go-fed/activity/streams/impl/activitystreams/type_document"
typeevent "github.com/go-fed/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/go-fed/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/go-fed/activity/streams/impl/activitystreams/type_follow"
typegroup "github.com/go-fed/activity/streams/impl/activitystreams/type_group"
typeignore "github.com/go-fed/activity/streams/impl/activitystreams/type_ignore"
typeimage "github.com/go-fed/activity/streams/impl/activitystreams/type_image"
typeintransitiveactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_intransitiveactivity"
typeinvite "github.com/go-fed/activity/streams/impl/activitystreams/type_invite"
typejoin "github.com/go-fed/activity/streams/impl/activitystreams/type_join"
typeleave "github.com/go-fed/activity/streams/impl/activitystreams/type_leave"
typelike "github.com/go-fed/activity/streams/impl/activitystreams/type_like"
typelink "github.com/go-fed/activity/streams/impl/activitystreams/type_link"
typelisten "github.com/go-fed/activity/streams/impl/activitystreams/type_listen"
typemention "github.com/go-fed/activity/streams/impl/activitystreams/type_mention"
typemove "github.com/go-fed/activity/streams/impl/activitystreams/type_move"
typenote "github.com/go-fed/activity/streams/impl/activitystreams/type_note"
typeobject "github.com/go-fed/activity/streams/impl/activitystreams/type_object"
typeoffer "github.com/go-fed/activity/streams/impl/activitystreams/type_offer"
typeorderedcollection "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollection"
typeorderedcollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollectionpage"
typeorganization "github.com/go-fed/activity/streams/impl/activitystreams/type_organization"
typepage "github.com/go-fed/activity/streams/impl/activitystreams/type_page"
typeperson "github.com/go-fed/activity/streams/impl/activitystreams/type_person"
typeplace "github.com/go-fed/activity/streams/impl/activitystreams/type_place"
typeprofile "github.com/go-fed/activity/streams/impl/activitystreams/type_profile"
typequestion "github.com/go-fed/activity/streams/impl/activitystreams/type_question"
typeread "github.com/go-fed/activity/streams/impl/activitystreams/type_read"
typereject "github.com/go-fed/activity/streams/impl/activitystreams/type_reject"
typerelationship "github.com/go-fed/activity/streams/impl/activitystreams/type_relationship"
typeremove "github.com/go-fed/activity/streams/impl/activitystreams/type_remove"
typeservice "github.com/go-fed/activity/streams/impl/activitystreams/type_service"
typetentativeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativeaccept"
typetentativereject "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativereject"
typetombstone "github.com/go-fed/activity/streams/impl/activitystreams/type_tombstone"
typetravel "github.com/go-fed/activity/streams/impl/activitystreams/type_travel"
typeundo "github.com/go-fed/activity/streams/impl/activitystreams/type_undo"
typeupdate "github.com/go-fed/activity/streams/impl/activitystreams/type_update"
typevideo "github.com/go-fed/activity/streams/impl/activitystreams/type_video"
typeview "github.com/go-fed/activity/streams/impl/activitystreams/type_view"
propertyassignedto "github.com/go-fed/activity/streams/impl/forgefed/property_assignedto"
propertycommitted "github.com/go-fed/activity/streams/impl/forgefed/property_committed"
propertycommittedby "github.com/go-fed/activity/streams/impl/forgefed/property_committedby"
propertydependants "github.com/go-fed/activity/streams/impl/forgefed/property_dependants"
propertydependedby "github.com/go-fed/activity/streams/impl/forgefed/property_dependedby"
propertydependencies "github.com/go-fed/activity/streams/impl/forgefed/property_dependencies"
propertydependson "github.com/go-fed/activity/streams/impl/forgefed/property_dependson"
propertydescription "github.com/go-fed/activity/streams/impl/forgefed/property_description"
propertyearlyitems "github.com/go-fed/activity/streams/impl/forgefed/property_earlyitems"
propertyfilesadded "github.com/go-fed/activity/streams/impl/forgefed/property_filesadded"
propertyfilesmodified "github.com/go-fed/activity/streams/impl/forgefed/property_filesmodified"
propertyfilesremoved "github.com/go-fed/activity/streams/impl/forgefed/property_filesremoved"
propertyforks "github.com/go-fed/activity/streams/impl/forgefed/property_forks"
propertyhash "github.com/go-fed/activity/streams/impl/forgefed/property_hash"
propertyisresolved "github.com/go-fed/activity/streams/impl/forgefed/property_isresolved"
propertyref "github.com/go-fed/activity/streams/impl/forgefed/property_ref"
propertyteam "github.com/go-fed/activity/streams/impl/forgefed/property_team"
propertyticketstrackedby "github.com/go-fed/activity/streams/impl/forgefed/property_ticketstrackedby"
propertytracksticketsfor "github.com/go-fed/activity/streams/impl/forgefed/property_tracksticketsfor"
typebranch "github.com/go-fed/activity/streams/impl/forgefed/type_branch"
typecommit "github.com/go-fed/activity/streams/impl/forgefed/type_commit"
typepush "github.com/go-fed/activity/streams/impl/forgefed/type_push"
typerepository "github.com/go-fed/activity/streams/impl/forgefed/type_repository"
typeticket "github.com/go-fed/activity/streams/impl/forgefed/type_ticket"
typeticketdependency "github.com/go-fed/activity/streams/impl/forgefed/type_ticketdependency"
propertyblurhash "github.com/go-fed/activity/streams/impl/toot/property_blurhash"
propertydiscoverable "github.com/go-fed/activity/streams/impl/toot/property_discoverable"
propertyfeatured "github.com/go-fed/activity/streams/impl/toot/property_featured"
propertysignaturealgorithm "github.com/go-fed/activity/streams/impl/toot/property_signaturealgorithm"
propertysignaturevalue "github.com/go-fed/activity/streams/impl/toot/property_signaturevalue"
propertyvoterscount "github.com/go-fed/activity/streams/impl/toot/property_voterscount"
typeemoji "github.com/go-fed/activity/streams/impl/toot/type_emoji"
typeidentityproof "github.com/go-fed/activity/streams/impl/toot/type_identityproof"
propertyowner "github.com/go-fed/activity/streams/impl/w3idsecurityv1/property_owner"
propertypublickey "github.com/go-fed/activity/streams/impl/w3idsecurityv1/property_publickey"
propertypublickeypem "github.com/go-fed/activity/streams/impl/w3idsecurityv1/property_publickeypem"
typepublickey "github.com/go-fed/activity/streams/impl/w3idsecurityv1/type_publickey"
)
var mgr *Manager
// init handles the 'magic' of creating a Manager and dependency-injecting it into
// every other code-generated package. This gives the implementations access
// to create any type needed to deserialize, without relying on the other
// specific concrete implementations. In order to replace a go-fed created
// type with your own, be sure to have the manager call your own
// implementation's deserialize functions instead of the built-in type.
// Finally, each implementation views the Manager as an interface with only a
// subset of funcitons available. This means this Manager implements the union
// of those interfaces.
func init() {
mgr = &Manager{}
propertyaccuracy.SetManager(mgr)
propertyactor.SetManager(mgr)
propertyaltitude.SetManager(mgr)
propertyanyof.SetManager(mgr)
propertyattachment.SetManager(mgr)
propertyattributedto.SetManager(mgr)
propertyaudience.SetManager(mgr)
propertybcc.SetManager(mgr)
propertybto.SetManager(mgr)
propertycc.SetManager(mgr)
propertyclosed.SetManager(mgr)
propertycontent.SetManager(mgr)
propertycontext.SetManager(mgr)
propertycurrent.SetManager(mgr)
propertydeleted.SetManager(mgr)
propertydescribes.SetManager(mgr)
propertyduration.SetManager(mgr)
propertyendtime.SetManager(mgr)
propertyfirst.SetManager(mgr)
propertyfollowers.SetManager(mgr)
propertyfollowing.SetManager(mgr)
propertyformertype.SetManager(mgr)
propertygenerator.SetManager(mgr)
propertyheight.SetManager(mgr)
propertyhref.SetManager(mgr)
propertyhreflang.SetManager(mgr)
propertyicon.SetManager(mgr)
propertyimage.SetManager(mgr)
propertyinbox.SetManager(mgr)
propertyinreplyto.SetManager(mgr)
propertyinstrument.SetManager(mgr)
propertyitems.SetManager(mgr)
propertylast.SetManager(mgr)
propertylatitude.SetManager(mgr)
propertyliked.SetManager(mgr)
propertylikes.SetManager(mgr)
propertylocation.SetManager(mgr)
propertylongitude.SetManager(mgr)
propertymanuallyapprovesfollowers.SetManager(mgr)
propertymediatype.SetManager(mgr)
propertyname.SetManager(mgr)
propertynext.SetManager(mgr)
propertyobject.SetManager(mgr)
propertyoneof.SetManager(mgr)
propertyordereditems.SetManager(mgr)
propertyorigin.SetManager(mgr)
propertyoutbox.SetManager(mgr)
propertypartof.SetManager(mgr)
propertypreferredusername.SetManager(mgr)
propertyprev.SetManager(mgr)
propertypreview.SetManager(mgr)
propertypublished.SetManager(mgr)
propertyradius.SetManager(mgr)
propertyrel.SetManager(mgr)
propertyrelationship.SetManager(mgr)
propertyreplies.SetManager(mgr)
propertyresult.SetManager(mgr)
propertyshares.SetManager(mgr)
propertysource.SetManager(mgr)
propertystartindex.SetManager(mgr)
propertystarttime.SetManager(mgr)
propertystreams.SetManager(mgr)
propertysubject.SetManager(mgr)
propertysummary.SetManager(mgr)
propertytag.SetManager(mgr)
propertytarget.SetManager(mgr)
propertyto.SetManager(mgr)
propertytotalitems.SetManager(mgr)
propertyunits.SetManager(mgr)
propertyupdated.SetManager(mgr)
propertyurl.SetManager(mgr)
propertywidth.SetManager(mgr)
typeaccept.SetManager(mgr)
typeactivity.SetManager(mgr)
typeadd.SetManager(mgr)
typeannounce.SetManager(mgr)
typeapplication.SetManager(mgr)
typearrive.SetManager(mgr)
typearticle.SetManager(mgr)
typeaudio.SetManager(mgr)
typeblock.SetManager(mgr)
typecollection.SetManager(mgr)
typecollectionpage.SetManager(mgr)
typecreate.SetManager(mgr)
typedelete.SetManager(mgr)
typedislike.SetManager(mgr)
typedocument.SetManager(mgr)
typeevent.SetManager(mgr)
typeflag.SetManager(mgr)
typefollow.SetManager(mgr)
typegroup.SetManager(mgr)
typeignore.SetManager(mgr)
typeimage.SetManager(mgr)
typeintransitiveactivity.SetManager(mgr)
typeinvite.SetManager(mgr)
typejoin.SetManager(mgr)
typeleave.SetManager(mgr)
typelike.SetManager(mgr)
typelink.SetManager(mgr)
typelisten.SetManager(mgr)
typemention.SetManager(mgr)
typemove.SetManager(mgr)
typenote.SetManager(mgr)
typeobject.SetManager(mgr)
typeoffer.SetManager(mgr)
typeorderedcollection.SetManager(mgr)
typeorderedcollectionpage.SetManager(mgr)
typeorganization.SetManager(mgr)
typepage.SetManager(mgr)
typeperson.SetManager(mgr)
typeplace.SetManager(mgr)
typeprofile.SetManager(mgr)
typequestion.SetManager(mgr)
typeread.SetManager(mgr)
typereject.SetManager(mgr)
typerelationship.SetManager(mgr)
typeremove.SetManager(mgr)
typeservice.SetManager(mgr)
typetentativeaccept.SetManager(mgr)
typetentativereject.SetManager(mgr)
typetombstone.SetManager(mgr)
typetravel.SetManager(mgr)
typeundo.SetManager(mgr)
typeupdate.SetManager(mgr)
typevideo.SetManager(mgr)
typeview.SetManager(mgr)
propertyassignedto.SetManager(mgr)
propertycommitted.SetManager(mgr)
propertycommittedby.SetManager(mgr)
propertydependants.SetManager(mgr)
propertydependedby.SetManager(mgr)
propertydependencies.SetManager(mgr)
propertydependson.SetManager(mgr)
propertydescription.SetManager(mgr)
propertyearlyitems.SetManager(mgr)
propertyfilesadded.SetManager(mgr)
propertyfilesmodified.SetManager(mgr)
propertyfilesremoved.SetManager(mgr)
propertyforks.SetManager(mgr)
propertyhash.SetManager(mgr)
propertyisresolved.SetManager(mgr)
propertyref.SetManager(mgr)
propertyteam.SetManager(mgr)
propertyticketstrackedby.SetManager(mgr)
propertytracksticketsfor.SetManager(mgr)
typebranch.SetManager(mgr)
typecommit.SetManager(mgr)
typepush.SetManager(mgr)
typerepository.SetManager(mgr)
typeticket.SetManager(mgr)
typeticketdependency.SetManager(mgr)
propertyblurhash.SetManager(mgr)
propertydiscoverable.SetManager(mgr)
propertyfeatured.SetManager(mgr)
propertysignaturealgorithm.SetManager(mgr)
propertysignaturevalue.SetManager(mgr)
propertyvoterscount.SetManager(mgr)
typeemoji.SetManager(mgr)
typeidentityproof.SetManager(mgr)
propertyowner.SetManager(mgr)
propertypublickey.SetManager(mgr)
propertypublickeypem.SetManager(mgr)
typepublickey.SetManager(mgr)
typeaccept.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeactivity.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeadd.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeannounce.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeapplication.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typearrive.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typearticle.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeaudio.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeblock.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typecollection.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typecollectionpage.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typecreate.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typedelete.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typedislike.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typedocument.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeevent.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeflag.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typefollow.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typegroup.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeignore.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeimage.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeintransitiveactivity.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeinvite.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typejoin.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeleave.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typelike.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typelink.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typelisten.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typemention.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typemove.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typenote.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeobject.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeoffer.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeorderedcollection.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeorderedcollectionpage.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeorganization.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typepage.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeperson.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeplace.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeprofile.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typequestion.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeread.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typereject.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typerelationship.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeremove.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeservice.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typetentativeaccept.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typetentativereject.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typetombstone.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typetravel.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeundo.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeupdate.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typevideo.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeview.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typebranch.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typecommit.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typepush.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typerepository.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeticket.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeticketdependency.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeemoji.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typeidentityproof.SetTypePropertyConstructor(NewJSONLDTypeProperty)
typepublickey.SetTypePropertyConstructor(NewJSONLDTypeProperty)
}

View file

@ -1,978 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
"context"
"errors"
"fmt"
vocab "github.com/go-fed/activity/streams/vocab"
"strings"
)
// JSONResolver resolves a JSON-deserialized map into its concrete ActivityStreams
// type
type JSONResolver struct {
callbacks []interface{}
}
// NewJSONResolver creates a new Resolver that takes a JSON-deserialized generic
// map and determines the correct concrete Go type. The callback function is
// guaranteed to receive a value whose underlying ActivityStreams type matches
// the concrete interface name in its signature. The callback functions must
// be of the form:
//
// func(context.Context, <TypeInterface>) error
//
// where TypeInterface is the code-generated interface for an ActivityStream
// type. An error is returned if a callback function does not match this
// signature.
func NewJSONResolver(callbacks ...interface{}) (*JSONResolver, error) {
for _, cb := range callbacks {
// Each callback function must satisfy one known function signature, or else we will generate a runtime error instead of silently fail.
switch cb.(type) {
case func(context.Context, vocab.ActivityStreamsAccept) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsActivity) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsAdd) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsAnnounce) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsApplication) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsArrive) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsArticle) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsAudio) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsBlock) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ForgeFedBranch) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsCollection) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsCollectionPage) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ForgeFedCommit) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsCreate) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsDelete) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsDislike) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsDocument) 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.ActivityStreamsEvent) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsFlag) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsFollow) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsGroup) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.TootIdentityProof) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsIgnore) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsImage) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsIntransitiveActivity) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsInvite) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsJoin) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsLeave) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsLike) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsLink) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsListen) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsMention) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsMove) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsNote) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsObject) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsOffer) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsOrderedCollection) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsOrderedCollectionPage) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsOrganization) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsPage) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsPerson) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsPlace) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsProfile) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.W3IDSecurityV1PublicKey) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ForgeFedPush) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsQuestion) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsRead) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsReject) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsRelationship) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsRemove) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ForgeFedRepository) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsService) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsTentativeAccept) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsTentativeReject) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ForgeFedTicket) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ForgeFedTicketDependency) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsTombstone) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsTravel) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsUndo) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsUpdate) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsVideo) error:
// Do nothing, this callback has a correct signature.
case func(context.Context, vocab.ActivityStreamsView) error:
// Do nothing, this callback has a correct signature.
default:
return nil, errors.New("a callback function is of the wrong signature and would never be called")
}
}
return &JSONResolver{callbacks: callbacks}, nil
}
// toAliasMap converts a JSONLD context into a map of vocabulary name to alias.
func toAliasMap(i interface{}) (m map[string]string) {
m = make(map[string]string)
toHttpHttpsFn := func(s string) (ok bool, http, https string) {
if strings.HasPrefix(s, "http://") {
ok = true
http = s
https = "https" + strings.TrimPrefix(s, "http")
} else if strings.HasPrefix(s, "https://") {
ok = true
https = s
http = "http" + strings.TrimPrefix(s, "https")
}
return
}
switch v := i.(type) {
case string:
// Single entry, no alias.
if ok, http, https := toHttpHttpsFn(v); ok {
m[http] = ""
m[https] = ""
} else {
m[v] = ""
}
case []interface{}:
// Recursively apply.
for _, elem := range v {
r := toAliasMap(elem)
for k, val := range r {
m[k] = val
}
}
case map[string]interface{}:
// Map any aliases.
for k, val := range v {
// Only handle string aliases.
switch conc := val.(type) {
case string:
m[k] = conc
}
}
}
return
}
// Resolve determines the ActivityStreams type of the payload, then applies the
// first callback function whose signature accepts the ActivityStreams value's
// type. This strictly assures that the callback function will only be passed
// ActivityStream objects whose type matches its interface. Returns an error
// if the ActivityStreams type does not match callbackers or is not a type
// handled by the generated code. If multiple types are present, it will check
// each one in order and apply only the first one. It returns an unhandled
// error for a multi-typed object if none of the types were able to be handled.
func (this JSONResolver) Resolve(ctx context.Context, m map[string]interface{}) error {
typeValue, ok := m["type"]
if !ok {
return fmt.Errorf("cannot determine ActivityStreams type: 'type' property is missing")
}
rawContext, ok := m["@context"]
if !ok {
return fmt.Errorf("cannot determine ActivityStreams type: '@context' is missing")
}
aliasMap := toAliasMap(rawContext)
// Begin: Private lambda to handle a single string "type" value. Makes code generation easier.
handleFn := func(typeString string) error {
ActivityStreamsAlias, ok := aliasMap["https://www.w3.org/ns/activitystreams"]
if !ok {
ActivityStreamsAlias = aliasMap["http://www.w3.org/ns/activitystreams"]
}
if len(ActivityStreamsAlias) > 0 {
ActivityStreamsAlias += ":"
}
ForgeFedAlias, ok := aliasMap["https://forgefed.peers.community/ns"]
if !ok {
ForgeFedAlias = aliasMap["http://forgefed.peers.community/ns"]
}
if len(ForgeFedAlias) > 0 {
ForgeFedAlias += ":"
}
TootAlias, ok := aliasMap["https://joinmastodon.org/ns"]
if !ok {
TootAlias = aliasMap["http://joinmastodon.org/ns"]
}
if len(TootAlias) > 0 {
TootAlias += ":"
}
W3IDSecurityV1Alias, ok := aliasMap["https://w3id.org/security/v1"]
if !ok {
W3IDSecurityV1Alias = aliasMap["http://w3id.org/security/v1"]
}
if len(W3IDSecurityV1Alias) > 0 {
W3IDSecurityV1Alias += ":"
}
if typeString == ActivityStreamsAlias+"Accept" {
v, err := mgr.DeserializeAcceptActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsAccept) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Activity" {
v, err := mgr.DeserializeActivityActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsActivity) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Add" {
v, err := mgr.DeserializeAddActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsAdd) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Announce" {
v, err := mgr.DeserializeAnnounceActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsAnnounce) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Application" {
v, err := mgr.DeserializeApplicationActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsApplication) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Arrive" {
v, err := mgr.DeserializeArriveActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsArrive) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Article" {
v, err := mgr.DeserializeArticleActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsArticle) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Audio" {
v, err := mgr.DeserializeAudioActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsAudio) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Block" {
v, err := mgr.DeserializeBlockActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsBlock) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ForgeFedAlias+"Branch" {
v, err := mgr.DeserializeBranchForgeFed()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ForgeFedBranch) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Collection" {
v, err := mgr.DeserializeCollectionActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsCollection) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"CollectionPage" {
v, err := mgr.DeserializeCollectionPageActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsCollectionPage) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ForgeFedAlias+"Commit" {
v, err := mgr.DeserializeCommitForgeFed()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ForgeFedCommit) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Create" {
v, err := mgr.DeserializeCreateActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsCreate) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Delete" {
v, err := mgr.DeserializeDeleteActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsDelete) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Dislike" {
v, err := mgr.DeserializeDislikeActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsDislike) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Document" {
v, err := mgr.DeserializeDocumentActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsDocument) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == TootAlias+"Emoji" {
v, err := mgr.DeserializeEmojiToot()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.TootEmoji) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Event" {
v, err := mgr.DeserializeEventActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsEvent) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Flag" {
v, err := mgr.DeserializeFlagActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsFlag) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Follow" {
v, err := mgr.DeserializeFollowActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsFollow) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Group" {
v, err := mgr.DeserializeGroupActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsGroup) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == TootAlias+"IdentityProof" {
v, err := mgr.DeserializeIdentityProofToot()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.TootIdentityProof) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Ignore" {
v, err := mgr.DeserializeIgnoreActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsIgnore) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Image" {
v, err := mgr.DeserializeImageActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsImage) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"IntransitiveActivity" {
v, err := mgr.DeserializeIntransitiveActivityActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsIntransitiveActivity) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Invite" {
v, err := mgr.DeserializeInviteActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsInvite) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Join" {
v, err := mgr.DeserializeJoinActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsJoin) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Leave" {
v, err := mgr.DeserializeLeaveActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsLeave) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Like" {
v, err := mgr.DeserializeLikeActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsLike) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Link" {
v, err := mgr.DeserializeLinkActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsLink) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Listen" {
v, err := mgr.DeserializeListenActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsListen) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Mention" {
v, err := mgr.DeserializeMentionActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsMention) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Move" {
v, err := mgr.DeserializeMoveActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsMove) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Note" {
v, err := mgr.DeserializeNoteActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsNote) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Object" {
v, err := mgr.DeserializeObjectActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsObject) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Offer" {
v, err := mgr.DeserializeOfferActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsOffer) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"OrderedCollection" {
v, err := mgr.DeserializeOrderedCollectionActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsOrderedCollection) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"OrderedCollectionPage" {
v, err := mgr.DeserializeOrderedCollectionPageActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsOrderedCollectionPage) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Organization" {
v, err := mgr.DeserializeOrganizationActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsOrganization) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Page" {
v, err := mgr.DeserializePageActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsPage) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Person" {
v, err := mgr.DeserializePersonActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsPerson) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Place" {
v, err := mgr.DeserializePlaceActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsPlace) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Profile" {
v, err := mgr.DeserializeProfileActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsProfile) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == W3IDSecurityV1Alias+"PublicKey" {
v, err := mgr.DeserializePublicKeyW3IDSecurityV1()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.W3IDSecurityV1PublicKey) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ForgeFedAlias+"Push" {
v, err := mgr.DeserializePushForgeFed()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ForgeFedPush) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Question" {
v, err := mgr.DeserializeQuestionActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsQuestion) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Read" {
v, err := mgr.DeserializeReadActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsRead) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Reject" {
v, err := mgr.DeserializeRejectActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsReject) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Relationship" {
v, err := mgr.DeserializeRelationshipActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsRelationship) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Remove" {
v, err := mgr.DeserializeRemoveActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsRemove) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ForgeFedAlias+"Repository" {
v, err := mgr.DeserializeRepositoryForgeFed()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ForgeFedRepository) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Service" {
v, err := mgr.DeserializeServiceActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsService) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"TentativeAccept" {
v, err := mgr.DeserializeTentativeAcceptActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsTentativeAccept) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"TentativeReject" {
v, err := mgr.DeserializeTentativeRejectActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsTentativeReject) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ForgeFedAlias+"Ticket" {
v, err := mgr.DeserializeTicketForgeFed()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ForgeFedTicket) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ForgeFedAlias+"TicketDependency" {
v, err := mgr.DeserializeTicketDependencyForgeFed()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ForgeFedTicketDependency) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Tombstone" {
v, err := mgr.DeserializeTombstoneActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsTombstone) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Travel" {
v, err := mgr.DeserializeTravelActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsTravel) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Undo" {
v, err := mgr.DeserializeUndoActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsUndo) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Update" {
v, err := mgr.DeserializeUpdateActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsUpdate) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"Video" {
v, err := mgr.DeserializeVideoActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsVideo) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else if typeString == ActivityStreamsAlias+"View" {
v, err := mgr.DeserializeViewActivityStreams()(m, aliasMap)
if err != nil {
return err
}
for _, i := range this.callbacks {
if fn, ok := i.(func(context.Context, vocab.ActivityStreamsView) error); ok {
return fn(ctx, v)
}
}
return ErrNoCallbackMatch
} else {
return ErrUnhandledType
}
}
// End: Private lambda
if typeStr, ok := typeValue.(string); ok {
return handleFn(typeStr)
} else if typeIArr, ok := typeValue.([]interface{}); ok {
for _, typeI := range typeIArr {
if typeStr, ok := typeI.(string); ok {
if err := handleFn(typeStr); err == nil {
return nil
} else if err == ErrUnhandledType {
// Keep trying other types: only if all fail do we return this error.
continue
} else {
return err
}
}
}
return ErrUnhandledType
} else {
return ErrUnhandledType
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,385 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_accept"
typeactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_activity"
typeadd "github.com/go-fed/activity/streams/impl/activitystreams/type_add"
typeannounce "github.com/go-fed/activity/streams/impl/activitystreams/type_announce"
typeapplication "github.com/go-fed/activity/streams/impl/activitystreams/type_application"
typearrive "github.com/go-fed/activity/streams/impl/activitystreams/type_arrive"
typearticle "github.com/go-fed/activity/streams/impl/activitystreams/type_article"
typeaudio "github.com/go-fed/activity/streams/impl/activitystreams/type_audio"
typeblock "github.com/go-fed/activity/streams/impl/activitystreams/type_block"
typecollection "github.com/go-fed/activity/streams/impl/activitystreams/type_collection"
typecollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_collectionpage"
typecreate "github.com/go-fed/activity/streams/impl/activitystreams/type_create"
typedelete "github.com/go-fed/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/go-fed/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/go-fed/activity/streams/impl/activitystreams/type_document"
typeevent "github.com/go-fed/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/go-fed/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/go-fed/activity/streams/impl/activitystreams/type_follow"
typegroup "github.com/go-fed/activity/streams/impl/activitystreams/type_group"
typeignore "github.com/go-fed/activity/streams/impl/activitystreams/type_ignore"
typeimage "github.com/go-fed/activity/streams/impl/activitystreams/type_image"
typeintransitiveactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_intransitiveactivity"
typeinvite "github.com/go-fed/activity/streams/impl/activitystreams/type_invite"
typejoin "github.com/go-fed/activity/streams/impl/activitystreams/type_join"
typeleave "github.com/go-fed/activity/streams/impl/activitystreams/type_leave"
typelike "github.com/go-fed/activity/streams/impl/activitystreams/type_like"
typelink "github.com/go-fed/activity/streams/impl/activitystreams/type_link"
typelisten "github.com/go-fed/activity/streams/impl/activitystreams/type_listen"
typemention "github.com/go-fed/activity/streams/impl/activitystreams/type_mention"
typemove "github.com/go-fed/activity/streams/impl/activitystreams/type_move"
typenote "github.com/go-fed/activity/streams/impl/activitystreams/type_note"
typeobject "github.com/go-fed/activity/streams/impl/activitystreams/type_object"
typeoffer "github.com/go-fed/activity/streams/impl/activitystreams/type_offer"
typeorderedcollection "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollection"
typeorderedcollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollectionpage"
typeorganization "github.com/go-fed/activity/streams/impl/activitystreams/type_organization"
typepage "github.com/go-fed/activity/streams/impl/activitystreams/type_page"
typeperson "github.com/go-fed/activity/streams/impl/activitystreams/type_person"
typeplace "github.com/go-fed/activity/streams/impl/activitystreams/type_place"
typeprofile "github.com/go-fed/activity/streams/impl/activitystreams/type_profile"
typequestion "github.com/go-fed/activity/streams/impl/activitystreams/type_question"
typeread "github.com/go-fed/activity/streams/impl/activitystreams/type_read"
typereject "github.com/go-fed/activity/streams/impl/activitystreams/type_reject"
typerelationship "github.com/go-fed/activity/streams/impl/activitystreams/type_relationship"
typeremove "github.com/go-fed/activity/streams/impl/activitystreams/type_remove"
typeservice "github.com/go-fed/activity/streams/impl/activitystreams/type_service"
typetentativeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativeaccept"
typetentativereject "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativereject"
typetombstone "github.com/go-fed/activity/streams/impl/activitystreams/type_tombstone"
typetravel "github.com/go-fed/activity/streams/impl/activitystreams/type_travel"
typeundo "github.com/go-fed/activity/streams/impl/activitystreams/type_undo"
typeupdate "github.com/go-fed/activity/streams/impl/activitystreams/type_update"
typevideo "github.com/go-fed/activity/streams/impl/activitystreams/type_video"
typeview "github.com/go-fed/activity/streams/impl/activitystreams/type_view"
vocab "github.com/go-fed/activity/streams/vocab"
)
// ActivityStreamsAcceptIsDisjointWith returns true if Accept is disjoint with the
// other's type.
func ActivityStreamsAcceptIsDisjointWith(other vocab.Type) bool {
return typeaccept.AcceptIsDisjointWith(other)
}
// ActivityStreamsActivityIsDisjointWith returns true if Activity is disjoint with
// the other's type.
func ActivityStreamsActivityIsDisjointWith(other vocab.Type) bool {
return typeactivity.ActivityIsDisjointWith(other)
}
// ActivityStreamsAddIsDisjointWith returns true if Add is disjoint with the
// other's type.
func ActivityStreamsAddIsDisjointWith(other vocab.Type) bool {
return typeadd.AddIsDisjointWith(other)
}
// ActivityStreamsAnnounceIsDisjointWith returns true if Announce is disjoint with
// the other's type.
func ActivityStreamsAnnounceIsDisjointWith(other vocab.Type) bool {
return typeannounce.AnnounceIsDisjointWith(other)
}
// ActivityStreamsApplicationIsDisjointWith returns true if Application is
// disjoint with the other's type.
func ActivityStreamsApplicationIsDisjointWith(other vocab.Type) bool {
return typeapplication.ApplicationIsDisjointWith(other)
}
// ActivityStreamsArriveIsDisjointWith returns true if Arrive is disjoint with the
// other's type.
func ActivityStreamsArriveIsDisjointWith(other vocab.Type) bool {
return typearrive.ArriveIsDisjointWith(other)
}
// ActivityStreamsArticleIsDisjointWith returns true if Article is disjoint with
// the other's type.
func ActivityStreamsArticleIsDisjointWith(other vocab.Type) bool {
return typearticle.ArticleIsDisjointWith(other)
}
// ActivityStreamsAudioIsDisjointWith returns true if Audio is disjoint with the
// other's type.
func ActivityStreamsAudioIsDisjointWith(other vocab.Type) bool {
return typeaudio.AudioIsDisjointWith(other)
}
// ActivityStreamsBlockIsDisjointWith returns true if Block is disjoint with the
// other's type.
func ActivityStreamsBlockIsDisjointWith(other vocab.Type) bool {
return typeblock.BlockIsDisjointWith(other)
}
// ActivityStreamsCollectionIsDisjointWith returns true if Collection is disjoint
// with the other's type.
func ActivityStreamsCollectionIsDisjointWith(other vocab.Type) bool {
return typecollection.CollectionIsDisjointWith(other)
}
// ActivityStreamsCollectionPageIsDisjointWith returns true if CollectionPage is
// disjoint with the other's type.
func ActivityStreamsCollectionPageIsDisjointWith(other vocab.Type) bool {
return typecollectionpage.CollectionPageIsDisjointWith(other)
}
// ActivityStreamsCreateIsDisjointWith returns true if Create is disjoint with the
// other's type.
func ActivityStreamsCreateIsDisjointWith(other vocab.Type) bool {
return typecreate.CreateIsDisjointWith(other)
}
// ActivityStreamsDeleteIsDisjointWith returns true if Delete is disjoint with the
// other's type.
func ActivityStreamsDeleteIsDisjointWith(other vocab.Type) bool {
return typedelete.DeleteIsDisjointWith(other)
}
// ActivityStreamsDislikeIsDisjointWith returns true if Dislike is disjoint with
// the other's type.
func ActivityStreamsDislikeIsDisjointWith(other vocab.Type) bool {
return typedislike.DislikeIsDisjointWith(other)
}
// ActivityStreamsDocumentIsDisjointWith returns true if Document is disjoint with
// the other's type.
func ActivityStreamsDocumentIsDisjointWith(other vocab.Type) bool {
return typedocument.DocumentIsDisjointWith(other)
}
// ActivityStreamsEventIsDisjointWith returns true if Event is disjoint with the
// other's type.
func ActivityStreamsEventIsDisjointWith(other vocab.Type) bool {
return typeevent.EventIsDisjointWith(other)
}
// ActivityStreamsFlagIsDisjointWith returns true if Flag is disjoint with the
// other's type.
func ActivityStreamsFlagIsDisjointWith(other vocab.Type) bool {
return typeflag.FlagIsDisjointWith(other)
}
// ActivityStreamsFollowIsDisjointWith returns true if Follow is disjoint with the
// other's type.
func ActivityStreamsFollowIsDisjointWith(other vocab.Type) bool {
return typefollow.FollowIsDisjointWith(other)
}
// ActivityStreamsGroupIsDisjointWith returns true if Group is disjoint with the
// other's type.
func ActivityStreamsGroupIsDisjointWith(other vocab.Type) bool {
return typegroup.GroupIsDisjointWith(other)
}
// ActivityStreamsIgnoreIsDisjointWith returns true if Ignore is disjoint with the
// other's type.
func ActivityStreamsIgnoreIsDisjointWith(other vocab.Type) bool {
return typeignore.IgnoreIsDisjointWith(other)
}
// ActivityStreamsImageIsDisjointWith returns true if Image is disjoint with the
// other's type.
func ActivityStreamsImageIsDisjointWith(other vocab.Type) bool {
return typeimage.ImageIsDisjointWith(other)
}
// ActivityStreamsIntransitiveActivityIsDisjointWith returns true if
// IntransitiveActivity is disjoint with the other's type.
func ActivityStreamsIntransitiveActivityIsDisjointWith(other vocab.Type) bool {
return typeintransitiveactivity.IntransitiveActivityIsDisjointWith(other)
}
// ActivityStreamsInviteIsDisjointWith returns true if Invite is disjoint with the
// other's type.
func ActivityStreamsInviteIsDisjointWith(other vocab.Type) bool {
return typeinvite.InviteIsDisjointWith(other)
}
// ActivityStreamsJoinIsDisjointWith returns true if Join is disjoint with the
// other's type.
func ActivityStreamsJoinIsDisjointWith(other vocab.Type) bool {
return typejoin.JoinIsDisjointWith(other)
}
// ActivityStreamsLeaveIsDisjointWith returns true if Leave is disjoint with the
// other's type.
func ActivityStreamsLeaveIsDisjointWith(other vocab.Type) bool {
return typeleave.LeaveIsDisjointWith(other)
}
// ActivityStreamsLikeIsDisjointWith returns true if Like is disjoint with the
// other's type.
func ActivityStreamsLikeIsDisjointWith(other vocab.Type) bool {
return typelike.LikeIsDisjointWith(other)
}
// ActivityStreamsLinkIsDisjointWith returns true if Link is disjoint with the
// other's type.
func ActivityStreamsLinkIsDisjointWith(other vocab.Type) bool {
return typelink.LinkIsDisjointWith(other)
}
// ActivityStreamsListenIsDisjointWith returns true if Listen is disjoint with the
// other's type.
func ActivityStreamsListenIsDisjointWith(other vocab.Type) bool {
return typelisten.ListenIsDisjointWith(other)
}
// ActivityStreamsMentionIsDisjointWith returns true if Mention is disjoint with
// the other's type.
func ActivityStreamsMentionIsDisjointWith(other vocab.Type) bool {
return typemention.MentionIsDisjointWith(other)
}
// ActivityStreamsMoveIsDisjointWith returns true if Move is disjoint with the
// other's type.
func ActivityStreamsMoveIsDisjointWith(other vocab.Type) bool {
return typemove.MoveIsDisjointWith(other)
}
// ActivityStreamsNoteIsDisjointWith returns true if Note is disjoint with the
// other's type.
func ActivityStreamsNoteIsDisjointWith(other vocab.Type) bool {
return typenote.NoteIsDisjointWith(other)
}
// ActivityStreamsObjectIsDisjointWith returns true if Object is disjoint with the
// other's type.
func ActivityStreamsObjectIsDisjointWith(other vocab.Type) bool {
return typeobject.ObjectIsDisjointWith(other)
}
// ActivityStreamsOfferIsDisjointWith returns true if Offer is disjoint with the
// other's type.
func ActivityStreamsOfferIsDisjointWith(other vocab.Type) bool {
return typeoffer.OfferIsDisjointWith(other)
}
// ActivityStreamsOrderedCollectionIsDisjointWith returns true if
// OrderedCollection is disjoint with the other's type.
func ActivityStreamsOrderedCollectionIsDisjointWith(other vocab.Type) bool {
return typeorderedcollection.OrderedCollectionIsDisjointWith(other)
}
// ActivityStreamsOrderedCollectionPageIsDisjointWith returns true if
// OrderedCollectionPage is disjoint with the other's type.
func ActivityStreamsOrderedCollectionPageIsDisjointWith(other vocab.Type) bool {
return typeorderedcollectionpage.OrderedCollectionPageIsDisjointWith(other)
}
// ActivityStreamsOrganizationIsDisjointWith returns true if Organization is
// disjoint with the other's type.
func ActivityStreamsOrganizationIsDisjointWith(other vocab.Type) bool {
return typeorganization.OrganizationIsDisjointWith(other)
}
// ActivityStreamsPageIsDisjointWith returns true if Page is disjoint with the
// other's type.
func ActivityStreamsPageIsDisjointWith(other vocab.Type) bool {
return typepage.PageIsDisjointWith(other)
}
// ActivityStreamsPersonIsDisjointWith returns true if Person is disjoint with the
// other's type.
func ActivityStreamsPersonIsDisjointWith(other vocab.Type) bool {
return typeperson.PersonIsDisjointWith(other)
}
// ActivityStreamsPlaceIsDisjointWith returns true if Place is disjoint with the
// other's type.
func ActivityStreamsPlaceIsDisjointWith(other vocab.Type) bool {
return typeplace.PlaceIsDisjointWith(other)
}
// ActivityStreamsProfileIsDisjointWith returns true if Profile is disjoint with
// the other's type.
func ActivityStreamsProfileIsDisjointWith(other vocab.Type) bool {
return typeprofile.ProfileIsDisjointWith(other)
}
// ActivityStreamsQuestionIsDisjointWith returns true if Question is disjoint with
// the other's type.
func ActivityStreamsQuestionIsDisjointWith(other vocab.Type) bool {
return typequestion.QuestionIsDisjointWith(other)
}
// ActivityStreamsReadIsDisjointWith returns true if Read is disjoint with the
// other's type.
func ActivityStreamsReadIsDisjointWith(other vocab.Type) bool {
return typeread.ReadIsDisjointWith(other)
}
// ActivityStreamsRejectIsDisjointWith returns true if Reject is disjoint with the
// other's type.
func ActivityStreamsRejectIsDisjointWith(other vocab.Type) bool {
return typereject.RejectIsDisjointWith(other)
}
// ActivityStreamsRelationshipIsDisjointWith returns true if Relationship is
// disjoint with the other's type.
func ActivityStreamsRelationshipIsDisjointWith(other vocab.Type) bool {
return typerelationship.RelationshipIsDisjointWith(other)
}
// ActivityStreamsRemoveIsDisjointWith returns true if Remove is disjoint with the
// other's type.
func ActivityStreamsRemoveIsDisjointWith(other vocab.Type) bool {
return typeremove.RemoveIsDisjointWith(other)
}
// ActivityStreamsServiceIsDisjointWith returns true if Service is disjoint with
// the other's type.
func ActivityStreamsServiceIsDisjointWith(other vocab.Type) bool {
return typeservice.ServiceIsDisjointWith(other)
}
// ActivityStreamsTentativeAcceptIsDisjointWith returns true if TentativeAccept is
// disjoint with the other's type.
func ActivityStreamsTentativeAcceptIsDisjointWith(other vocab.Type) bool {
return typetentativeaccept.TentativeAcceptIsDisjointWith(other)
}
// ActivityStreamsTentativeRejectIsDisjointWith returns true if TentativeReject is
// disjoint with the other's type.
func ActivityStreamsTentativeRejectIsDisjointWith(other vocab.Type) bool {
return typetentativereject.TentativeRejectIsDisjointWith(other)
}
// ActivityStreamsTombstoneIsDisjointWith returns true if Tombstone is disjoint
// with the other's type.
func ActivityStreamsTombstoneIsDisjointWith(other vocab.Type) bool {
return typetombstone.TombstoneIsDisjointWith(other)
}
// ActivityStreamsTravelIsDisjointWith returns true if Travel is disjoint with the
// other's type.
func ActivityStreamsTravelIsDisjointWith(other vocab.Type) bool {
return typetravel.TravelIsDisjointWith(other)
}
// ActivityStreamsUndoIsDisjointWith returns true if Undo is disjoint with the
// other's type.
func ActivityStreamsUndoIsDisjointWith(other vocab.Type) bool {
return typeundo.UndoIsDisjointWith(other)
}
// ActivityStreamsUpdateIsDisjointWith returns true if Update is disjoint with the
// other's type.
func ActivityStreamsUpdateIsDisjointWith(other vocab.Type) bool {
return typeupdate.UpdateIsDisjointWith(other)
}
// ActivityStreamsVideoIsDisjointWith returns true if Video is disjoint with the
// other's type.
func ActivityStreamsVideoIsDisjointWith(other vocab.Type) bool {
return typevideo.VideoIsDisjointWith(other)
}
// ActivityStreamsViewIsDisjointWith returns true if View is disjoint with the
// other's type.
func ActivityStreamsViewIsDisjointWith(other vocab.Type) bool {
return typeview.ViewIsDisjointWith(other)
}

View file

@ -1,439 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_accept"
typeactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_activity"
typeadd "github.com/go-fed/activity/streams/impl/activitystreams/type_add"
typeannounce "github.com/go-fed/activity/streams/impl/activitystreams/type_announce"
typeapplication "github.com/go-fed/activity/streams/impl/activitystreams/type_application"
typearrive "github.com/go-fed/activity/streams/impl/activitystreams/type_arrive"
typearticle "github.com/go-fed/activity/streams/impl/activitystreams/type_article"
typeaudio "github.com/go-fed/activity/streams/impl/activitystreams/type_audio"
typeblock "github.com/go-fed/activity/streams/impl/activitystreams/type_block"
typecollection "github.com/go-fed/activity/streams/impl/activitystreams/type_collection"
typecollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_collectionpage"
typecreate "github.com/go-fed/activity/streams/impl/activitystreams/type_create"
typedelete "github.com/go-fed/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/go-fed/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/go-fed/activity/streams/impl/activitystreams/type_document"
typeevent "github.com/go-fed/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/go-fed/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/go-fed/activity/streams/impl/activitystreams/type_follow"
typegroup "github.com/go-fed/activity/streams/impl/activitystreams/type_group"
typeignore "github.com/go-fed/activity/streams/impl/activitystreams/type_ignore"
typeimage "github.com/go-fed/activity/streams/impl/activitystreams/type_image"
typeintransitiveactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_intransitiveactivity"
typeinvite "github.com/go-fed/activity/streams/impl/activitystreams/type_invite"
typejoin "github.com/go-fed/activity/streams/impl/activitystreams/type_join"
typeleave "github.com/go-fed/activity/streams/impl/activitystreams/type_leave"
typelike "github.com/go-fed/activity/streams/impl/activitystreams/type_like"
typelink "github.com/go-fed/activity/streams/impl/activitystreams/type_link"
typelisten "github.com/go-fed/activity/streams/impl/activitystreams/type_listen"
typemention "github.com/go-fed/activity/streams/impl/activitystreams/type_mention"
typemove "github.com/go-fed/activity/streams/impl/activitystreams/type_move"
typenote "github.com/go-fed/activity/streams/impl/activitystreams/type_note"
typeobject "github.com/go-fed/activity/streams/impl/activitystreams/type_object"
typeoffer "github.com/go-fed/activity/streams/impl/activitystreams/type_offer"
typeorderedcollection "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollection"
typeorderedcollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollectionpage"
typeorganization "github.com/go-fed/activity/streams/impl/activitystreams/type_organization"
typepage "github.com/go-fed/activity/streams/impl/activitystreams/type_page"
typeperson "github.com/go-fed/activity/streams/impl/activitystreams/type_person"
typeplace "github.com/go-fed/activity/streams/impl/activitystreams/type_place"
typeprofile "github.com/go-fed/activity/streams/impl/activitystreams/type_profile"
typequestion "github.com/go-fed/activity/streams/impl/activitystreams/type_question"
typeread "github.com/go-fed/activity/streams/impl/activitystreams/type_read"
typereject "github.com/go-fed/activity/streams/impl/activitystreams/type_reject"
typerelationship "github.com/go-fed/activity/streams/impl/activitystreams/type_relationship"
typeremove "github.com/go-fed/activity/streams/impl/activitystreams/type_remove"
typeservice "github.com/go-fed/activity/streams/impl/activitystreams/type_service"
typetentativeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativeaccept"
typetentativereject "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativereject"
typetombstone "github.com/go-fed/activity/streams/impl/activitystreams/type_tombstone"
typetravel "github.com/go-fed/activity/streams/impl/activitystreams/type_travel"
typeundo "github.com/go-fed/activity/streams/impl/activitystreams/type_undo"
typeupdate "github.com/go-fed/activity/streams/impl/activitystreams/type_update"
typevideo "github.com/go-fed/activity/streams/impl/activitystreams/type_video"
typeview "github.com/go-fed/activity/streams/impl/activitystreams/type_view"
vocab "github.com/go-fed/activity/streams/vocab"
)
// ActivityStreamsAcceptIsExtendedBy returns true if the other's type extends from
// Accept. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsAcceptIsExtendedBy(other vocab.Type) bool {
return typeaccept.AcceptIsExtendedBy(other)
}
// ActivityStreamsActivityIsExtendedBy returns true if the other's type extends
// from Activity. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsActivityIsExtendedBy(other vocab.Type) bool {
return typeactivity.ActivityIsExtendedBy(other)
}
// ActivityStreamsAddIsExtendedBy returns true if the other's type extends from
// Add. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsAddIsExtendedBy(other vocab.Type) bool {
return typeadd.AddIsExtendedBy(other)
}
// ActivityStreamsAnnounceIsExtendedBy returns true if the other's type extends
// from Announce. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsAnnounceIsExtendedBy(other vocab.Type) bool {
return typeannounce.AnnounceIsExtendedBy(other)
}
// ActivityStreamsApplicationIsExtendedBy returns true if the other's type extends
// from Application. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsApplicationIsExtendedBy(other vocab.Type) bool {
return typeapplication.ApplicationIsExtendedBy(other)
}
// ActivityStreamsArriveIsExtendedBy returns true if the other's type extends from
// Arrive. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsArriveIsExtendedBy(other vocab.Type) bool {
return typearrive.ArriveIsExtendedBy(other)
}
// ActivityStreamsArticleIsExtendedBy returns true if the other's type extends
// from Article. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsArticleIsExtendedBy(other vocab.Type) bool {
return typearticle.ArticleIsExtendedBy(other)
}
// ActivityStreamsAudioIsExtendedBy returns true if the other's type extends from
// Audio. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsAudioIsExtendedBy(other vocab.Type) bool {
return typeaudio.AudioIsExtendedBy(other)
}
// ActivityStreamsBlockIsExtendedBy returns true if the other's type extends from
// Block. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsBlockIsExtendedBy(other vocab.Type) bool {
return typeblock.BlockIsExtendedBy(other)
}
// ActivityStreamsCollectionIsExtendedBy returns true if the other's type extends
// from Collection. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsCollectionIsExtendedBy(other vocab.Type) bool {
return typecollection.CollectionIsExtendedBy(other)
}
// ActivityStreamsCollectionPageIsExtendedBy returns true if the other's type
// extends from CollectionPage. Note that it returns false if the types are
// the same; see the "IsOrExtends" variant instead.
func ActivityStreamsCollectionPageIsExtendedBy(other vocab.Type) bool {
return typecollectionpage.CollectionPageIsExtendedBy(other)
}
// ActivityStreamsCreateIsExtendedBy returns true if the other's type extends from
// Create. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsCreateIsExtendedBy(other vocab.Type) bool {
return typecreate.CreateIsExtendedBy(other)
}
// ActivityStreamsDeleteIsExtendedBy returns true if the other's type extends from
// Delete. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsDeleteIsExtendedBy(other vocab.Type) bool {
return typedelete.DeleteIsExtendedBy(other)
}
// ActivityStreamsDislikeIsExtendedBy returns true if the other's type extends
// from Dislike. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsDislikeIsExtendedBy(other vocab.Type) bool {
return typedislike.DislikeIsExtendedBy(other)
}
// ActivityStreamsDocumentIsExtendedBy returns true if the other's type extends
// from Document. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsDocumentIsExtendedBy(other vocab.Type) bool {
return typedocument.DocumentIsExtendedBy(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.
func ActivityStreamsEventIsExtendedBy(other vocab.Type) bool {
return typeevent.EventIsExtendedBy(other)
}
// ActivityStreamsFlagIsExtendedBy returns true if the other's type extends from
// Flag. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsFlagIsExtendedBy(other vocab.Type) bool {
return typeflag.FlagIsExtendedBy(other)
}
// ActivityStreamsFollowIsExtendedBy returns true if the other's type extends from
// Follow. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsFollowIsExtendedBy(other vocab.Type) bool {
return typefollow.FollowIsExtendedBy(other)
}
// ActivityStreamsGroupIsExtendedBy returns true if the other's type extends from
// Group. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsGroupIsExtendedBy(other vocab.Type) bool {
return typegroup.GroupIsExtendedBy(other)
}
// ActivityStreamsIgnoreIsExtendedBy returns true if the other's type extends from
// Ignore. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsIgnoreIsExtendedBy(other vocab.Type) bool {
return typeignore.IgnoreIsExtendedBy(other)
}
// ActivityStreamsImageIsExtendedBy returns true if the other's type extends from
// Image. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsImageIsExtendedBy(other vocab.Type) bool {
return typeimage.ImageIsExtendedBy(other)
}
// ActivityStreamsIntransitiveActivityIsExtendedBy returns true if the other's
// type extends from IntransitiveActivity. Note that it returns false if the
// types are the same; see the "IsOrExtends" variant instead.
func ActivityStreamsIntransitiveActivityIsExtendedBy(other vocab.Type) bool {
return typeintransitiveactivity.IntransitiveActivityIsExtendedBy(other)
}
// ActivityStreamsInviteIsExtendedBy returns true if the other's type extends from
// Invite. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsInviteIsExtendedBy(other vocab.Type) bool {
return typeinvite.InviteIsExtendedBy(other)
}
// ActivityStreamsJoinIsExtendedBy returns true if the other's type extends from
// Join. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsJoinIsExtendedBy(other vocab.Type) bool {
return typejoin.JoinIsExtendedBy(other)
}
// ActivityStreamsLeaveIsExtendedBy returns true if the other's type extends from
// Leave. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsLeaveIsExtendedBy(other vocab.Type) bool {
return typeleave.LeaveIsExtendedBy(other)
}
// ActivityStreamsLikeIsExtendedBy returns true if the other's type extends from
// Like. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsLikeIsExtendedBy(other vocab.Type) bool {
return typelike.LikeIsExtendedBy(other)
}
// ActivityStreamsLinkIsExtendedBy returns true if the other's type extends from
// Link. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsLinkIsExtendedBy(other vocab.Type) bool {
return typelink.LinkIsExtendedBy(other)
}
// ActivityStreamsListenIsExtendedBy returns true if the other's type extends from
// Listen. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsListenIsExtendedBy(other vocab.Type) bool {
return typelisten.ListenIsExtendedBy(other)
}
// ActivityStreamsMentionIsExtendedBy returns true if the other's type extends
// from Mention. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsMentionIsExtendedBy(other vocab.Type) bool {
return typemention.MentionIsExtendedBy(other)
}
// ActivityStreamsMoveIsExtendedBy returns true if the other's type extends from
// Move. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsMoveIsExtendedBy(other vocab.Type) bool {
return typemove.MoveIsExtendedBy(other)
}
// ActivityStreamsNoteIsExtendedBy returns true if the other's type extends from
// Note. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsNoteIsExtendedBy(other vocab.Type) bool {
return typenote.NoteIsExtendedBy(other)
}
// ActivityStreamsObjectIsExtendedBy returns true if the other's type extends from
// Object. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsObjectIsExtendedBy(other vocab.Type) bool {
return typeobject.ObjectIsExtendedBy(other)
}
// ActivityStreamsOfferIsExtendedBy returns true if the other's type extends from
// Offer. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsOfferIsExtendedBy(other vocab.Type) bool {
return typeoffer.OfferIsExtendedBy(other)
}
// ActivityStreamsOrderedCollectionIsExtendedBy returns true if the other's type
// extends from OrderedCollection. Note that it returns false if the types are
// the same; see the "IsOrExtends" variant instead.
func ActivityStreamsOrderedCollectionIsExtendedBy(other vocab.Type) bool {
return typeorderedcollection.OrderedCollectionIsExtendedBy(other)
}
// ActivityStreamsOrderedCollectionPageIsExtendedBy returns true if the other's
// type extends from OrderedCollectionPage. Note that it returns false if the
// types are the same; see the "IsOrExtends" variant instead.
func ActivityStreamsOrderedCollectionPageIsExtendedBy(other vocab.Type) bool {
return typeorderedcollectionpage.OrderedCollectionPageIsExtendedBy(other)
}
// ActivityStreamsOrganizationIsExtendedBy returns true if the other's type
// extends from Organization. Note that it returns false if the types are the
// same; see the "IsOrExtends" variant instead.
func ActivityStreamsOrganizationIsExtendedBy(other vocab.Type) bool {
return typeorganization.OrganizationIsExtendedBy(other)
}
// ActivityStreamsPageIsExtendedBy returns true if the other's type extends from
// Page. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsPageIsExtendedBy(other vocab.Type) bool {
return typepage.PageIsExtendedBy(other)
}
// ActivityStreamsPersonIsExtendedBy returns true if the other's type extends from
// Person. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsPersonIsExtendedBy(other vocab.Type) bool {
return typeperson.PersonIsExtendedBy(other)
}
// ActivityStreamsPlaceIsExtendedBy returns true if the other's type extends from
// Place. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsPlaceIsExtendedBy(other vocab.Type) bool {
return typeplace.PlaceIsExtendedBy(other)
}
// ActivityStreamsProfileIsExtendedBy returns true if the other's type extends
// from Profile. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsProfileIsExtendedBy(other vocab.Type) bool {
return typeprofile.ProfileIsExtendedBy(other)
}
// ActivityStreamsQuestionIsExtendedBy returns true if the other's type extends
// from Question. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsQuestionIsExtendedBy(other vocab.Type) bool {
return typequestion.QuestionIsExtendedBy(other)
}
// ActivityStreamsReadIsExtendedBy returns true if the other's type extends from
// Read. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsReadIsExtendedBy(other vocab.Type) bool {
return typeread.ReadIsExtendedBy(other)
}
// ActivityStreamsRejectIsExtendedBy returns true if the other's type extends from
// Reject. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsRejectIsExtendedBy(other vocab.Type) bool {
return typereject.RejectIsExtendedBy(other)
}
// ActivityStreamsRelationshipIsExtendedBy returns true if the other's type
// extends from Relationship. Note that it returns false if the types are the
// same; see the "IsOrExtends" variant instead.
func ActivityStreamsRelationshipIsExtendedBy(other vocab.Type) bool {
return typerelationship.RelationshipIsExtendedBy(other)
}
// ActivityStreamsRemoveIsExtendedBy returns true if the other's type extends from
// Remove. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsRemoveIsExtendedBy(other vocab.Type) bool {
return typeremove.RemoveIsExtendedBy(other)
}
// ActivityStreamsServiceIsExtendedBy returns true if the other's type extends
// from Service. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsServiceIsExtendedBy(other vocab.Type) bool {
return typeservice.ServiceIsExtendedBy(other)
}
// ActivityStreamsTentativeAcceptIsExtendedBy returns true if the other's type
// extends from TentativeAccept. Note that it returns false if the types are
// the same; see the "IsOrExtends" variant instead.
func ActivityStreamsTentativeAcceptIsExtendedBy(other vocab.Type) bool {
return typetentativeaccept.TentativeAcceptIsExtendedBy(other)
}
// ActivityStreamsTentativeRejectIsExtendedBy returns true if the other's type
// extends from TentativeReject. Note that it returns false if the types are
// the same; see the "IsOrExtends" variant instead.
func ActivityStreamsTentativeRejectIsExtendedBy(other vocab.Type) bool {
return typetentativereject.TentativeRejectIsExtendedBy(other)
}
// ActivityStreamsTombstoneIsExtendedBy returns true if the other's type extends
// from Tombstone. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func ActivityStreamsTombstoneIsExtendedBy(other vocab.Type) bool {
return typetombstone.TombstoneIsExtendedBy(other)
}
// ActivityStreamsTravelIsExtendedBy returns true if the other's type extends from
// Travel. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsTravelIsExtendedBy(other vocab.Type) bool {
return typetravel.TravelIsExtendedBy(other)
}
// ActivityStreamsUndoIsExtendedBy returns true if the other's type extends from
// Undo. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsUndoIsExtendedBy(other vocab.Type) bool {
return typeundo.UndoIsExtendedBy(other)
}
// ActivityStreamsUpdateIsExtendedBy returns true if the other's type extends from
// Update. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsUpdateIsExtendedBy(other vocab.Type) bool {
return typeupdate.UpdateIsExtendedBy(other)
}
// ActivityStreamsVideoIsExtendedBy returns true if the other's type extends from
// Video. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsVideoIsExtendedBy(other vocab.Type) bool {
return typevideo.VideoIsExtendedBy(other)
}
// ActivityStreamsViewIsExtendedBy returns true if the other's type extends from
// View. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ActivityStreamsViewIsExtendedBy(other vocab.Type) bool {
return typeview.ViewIsExtendedBy(other)
}

View file

@ -1,385 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_accept"
typeactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_activity"
typeadd "github.com/go-fed/activity/streams/impl/activitystreams/type_add"
typeannounce "github.com/go-fed/activity/streams/impl/activitystreams/type_announce"
typeapplication "github.com/go-fed/activity/streams/impl/activitystreams/type_application"
typearrive "github.com/go-fed/activity/streams/impl/activitystreams/type_arrive"
typearticle "github.com/go-fed/activity/streams/impl/activitystreams/type_article"
typeaudio "github.com/go-fed/activity/streams/impl/activitystreams/type_audio"
typeblock "github.com/go-fed/activity/streams/impl/activitystreams/type_block"
typecollection "github.com/go-fed/activity/streams/impl/activitystreams/type_collection"
typecollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_collectionpage"
typecreate "github.com/go-fed/activity/streams/impl/activitystreams/type_create"
typedelete "github.com/go-fed/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/go-fed/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/go-fed/activity/streams/impl/activitystreams/type_document"
typeevent "github.com/go-fed/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/go-fed/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/go-fed/activity/streams/impl/activitystreams/type_follow"
typegroup "github.com/go-fed/activity/streams/impl/activitystreams/type_group"
typeignore "github.com/go-fed/activity/streams/impl/activitystreams/type_ignore"
typeimage "github.com/go-fed/activity/streams/impl/activitystreams/type_image"
typeintransitiveactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_intransitiveactivity"
typeinvite "github.com/go-fed/activity/streams/impl/activitystreams/type_invite"
typejoin "github.com/go-fed/activity/streams/impl/activitystreams/type_join"
typeleave "github.com/go-fed/activity/streams/impl/activitystreams/type_leave"
typelike "github.com/go-fed/activity/streams/impl/activitystreams/type_like"
typelink "github.com/go-fed/activity/streams/impl/activitystreams/type_link"
typelisten "github.com/go-fed/activity/streams/impl/activitystreams/type_listen"
typemention "github.com/go-fed/activity/streams/impl/activitystreams/type_mention"
typemove "github.com/go-fed/activity/streams/impl/activitystreams/type_move"
typenote "github.com/go-fed/activity/streams/impl/activitystreams/type_note"
typeobject "github.com/go-fed/activity/streams/impl/activitystreams/type_object"
typeoffer "github.com/go-fed/activity/streams/impl/activitystreams/type_offer"
typeorderedcollection "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollection"
typeorderedcollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollectionpage"
typeorganization "github.com/go-fed/activity/streams/impl/activitystreams/type_organization"
typepage "github.com/go-fed/activity/streams/impl/activitystreams/type_page"
typeperson "github.com/go-fed/activity/streams/impl/activitystreams/type_person"
typeplace "github.com/go-fed/activity/streams/impl/activitystreams/type_place"
typeprofile "github.com/go-fed/activity/streams/impl/activitystreams/type_profile"
typequestion "github.com/go-fed/activity/streams/impl/activitystreams/type_question"
typeread "github.com/go-fed/activity/streams/impl/activitystreams/type_read"
typereject "github.com/go-fed/activity/streams/impl/activitystreams/type_reject"
typerelationship "github.com/go-fed/activity/streams/impl/activitystreams/type_relationship"
typeremove "github.com/go-fed/activity/streams/impl/activitystreams/type_remove"
typeservice "github.com/go-fed/activity/streams/impl/activitystreams/type_service"
typetentativeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativeaccept"
typetentativereject "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativereject"
typetombstone "github.com/go-fed/activity/streams/impl/activitystreams/type_tombstone"
typetravel "github.com/go-fed/activity/streams/impl/activitystreams/type_travel"
typeundo "github.com/go-fed/activity/streams/impl/activitystreams/type_undo"
typeupdate "github.com/go-fed/activity/streams/impl/activitystreams/type_update"
typevideo "github.com/go-fed/activity/streams/impl/activitystreams/type_video"
typeview "github.com/go-fed/activity/streams/impl/activitystreams/type_view"
vocab "github.com/go-fed/activity/streams/vocab"
)
// ActivityStreamsActivityStreamsAcceptExtends returns true if Accept extends from
// the other's type.
func ActivityStreamsActivityStreamsAcceptExtends(other vocab.Type) bool {
return typeaccept.ActivityStreamsAcceptExtends(other)
}
// ActivityStreamsActivityStreamsActivityExtends returns true if Activity extends
// from the other's type.
func ActivityStreamsActivityStreamsActivityExtends(other vocab.Type) bool {
return typeactivity.ActivityStreamsActivityExtends(other)
}
// ActivityStreamsActivityStreamsAddExtends returns true if Add extends from the
// other's type.
func ActivityStreamsActivityStreamsAddExtends(other vocab.Type) bool {
return typeadd.ActivityStreamsAddExtends(other)
}
// ActivityStreamsActivityStreamsAnnounceExtends returns true if Announce extends
// from the other's type.
func ActivityStreamsActivityStreamsAnnounceExtends(other vocab.Type) bool {
return typeannounce.ActivityStreamsAnnounceExtends(other)
}
// ActivityStreamsActivityStreamsApplicationExtends returns true if Application
// extends from the other's type.
func ActivityStreamsActivityStreamsApplicationExtends(other vocab.Type) bool {
return typeapplication.ActivityStreamsApplicationExtends(other)
}
// ActivityStreamsActivityStreamsArriveExtends returns true if Arrive extends from
// the other's type.
func ActivityStreamsActivityStreamsArriveExtends(other vocab.Type) bool {
return typearrive.ActivityStreamsArriveExtends(other)
}
// ActivityStreamsActivityStreamsArticleExtends returns true if Article extends
// from the other's type.
func ActivityStreamsActivityStreamsArticleExtends(other vocab.Type) bool {
return typearticle.ActivityStreamsArticleExtends(other)
}
// ActivityStreamsActivityStreamsAudioExtends returns true if Audio extends from
// the other's type.
func ActivityStreamsActivityStreamsAudioExtends(other vocab.Type) bool {
return typeaudio.ActivityStreamsAudioExtends(other)
}
// ActivityStreamsActivityStreamsBlockExtends returns true if Block extends from
// the other's type.
func ActivityStreamsActivityStreamsBlockExtends(other vocab.Type) bool {
return typeblock.ActivityStreamsBlockExtends(other)
}
// ActivityStreamsActivityStreamsCollectionExtends returns true if Collection
// extends from the other's type.
func ActivityStreamsActivityStreamsCollectionExtends(other vocab.Type) bool {
return typecollection.ActivityStreamsCollectionExtends(other)
}
// ActivityStreamsActivityStreamsCollectionPageExtends returns true if
// CollectionPage extends from the other's type.
func ActivityStreamsActivityStreamsCollectionPageExtends(other vocab.Type) bool {
return typecollectionpage.ActivityStreamsCollectionPageExtends(other)
}
// ActivityStreamsActivityStreamsCreateExtends returns true if Create extends from
// the other's type.
func ActivityStreamsActivityStreamsCreateExtends(other vocab.Type) bool {
return typecreate.ActivityStreamsCreateExtends(other)
}
// ActivityStreamsActivityStreamsDeleteExtends returns true if Delete extends from
// the other's type.
func ActivityStreamsActivityStreamsDeleteExtends(other vocab.Type) bool {
return typedelete.ActivityStreamsDeleteExtends(other)
}
// ActivityStreamsActivityStreamsDislikeExtends returns true if Dislike extends
// from the other's type.
func ActivityStreamsActivityStreamsDislikeExtends(other vocab.Type) bool {
return typedislike.ActivityStreamsDislikeExtends(other)
}
// ActivityStreamsActivityStreamsDocumentExtends returns true if Document extends
// from the other's type.
func ActivityStreamsActivityStreamsDocumentExtends(other vocab.Type) bool {
return typedocument.ActivityStreamsDocumentExtends(other)
}
// ActivityStreamsActivityStreamsEventExtends returns true if Event extends from
// the other's type.
func ActivityStreamsActivityStreamsEventExtends(other vocab.Type) bool {
return typeevent.ActivityStreamsEventExtends(other)
}
// ActivityStreamsActivityStreamsFlagExtends returns true if Flag extends from the
// other's type.
func ActivityStreamsActivityStreamsFlagExtends(other vocab.Type) bool {
return typeflag.ActivityStreamsFlagExtends(other)
}
// ActivityStreamsActivityStreamsFollowExtends returns true if Follow extends from
// the other's type.
func ActivityStreamsActivityStreamsFollowExtends(other vocab.Type) bool {
return typefollow.ActivityStreamsFollowExtends(other)
}
// ActivityStreamsActivityStreamsGroupExtends returns true if Group extends from
// the other's type.
func ActivityStreamsActivityStreamsGroupExtends(other vocab.Type) bool {
return typegroup.ActivityStreamsGroupExtends(other)
}
// ActivityStreamsActivityStreamsIgnoreExtends returns true if Ignore extends from
// the other's type.
func ActivityStreamsActivityStreamsIgnoreExtends(other vocab.Type) bool {
return typeignore.ActivityStreamsIgnoreExtends(other)
}
// ActivityStreamsActivityStreamsImageExtends returns true if Image extends from
// the other's type.
func ActivityStreamsActivityStreamsImageExtends(other vocab.Type) bool {
return typeimage.ActivityStreamsImageExtends(other)
}
// ActivityStreamsActivityStreamsIntransitiveActivityExtends returns true if
// IntransitiveActivity extends from the other's type.
func ActivityStreamsActivityStreamsIntransitiveActivityExtends(other vocab.Type) bool {
return typeintransitiveactivity.ActivityStreamsIntransitiveActivityExtends(other)
}
// ActivityStreamsActivityStreamsInviteExtends returns true if Invite extends from
// the other's type.
func ActivityStreamsActivityStreamsInviteExtends(other vocab.Type) bool {
return typeinvite.ActivityStreamsInviteExtends(other)
}
// ActivityStreamsActivityStreamsJoinExtends returns true if Join extends from the
// other's type.
func ActivityStreamsActivityStreamsJoinExtends(other vocab.Type) bool {
return typejoin.ActivityStreamsJoinExtends(other)
}
// ActivityStreamsActivityStreamsLeaveExtends returns true if Leave extends from
// the other's type.
func ActivityStreamsActivityStreamsLeaveExtends(other vocab.Type) bool {
return typeleave.ActivityStreamsLeaveExtends(other)
}
// ActivityStreamsActivityStreamsLikeExtends returns true if Like extends from the
// other's type.
func ActivityStreamsActivityStreamsLikeExtends(other vocab.Type) bool {
return typelike.ActivityStreamsLikeExtends(other)
}
// ActivityStreamsActivityStreamsLinkExtends returns true if Link extends from the
// other's type.
func ActivityStreamsActivityStreamsLinkExtends(other vocab.Type) bool {
return typelink.ActivityStreamsLinkExtends(other)
}
// ActivityStreamsActivityStreamsListenExtends returns true if Listen extends from
// the other's type.
func ActivityStreamsActivityStreamsListenExtends(other vocab.Type) bool {
return typelisten.ActivityStreamsListenExtends(other)
}
// ActivityStreamsActivityStreamsMentionExtends returns true if Mention extends
// from the other's type.
func ActivityStreamsActivityStreamsMentionExtends(other vocab.Type) bool {
return typemention.ActivityStreamsMentionExtends(other)
}
// ActivityStreamsActivityStreamsMoveExtends returns true if Move extends from the
// other's type.
func ActivityStreamsActivityStreamsMoveExtends(other vocab.Type) bool {
return typemove.ActivityStreamsMoveExtends(other)
}
// ActivityStreamsActivityStreamsNoteExtends returns true if Note extends from the
// other's type.
func ActivityStreamsActivityStreamsNoteExtends(other vocab.Type) bool {
return typenote.ActivityStreamsNoteExtends(other)
}
// ActivityStreamsActivityStreamsObjectExtends returns true if Object extends from
// the other's type.
func ActivityStreamsActivityStreamsObjectExtends(other vocab.Type) bool {
return typeobject.ActivityStreamsObjectExtends(other)
}
// ActivityStreamsActivityStreamsOfferExtends returns true if Offer extends from
// the other's type.
func ActivityStreamsActivityStreamsOfferExtends(other vocab.Type) bool {
return typeoffer.ActivityStreamsOfferExtends(other)
}
// ActivityStreamsActivityStreamsOrderedCollectionExtends returns true if
// OrderedCollection extends from the other's type.
func ActivityStreamsActivityStreamsOrderedCollectionExtends(other vocab.Type) bool {
return typeorderedcollection.ActivityStreamsOrderedCollectionExtends(other)
}
// ActivityStreamsActivityStreamsOrderedCollectionPageExtends returns true if
// OrderedCollectionPage extends from the other's type.
func ActivityStreamsActivityStreamsOrderedCollectionPageExtends(other vocab.Type) bool {
return typeorderedcollectionpage.ActivityStreamsOrderedCollectionPageExtends(other)
}
// ActivityStreamsActivityStreamsOrganizationExtends returns true if Organization
// extends from the other's type.
func ActivityStreamsActivityStreamsOrganizationExtends(other vocab.Type) bool {
return typeorganization.ActivityStreamsOrganizationExtends(other)
}
// ActivityStreamsActivityStreamsPageExtends returns true if Page extends from the
// other's type.
func ActivityStreamsActivityStreamsPageExtends(other vocab.Type) bool {
return typepage.ActivityStreamsPageExtends(other)
}
// ActivityStreamsActivityStreamsPersonExtends returns true if Person extends from
// the other's type.
func ActivityStreamsActivityStreamsPersonExtends(other vocab.Type) bool {
return typeperson.ActivityStreamsPersonExtends(other)
}
// ActivityStreamsActivityStreamsPlaceExtends returns true if Place extends from
// the other's type.
func ActivityStreamsActivityStreamsPlaceExtends(other vocab.Type) bool {
return typeplace.ActivityStreamsPlaceExtends(other)
}
// ActivityStreamsActivityStreamsProfileExtends returns true if Profile extends
// from the other's type.
func ActivityStreamsActivityStreamsProfileExtends(other vocab.Type) bool {
return typeprofile.ActivityStreamsProfileExtends(other)
}
// ActivityStreamsActivityStreamsQuestionExtends returns true if Question extends
// from the other's type.
func ActivityStreamsActivityStreamsQuestionExtends(other vocab.Type) bool {
return typequestion.ActivityStreamsQuestionExtends(other)
}
// ActivityStreamsActivityStreamsReadExtends returns true if Read extends from the
// other's type.
func ActivityStreamsActivityStreamsReadExtends(other vocab.Type) bool {
return typeread.ActivityStreamsReadExtends(other)
}
// ActivityStreamsActivityStreamsRejectExtends returns true if Reject extends from
// the other's type.
func ActivityStreamsActivityStreamsRejectExtends(other vocab.Type) bool {
return typereject.ActivityStreamsRejectExtends(other)
}
// ActivityStreamsActivityStreamsRelationshipExtends returns true if Relationship
// extends from the other's type.
func ActivityStreamsActivityStreamsRelationshipExtends(other vocab.Type) bool {
return typerelationship.ActivityStreamsRelationshipExtends(other)
}
// ActivityStreamsActivityStreamsRemoveExtends returns true if Remove extends from
// the other's type.
func ActivityStreamsActivityStreamsRemoveExtends(other vocab.Type) bool {
return typeremove.ActivityStreamsRemoveExtends(other)
}
// ActivityStreamsActivityStreamsServiceExtends returns true if Service extends
// from the other's type.
func ActivityStreamsActivityStreamsServiceExtends(other vocab.Type) bool {
return typeservice.ActivityStreamsServiceExtends(other)
}
// ActivityStreamsActivityStreamsTentativeAcceptExtends returns true if
// TentativeAccept extends from the other's type.
func ActivityStreamsActivityStreamsTentativeAcceptExtends(other vocab.Type) bool {
return typetentativeaccept.ActivityStreamsTentativeAcceptExtends(other)
}
// ActivityStreamsActivityStreamsTentativeRejectExtends returns true if
// TentativeReject extends from the other's type.
func ActivityStreamsActivityStreamsTentativeRejectExtends(other vocab.Type) bool {
return typetentativereject.ActivityStreamsTentativeRejectExtends(other)
}
// ActivityStreamsActivityStreamsTombstoneExtends returns true if Tombstone
// extends from the other's type.
func ActivityStreamsActivityStreamsTombstoneExtends(other vocab.Type) bool {
return typetombstone.ActivityStreamsTombstoneExtends(other)
}
// ActivityStreamsActivityStreamsTravelExtends returns true if Travel extends from
// the other's type.
func ActivityStreamsActivityStreamsTravelExtends(other vocab.Type) bool {
return typetravel.ActivityStreamsTravelExtends(other)
}
// ActivityStreamsActivityStreamsUndoExtends returns true if Undo extends from the
// other's type.
func ActivityStreamsActivityStreamsUndoExtends(other vocab.Type) bool {
return typeundo.ActivityStreamsUndoExtends(other)
}
// ActivityStreamsActivityStreamsUpdateExtends returns true if Update extends from
// the other's type.
func ActivityStreamsActivityStreamsUpdateExtends(other vocab.Type) bool {
return typeupdate.ActivityStreamsUpdateExtends(other)
}
// ActivityStreamsActivityStreamsVideoExtends returns true if Video extends from
// the other's type.
func ActivityStreamsActivityStreamsVideoExtends(other vocab.Type) bool {
return typevideo.ActivityStreamsVideoExtends(other)
}
// ActivityStreamsActivityStreamsViewExtends returns true if View extends from the
// other's type.
func ActivityStreamsActivityStreamsViewExtends(other vocab.Type) bool {
return typeview.ActivityStreamsViewExtends(other)
}

View file

@ -1,388 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_accept"
typeactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_activity"
typeadd "github.com/go-fed/activity/streams/impl/activitystreams/type_add"
typeannounce "github.com/go-fed/activity/streams/impl/activitystreams/type_announce"
typeapplication "github.com/go-fed/activity/streams/impl/activitystreams/type_application"
typearrive "github.com/go-fed/activity/streams/impl/activitystreams/type_arrive"
typearticle "github.com/go-fed/activity/streams/impl/activitystreams/type_article"
typeaudio "github.com/go-fed/activity/streams/impl/activitystreams/type_audio"
typeblock "github.com/go-fed/activity/streams/impl/activitystreams/type_block"
typecollection "github.com/go-fed/activity/streams/impl/activitystreams/type_collection"
typecollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_collectionpage"
typecreate "github.com/go-fed/activity/streams/impl/activitystreams/type_create"
typedelete "github.com/go-fed/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/go-fed/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/go-fed/activity/streams/impl/activitystreams/type_document"
typeevent "github.com/go-fed/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/go-fed/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/go-fed/activity/streams/impl/activitystreams/type_follow"
typegroup "github.com/go-fed/activity/streams/impl/activitystreams/type_group"
typeignore "github.com/go-fed/activity/streams/impl/activitystreams/type_ignore"
typeimage "github.com/go-fed/activity/streams/impl/activitystreams/type_image"
typeintransitiveactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_intransitiveactivity"
typeinvite "github.com/go-fed/activity/streams/impl/activitystreams/type_invite"
typejoin "github.com/go-fed/activity/streams/impl/activitystreams/type_join"
typeleave "github.com/go-fed/activity/streams/impl/activitystreams/type_leave"
typelike "github.com/go-fed/activity/streams/impl/activitystreams/type_like"
typelink "github.com/go-fed/activity/streams/impl/activitystreams/type_link"
typelisten "github.com/go-fed/activity/streams/impl/activitystreams/type_listen"
typemention "github.com/go-fed/activity/streams/impl/activitystreams/type_mention"
typemove "github.com/go-fed/activity/streams/impl/activitystreams/type_move"
typenote "github.com/go-fed/activity/streams/impl/activitystreams/type_note"
typeobject "github.com/go-fed/activity/streams/impl/activitystreams/type_object"
typeoffer "github.com/go-fed/activity/streams/impl/activitystreams/type_offer"
typeorderedcollection "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollection"
typeorderedcollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollectionpage"
typeorganization "github.com/go-fed/activity/streams/impl/activitystreams/type_organization"
typepage "github.com/go-fed/activity/streams/impl/activitystreams/type_page"
typeperson "github.com/go-fed/activity/streams/impl/activitystreams/type_person"
typeplace "github.com/go-fed/activity/streams/impl/activitystreams/type_place"
typeprofile "github.com/go-fed/activity/streams/impl/activitystreams/type_profile"
typequestion "github.com/go-fed/activity/streams/impl/activitystreams/type_question"
typeread "github.com/go-fed/activity/streams/impl/activitystreams/type_read"
typereject "github.com/go-fed/activity/streams/impl/activitystreams/type_reject"
typerelationship "github.com/go-fed/activity/streams/impl/activitystreams/type_relationship"
typeremove "github.com/go-fed/activity/streams/impl/activitystreams/type_remove"
typeservice "github.com/go-fed/activity/streams/impl/activitystreams/type_service"
typetentativeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativeaccept"
typetentativereject "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativereject"
typetombstone "github.com/go-fed/activity/streams/impl/activitystreams/type_tombstone"
typetravel "github.com/go-fed/activity/streams/impl/activitystreams/type_travel"
typeundo "github.com/go-fed/activity/streams/impl/activitystreams/type_undo"
typeupdate "github.com/go-fed/activity/streams/impl/activitystreams/type_update"
typevideo "github.com/go-fed/activity/streams/impl/activitystreams/type_video"
typeview "github.com/go-fed/activity/streams/impl/activitystreams/type_view"
vocab "github.com/go-fed/activity/streams/vocab"
)
// IsOrExtendsActivityStreamsAccept returns true if the other provided type is the
// Accept type or extends from the Accept type.
func IsOrExtendsActivityStreamsAccept(other vocab.Type) bool {
return typeaccept.IsOrExtendsAccept(other)
}
// IsOrExtendsActivityStreamsActivity returns true if the other provided type is
// the Activity type or extends from the Activity type.
func IsOrExtendsActivityStreamsActivity(other vocab.Type) bool {
return typeactivity.IsOrExtendsActivity(other)
}
// IsOrExtendsActivityStreamsAdd returns true if the other provided type is the
// Add type or extends from the Add type.
func IsOrExtendsActivityStreamsAdd(other vocab.Type) bool {
return typeadd.IsOrExtendsAdd(other)
}
// IsOrExtendsActivityStreamsAnnounce returns true if the other provided type is
// the Announce type or extends from the Announce type.
func IsOrExtendsActivityStreamsAnnounce(other vocab.Type) bool {
return typeannounce.IsOrExtendsAnnounce(other)
}
// IsOrExtendsActivityStreamsApplication returns true if the other provided type
// is the Application type or extends from the Application type.
func IsOrExtendsActivityStreamsApplication(other vocab.Type) bool {
return typeapplication.IsOrExtendsApplication(other)
}
// IsOrExtendsActivityStreamsArrive returns true if the other provided type is the
// Arrive type or extends from the Arrive type.
func IsOrExtendsActivityStreamsArrive(other vocab.Type) bool {
return typearrive.IsOrExtendsArrive(other)
}
// IsOrExtendsActivityStreamsArticle returns true if the other provided type is
// the Article type or extends from the Article type.
func IsOrExtendsActivityStreamsArticle(other vocab.Type) bool {
return typearticle.IsOrExtendsArticle(other)
}
// IsOrExtendsActivityStreamsAudio returns true if the other provided type is the
// Audio type or extends from the Audio type.
func IsOrExtendsActivityStreamsAudio(other vocab.Type) bool {
return typeaudio.IsOrExtendsAudio(other)
}
// IsOrExtendsActivityStreamsBlock returns true if the other provided type is the
// Block type or extends from the Block type.
func IsOrExtendsActivityStreamsBlock(other vocab.Type) bool {
return typeblock.IsOrExtendsBlock(other)
}
// IsOrExtendsActivityStreamsCollection returns true if the other provided type is
// the Collection type or extends from the Collection type.
func IsOrExtendsActivityStreamsCollection(other vocab.Type) bool {
return typecollection.IsOrExtendsCollection(other)
}
// IsOrExtendsActivityStreamsCollectionPage returns true if the other provided
// type is the CollectionPage type or extends from the CollectionPage type.
func IsOrExtendsActivityStreamsCollectionPage(other vocab.Type) bool {
return typecollectionpage.IsOrExtendsCollectionPage(other)
}
// IsOrExtendsActivityStreamsCreate returns true if the other provided type is the
// Create type or extends from the Create type.
func IsOrExtendsActivityStreamsCreate(other vocab.Type) bool {
return typecreate.IsOrExtendsCreate(other)
}
// IsOrExtendsActivityStreamsDelete returns true if the other provided type is the
// Delete type or extends from the Delete type.
func IsOrExtendsActivityStreamsDelete(other vocab.Type) bool {
return typedelete.IsOrExtendsDelete(other)
}
// IsOrExtendsActivityStreamsDislike returns true if the other provided type is
// the Dislike type or extends from the Dislike type.
func IsOrExtendsActivityStreamsDislike(other vocab.Type) bool {
return typedislike.IsOrExtendsDislike(other)
}
// IsOrExtendsActivityStreamsDocument returns true if the other provided type is
// the Document type or extends from the Document type.
func IsOrExtendsActivityStreamsDocument(other vocab.Type) bool {
return typedocument.IsOrExtendsDocument(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 {
return typeevent.IsOrExtendsEvent(other)
}
// IsOrExtendsActivityStreamsFlag returns true if the other provided type is the
// Flag type or extends from the Flag type.
func IsOrExtendsActivityStreamsFlag(other vocab.Type) bool {
return typeflag.IsOrExtendsFlag(other)
}
// IsOrExtendsActivityStreamsFollow returns true if the other provided type is the
// Follow type or extends from the Follow type.
func IsOrExtendsActivityStreamsFollow(other vocab.Type) bool {
return typefollow.IsOrExtendsFollow(other)
}
// IsOrExtendsActivityStreamsGroup returns true if the other provided type is the
// Group type or extends from the Group type.
func IsOrExtendsActivityStreamsGroup(other vocab.Type) bool {
return typegroup.IsOrExtendsGroup(other)
}
// IsOrExtendsActivityStreamsIgnore returns true if the other provided type is the
// Ignore type or extends from the Ignore type.
func IsOrExtendsActivityStreamsIgnore(other vocab.Type) bool {
return typeignore.IsOrExtendsIgnore(other)
}
// IsOrExtendsActivityStreamsImage returns true if the other provided type is the
// Image type or extends from the Image type.
func IsOrExtendsActivityStreamsImage(other vocab.Type) bool {
return typeimage.IsOrExtendsImage(other)
}
// IsOrExtendsActivityStreamsIntransitiveActivity returns true if the other
// provided type is the IntransitiveActivity type or extends from the
// IntransitiveActivity type.
func IsOrExtendsActivityStreamsIntransitiveActivity(other vocab.Type) bool {
return typeintransitiveactivity.IsOrExtendsIntransitiveActivity(other)
}
// IsOrExtendsActivityStreamsInvite returns true if the other provided type is the
// Invite type or extends from the Invite type.
func IsOrExtendsActivityStreamsInvite(other vocab.Type) bool {
return typeinvite.IsOrExtendsInvite(other)
}
// IsOrExtendsActivityStreamsJoin returns true if the other provided type is the
// Join type or extends from the Join type.
func IsOrExtendsActivityStreamsJoin(other vocab.Type) bool {
return typejoin.IsOrExtendsJoin(other)
}
// IsOrExtendsActivityStreamsLeave returns true if the other provided type is the
// Leave type or extends from the Leave type.
func IsOrExtendsActivityStreamsLeave(other vocab.Type) bool {
return typeleave.IsOrExtendsLeave(other)
}
// IsOrExtendsActivityStreamsLike returns true if the other provided type is the
// Like type or extends from the Like type.
func IsOrExtendsActivityStreamsLike(other vocab.Type) bool {
return typelike.IsOrExtendsLike(other)
}
// IsOrExtendsActivityStreamsLink returns true if the other provided type is the
// Link type or extends from the Link type.
func IsOrExtendsActivityStreamsLink(other vocab.Type) bool {
return typelink.IsOrExtendsLink(other)
}
// IsOrExtendsActivityStreamsListen returns true if the other provided type is the
// Listen type or extends from the Listen type.
func IsOrExtendsActivityStreamsListen(other vocab.Type) bool {
return typelisten.IsOrExtendsListen(other)
}
// IsOrExtendsActivityStreamsMention returns true if the other provided type is
// the Mention type or extends from the Mention type.
func IsOrExtendsActivityStreamsMention(other vocab.Type) bool {
return typemention.IsOrExtendsMention(other)
}
// IsOrExtendsActivityStreamsMove returns true if the other provided type is the
// Move type or extends from the Move type.
func IsOrExtendsActivityStreamsMove(other vocab.Type) bool {
return typemove.IsOrExtendsMove(other)
}
// IsOrExtendsActivityStreamsNote returns true if the other provided type is the
// Note type or extends from the Note type.
func IsOrExtendsActivityStreamsNote(other vocab.Type) bool {
return typenote.IsOrExtendsNote(other)
}
// IsOrExtendsActivityStreamsObject returns true if the other provided type is the
// Object type or extends from the Object type.
func IsOrExtendsActivityStreamsObject(other vocab.Type) bool {
return typeobject.IsOrExtendsObject(other)
}
// IsOrExtendsActivityStreamsOffer returns true if the other provided type is the
// Offer type or extends from the Offer type.
func IsOrExtendsActivityStreamsOffer(other vocab.Type) bool {
return typeoffer.IsOrExtendsOffer(other)
}
// IsOrExtendsActivityStreamsOrderedCollection returns true if the other provided
// type is the OrderedCollection type or extends from the OrderedCollection
// type.
func IsOrExtendsActivityStreamsOrderedCollection(other vocab.Type) bool {
return typeorderedcollection.IsOrExtendsOrderedCollection(other)
}
// IsOrExtendsActivityStreamsOrderedCollectionPage returns true if the other
// provided type is the OrderedCollectionPage type or extends from the
// OrderedCollectionPage type.
func IsOrExtendsActivityStreamsOrderedCollectionPage(other vocab.Type) bool {
return typeorderedcollectionpage.IsOrExtendsOrderedCollectionPage(other)
}
// IsOrExtendsActivityStreamsOrganization returns true if the other provided type
// is the Organization type or extends from the Organization type.
func IsOrExtendsActivityStreamsOrganization(other vocab.Type) bool {
return typeorganization.IsOrExtendsOrganization(other)
}
// IsOrExtendsActivityStreamsPage returns true if the other provided type is the
// Page type or extends from the Page type.
func IsOrExtendsActivityStreamsPage(other vocab.Type) bool {
return typepage.IsOrExtendsPage(other)
}
// IsOrExtendsActivityStreamsPerson returns true if the other provided type is the
// Person type or extends from the Person type.
func IsOrExtendsActivityStreamsPerson(other vocab.Type) bool {
return typeperson.IsOrExtendsPerson(other)
}
// IsOrExtendsActivityStreamsPlace returns true if the other provided type is the
// Place type or extends from the Place type.
func IsOrExtendsActivityStreamsPlace(other vocab.Type) bool {
return typeplace.IsOrExtendsPlace(other)
}
// IsOrExtendsActivityStreamsProfile returns true if the other provided type is
// the Profile type or extends from the Profile type.
func IsOrExtendsActivityStreamsProfile(other vocab.Type) bool {
return typeprofile.IsOrExtendsProfile(other)
}
// IsOrExtendsActivityStreamsQuestion returns true if the other provided type is
// the Question type or extends from the Question type.
func IsOrExtendsActivityStreamsQuestion(other vocab.Type) bool {
return typequestion.IsOrExtendsQuestion(other)
}
// IsOrExtendsActivityStreamsRead returns true if the other provided type is the
// Read type or extends from the Read type.
func IsOrExtendsActivityStreamsRead(other vocab.Type) bool {
return typeread.IsOrExtendsRead(other)
}
// IsOrExtendsActivityStreamsReject returns true if the other provided type is the
// Reject type or extends from the Reject type.
func IsOrExtendsActivityStreamsReject(other vocab.Type) bool {
return typereject.IsOrExtendsReject(other)
}
// IsOrExtendsActivityStreamsRelationship returns true if the other provided type
// is the Relationship type or extends from the Relationship type.
func IsOrExtendsActivityStreamsRelationship(other vocab.Type) bool {
return typerelationship.IsOrExtendsRelationship(other)
}
// IsOrExtendsActivityStreamsRemove returns true if the other provided type is the
// Remove type or extends from the Remove type.
func IsOrExtendsActivityStreamsRemove(other vocab.Type) bool {
return typeremove.IsOrExtendsRemove(other)
}
// IsOrExtendsActivityStreamsService returns true if the other provided type is
// the Service type or extends from the Service type.
func IsOrExtendsActivityStreamsService(other vocab.Type) bool {
return typeservice.IsOrExtendsService(other)
}
// IsOrExtendsActivityStreamsTentativeAccept returns true if the other provided
// type is the TentativeAccept type or extends from the TentativeAccept type.
func IsOrExtendsActivityStreamsTentativeAccept(other vocab.Type) bool {
return typetentativeaccept.IsOrExtendsTentativeAccept(other)
}
// IsOrExtendsActivityStreamsTentativeReject returns true if the other provided
// type is the TentativeReject type or extends from the TentativeReject type.
func IsOrExtendsActivityStreamsTentativeReject(other vocab.Type) bool {
return typetentativereject.IsOrExtendsTentativeReject(other)
}
// IsOrExtendsActivityStreamsTombstone returns true if the other provided type is
// the Tombstone type or extends from the Tombstone type.
func IsOrExtendsActivityStreamsTombstone(other vocab.Type) bool {
return typetombstone.IsOrExtendsTombstone(other)
}
// IsOrExtendsActivityStreamsTravel returns true if the other provided type is the
// Travel type or extends from the Travel type.
func IsOrExtendsActivityStreamsTravel(other vocab.Type) bool {
return typetravel.IsOrExtendsTravel(other)
}
// IsOrExtendsActivityStreamsUndo returns true if the other provided type is the
// Undo type or extends from the Undo type.
func IsOrExtendsActivityStreamsUndo(other vocab.Type) bool {
return typeundo.IsOrExtendsUndo(other)
}
// IsOrExtendsActivityStreamsUpdate returns true if the other provided type is the
// Update type or extends from the Update type.
func IsOrExtendsActivityStreamsUpdate(other vocab.Type) bool {
return typeupdate.IsOrExtendsUpdate(other)
}
// IsOrExtendsActivityStreamsVideo returns true if the other provided type is the
// Video type or extends from the Video type.
func IsOrExtendsActivityStreamsVideo(other vocab.Type) bool {
return typevideo.IsOrExtendsVideo(other)
}
// IsOrExtendsActivityStreamsView returns true if the other provided type is the
// View type or extends from the View type.
func IsOrExtendsActivityStreamsView(other vocab.Type) bool {
return typeview.IsOrExtendsView(other)
}

View file

@ -1,511 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
propertyaccuracy "github.com/go-fed/activity/streams/impl/activitystreams/property_accuracy"
propertyactor "github.com/go-fed/activity/streams/impl/activitystreams/property_actor"
propertyaltitude "github.com/go-fed/activity/streams/impl/activitystreams/property_altitude"
propertyanyof "github.com/go-fed/activity/streams/impl/activitystreams/property_anyof"
propertyattachment "github.com/go-fed/activity/streams/impl/activitystreams/property_attachment"
propertyattributedto "github.com/go-fed/activity/streams/impl/activitystreams/property_attributedto"
propertyaudience "github.com/go-fed/activity/streams/impl/activitystreams/property_audience"
propertybcc "github.com/go-fed/activity/streams/impl/activitystreams/property_bcc"
propertybto "github.com/go-fed/activity/streams/impl/activitystreams/property_bto"
propertycc "github.com/go-fed/activity/streams/impl/activitystreams/property_cc"
propertyclosed "github.com/go-fed/activity/streams/impl/activitystreams/property_closed"
propertycontent "github.com/go-fed/activity/streams/impl/activitystreams/property_content"
propertycontext "github.com/go-fed/activity/streams/impl/activitystreams/property_context"
propertycurrent "github.com/go-fed/activity/streams/impl/activitystreams/property_current"
propertydeleted "github.com/go-fed/activity/streams/impl/activitystreams/property_deleted"
propertydescribes "github.com/go-fed/activity/streams/impl/activitystreams/property_describes"
propertyduration "github.com/go-fed/activity/streams/impl/activitystreams/property_duration"
propertyendtime "github.com/go-fed/activity/streams/impl/activitystreams/property_endtime"
propertyfirst "github.com/go-fed/activity/streams/impl/activitystreams/property_first"
propertyfollowers "github.com/go-fed/activity/streams/impl/activitystreams/property_followers"
propertyfollowing "github.com/go-fed/activity/streams/impl/activitystreams/property_following"
propertyformertype "github.com/go-fed/activity/streams/impl/activitystreams/property_formertype"
propertygenerator "github.com/go-fed/activity/streams/impl/activitystreams/property_generator"
propertyheight "github.com/go-fed/activity/streams/impl/activitystreams/property_height"
propertyhref "github.com/go-fed/activity/streams/impl/activitystreams/property_href"
propertyhreflang "github.com/go-fed/activity/streams/impl/activitystreams/property_hreflang"
propertyicon "github.com/go-fed/activity/streams/impl/activitystreams/property_icon"
propertyimage "github.com/go-fed/activity/streams/impl/activitystreams/property_image"
propertyinbox "github.com/go-fed/activity/streams/impl/activitystreams/property_inbox"
propertyinreplyto "github.com/go-fed/activity/streams/impl/activitystreams/property_inreplyto"
propertyinstrument "github.com/go-fed/activity/streams/impl/activitystreams/property_instrument"
propertyitems "github.com/go-fed/activity/streams/impl/activitystreams/property_items"
propertylast "github.com/go-fed/activity/streams/impl/activitystreams/property_last"
propertylatitude "github.com/go-fed/activity/streams/impl/activitystreams/property_latitude"
propertyliked "github.com/go-fed/activity/streams/impl/activitystreams/property_liked"
propertylikes "github.com/go-fed/activity/streams/impl/activitystreams/property_likes"
propertylocation "github.com/go-fed/activity/streams/impl/activitystreams/property_location"
propertylongitude "github.com/go-fed/activity/streams/impl/activitystreams/property_longitude"
propertymanuallyapprovesfollowers "github.com/go-fed/activity/streams/impl/activitystreams/property_manuallyapprovesfollowers"
propertymediatype "github.com/go-fed/activity/streams/impl/activitystreams/property_mediatype"
propertyname "github.com/go-fed/activity/streams/impl/activitystreams/property_name"
propertynext "github.com/go-fed/activity/streams/impl/activitystreams/property_next"
propertyobject "github.com/go-fed/activity/streams/impl/activitystreams/property_object"
propertyoneof "github.com/go-fed/activity/streams/impl/activitystreams/property_oneof"
propertyordereditems "github.com/go-fed/activity/streams/impl/activitystreams/property_ordereditems"
propertyorigin "github.com/go-fed/activity/streams/impl/activitystreams/property_origin"
propertyoutbox "github.com/go-fed/activity/streams/impl/activitystreams/property_outbox"
propertypartof "github.com/go-fed/activity/streams/impl/activitystreams/property_partof"
propertypreferredusername "github.com/go-fed/activity/streams/impl/activitystreams/property_preferredusername"
propertyprev "github.com/go-fed/activity/streams/impl/activitystreams/property_prev"
propertypreview "github.com/go-fed/activity/streams/impl/activitystreams/property_preview"
propertypublished "github.com/go-fed/activity/streams/impl/activitystreams/property_published"
propertyradius "github.com/go-fed/activity/streams/impl/activitystreams/property_radius"
propertyrel "github.com/go-fed/activity/streams/impl/activitystreams/property_rel"
propertyrelationship "github.com/go-fed/activity/streams/impl/activitystreams/property_relationship"
propertyreplies "github.com/go-fed/activity/streams/impl/activitystreams/property_replies"
propertyresult "github.com/go-fed/activity/streams/impl/activitystreams/property_result"
propertyshares "github.com/go-fed/activity/streams/impl/activitystreams/property_shares"
propertysource "github.com/go-fed/activity/streams/impl/activitystreams/property_source"
propertystartindex "github.com/go-fed/activity/streams/impl/activitystreams/property_startindex"
propertystarttime "github.com/go-fed/activity/streams/impl/activitystreams/property_starttime"
propertystreams "github.com/go-fed/activity/streams/impl/activitystreams/property_streams"
propertysubject "github.com/go-fed/activity/streams/impl/activitystreams/property_subject"
propertysummary "github.com/go-fed/activity/streams/impl/activitystreams/property_summary"
propertytag "github.com/go-fed/activity/streams/impl/activitystreams/property_tag"
propertytarget "github.com/go-fed/activity/streams/impl/activitystreams/property_target"
propertyto "github.com/go-fed/activity/streams/impl/activitystreams/property_to"
propertytotalitems "github.com/go-fed/activity/streams/impl/activitystreams/property_totalitems"
propertyunits "github.com/go-fed/activity/streams/impl/activitystreams/property_units"
propertyupdated "github.com/go-fed/activity/streams/impl/activitystreams/property_updated"
propertyurl "github.com/go-fed/activity/streams/impl/activitystreams/property_url"
propertywidth "github.com/go-fed/activity/streams/impl/activitystreams/property_width"
vocab "github.com/go-fed/activity/streams/vocab"
)
// NewActivityStreamsActivityStreamsAccuracyProperty creates a new
// ActivityStreamsAccuracyProperty
func NewActivityStreamsAccuracyProperty() vocab.ActivityStreamsAccuracyProperty {
return propertyaccuracy.NewActivityStreamsAccuracyProperty()
}
// NewActivityStreamsActivityStreamsActorProperty creates a new
// ActivityStreamsActorProperty
func NewActivityStreamsActorProperty() vocab.ActivityStreamsActorProperty {
return propertyactor.NewActivityStreamsActorProperty()
}
// NewActivityStreamsActivityStreamsAltitudeProperty creates a new
// ActivityStreamsAltitudeProperty
func NewActivityStreamsAltitudeProperty() vocab.ActivityStreamsAltitudeProperty {
return propertyaltitude.NewActivityStreamsAltitudeProperty()
}
// NewActivityStreamsActivityStreamsAnyOfProperty creates a new
// ActivityStreamsAnyOfProperty
func NewActivityStreamsAnyOfProperty() vocab.ActivityStreamsAnyOfProperty {
return propertyanyof.NewActivityStreamsAnyOfProperty()
}
// NewActivityStreamsActivityStreamsAttachmentProperty creates a new
// ActivityStreamsAttachmentProperty
func NewActivityStreamsAttachmentProperty() vocab.ActivityStreamsAttachmentProperty {
return propertyattachment.NewActivityStreamsAttachmentProperty()
}
// NewActivityStreamsActivityStreamsAttributedToProperty creates a new
// ActivityStreamsAttributedToProperty
func NewActivityStreamsAttributedToProperty() vocab.ActivityStreamsAttributedToProperty {
return propertyattributedto.NewActivityStreamsAttributedToProperty()
}
// NewActivityStreamsActivityStreamsAudienceProperty creates a new
// ActivityStreamsAudienceProperty
func NewActivityStreamsAudienceProperty() vocab.ActivityStreamsAudienceProperty {
return propertyaudience.NewActivityStreamsAudienceProperty()
}
// NewActivityStreamsActivityStreamsBccProperty creates a new
// ActivityStreamsBccProperty
func NewActivityStreamsBccProperty() vocab.ActivityStreamsBccProperty {
return propertybcc.NewActivityStreamsBccProperty()
}
// NewActivityStreamsActivityStreamsBtoProperty creates a new
// ActivityStreamsBtoProperty
func NewActivityStreamsBtoProperty() vocab.ActivityStreamsBtoProperty {
return propertybto.NewActivityStreamsBtoProperty()
}
// NewActivityStreamsActivityStreamsCcProperty creates a new
// ActivityStreamsCcProperty
func NewActivityStreamsCcProperty() vocab.ActivityStreamsCcProperty {
return propertycc.NewActivityStreamsCcProperty()
}
// NewActivityStreamsActivityStreamsClosedProperty creates a new
// ActivityStreamsClosedProperty
func NewActivityStreamsClosedProperty() vocab.ActivityStreamsClosedProperty {
return propertyclosed.NewActivityStreamsClosedProperty()
}
// NewActivityStreamsActivityStreamsContentProperty creates a new
// ActivityStreamsContentProperty
func NewActivityStreamsContentProperty() vocab.ActivityStreamsContentProperty {
return propertycontent.NewActivityStreamsContentProperty()
}
// NewActivityStreamsActivityStreamsContextProperty creates a new
// ActivityStreamsContextProperty
func NewActivityStreamsContextProperty() vocab.ActivityStreamsContextProperty {
return propertycontext.NewActivityStreamsContextProperty()
}
// NewActivityStreamsActivityStreamsCurrentProperty creates a new
// ActivityStreamsCurrentProperty
func NewActivityStreamsCurrentProperty() vocab.ActivityStreamsCurrentProperty {
return propertycurrent.NewActivityStreamsCurrentProperty()
}
// NewActivityStreamsActivityStreamsDeletedProperty creates a new
// ActivityStreamsDeletedProperty
func NewActivityStreamsDeletedProperty() vocab.ActivityStreamsDeletedProperty {
return propertydeleted.NewActivityStreamsDeletedProperty()
}
// NewActivityStreamsActivityStreamsDescribesProperty creates a new
// ActivityStreamsDescribesProperty
func NewActivityStreamsDescribesProperty() vocab.ActivityStreamsDescribesProperty {
return propertydescribes.NewActivityStreamsDescribesProperty()
}
// NewActivityStreamsActivityStreamsDurationProperty creates a new
// ActivityStreamsDurationProperty
func NewActivityStreamsDurationProperty() vocab.ActivityStreamsDurationProperty {
return propertyduration.NewActivityStreamsDurationProperty()
}
// NewActivityStreamsActivityStreamsEndTimeProperty creates a new
// ActivityStreamsEndTimeProperty
func NewActivityStreamsEndTimeProperty() vocab.ActivityStreamsEndTimeProperty {
return propertyendtime.NewActivityStreamsEndTimeProperty()
}
// NewActivityStreamsActivityStreamsFirstProperty creates a new
// ActivityStreamsFirstProperty
func NewActivityStreamsFirstProperty() vocab.ActivityStreamsFirstProperty {
return propertyfirst.NewActivityStreamsFirstProperty()
}
// NewActivityStreamsActivityStreamsFollowersProperty creates a new
// ActivityStreamsFollowersProperty
func NewActivityStreamsFollowersProperty() vocab.ActivityStreamsFollowersProperty {
return propertyfollowers.NewActivityStreamsFollowersProperty()
}
// NewActivityStreamsActivityStreamsFollowingProperty creates a new
// ActivityStreamsFollowingProperty
func NewActivityStreamsFollowingProperty() vocab.ActivityStreamsFollowingProperty {
return propertyfollowing.NewActivityStreamsFollowingProperty()
}
// NewActivityStreamsActivityStreamsFormerTypeProperty creates a new
// ActivityStreamsFormerTypeProperty
func NewActivityStreamsFormerTypeProperty() vocab.ActivityStreamsFormerTypeProperty {
return propertyformertype.NewActivityStreamsFormerTypeProperty()
}
// NewActivityStreamsActivityStreamsGeneratorProperty creates a new
// ActivityStreamsGeneratorProperty
func NewActivityStreamsGeneratorProperty() vocab.ActivityStreamsGeneratorProperty {
return propertygenerator.NewActivityStreamsGeneratorProperty()
}
// NewActivityStreamsActivityStreamsHeightProperty creates a new
// ActivityStreamsHeightProperty
func NewActivityStreamsHeightProperty() vocab.ActivityStreamsHeightProperty {
return propertyheight.NewActivityStreamsHeightProperty()
}
// NewActivityStreamsActivityStreamsHrefProperty creates a new
// ActivityStreamsHrefProperty
func NewActivityStreamsHrefProperty() vocab.ActivityStreamsHrefProperty {
return propertyhref.NewActivityStreamsHrefProperty()
}
// NewActivityStreamsActivityStreamsHreflangProperty creates a new
// ActivityStreamsHreflangProperty
func NewActivityStreamsHreflangProperty() vocab.ActivityStreamsHreflangProperty {
return propertyhreflang.NewActivityStreamsHreflangProperty()
}
// NewActivityStreamsActivityStreamsIconProperty creates a new
// ActivityStreamsIconProperty
func NewActivityStreamsIconProperty() vocab.ActivityStreamsIconProperty {
return propertyicon.NewActivityStreamsIconProperty()
}
// NewActivityStreamsActivityStreamsImageProperty creates a new
// ActivityStreamsImageProperty
func NewActivityStreamsImageProperty() vocab.ActivityStreamsImageProperty {
return propertyimage.NewActivityStreamsImageProperty()
}
// NewActivityStreamsActivityStreamsInReplyToProperty creates a new
// ActivityStreamsInReplyToProperty
func NewActivityStreamsInReplyToProperty() vocab.ActivityStreamsInReplyToProperty {
return propertyinreplyto.NewActivityStreamsInReplyToProperty()
}
// NewActivityStreamsActivityStreamsInboxProperty creates a new
// ActivityStreamsInboxProperty
func NewActivityStreamsInboxProperty() vocab.ActivityStreamsInboxProperty {
return propertyinbox.NewActivityStreamsInboxProperty()
}
// NewActivityStreamsActivityStreamsInstrumentProperty creates a new
// ActivityStreamsInstrumentProperty
func NewActivityStreamsInstrumentProperty() vocab.ActivityStreamsInstrumentProperty {
return propertyinstrument.NewActivityStreamsInstrumentProperty()
}
// NewActivityStreamsActivityStreamsItemsProperty creates a new
// ActivityStreamsItemsProperty
func NewActivityStreamsItemsProperty() vocab.ActivityStreamsItemsProperty {
return propertyitems.NewActivityStreamsItemsProperty()
}
// NewActivityStreamsActivityStreamsLastProperty creates a new
// ActivityStreamsLastProperty
func NewActivityStreamsLastProperty() vocab.ActivityStreamsLastProperty {
return propertylast.NewActivityStreamsLastProperty()
}
// NewActivityStreamsActivityStreamsLatitudeProperty creates a new
// ActivityStreamsLatitudeProperty
func NewActivityStreamsLatitudeProperty() vocab.ActivityStreamsLatitudeProperty {
return propertylatitude.NewActivityStreamsLatitudeProperty()
}
// NewActivityStreamsActivityStreamsLikedProperty creates a new
// ActivityStreamsLikedProperty
func NewActivityStreamsLikedProperty() vocab.ActivityStreamsLikedProperty {
return propertyliked.NewActivityStreamsLikedProperty()
}
// NewActivityStreamsActivityStreamsLikesProperty creates a new
// ActivityStreamsLikesProperty
func NewActivityStreamsLikesProperty() vocab.ActivityStreamsLikesProperty {
return propertylikes.NewActivityStreamsLikesProperty()
}
// NewActivityStreamsActivityStreamsLocationProperty creates a new
// ActivityStreamsLocationProperty
func NewActivityStreamsLocationProperty() vocab.ActivityStreamsLocationProperty {
return propertylocation.NewActivityStreamsLocationProperty()
}
// NewActivityStreamsActivityStreamsLongitudeProperty creates a new
// ActivityStreamsLongitudeProperty
func NewActivityStreamsLongitudeProperty() vocab.ActivityStreamsLongitudeProperty {
return propertylongitude.NewActivityStreamsLongitudeProperty()
}
// NewActivityStreamsActivityStreamsManuallyApprovesFollowersProperty creates a
// new ActivityStreamsManuallyApprovesFollowersProperty
func NewActivityStreamsManuallyApprovesFollowersProperty() vocab.ActivityStreamsManuallyApprovesFollowersProperty {
return propertymanuallyapprovesfollowers.NewActivityStreamsManuallyApprovesFollowersProperty()
}
// NewActivityStreamsActivityStreamsMediaTypeProperty creates a new
// ActivityStreamsMediaTypeProperty
func NewActivityStreamsMediaTypeProperty() vocab.ActivityStreamsMediaTypeProperty {
return propertymediatype.NewActivityStreamsMediaTypeProperty()
}
// NewActivityStreamsActivityStreamsNameProperty creates a new
// ActivityStreamsNameProperty
func NewActivityStreamsNameProperty() vocab.ActivityStreamsNameProperty {
return propertyname.NewActivityStreamsNameProperty()
}
// NewActivityStreamsActivityStreamsNextProperty creates a new
// ActivityStreamsNextProperty
func NewActivityStreamsNextProperty() vocab.ActivityStreamsNextProperty {
return propertynext.NewActivityStreamsNextProperty()
}
// NewActivityStreamsActivityStreamsObjectProperty creates a new
// ActivityStreamsObjectProperty
func NewActivityStreamsObjectProperty() vocab.ActivityStreamsObjectProperty {
return propertyobject.NewActivityStreamsObjectProperty()
}
// NewActivityStreamsActivityStreamsOneOfProperty creates a new
// ActivityStreamsOneOfProperty
func NewActivityStreamsOneOfProperty() vocab.ActivityStreamsOneOfProperty {
return propertyoneof.NewActivityStreamsOneOfProperty()
}
// NewActivityStreamsActivityStreamsOrderedItemsProperty creates a new
// ActivityStreamsOrderedItemsProperty
func NewActivityStreamsOrderedItemsProperty() vocab.ActivityStreamsOrderedItemsProperty {
return propertyordereditems.NewActivityStreamsOrderedItemsProperty()
}
// NewActivityStreamsActivityStreamsOriginProperty creates a new
// ActivityStreamsOriginProperty
func NewActivityStreamsOriginProperty() vocab.ActivityStreamsOriginProperty {
return propertyorigin.NewActivityStreamsOriginProperty()
}
// NewActivityStreamsActivityStreamsOutboxProperty creates a new
// ActivityStreamsOutboxProperty
func NewActivityStreamsOutboxProperty() vocab.ActivityStreamsOutboxProperty {
return propertyoutbox.NewActivityStreamsOutboxProperty()
}
// NewActivityStreamsActivityStreamsPartOfProperty creates a new
// ActivityStreamsPartOfProperty
func NewActivityStreamsPartOfProperty() vocab.ActivityStreamsPartOfProperty {
return propertypartof.NewActivityStreamsPartOfProperty()
}
// NewActivityStreamsActivityStreamsPreferredUsernameProperty creates a new
// ActivityStreamsPreferredUsernameProperty
func NewActivityStreamsPreferredUsernameProperty() vocab.ActivityStreamsPreferredUsernameProperty {
return propertypreferredusername.NewActivityStreamsPreferredUsernameProperty()
}
// NewActivityStreamsActivityStreamsPrevProperty creates a new
// ActivityStreamsPrevProperty
func NewActivityStreamsPrevProperty() vocab.ActivityStreamsPrevProperty {
return propertyprev.NewActivityStreamsPrevProperty()
}
// NewActivityStreamsActivityStreamsPreviewProperty creates a new
// ActivityStreamsPreviewProperty
func NewActivityStreamsPreviewProperty() vocab.ActivityStreamsPreviewProperty {
return propertypreview.NewActivityStreamsPreviewProperty()
}
// NewActivityStreamsActivityStreamsPublishedProperty creates a new
// ActivityStreamsPublishedProperty
func NewActivityStreamsPublishedProperty() vocab.ActivityStreamsPublishedProperty {
return propertypublished.NewActivityStreamsPublishedProperty()
}
// NewActivityStreamsActivityStreamsRadiusProperty creates a new
// ActivityStreamsRadiusProperty
func NewActivityStreamsRadiusProperty() vocab.ActivityStreamsRadiusProperty {
return propertyradius.NewActivityStreamsRadiusProperty()
}
// NewActivityStreamsActivityStreamsRelProperty creates a new
// ActivityStreamsRelProperty
func NewActivityStreamsRelProperty() vocab.ActivityStreamsRelProperty {
return propertyrel.NewActivityStreamsRelProperty()
}
// NewActivityStreamsActivityStreamsRelationshipProperty creates a new
// ActivityStreamsRelationshipProperty
func NewActivityStreamsRelationshipProperty() vocab.ActivityStreamsRelationshipProperty {
return propertyrelationship.NewActivityStreamsRelationshipProperty()
}
// NewActivityStreamsActivityStreamsRepliesProperty creates a new
// ActivityStreamsRepliesProperty
func NewActivityStreamsRepliesProperty() vocab.ActivityStreamsRepliesProperty {
return propertyreplies.NewActivityStreamsRepliesProperty()
}
// NewActivityStreamsActivityStreamsResultProperty creates a new
// ActivityStreamsResultProperty
func NewActivityStreamsResultProperty() vocab.ActivityStreamsResultProperty {
return propertyresult.NewActivityStreamsResultProperty()
}
// NewActivityStreamsActivityStreamsSharesProperty creates a new
// ActivityStreamsSharesProperty
func NewActivityStreamsSharesProperty() vocab.ActivityStreamsSharesProperty {
return propertyshares.NewActivityStreamsSharesProperty()
}
// NewActivityStreamsActivityStreamsSourceProperty creates a new
// ActivityStreamsSourceProperty
func NewActivityStreamsSourceProperty() vocab.ActivityStreamsSourceProperty {
return propertysource.NewActivityStreamsSourceProperty()
}
// NewActivityStreamsActivityStreamsStartIndexProperty creates a new
// ActivityStreamsStartIndexProperty
func NewActivityStreamsStartIndexProperty() vocab.ActivityStreamsStartIndexProperty {
return propertystartindex.NewActivityStreamsStartIndexProperty()
}
// NewActivityStreamsActivityStreamsStartTimeProperty creates a new
// ActivityStreamsStartTimeProperty
func NewActivityStreamsStartTimeProperty() vocab.ActivityStreamsStartTimeProperty {
return propertystarttime.NewActivityStreamsStartTimeProperty()
}
// NewActivityStreamsActivityStreamsStreamsProperty creates a new
// ActivityStreamsStreamsProperty
func NewActivityStreamsStreamsProperty() vocab.ActivityStreamsStreamsProperty {
return propertystreams.NewActivityStreamsStreamsProperty()
}
// NewActivityStreamsActivityStreamsSubjectProperty creates a new
// ActivityStreamsSubjectProperty
func NewActivityStreamsSubjectProperty() vocab.ActivityStreamsSubjectProperty {
return propertysubject.NewActivityStreamsSubjectProperty()
}
// NewActivityStreamsActivityStreamsSummaryProperty creates a new
// ActivityStreamsSummaryProperty
func NewActivityStreamsSummaryProperty() vocab.ActivityStreamsSummaryProperty {
return propertysummary.NewActivityStreamsSummaryProperty()
}
// NewActivityStreamsActivityStreamsTagProperty creates a new
// ActivityStreamsTagProperty
func NewActivityStreamsTagProperty() vocab.ActivityStreamsTagProperty {
return propertytag.NewActivityStreamsTagProperty()
}
// NewActivityStreamsActivityStreamsTargetProperty creates a new
// ActivityStreamsTargetProperty
func NewActivityStreamsTargetProperty() vocab.ActivityStreamsTargetProperty {
return propertytarget.NewActivityStreamsTargetProperty()
}
// NewActivityStreamsActivityStreamsToProperty creates a new
// ActivityStreamsToProperty
func NewActivityStreamsToProperty() vocab.ActivityStreamsToProperty {
return propertyto.NewActivityStreamsToProperty()
}
// NewActivityStreamsActivityStreamsTotalItemsProperty creates a new
// ActivityStreamsTotalItemsProperty
func NewActivityStreamsTotalItemsProperty() vocab.ActivityStreamsTotalItemsProperty {
return propertytotalitems.NewActivityStreamsTotalItemsProperty()
}
// NewActivityStreamsActivityStreamsUnitsProperty creates a new
// ActivityStreamsUnitsProperty
func NewActivityStreamsUnitsProperty() vocab.ActivityStreamsUnitsProperty {
return propertyunits.NewActivityStreamsUnitsProperty()
}
// NewActivityStreamsActivityStreamsUpdatedProperty creates a new
// ActivityStreamsUpdatedProperty
func NewActivityStreamsUpdatedProperty() vocab.ActivityStreamsUpdatedProperty {
return propertyupdated.NewActivityStreamsUpdatedProperty()
}
// NewActivityStreamsActivityStreamsUrlProperty creates a new
// ActivityStreamsUrlProperty
func NewActivityStreamsUrlProperty() vocab.ActivityStreamsUrlProperty {
return propertyurl.NewActivityStreamsUrlProperty()
}
// NewActivityStreamsActivityStreamsWidthProperty creates a new
// ActivityStreamsWidthProperty
func NewActivityStreamsWidthProperty() vocab.ActivityStreamsWidthProperty {
return propertywidth.NewActivityStreamsWidthProperty()
}

View file

@ -1,334 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_accept"
typeactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_activity"
typeadd "github.com/go-fed/activity/streams/impl/activitystreams/type_add"
typeannounce "github.com/go-fed/activity/streams/impl/activitystreams/type_announce"
typeapplication "github.com/go-fed/activity/streams/impl/activitystreams/type_application"
typearrive "github.com/go-fed/activity/streams/impl/activitystreams/type_arrive"
typearticle "github.com/go-fed/activity/streams/impl/activitystreams/type_article"
typeaudio "github.com/go-fed/activity/streams/impl/activitystreams/type_audio"
typeblock "github.com/go-fed/activity/streams/impl/activitystreams/type_block"
typecollection "github.com/go-fed/activity/streams/impl/activitystreams/type_collection"
typecollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_collectionpage"
typecreate "github.com/go-fed/activity/streams/impl/activitystreams/type_create"
typedelete "github.com/go-fed/activity/streams/impl/activitystreams/type_delete"
typedislike "github.com/go-fed/activity/streams/impl/activitystreams/type_dislike"
typedocument "github.com/go-fed/activity/streams/impl/activitystreams/type_document"
typeevent "github.com/go-fed/activity/streams/impl/activitystreams/type_event"
typeflag "github.com/go-fed/activity/streams/impl/activitystreams/type_flag"
typefollow "github.com/go-fed/activity/streams/impl/activitystreams/type_follow"
typegroup "github.com/go-fed/activity/streams/impl/activitystreams/type_group"
typeignore "github.com/go-fed/activity/streams/impl/activitystreams/type_ignore"
typeimage "github.com/go-fed/activity/streams/impl/activitystreams/type_image"
typeintransitiveactivity "github.com/go-fed/activity/streams/impl/activitystreams/type_intransitiveactivity"
typeinvite "github.com/go-fed/activity/streams/impl/activitystreams/type_invite"
typejoin "github.com/go-fed/activity/streams/impl/activitystreams/type_join"
typeleave "github.com/go-fed/activity/streams/impl/activitystreams/type_leave"
typelike "github.com/go-fed/activity/streams/impl/activitystreams/type_like"
typelink "github.com/go-fed/activity/streams/impl/activitystreams/type_link"
typelisten "github.com/go-fed/activity/streams/impl/activitystreams/type_listen"
typemention "github.com/go-fed/activity/streams/impl/activitystreams/type_mention"
typemove "github.com/go-fed/activity/streams/impl/activitystreams/type_move"
typenote "github.com/go-fed/activity/streams/impl/activitystreams/type_note"
typeobject "github.com/go-fed/activity/streams/impl/activitystreams/type_object"
typeoffer "github.com/go-fed/activity/streams/impl/activitystreams/type_offer"
typeorderedcollection "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollection"
typeorderedcollectionpage "github.com/go-fed/activity/streams/impl/activitystreams/type_orderedcollectionpage"
typeorganization "github.com/go-fed/activity/streams/impl/activitystreams/type_organization"
typepage "github.com/go-fed/activity/streams/impl/activitystreams/type_page"
typeperson "github.com/go-fed/activity/streams/impl/activitystreams/type_person"
typeplace "github.com/go-fed/activity/streams/impl/activitystreams/type_place"
typeprofile "github.com/go-fed/activity/streams/impl/activitystreams/type_profile"
typequestion "github.com/go-fed/activity/streams/impl/activitystreams/type_question"
typeread "github.com/go-fed/activity/streams/impl/activitystreams/type_read"
typereject "github.com/go-fed/activity/streams/impl/activitystreams/type_reject"
typerelationship "github.com/go-fed/activity/streams/impl/activitystreams/type_relationship"
typeremove "github.com/go-fed/activity/streams/impl/activitystreams/type_remove"
typeservice "github.com/go-fed/activity/streams/impl/activitystreams/type_service"
typetentativeaccept "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativeaccept"
typetentativereject "github.com/go-fed/activity/streams/impl/activitystreams/type_tentativereject"
typetombstone "github.com/go-fed/activity/streams/impl/activitystreams/type_tombstone"
typetravel "github.com/go-fed/activity/streams/impl/activitystreams/type_travel"
typeundo "github.com/go-fed/activity/streams/impl/activitystreams/type_undo"
typeupdate "github.com/go-fed/activity/streams/impl/activitystreams/type_update"
typevideo "github.com/go-fed/activity/streams/impl/activitystreams/type_video"
typeview "github.com/go-fed/activity/streams/impl/activitystreams/type_view"
vocab "github.com/go-fed/activity/streams/vocab"
)
// NewActivityStreamsAccept creates a new ActivityStreamsAccept
func NewActivityStreamsAccept() vocab.ActivityStreamsAccept {
return typeaccept.NewActivityStreamsAccept()
}
// NewActivityStreamsActivity creates a new ActivityStreamsActivity
func NewActivityStreamsActivity() vocab.ActivityStreamsActivity {
return typeactivity.NewActivityStreamsActivity()
}
// NewActivityStreamsAdd creates a new ActivityStreamsAdd
func NewActivityStreamsAdd() vocab.ActivityStreamsAdd {
return typeadd.NewActivityStreamsAdd()
}
// NewActivityStreamsAnnounce creates a new ActivityStreamsAnnounce
func NewActivityStreamsAnnounce() vocab.ActivityStreamsAnnounce {
return typeannounce.NewActivityStreamsAnnounce()
}
// NewActivityStreamsApplication creates a new ActivityStreamsApplication
func NewActivityStreamsApplication() vocab.ActivityStreamsApplication {
return typeapplication.NewActivityStreamsApplication()
}
// NewActivityStreamsArrive creates a new ActivityStreamsArrive
func NewActivityStreamsArrive() vocab.ActivityStreamsArrive {
return typearrive.NewActivityStreamsArrive()
}
// NewActivityStreamsArticle creates a new ActivityStreamsArticle
func NewActivityStreamsArticle() vocab.ActivityStreamsArticle {
return typearticle.NewActivityStreamsArticle()
}
// NewActivityStreamsAudio creates a new ActivityStreamsAudio
func NewActivityStreamsAudio() vocab.ActivityStreamsAudio {
return typeaudio.NewActivityStreamsAudio()
}
// NewActivityStreamsBlock creates a new ActivityStreamsBlock
func NewActivityStreamsBlock() vocab.ActivityStreamsBlock {
return typeblock.NewActivityStreamsBlock()
}
// NewActivityStreamsCollection creates a new ActivityStreamsCollection
func NewActivityStreamsCollection() vocab.ActivityStreamsCollection {
return typecollection.NewActivityStreamsCollection()
}
// NewActivityStreamsCollectionPage creates a new ActivityStreamsCollectionPage
func NewActivityStreamsCollectionPage() vocab.ActivityStreamsCollectionPage {
return typecollectionpage.NewActivityStreamsCollectionPage()
}
// NewActivityStreamsCreate creates a new ActivityStreamsCreate
func NewActivityStreamsCreate() vocab.ActivityStreamsCreate {
return typecreate.NewActivityStreamsCreate()
}
// NewActivityStreamsDelete creates a new ActivityStreamsDelete
func NewActivityStreamsDelete() vocab.ActivityStreamsDelete {
return typedelete.NewActivityStreamsDelete()
}
// NewActivityStreamsDislike creates a new ActivityStreamsDislike
func NewActivityStreamsDislike() vocab.ActivityStreamsDislike {
return typedislike.NewActivityStreamsDislike()
}
// NewActivityStreamsDocument creates a new ActivityStreamsDocument
func NewActivityStreamsDocument() vocab.ActivityStreamsDocument {
return typedocument.NewActivityStreamsDocument()
}
// NewActivityStreamsEvent creates a new ActivityStreamsEvent
func NewActivityStreamsEvent() vocab.ActivityStreamsEvent {
return typeevent.NewActivityStreamsEvent()
}
// NewActivityStreamsFlag creates a new ActivityStreamsFlag
func NewActivityStreamsFlag() vocab.ActivityStreamsFlag {
return typeflag.NewActivityStreamsFlag()
}
// NewActivityStreamsFollow creates a new ActivityStreamsFollow
func NewActivityStreamsFollow() vocab.ActivityStreamsFollow {
return typefollow.NewActivityStreamsFollow()
}
// NewActivityStreamsGroup creates a new ActivityStreamsGroup
func NewActivityStreamsGroup() vocab.ActivityStreamsGroup {
return typegroup.NewActivityStreamsGroup()
}
// NewActivityStreamsIgnore creates a new ActivityStreamsIgnore
func NewActivityStreamsIgnore() vocab.ActivityStreamsIgnore {
return typeignore.NewActivityStreamsIgnore()
}
// NewActivityStreamsImage creates a new ActivityStreamsImage
func NewActivityStreamsImage() vocab.ActivityStreamsImage {
return typeimage.NewActivityStreamsImage()
}
// NewActivityStreamsIntransitiveActivity creates a new
// ActivityStreamsIntransitiveActivity
func NewActivityStreamsIntransitiveActivity() vocab.ActivityStreamsIntransitiveActivity {
return typeintransitiveactivity.NewActivityStreamsIntransitiveActivity()
}
// NewActivityStreamsInvite creates a new ActivityStreamsInvite
func NewActivityStreamsInvite() vocab.ActivityStreamsInvite {
return typeinvite.NewActivityStreamsInvite()
}
// NewActivityStreamsJoin creates a new ActivityStreamsJoin
func NewActivityStreamsJoin() vocab.ActivityStreamsJoin {
return typejoin.NewActivityStreamsJoin()
}
// NewActivityStreamsLeave creates a new ActivityStreamsLeave
func NewActivityStreamsLeave() vocab.ActivityStreamsLeave {
return typeleave.NewActivityStreamsLeave()
}
// NewActivityStreamsLike creates a new ActivityStreamsLike
func NewActivityStreamsLike() vocab.ActivityStreamsLike {
return typelike.NewActivityStreamsLike()
}
// NewActivityStreamsLink creates a new ActivityStreamsLink
func NewActivityStreamsLink() vocab.ActivityStreamsLink {
return typelink.NewActivityStreamsLink()
}
// NewActivityStreamsListen creates a new ActivityStreamsListen
func NewActivityStreamsListen() vocab.ActivityStreamsListen {
return typelisten.NewActivityStreamsListen()
}
// NewActivityStreamsMention creates a new ActivityStreamsMention
func NewActivityStreamsMention() vocab.ActivityStreamsMention {
return typemention.NewActivityStreamsMention()
}
// NewActivityStreamsMove creates a new ActivityStreamsMove
func NewActivityStreamsMove() vocab.ActivityStreamsMove {
return typemove.NewActivityStreamsMove()
}
// NewActivityStreamsNote creates a new ActivityStreamsNote
func NewActivityStreamsNote() vocab.ActivityStreamsNote {
return typenote.NewActivityStreamsNote()
}
// NewActivityStreamsObject creates a new ActivityStreamsObject
func NewActivityStreamsObject() vocab.ActivityStreamsObject {
return typeobject.NewActivityStreamsObject()
}
// NewActivityStreamsOffer creates a new ActivityStreamsOffer
func NewActivityStreamsOffer() vocab.ActivityStreamsOffer {
return typeoffer.NewActivityStreamsOffer()
}
// NewActivityStreamsOrderedCollection creates a new
// ActivityStreamsOrderedCollection
func NewActivityStreamsOrderedCollection() vocab.ActivityStreamsOrderedCollection {
return typeorderedcollection.NewActivityStreamsOrderedCollection()
}
// NewActivityStreamsOrderedCollectionPage creates a new
// ActivityStreamsOrderedCollectionPage
func NewActivityStreamsOrderedCollectionPage() vocab.ActivityStreamsOrderedCollectionPage {
return typeorderedcollectionpage.NewActivityStreamsOrderedCollectionPage()
}
// NewActivityStreamsOrganization creates a new ActivityStreamsOrganization
func NewActivityStreamsOrganization() vocab.ActivityStreamsOrganization {
return typeorganization.NewActivityStreamsOrganization()
}
// NewActivityStreamsPage creates a new ActivityStreamsPage
func NewActivityStreamsPage() vocab.ActivityStreamsPage {
return typepage.NewActivityStreamsPage()
}
// NewActivityStreamsPerson creates a new ActivityStreamsPerson
func NewActivityStreamsPerson() vocab.ActivityStreamsPerson {
return typeperson.NewActivityStreamsPerson()
}
// NewActivityStreamsPlace creates a new ActivityStreamsPlace
func NewActivityStreamsPlace() vocab.ActivityStreamsPlace {
return typeplace.NewActivityStreamsPlace()
}
// NewActivityStreamsProfile creates a new ActivityStreamsProfile
func NewActivityStreamsProfile() vocab.ActivityStreamsProfile {
return typeprofile.NewActivityStreamsProfile()
}
// NewActivityStreamsQuestion creates a new ActivityStreamsQuestion
func NewActivityStreamsQuestion() vocab.ActivityStreamsQuestion {
return typequestion.NewActivityStreamsQuestion()
}
// NewActivityStreamsRead creates a new ActivityStreamsRead
func NewActivityStreamsRead() vocab.ActivityStreamsRead {
return typeread.NewActivityStreamsRead()
}
// NewActivityStreamsReject creates a new ActivityStreamsReject
func NewActivityStreamsReject() vocab.ActivityStreamsReject {
return typereject.NewActivityStreamsReject()
}
// NewActivityStreamsRelationship creates a new ActivityStreamsRelationship
func NewActivityStreamsRelationship() vocab.ActivityStreamsRelationship {
return typerelationship.NewActivityStreamsRelationship()
}
// NewActivityStreamsRemove creates a new ActivityStreamsRemove
func NewActivityStreamsRemove() vocab.ActivityStreamsRemove {
return typeremove.NewActivityStreamsRemove()
}
// NewActivityStreamsService creates a new ActivityStreamsService
func NewActivityStreamsService() vocab.ActivityStreamsService {
return typeservice.NewActivityStreamsService()
}
// NewActivityStreamsTentativeAccept creates a new ActivityStreamsTentativeAccept
func NewActivityStreamsTentativeAccept() vocab.ActivityStreamsTentativeAccept {
return typetentativeaccept.NewActivityStreamsTentativeAccept()
}
// NewActivityStreamsTentativeReject creates a new ActivityStreamsTentativeReject
func NewActivityStreamsTentativeReject() vocab.ActivityStreamsTentativeReject {
return typetentativereject.NewActivityStreamsTentativeReject()
}
// NewActivityStreamsTombstone creates a new ActivityStreamsTombstone
func NewActivityStreamsTombstone() vocab.ActivityStreamsTombstone {
return typetombstone.NewActivityStreamsTombstone()
}
// NewActivityStreamsTravel creates a new ActivityStreamsTravel
func NewActivityStreamsTravel() vocab.ActivityStreamsTravel {
return typetravel.NewActivityStreamsTravel()
}
// NewActivityStreamsUndo creates a new ActivityStreamsUndo
func NewActivityStreamsUndo() vocab.ActivityStreamsUndo {
return typeundo.NewActivityStreamsUndo()
}
// NewActivityStreamsUpdate creates a new ActivityStreamsUpdate
func NewActivityStreamsUpdate() vocab.ActivityStreamsUpdate {
return typeupdate.NewActivityStreamsUpdate()
}
// NewActivityStreamsVideo creates a new ActivityStreamsVideo
func NewActivityStreamsVideo() vocab.ActivityStreamsVideo {
return typevideo.NewActivityStreamsVideo()
}
// NewActivityStreamsView creates a new ActivityStreamsView
func NewActivityStreamsView() vocab.ActivityStreamsView {
return typeview.NewActivityStreamsView()
}

View file

@ -1,49 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typebranch "github.com/go-fed/activity/streams/impl/forgefed/type_branch"
typecommit "github.com/go-fed/activity/streams/impl/forgefed/type_commit"
typepush "github.com/go-fed/activity/streams/impl/forgefed/type_push"
typerepository "github.com/go-fed/activity/streams/impl/forgefed/type_repository"
typeticket "github.com/go-fed/activity/streams/impl/forgefed/type_ticket"
typeticketdependency "github.com/go-fed/activity/streams/impl/forgefed/type_ticketdependency"
vocab "github.com/go-fed/activity/streams/vocab"
)
// ForgeFedBranchIsDisjointWith returns true if Branch is disjoint with the
// other's type.
func ForgeFedBranchIsDisjointWith(other vocab.Type) bool {
return typebranch.BranchIsDisjointWith(other)
}
// ForgeFedCommitIsDisjointWith returns true if Commit is disjoint with the
// other's type.
func ForgeFedCommitIsDisjointWith(other vocab.Type) bool {
return typecommit.CommitIsDisjointWith(other)
}
// ForgeFedPushIsDisjointWith returns true if Push is disjoint with the other's
// type.
func ForgeFedPushIsDisjointWith(other vocab.Type) bool {
return typepush.PushIsDisjointWith(other)
}
// ForgeFedRepositoryIsDisjointWith returns true if Repository is disjoint with
// the other's type.
func ForgeFedRepositoryIsDisjointWith(other vocab.Type) bool {
return typerepository.RepositoryIsDisjointWith(other)
}
// ForgeFedTicketIsDisjointWith returns true if Ticket is disjoint with the
// other's type.
func ForgeFedTicketIsDisjointWith(other vocab.Type) bool {
return typeticket.TicketIsDisjointWith(other)
}
// ForgeFedTicketDependencyIsDisjointWith returns true if TicketDependency is
// disjoint with the other's type.
func ForgeFedTicketDependencyIsDisjointWith(other vocab.Type) bool {
return typeticketdependency.TicketDependencyIsDisjointWith(other)
}

View file

@ -1,55 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typebranch "github.com/go-fed/activity/streams/impl/forgefed/type_branch"
typecommit "github.com/go-fed/activity/streams/impl/forgefed/type_commit"
typepush "github.com/go-fed/activity/streams/impl/forgefed/type_push"
typerepository "github.com/go-fed/activity/streams/impl/forgefed/type_repository"
typeticket "github.com/go-fed/activity/streams/impl/forgefed/type_ticket"
typeticketdependency "github.com/go-fed/activity/streams/impl/forgefed/type_ticketdependency"
vocab "github.com/go-fed/activity/streams/vocab"
)
// ForgeFedBranchIsExtendedBy returns true if the other's type extends from
// Branch. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ForgeFedBranchIsExtendedBy(other vocab.Type) bool {
return typebranch.BranchIsExtendedBy(other)
}
// ForgeFedCommitIsExtendedBy returns true if the other's type extends from
// Commit. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ForgeFedCommitIsExtendedBy(other vocab.Type) bool {
return typecommit.CommitIsExtendedBy(other)
}
// ForgeFedPushIsExtendedBy returns true if the other's type extends from Push.
// Note that it returns false if the types are the same; see the "IsOrExtends"
// variant instead.
func ForgeFedPushIsExtendedBy(other vocab.Type) bool {
return typepush.PushIsExtendedBy(other)
}
// ForgeFedRepositoryIsExtendedBy returns true if the other's type extends from
// Repository. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ForgeFedRepositoryIsExtendedBy(other vocab.Type) bool {
return typerepository.RepositoryIsExtendedBy(other)
}
// ForgeFedTicketIsExtendedBy returns true if the other's type extends from
// Ticket. Note that it returns false if the types are the same; see the
// "IsOrExtends" variant instead.
func ForgeFedTicketIsExtendedBy(other vocab.Type) bool {
return typeticket.TicketIsExtendedBy(other)
}
// ForgeFedTicketDependencyIsExtendedBy returns true if the other's type extends
// from TicketDependency. Note that it returns false if the types are the
// same; see the "IsOrExtends" variant instead.
func ForgeFedTicketDependencyIsExtendedBy(other vocab.Type) bool {
return typeticketdependency.TicketDependencyIsExtendedBy(other)
}

View file

@ -1,48 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typebranch "github.com/go-fed/activity/streams/impl/forgefed/type_branch"
typecommit "github.com/go-fed/activity/streams/impl/forgefed/type_commit"
typepush "github.com/go-fed/activity/streams/impl/forgefed/type_push"
typerepository "github.com/go-fed/activity/streams/impl/forgefed/type_repository"
typeticket "github.com/go-fed/activity/streams/impl/forgefed/type_ticket"
typeticketdependency "github.com/go-fed/activity/streams/impl/forgefed/type_ticketdependency"
vocab "github.com/go-fed/activity/streams/vocab"
)
// ForgeFedForgeFedBranchExtends returns true if Branch extends from the other's
// type.
func ForgeFedForgeFedBranchExtends(other vocab.Type) bool {
return typebranch.ForgeFedBranchExtends(other)
}
// ForgeFedForgeFedCommitExtends returns true if Commit extends from the other's
// type.
func ForgeFedForgeFedCommitExtends(other vocab.Type) bool {
return typecommit.ForgeFedCommitExtends(other)
}
// ForgeFedForgeFedPushExtends returns true if Push extends from the other's type.
func ForgeFedForgeFedPushExtends(other vocab.Type) bool {
return typepush.ForgeFedPushExtends(other)
}
// ForgeFedForgeFedRepositoryExtends returns true if Repository extends from the
// other's type.
func ForgeFedForgeFedRepositoryExtends(other vocab.Type) bool {
return typerepository.ForgeFedRepositoryExtends(other)
}
// ForgeFedForgeFedTicketExtends returns true if Ticket extends from the other's
// type.
func ForgeFedForgeFedTicketExtends(other vocab.Type) bool {
return typeticket.ForgeFedTicketExtends(other)
}
// ForgeFedForgeFedTicketDependencyExtends returns true if TicketDependency
// extends from the other's type.
func ForgeFedForgeFedTicketDependencyExtends(other vocab.Type) bool {
return typeticketdependency.ForgeFedTicketDependencyExtends(other)
}

View file

@ -1,49 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typebranch "github.com/go-fed/activity/streams/impl/forgefed/type_branch"
typecommit "github.com/go-fed/activity/streams/impl/forgefed/type_commit"
typepush "github.com/go-fed/activity/streams/impl/forgefed/type_push"
typerepository "github.com/go-fed/activity/streams/impl/forgefed/type_repository"
typeticket "github.com/go-fed/activity/streams/impl/forgefed/type_ticket"
typeticketdependency "github.com/go-fed/activity/streams/impl/forgefed/type_ticketdependency"
vocab "github.com/go-fed/activity/streams/vocab"
)
// IsOrExtendsForgeFedBranch returns true if the other provided type is the Branch
// type or extends from the Branch type.
func IsOrExtendsForgeFedBranch(other vocab.Type) bool {
return typebranch.IsOrExtendsBranch(other)
}
// IsOrExtendsForgeFedCommit returns true if the other provided type is the Commit
// type or extends from the Commit type.
func IsOrExtendsForgeFedCommit(other vocab.Type) bool {
return typecommit.IsOrExtendsCommit(other)
}
// IsOrExtendsForgeFedPush returns true if the other provided type is the Push
// type or extends from the Push type.
func IsOrExtendsForgeFedPush(other vocab.Type) bool {
return typepush.IsOrExtendsPush(other)
}
// IsOrExtendsForgeFedRepository returns true if the other provided type is the
// Repository type or extends from the Repository type.
func IsOrExtendsForgeFedRepository(other vocab.Type) bool {
return typerepository.IsOrExtendsRepository(other)
}
// IsOrExtendsForgeFedTicket returns true if the other provided type is the Ticket
// type or extends from the Ticket type.
func IsOrExtendsForgeFedTicket(other vocab.Type) bool {
return typeticket.IsOrExtendsTicket(other)
}
// IsOrExtendsForgeFedTicketDependency returns true if the other provided type is
// the TicketDependency type or extends from the TicketDependency type.
func IsOrExtendsForgeFedTicketDependency(other vocab.Type) bool {
return typeticketdependency.IsOrExtendsTicketDependency(other)
}

View file

@ -1,126 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
propertyassignedto "github.com/go-fed/activity/streams/impl/forgefed/property_assignedto"
propertycommitted "github.com/go-fed/activity/streams/impl/forgefed/property_committed"
propertycommittedby "github.com/go-fed/activity/streams/impl/forgefed/property_committedby"
propertydependants "github.com/go-fed/activity/streams/impl/forgefed/property_dependants"
propertydependedby "github.com/go-fed/activity/streams/impl/forgefed/property_dependedby"
propertydependencies "github.com/go-fed/activity/streams/impl/forgefed/property_dependencies"
propertydependson "github.com/go-fed/activity/streams/impl/forgefed/property_dependson"
propertydescription "github.com/go-fed/activity/streams/impl/forgefed/property_description"
propertyearlyitems "github.com/go-fed/activity/streams/impl/forgefed/property_earlyitems"
propertyfilesadded "github.com/go-fed/activity/streams/impl/forgefed/property_filesadded"
propertyfilesmodified "github.com/go-fed/activity/streams/impl/forgefed/property_filesmodified"
propertyfilesremoved "github.com/go-fed/activity/streams/impl/forgefed/property_filesremoved"
propertyforks "github.com/go-fed/activity/streams/impl/forgefed/property_forks"
propertyhash "github.com/go-fed/activity/streams/impl/forgefed/property_hash"
propertyisresolved "github.com/go-fed/activity/streams/impl/forgefed/property_isresolved"
propertyref "github.com/go-fed/activity/streams/impl/forgefed/property_ref"
propertyteam "github.com/go-fed/activity/streams/impl/forgefed/property_team"
propertyticketstrackedby "github.com/go-fed/activity/streams/impl/forgefed/property_ticketstrackedby"
propertytracksticketsfor "github.com/go-fed/activity/streams/impl/forgefed/property_tracksticketsfor"
vocab "github.com/go-fed/activity/streams/vocab"
)
// NewForgeFedForgeFedAssignedToProperty creates a new ForgeFedAssignedToProperty
func NewForgeFedAssignedToProperty() vocab.ForgeFedAssignedToProperty {
return propertyassignedto.NewForgeFedAssignedToProperty()
}
// NewForgeFedForgeFedCommittedProperty creates a new ForgeFedCommittedProperty
func NewForgeFedCommittedProperty() vocab.ForgeFedCommittedProperty {
return propertycommitted.NewForgeFedCommittedProperty()
}
// NewForgeFedForgeFedCommittedByProperty creates a new ForgeFedCommittedByProperty
func NewForgeFedCommittedByProperty() vocab.ForgeFedCommittedByProperty {
return propertycommittedby.NewForgeFedCommittedByProperty()
}
// NewForgeFedForgeFedDependantsProperty creates a new ForgeFedDependantsProperty
func NewForgeFedDependantsProperty() vocab.ForgeFedDependantsProperty {
return propertydependants.NewForgeFedDependantsProperty()
}
// NewForgeFedForgeFedDependedByProperty creates a new ForgeFedDependedByProperty
func NewForgeFedDependedByProperty() vocab.ForgeFedDependedByProperty {
return propertydependedby.NewForgeFedDependedByProperty()
}
// NewForgeFedForgeFedDependenciesProperty creates a new
// ForgeFedDependenciesProperty
func NewForgeFedDependenciesProperty() vocab.ForgeFedDependenciesProperty {
return propertydependencies.NewForgeFedDependenciesProperty()
}
// NewForgeFedForgeFedDependsOnProperty creates a new ForgeFedDependsOnProperty
func NewForgeFedDependsOnProperty() vocab.ForgeFedDependsOnProperty {
return propertydependson.NewForgeFedDependsOnProperty()
}
// NewForgeFedForgeFedDescriptionProperty creates a new ForgeFedDescriptionProperty
func NewForgeFedDescriptionProperty() vocab.ForgeFedDescriptionProperty {
return propertydescription.NewForgeFedDescriptionProperty()
}
// NewForgeFedForgeFedEarlyItemsProperty creates a new ForgeFedEarlyItemsProperty
func NewForgeFedEarlyItemsProperty() vocab.ForgeFedEarlyItemsProperty {
return propertyearlyitems.NewForgeFedEarlyItemsProperty()
}
// NewForgeFedForgeFedFilesAddedProperty creates a new ForgeFedFilesAddedProperty
func NewForgeFedFilesAddedProperty() vocab.ForgeFedFilesAddedProperty {
return propertyfilesadded.NewForgeFedFilesAddedProperty()
}
// NewForgeFedForgeFedFilesModifiedProperty creates a new
// ForgeFedFilesModifiedProperty
func NewForgeFedFilesModifiedProperty() vocab.ForgeFedFilesModifiedProperty {
return propertyfilesmodified.NewForgeFedFilesModifiedProperty()
}
// NewForgeFedForgeFedFilesRemovedProperty creates a new
// ForgeFedFilesRemovedProperty
func NewForgeFedFilesRemovedProperty() vocab.ForgeFedFilesRemovedProperty {
return propertyfilesremoved.NewForgeFedFilesRemovedProperty()
}
// NewForgeFedForgeFedForksProperty creates a new ForgeFedForksProperty
func NewForgeFedForksProperty() vocab.ForgeFedForksProperty {
return propertyforks.NewForgeFedForksProperty()
}
// NewForgeFedForgeFedHashProperty creates a new ForgeFedHashProperty
func NewForgeFedHashProperty() vocab.ForgeFedHashProperty {
return propertyhash.NewForgeFedHashProperty()
}
// NewForgeFedForgeFedIsResolvedProperty creates a new ForgeFedIsResolvedProperty
func NewForgeFedIsResolvedProperty() vocab.ForgeFedIsResolvedProperty {
return propertyisresolved.NewForgeFedIsResolvedProperty()
}
// NewForgeFedForgeFedRefProperty creates a new ForgeFedRefProperty
func NewForgeFedRefProperty() vocab.ForgeFedRefProperty {
return propertyref.NewForgeFedRefProperty()
}
// NewForgeFedForgeFedTeamProperty creates a new ForgeFedTeamProperty
func NewForgeFedTeamProperty() vocab.ForgeFedTeamProperty {
return propertyteam.NewForgeFedTeamProperty()
}
// NewForgeFedForgeFedTicketsTrackedByProperty creates a new
// ForgeFedTicketsTrackedByProperty
func NewForgeFedTicketsTrackedByProperty() vocab.ForgeFedTicketsTrackedByProperty {
return propertyticketstrackedby.NewForgeFedTicketsTrackedByProperty()
}
// NewForgeFedForgeFedTracksTicketsForProperty creates a new
// ForgeFedTracksTicketsForProperty
func NewForgeFedTracksTicketsForProperty() vocab.ForgeFedTracksTicketsForProperty {
return propertytracksticketsfor.NewForgeFedTracksTicketsForProperty()
}

View file

@ -1,43 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typebranch "github.com/go-fed/activity/streams/impl/forgefed/type_branch"
typecommit "github.com/go-fed/activity/streams/impl/forgefed/type_commit"
typepush "github.com/go-fed/activity/streams/impl/forgefed/type_push"
typerepository "github.com/go-fed/activity/streams/impl/forgefed/type_repository"
typeticket "github.com/go-fed/activity/streams/impl/forgefed/type_ticket"
typeticketdependency "github.com/go-fed/activity/streams/impl/forgefed/type_ticketdependency"
vocab "github.com/go-fed/activity/streams/vocab"
)
// NewForgeFedBranch creates a new ForgeFedBranch
func NewForgeFedBranch() vocab.ForgeFedBranch {
return typebranch.NewForgeFedBranch()
}
// NewForgeFedCommit creates a new ForgeFedCommit
func NewForgeFedCommit() vocab.ForgeFedCommit {
return typecommit.NewForgeFedCommit()
}
// NewForgeFedPush creates a new ForgeFedPush
func NewForgeFedPush() vocab.ForgeFedPush {
return typepush.NewForgeFedPush()
}
// NewForgeFedRepository creates a new ForgeFedRepository
func NewForgeFedRepository() vocab.ForgeFedRepository {
return typerepository.NewForgeFedRepository()
}
// NewForgeFedTicket creates a new ForgeFedTicket
func NewForgeFedTicket() vocab.ForgeFedTicket {
return typeticket.NewForgeFedTicket()
}
// NewForgeFedTicketDependency creates a new ForgeFedTicketDependency
func NewForgeFedTicketDependency() vocab.ForgeFedTicketDependency {
return typeticketdependency.NewForgeFedTicketDependency()
}

View file

@ -1,19 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
propertyid "github.com/go-fed/activity/streams/impl/jsonld/property_id"
propertytype "github.com/go-fed/activity/streams/impl/jsonld/property_type"
vocab "github.com/go-fed/activity/streams/vocab"
)
// NewJSONLDJSONLDTypeProperty creates a new JSONLDTypeProperty
func NewJSONLDTypeProperty() vocab.JSONLDTypeProperty {
return propertytype.NewJSONLDTypeProperty()
}
// NewJSONLDJSONLDIdProperty creates a new JSONLDIdProperty
func NewJSONLDIdProperty() vocab.JSONLDIdProperty {
return propertyid.NewJSONLDIdProperty()
}

View file

@ -1,20 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeemoji "github.com/go-fed/activity/streams/impl/toot/type_emoji"
typeidentityproof "github.com/go-fed/activity/streams/impl/toot/type_identityproof"
vocab "github.com/go-fed/activity/streams/vocab"
)
// TootEmojiIsDisjointWith returns true if Emoji is disjoint with the other's type.
func TootEmojiIsDisjointWith(other vocab.Type) bool {
return typeemoji.EmojiIsDisjointWith(other)
}
// TootIdentityProofIsDisjointWith returns true if IdentityProof is disjoint with
// the other's type.
func TootIdentityProofIsDisjointWith(other vocab.Type) bool {
return typeidentityproof.IdentityProofIsDisjointWith(other)
}

View file

@ -1,23 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeemoji "github.com/go-fed/activity/streams/impl/toot/type_emoji"
typeidentityproof "github.com/go-fed/activity/streams/impl/toot/type_identityproof"
vocab "github.com/go-fed/activity/streams/vocab"
)
// TootEmojiIsExtendedBy returns true if the other's type extends from Emoji. Note
// that it returns false if the types are the same; see the "IsOrExtends"
// variant instead.
func TootEmojiIsExtendedBy(other vocab.Type) bool {
return typeemoji.EmojiIsExtendedBy(other)
}
// TootIdentityProofIsExtendedBy returns true if the other's type extends from
// IdentityProof. Note that it returns false if the types are the same; see
// the "IsOrExtends" variant instead.
func TootIdentityProofIsExtendedBy(other vocab.Type) bool {
return typeidentityproof.IdentityProofIsExtendedBy(other)
}

View file

@ -1,20 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeemoji "github.com/go-fed/activity/streams/impl/toot/type_emoji"
typeidentityproof "github.com/go-fed/activity/streams/impl/toot/type_identityproof"
vocab "github.com/go-fed/activity/streams/vocab"
)
// TootTootEmojiExtends returns true if Emoji extends from the other's type.
func TootTootEmojiExtends(other vocab.Type) bool {
return typeemoji.TootEmojiExtends(other)
}
// TootTootIdentityProofExtends returns true if IdentityProof extends from the
// other's type.
func TootTootIdentityProofExtends(other vocab.Type) bool {
return typeidentityproof.TootIdentityProofExtends(other)
}

View file

@ -1,21 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeemoji "github.com/go-fed/activity/streams/impl/toot/type_emoji"
typeidentityproof "github.com/go-fed/activity/streams/impl/toot/type_identityproof"
vocab "github.com/go-fed/activity/streams/vocab"
)
// IsOrExtendsTootEmoji returns true if the other provided type is the Emoji type
// or extends from the Emoji type.
func IsOrExtendsTootEmoji(other vocab.Type) bool {
return typeemoji.IsOrExtendsEmoji(other)
}
// IsOrExtendsTootIdentityProof returns true if the other provided type is the
// IdentityProof type or extends from the IdentityProof type.
func IsOrExtendsTootIdentityProof(other vocab.Type) bool {
return typeidentityproof.IsOrExtendsIdentityProof(other)
}

View file

@ -1,44 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
propertyblurhash "github.com/go-fed/activity/streams/impl/toot/property_blurhash"
propertydiscoverable "github.com/go-fed/activity/streams/impl/toot/property_discoverable"
propertyfeatured "github.com/go-fed/activity/streams/impl/toot/property_featured"
propertysignaturealgorithm "github.com/go-fed/activity/streams/impl/toot/property_signaturealgorithm"
propertysignaturevalue "github.com/go-fed/activity/streams/impl/toot/property_signaturevalue"
propertyvoterscount "github.com/go-fed/activity/streams/impl/toot/property_voterscount"
vocab "github.com/go-fed/activity/streams/vocab"
)
// NewTootTootBlurhashProperty creates a new TootBlurhashProperty
func NewTootBlurhashProperty() vocab.TootBlurhashProperty {
return propertyblurhash.NewTootBlurhashProperty()
}
// NewTootTootDiscoverableProperty creates a new TootDiscoverableProperty
func NewTootDiscoverableProperty() vocab.TootDiscoverableProperty {
return propertydiscoverable.NewTootDiscoverableProperty()
}
// NewTootTootFeaturedProperty creates a new TootFeaturedProperty
func NewTootFeaturedProperty() vocab.TootFeaturedProperty {
return propertyfeatured.NewTootFeaturedProperty()
}
// NewTootTootSignatureAlgorithmProperty creates a new
// TootSignatureAlgorithmProperty
func NewTootSignatureAlgorithmProperty() vocab.TootSignatureAlgorithmProperty {
return propertysignaturealgorithm.NewTootSignatureAlgorithmProperty()
}
// NewTootTootSignatureValueProperty creates a new TootSignatureValueProperty
func NewTootSignatureValueProperty() vocab.TootSignatureValueProperty {
return propertysignaturevalue.NewTootSignatureValueProperty()
}
// NewTootTootVotersCountProperty creates a new TootVotersCountProperty
func NewTootVotersCountProperty() vocab.TootVotersCountProperty {
return propertyvoterscount.NewTootVotersCountProperty()
}

View file

@ -1,19 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typeemoji "github.com/go-fed/activity/streams/impl/toot/type_emoji"
typeidentityproof "github.com/go-fed/activity/streams/impl/toot/type_identityproof"
vocab "github.com/go-fed/activity/streams/vocab"
)
// NewTootEmoji creates a new TootEmoji
func NewTootEmoji() vocab.TootEmoji {
return typeemoji.NewTootEmoji()
}
// NewTootIdentityProof creates a new TootIdentityProof
func NewTootIdentityProof() vocab.TootIdentityProof {
return typeidentityproof.NewTootIdentityProof()
}

View file

@ -1,14 +0,0 @@
// Code generated by astool. DO NOT EDIT.
package streams
import (
typepublickey "github.com/go-fed/activity/streams/impl/w3idsecurityv1/type_publickey"
vocab "github.com/go-fed/activity/streams/vocab"
)
// W3IDSecurityV1PublicKeyIsDisjointWith returns true if PublicKey is disjoint
// with the other's type.
func W3IDSecurityV1PublicKeyIsDisjointWith(other vocab.Type) bool {
return typepublickey.PublicKeyIsDisjointWith(other)
}

Some files were not shown because too many files have changed in this diff Show more