Some other places where we removed Object from names of things
This commit is contained in:
parent
b89c9ee68c
commit
67aa065f9f
|
@ -702,7 +702,7 @@ func (a *Activity) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
a.ID = JSONGetObjectID(data)
|
||||
a.ID = JSONGetID(data)
|
||||
a.Type = JSONGetType(data)
|
||||
a.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
a.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
2
actor.go
2
actor.go
|
@ -297,7 +297,7 @@ func (a *Actor) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
a.ID = JSONGetObjectID(data)
|
||||
a.ID = JSONGetID(data)
|
||||
a.Type = JSONGetType(data)
|
||||
a.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
a.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -216,7 +216,7 @@ func (c *Collection) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
c.ID = JSONGetObjectID(data)
|
||||
c.ID = JSONGetID(data)
|
||||
c.Type = JSONGetType(data)
|
||||
c.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
c.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -187,7 +187,7 @@ func (c *CollectionPage) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
c.ID = JSONGetObjectID(data)
|
||||
c.ID = JSONGetID(data)
|
||||
c.Type = JSONGetType(data)
|
||||
c.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
c.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -181,7 +181,7 @@ func (i *IntransitiveActivity) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
i.ID = JSONGetObjectID(data)
|
||||
i.ID = JSONGetID(data)
|
||||
i.Type = JSONGetType(data)
|
||||
i.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
i.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
2
item.go
2
item.go
|
@ -3,7 +3,7 @@ package activitypub
|
|||
// Item struct
|
||||
type Item ObjectOrLink
|
||||
|
||||
const EmptyObjectID = ID("")
|
||||
const EmptyID = ID("")
|
||||
const EmptyIRI = IRI("")
|
||||
|
||||
// Flatten checks if Item can be flatten to an IRI or array of IRIs and returns it if so
|
||||
|
|
|
@ -10,7 +10,7 @@ type ItemCollection []Item
|
|||
|
||||
// GetID returns the ID corresponding to ItemCollection
|
||||
func (i ItemCollection) GetID() ID {
|
||||
return EmptyObjectID
|
||||
return EmptyID
|
||||
}
|
||||
|
||||
// GetLink returns the empty IRI
|
||||
|
|
2
link.go
2
link.go
|
@ -99,7 +99,7 @@ func (l *Link) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
l.ID = JSONGetObjectID(data)
|
||||
l.ID = JSONGetID(data)
|
||||
l.Type = JSONGetType(data)
|
||||
l.MediaType = JSONGetMimeType(data)
|
||||
l.Preview = JSONGetItem(data, "preview")
|
||||
|
|
|
@ -250,7 +250,7 @@ func (o *Object) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
o.ID = JSONGetObjectID(data)
|
||||
o.ID = JSONGetID(data)
|
||||
o.Type = JSONGetType(data)
|
||||
o.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
o.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -2,7 +2,7 @@ package activitypub
|
|||
|
||||
import "testing"
|
||||
|
||||
func TestObjectID_UnmarshalJSON(t *testing.T) {
|
||||
func TestID_UnmarshalJSON(t *testing.T) {
|
||||
o := ID("")
|
||||
dataEmpty := []byte("")
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ func (o *OrderedCollection) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
o.ID = JSONGetObjectID(data)
|
||||
o.ID = JSONGetID(data)
|
||||
o.Type = JSONGetType(data)
|
||||
o.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
o.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -191,7 +191,7 @@ func (o *OrderedCollectionPage) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
o.ID = JSONGetObjectID(data)
|
||||
o.ID = JSONGetID(data)
|
||||
o.Type = JSONGetType(data)
|
||||
o.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
o.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
2
place.go
2
place.go
|
@ -157,7 +157,7 @@ func (p *Place) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
p.ID = JSONGetObjectID(data)
|
||||
p.ID = JSONGetID(data)
|
||||
p.Type = JSONGetType(data)
|
||||
p.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
p.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -143,7 +143,7 @@ func (p *Profile) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
p.ID = JSONGetObjectID(data)
|
||||
p.ID = JSONGetID(data)
|
||||
p.Type = JSONGetType(data)
|
||||
p.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
p.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -166,7 +166,7 @@ func (q *Question) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
q.ID = JSONGetObjectID(data)
|
||||
q.ID = JSONGetID(data)
|
||||
q.Type = JSONGetType(data)
|
||||
q.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
q.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -153,7 +153,7 @@ func (r *Relationship) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
r.ID = JSONGetObjectID(data)
|
||||
r.ID = JSONGetID(data)
|
||||
r.Type = JSONGetType(data)
|
||||
r.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
r.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -145,7 +145,7 @@ func (t *Tombstone) UnmarshalJSON(data []byte) error {
|
|||
if ItemTyperFunc == nil {
|
||||
ItemTyperFunc = JSONGetItemByType
|
||||
}
|
||||
t.ID = JSONGetObjectID(data)
|
||||
t.ID = JSONGetID(data)
|
||||
t.Type = JSONGetType(data)
|
||||
t.Name = JSONGetNaturalLanguageField(data, "name")
|
||||
t.Content = JSONGetNaturalLanguageField(data, "content")
|
||||
|
|
|
@ -25,7 +25,7 @@ var ItemTyperFunc TyperFn
|
|||
// for a specific ActivityVocabularyType
|
||||
type TyperFn func(ActivityVocabularyType) (Item, error)
|
||||
|
||||
func JSONGetObjectID(data []byte) ID {
|
||||
func JSONGetID(data []byte) ID {
|
||||
i, err := jsonparser.GetString(data, "id")
|
||||
if err != nil {
|
||||
return ID("")
|
||||
|
|
|
@ -165,7 +165,7 @@ func TestJSONGetMimeType(t *testing.T) {
|
|||
t.Skipf("TODO")
|
||||
}
|
||||
|
||||
func TestJSONGetObjectID(t *testing.T) {
|
||||
func TestJSONGetID(t *testing.T) {
|
||||
t.Skipf("TODO")
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue