Changes
4 changed files (+34/-3)
-
-
@@ -65,7 +65,7 @@ type actor struct {// for this actor or someone referencing this actor. // This mapping may be nested inside the actor document as the value or may be a link // to a JSON-LD document with these properties. Endpoints Endpoints `jsonld:"endpoints,omitempty"` Endpoints *Endpoints `jsonld:"endpoints,omitempty"` // A list of supplementary Collections which may be of interest. Streams []as.ItemCollection `jsonld:"streams,omitempty"` }
-
@@ -145,8 +145,7 @@ func (a *actor) UnmarshalJSON(data []byte) error {a.Inbox = as.JSONGetItem(data, "inbox") a.Outbox = as.JSONGetItem(data, "outbox") a.Liked = as.JSONGetItem(data, "liked") // TODO(marius): Endpoints need their own UnmarshalJSON //a.Endpoints = as.JSONGetItems(data, "endpoints") a.Endpoints = JSONGetActorEndpoints(data, "endpoints") // TODO(marius): Streams needs custom unmarshalling //a.Streams = as.JSONGetItems(data, "streams") return nil
-
@@ -162,3 +161,14 @@ func ToPerson(it as.Item) (*Person, error) {} return nil, errors.New("unable to convert object") } // UnmarshalJSON func (e *Endpoints) UnmarshalJSON(data []byte) error { e.OauthAuthorizationEndpoint = as.JSONGetItem(data, "oauthAuthorizationEndpoint") e.OauthTokenEndpoint = as.JSONGetItem(data, "oauthTokenEndpoint") e.UploadMedia = as.JSONGetItem(data, "uploadMedia") e.ProvideClientKey = as.JSONGetItem(data, "provideClientKey") e.SignClientKey = as.JSONGetItem(data, "signClientKey") e.SharedInbox = as.JSONGetItem(data, "sharedInbox") return nil }
-
-
-
@@ -191,3 +191,7 @@ func TestService_IsObject(t *testing.T) {func TestToPerson(t *testing.T) { t.Skipf("TODO") } func TestEndpoints_UnmarshalJSON(t *testing.T) { t.Skipf("TODO") }
-
-
-
@@ -1,6 +1,7 @@package activitypub import ( "github.com/buger/jsonparser" as "github.com/go-ap/activitystreams" )
-
@@ -45,3 +46,15 @@ func JSONGetItemByType(typ as.ActivityVocabularyType) (as.Item, error) {} return ret, err } func JSONGetActorEndpoints(data []byte, prop string) *Endpoints { str, _ := jsonparser.GetUnsafeString(data, prop) var e *Endpoints if len(str) > 0 { e = &Endpoints{} e.UnmarshalJSON([]byte(str)) } return e }
-
-
-
@@ -39,3 +39,7 @@ func TestJSONGetItemByType(t *testing.T) {}) } } func TestJSONGetActorEndpoints(t *testing.T) { t.Skipf("TODO") }
-