Changes
15 changed files (+32/-27)
-
-
@@ -19,6 +19,7 @@ const (ServiceType ActivityVocabularyType = "Service" ) // ActorTypes represent the valid Actor types. var ActorTypes = ActivityVocabularyTypes{ ApplicationType, GroupType,
-
-
-
@@ -1,10 +1,6 @@package activitypub import ( "bytes" "encoding/gob" ) /* func GobEncode(it Item) ([]byte, error) { b := new(bytes.Buffer) err := gob.NewEncoder(b).Encode(it)
-
@@ -42,3 +38,4 @@ func UnmarshalGob(data []byte) (Item, error) {} return GobUnmarshalToItem(data), nil } */
-
-
-
@@ -1,10 +1,6 @@package activitypub import ( "reflect" "testing" ) /* func TestGobEncode(t *testing.T) { type args struct { it Item
-
@@ -61,3 +57,4 @@ func TestUnmarshalGob(t *testing.T) {}) } } */
-
-
-
@@ -1,12 +1,6 @@package activitypub import ( "bytes" "encoding/gob" "errors" "testing" ) /* func TestMarshalGob(t *testing.T) { tests := []struct { name string
-
@@ -46,3 +40,4 @@ func TestMarshalGob(t *testing.T) {}) } } */
-
-
-
@@ -231,7 +231,7 @@ func IntransitiveActivityNew(id ID, typ ActivityVocabularyType) *IntransitiveActreturn &i } // ToIntransitiveActivity // ToIntransitiveActivity tries to convert it Item to an IntransitiveActivity object func ToIntransitiveActivity(it Item) (*IntransitiveActivity, error) { switch i := it.(type) { case *Activity:
-
-
-
@@ -18,6 +18,11 @@ const (PublicNS = ActivityBaseURI + "#Public" ) // JsonLDContext is a slice of IRIs that form the default context for the objects in the // GoActivitypub vocabulary. // It does not represent just the default ActivityStreams public namespace, but it also // has the W3 Permanent Identifier Community Group's Security namespace, which appears // in the Actor type objects, which contain public key related data. var JsonLDContext = []IRI{ ActivityBaseURI, SecurityContextURI,
-
-
-
@@ -4,11 +4,16 @@ package activitypubtype Item = ObjectOrLink const ( // EmptyIRI represents a zero length IRI EmptyIRI IRI = "" NilIRI IRI = "-" // NilIRI represents by convention an IRI which is nil // Its use is mostly to check if a property of an ActivityPub Item is nil NilIRI IRI = "-" // EmptyID represents a zero length ID EmptyID = EmptyIRI NilID = NilIRI // NilID represents by convention an ID which is nil, see details of NilIRI NilID = NilIRI ) // ItemsEqual checks if it and with Items are equal
-
-
-
@@ -34,6 +34,7 @@ func (i ItemCollection) IsObject() bool {return false } // MarshalJSON encodes the receiver object to a JSON document. func (i ItemCollection) MarshalJSON() ([]byte, error) { b := make([]byte, 0) writeItemCollectionJSONValue(&b, i)
-
-
-
@@ -1,12 +1,12 @@package activitypub import ( "errors" "fmt" "github.com/valyala/fastjson" ) // LinkTypes represent the valid values for a Link object var LinkTypes = ActivityVocabularyTypes{ LinkType, MentionType,
-
@@ -116,7 +116,7 @@ func (l *Link) UnmarshalJSON(data []byte) error {// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. func (l *Link) UnmarshalBinary(data []byte) error { return errors.New(fmt.Sprintf("UnmarshalBinary is not implemented for %T", *l)) return fmt.Errorf("UnmarshalBinary is not implemented for %T", *l) } /*
-
-
-
@@ -9,6 +9,8 @@ import ("github.com/valyala/fastjson" ) // NilLangRef represents a convention for a nil language reference. // It is used for LangRefValue objects without an explicit language key. const NilLangRef LangRef = "-" type (
-
-
-
@@ -14,6 +14,7 @@ package activitypub// (a part of its parent context) type ID = IRI // IsValid returns if the receiver pointer is not nil and if dereferenced it has a positive length. func (i *ID) IsValid() bool { return i != nil && len(*i) > 0 }
-
-
-
@@ -203,7 +203,7 @@ func (p *Profile) Clean() {p.Bto = nil } // ToProfile // ToProfile tries to convert the it Item to a Profile object func ToProfile(it Item) (*Profile, error) { switch i := it.(type) { case *Profile:
-
-
-
@@ -216,7 +216,7 @@ func QuestionNew(id ID) *Question {return &q } // ToQuestion // ToQuestion tries to convert the it Item to a Question object. func ToQuestion(it Item) (*Question, error) { switch i := it.(type) { case *Question:
-
@@ -232,5 +232,5 @@ func ToQuestion(it Item) (*Question, error) {} } } return nil, errors.New("unable to convert to question activity") return nil, errors.New("unable to convert to Question activity") }
-
-
-
@@ -220,7 +220,7 @@ func (r *Relationship) Clean() {r.Bto = nil } // ToRelationship // ToRelationship tries to convert the it Item to a Relationship object. func ToRelationship(it Item) (*Relationship, error) { switch i := it.(type) { case *Relationship:
-
-
-
@@ -1,8 +1,9 @@package activitypub // ActivityVocabularyTypes is a type alias for a slice of ActivityVocabularyType elements type ActivityVocabularyTypes []ActivityVocabularyType // Types contains all valid types in the ActivityPub vocab // Types contains all valid types in the ActivityPub vocabulary var Types = ActivityVocabularyTypes{ LinkType, MentionType,
-