Changes
5 changed files (+29/-13)
-
-
@@ -161,7 +161,6 @@ type Remove Activity// A specialization of Reject in which the rejection is considered tentative. type TentativeReject Reject // A specialization of Accept indicating that the acceptance is tentative. // A specialization of Accept indicating that the acceptance is tentative. type TentativeAccept Accept
-
@@ -204,7 +203,7 @@ type Question struct {// Instances of IntransitiveActivity are a subtype of Activity representing intransitive actions. // The object property is therefore inappropriate for these activities. type IntransitiveActivity struct { *BaseObject *Object // Describes one or more entities that either performed or are expected to perform the activity. // Any single activity can have multiple actors. The actor may be specified using an indirect Link. Actor Actor `jsonld:"actor"`
-
@@ -380,8 +379,8 @@ func ActivityNew(id ObjectId, _type string) *Activity {if !ValidActivityType(_type) { _type = ActivityType } o := BaseObject{Id: id, Type: _type} a := IntransitiveActivity{BaseObject: &o} o := ObjectNew(id, _type) a := IntransitiveActivity{Object: o} return &Activity{IntransitiveActivity: &a} }
-
@@ -390,7 +389,7 @@ func IntransitiveActivityNew(id ObjectId, _type string) *IntransitiveActivity {if !ValidActivityType(_type) { _type = IntransitiveActivityType } o := BaseObject{Id: id, Type: _type} o := ObjectNew(id, _type) return &IntransitiveActivity{BaseObject: &o} return &IntransitiveActivity{Object: o} }
-
-
-
@@ -7,7 +7,6 @@ func TestActivityNew(t *testing.T) {var testType string = "Accept" a := ActivityNew(testValue, testType) if a.Id != testValue { t.Errorf("Activity Id '%v' different than expected '%v'", a.Id, testValue) }
-
@@ -54,6 +53,11 @@ func TestValidActivityType(t *testing.T) {if ValidActivityType(ActivityType) { t.Errorf("Generic Activity Type '%v' should not be valid", ActivityType) } for _, inValidType := range validObjectTypes { if ValidActivityType(inValidType) { t.Errorf("Object Type '%v' should be invalid", inValidType) } } if ValidActivityType(invalidType) { t.Errorf("Activity Type '%v' should not be valid", invalidType) }
-
-
-
@@ -196,13 +196,29 @@ type Source struct {MediaType string } func ValidGenericType(_type string) bool { validGenericTypes := [...]string{ ActivityType, IntransitiveActivityType, ObjectType, LinkType, } for _, v := range validGenericTypes { if v == _type { return true } } return false } func ValidObjectType(_type string) bool { for _, v := range validObjectTypes { if v == _type { return true } } return false return ValidActivityType(_type) || ValidGenericType(_type) } func ValidLinkType(_type string) bool {
-
@@ -215,7 +231,7 @@ func ValidLinkType(_type string) bool {} func ObjectNew(id ObjectId, _type string) *Object { if !ValidObjectType(_type) { if !(ValidObjectType(_type)) { _type = ObjectType } p := BaseObject{Id: id, Type: _type}
-
-
-
@@ -44,9 +44,6 @@ func TestLinkNew(t *testing.T) {func TestValidObjectType(t *testing.T) { var invalidType string = "RandomType" if ValidObjectType(ObjectType) { t.Errorf("Generic Object Type '%v' should not be valid", ObjectType) } if ValidObjectType(invalidType) { t.Errorf("Object Type '%v' should not be valid", invalidType) }
-
-
-
@@ -1,4 +1,4 @@package activitypub type Iri URI type URI string type URI string
-