Changes
4 changed files (+96/-193)
-
-
@@ -699,68 +699,7 @@ func ActivityNew(id ID, typ ActivityVocabularyType, ob Item) *Activity {// UnmarshalJSON func (a *Activity) UnmarshalJSON(data []byte) error { if ItemTyperFunc == nil { ItemTyperFunc = JSONGetItemByType } a.ID = JSONGetID(data) a.Type = JSONGetType(data) a.Name = JSONGetNaturalLanguageField(data, "name") a.Content = JSONGetNaturalLanguageField(data, "content") a.Summary = JSONGetNaturalLanguageField(data, "summary") a.Context = JSONGetItem(data, "context") a.URL = JSONGetURIItem(data, "url") a.MediaType = MimeType(JSONGetString(data, "mediaType")) a.Generator = JSONGetItem(data, "generator") a.AttributedTo = JSONGetItem(data, "attributedTo") a.Attachment = JSONGetItem(data, "attachment") a.Location = JSONGetItem(data, "location") a.Published = JSONGetTime(data, "published") a.StartTime = JSONGetTime(data, "startTime") a.EndTime = JSONGetTime(data, "endTime") a.Duration = JSONGetDuration(data, "duration") a.Icon = JSONGetItem(data, "icon") a.Preview = JSONGetItem(data, "preview") a.Image = JSONGetItem(data, "image") a.Updated = JSONGetTime(data, "updated") inReplyTo := JSONGetItems(data, "inReplyTo") if len(inReplyTo) > 0 { a.InReplyTo = inReplyTo } to := JSONGetItems(data, "to") if len(to) > 0 { a.To = to } audience := JSONGetItems(data, "audience") if len(audience) > 0 { a.Audience = audience } bto := JSONGetItems(data, "bto") if len(bto) > 0 { a.Bto = bto } cc := JSONGetItems(data, "cc") if len(cc) > 0 { a.CC = cc } bcc := JSONGetItems(data, "bcc") if len(bcc) > 0 { a.BCC = bcc } replies := JSONGetItem(data, "replies") if replies != nil { a.Replies = replies } tag := JSONGetItems(data, "tag") if len(tag) > 0 { a.Tag = tag } a.Actor = JSONGetItem(data, "actor") a.Target = JSONGetItem(data, "target") a.Instrument = JSONGetItem(data, "instrument") a.Origin = JSONGetItem(data, "origin") a.Result = JSONGetItem(data, "result") a.Object = JSONGetItem(data, "object") return nil return loadActivity(data, a) } // ToActivity
-
@@ -805,15 +744,3 @@ func (a Activity) MarshalJSON() ([]byte, error) {write(&b, '}') return b, nil } // MarshalJSON func (i IntransitiveActivity) MarshalJSON() ([]byte, error) { b := make([]byte, 0) write(&b, '{') if !writeIntransitiveActivityValue(&b, i) { return nil, nil } write(&b, '}') return b, nil }
-
-
-
@@ -460,3 +460,85 @@ func JSONGetActorEndpoints(data []byte, prop string) *Endpoints {return e } func loadObject(data []byte, o *Object) error { if ItemTyperFunc == nil { ItemTyperFunc = JSONGetItemByType } o.ID = JSONGetID(data) o.Type = JSONGetType(data) o.Name = JSONGetNaturalLanguageField(data, "name") o.Content = JSONGetNaturalLanguageField(data, "content") o.Summary = JSONGetNaturalLanguageField(data, "summary") o.Context = JSONGetItem(data, "context") o.URL = JSONGetURIItem(data, "url") o.MediaType = MimeType(JSONGetString(data, "mediaType")) o.Generator = JSONGetItem(data, "generator") o.AttributedTo = JSONGetItem(data, "attributedTo") o.Attachment = JSONGetItem(data, "attachment") o.Location = JSONGetItem(data, "location") o.Published = JSONGetTime(data, "published") o.StartTime = JSONGetTime(data, "startTime") o.EndTime = JSONGetTime(data, "endTime") o.Duration = JSONGetDuration(data, "duration") o.Icon = JSONGetItem(data, "icon") o.Preview = JSONGetItem(data, "preview") o.Image = JSONGetItem(data, "image") o.Updated = JSONGetTime(data, "updated") inReplyTo := JSONGetItems(data, "inReplyTo") if len(inReplyTo) > 0 { o.InReplyTo = inReplyTo } to := JSONGetItems(data, "to") if len(to) > 0 { o.To = to } audience := JSONGetItems(data, "audience") if len(audience) > 0 { o.Audience = audience } bto := JSONGetItems(data, "bto") if len(bto) > 0 { o.Bto = bto } cc := JSONGetItems(data, "cc") if len(cc) > 0 { o.CC = cc } bcc := JSONGetItems(data, "bcc") if len(bcc) > 0 { o.BCC = bcc } replies := JSONGetItem(data, "replies") if replies != nil { o.Replies = replies } tag := JSONGetItems(data, "tag") if len(tag) > 0 { o.Tag = tag } o.Likes = JSONGetItem(data, "likes") o.Shares = JSONGetItem(data, "shares") o.Source = GetAPSource(data) return nil } func loadIntrasitiveActivity(data []byte, i *IntransitiveActivity) error { OnObject(i, func(o *Object) error { return loadObject(data, o) }) i.Actor = JSONGetItem(data, "actor") i.Target = JSONGetItem(data, "target") i.Result = JSONGetItem(data, "result") i.Origin = JSONGetItem(data, "origin") i.Instrument = JSONGetItem(data, "instrument") return nil } func loadActivity(data []byte, a *Activity) error { OnIntransitiveActivity(a, func(i *IntransitiveActivity) error { return loadIntrasitiveActivity(data, i) }) a.Object = JSONGetItem(data, "object") return nil }
-
-
-
@@ -179,67 +179,19 @@ func (i IntransitiveActivity) IsCollection() bool {// UnmarshalJSON func (i *IntransitiveActivity) UnmarshalJSON(data []byte) error { if ItemTyperFunc == nil { ItemTyperFunc = JSONGetItemByType } i.ID = JSONGetID(data) i.Type = JSONGetType(data) i.Name = JSONGetNaturalLanguageField(data, "name") i.Content = JSONGetNaturalLanguageField(data, "content") i.Summary = JSONGetNaturalLanguageField(data, "summary") i.Context = JSONGetItem(data, "context") i.URL = JSONGetURIItem(data, "url") i.MediaType = MimeType(JSONGetString(data, "mediaType")) i.Generator = JSONGetItem(data, "generator") i.AttributedTo = JSONGetItem(data, "attributedTo") i.Attachment = JSONGetItem(data, "attachment") i.Location = JSONGetItem(data, "location") i.Published = JSONGetTime(data, "published") i.StartTime = JSONGetTime(data, "startTime") i.EndTime = JSONGetTime(data, "endTime") i.Duration = JSONGetDuration(data, "duration") i.Icon = JSONGetItem(data, "icon") i.Preview = JSONGetItem(data, "preview") i.Image = JSONGetItem(data, "image") i.Updated = JSONGetTime(data, "updated") inReplyTo := JSONGetItems(data, "inReplyTo") if len(inReplyTo) > 0 { i.InReplyTo = inReplyTo } to := JSONGetItems(data, "to") if len(to) > 0 { i.To = to } audience := JSONGetItems(data, "audience") if len(audience) > 0 { i.Audience = audience } bto := JSONGetItems(data, "bto") if len(bto) > 0 { i.Bto = bto } cc := JSONGetItems(data, "cc") if len(cc) > 0 { i.CC = cc } bcc := JSONGetItems(data, "bcc") if len(bcc) > 0 { i.BCC = bcc } replies := JSONGetItem(data, "replies") if replies != nil { i.Replies = replies } tag := JSONGetItems(data, "tag") if len(tag) > 0 { i.Tag = tag return loadIntrasitiveActivity(data, i) } // MarshalJSON func (i IntransitiveActivity) MarshalJSON() ([]byte, error) { b := make([]byte, 0) write(&b, '{') if !writeIntransitiveActivityValue(&b, i) { return nil, nil } i.Actor = JSONGetItem(data, "actor") i.Target = JSONGetItem(data, "target") i.Result = JSONGetItem(data, "result") i.Origin = JSONGetItem(data, "origin") i.Instrument = JSONGetItem(data, "instrument") return nil write(&b, '}') return b, nil } // IntransitiveActivityNew initializes a intransitive activity
-
-
-
@@ -256,65 +256,7 @@ func (o Object) IsCollection() bool {// UnmarshalJSON func (o *Object) UnmarshalJSON(data []byte) error { if ItemTyperFunc == nil { ItemTyperFunc = JSONGetItemByType } o.ID = JSONGetID(data) o.Type = JSONGetType(data) o.Name = JSONGetNaturalLanguageField(data, "name") o.Content = JSONGetNaturalLanguageField(data, "content") o.Summary = JSONGetNaturalLanguageField(data, "summary") o.Context = JSONGetItem(data, "context") o.URL = JSONGetURIItem(data, "url") o.MediaType = MimeType(JSONGetString(data, "mediaType")) o.Generator = JSONGetItem(data, "generator") o.AttributedTo = JSONGetItem(data, "attributedTo") o.Attachment = JSONGetItem(data, "attachment") o.Location = JSONGetItem(data, "location") o.Published = JSONGetTime(data, "published") o.StartTime = JSONGetTime(data, "startTime") o.EndTime = JSONGetTime(data, "endTime") o.Duration = JSONGetDuration(data, "duration") o.Icon = JSONGetItem(data, "icon") o.Preview = JSONGetItem(data, "preview") o.Image = JSONGetItem(data, "image") o.Updated = JSONGetTime(data, "updated") inReplyTo := JSONGetItems(data, "inReplyTo") if len(inReplyTo) > 0 { o.InReplyTo = inReplyTo } to := JSONGetItems(data, "to") if len(to) > 0 { o.To = to } audience := JSONGetItems(data, "audience") if len(audience) > 0 { o.Audience = audience } bto := JSONGetItems(data, "bto") if len(bto) > 0 { o.Bto = bto } cc := JSONGetItems(data, "cc") if len(cc) > 0 { o.CC = cc } bcc := JSONGetItems(data, "bcc") if len(bcc) > 0 { o.BCC = bcc } replies := JSONGetItem(data, "replies") if replies != nil { o.Replies = replies } tag := JSONGetItems(data, "tag") if len(tag) > 0 { o.Tag = tag } o.Likes = JSONGetItem(data, "likes") o.Shares = JSONGetItem(data, "shares") o.Source = GetAPSource(data) return nil return loadObject(data, o) } // MarshalJSON
-