Leave out certain properties in Activity JSON
This commit is contained in:
@@ -11,9 +11,9 @@ const (
|
|||||||
type Activity struct {
|
type Activity struct {
|
||||||
BaseObject
|
BaseObject
|
||||||
Actor string `json:"actor"`
|
Actor string `json:"actor"`
|
||||||
Published time.Time `json:"published"`
|
Published time.Time `json:"published,omitempty"`
|
||||||
To []string `json:"to"`
|
To []string `json:"to,omitempty"`
|
||||||
CC []string `json:"cc"`
|
CC []string `json:"cc,omitempty"`
|
||||||
Object *Object `json:"object"`
|
Object *Object `json:"object"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,9 +24,6 @@ func NewCreateActivity(o *Object) *Activity {
|
|||||||
Type: "Create",
|
Type: "Create",
|
||||||
},
|
},
|
||||||
Actor: o.AttributedTo,
|
Actor: o.AttributedTo,
|
||||||
Published: o.Published,
|
|
||||||
To: o.To,
|
|
||||||
CC: o.CC,
|
|
||||||
Object: o,
|
Object: o,
|
||||||
}
|
}
|
||||||
return &a
|
return &a
|
||||||
@@ -35,14 +32,14 @@ func NewCreateActivity(o *Object) *Activity {
|
|||||||
type Object struct {
|
type Object struct {
|
||||||
BaseObject
|
BaseObject
|
||||||
Published time.Time `json:"published"`
|
Published time.Time `json:"published"`
|
||||||
Summary *string `json:"summary"`
|
Summary *string `json:"summary,omitempty"`
|
||||||
InReplyTo *string `json:"inReplyTo"`
|
InReplyTo *string `json:"inReplyTo"`
|
||||||
URL string `json:"url"`
|
URL string `json:"url"`
|
||||||
AttributedTo string `json:"attributedTo"`
|
AttributedTo string `json:"attributedTo"`
|
||||||
To []string `json:"to"`
|
To []string `json:"to"`
|
||||||
CC []string `json:"cc"`
|
CC []string `json:"cc,omitempty"`
|
||||||
Content string `json:"content"`
|
Content string `json:"content"`
|
||||||
ContentMap map[string]string `json:"contentMap"`
|
ContentMap map[string]string `json:"contentMap,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewNoteObject() *Object {
|
func NewNoteObject() *Object {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import "fmt"
|
|||||||
|
|
||||||
type (
|
type (
|
||||||
BaseObject struct {
|
BaseObject struct {
|
||||||
Context []string `json:"@context"`
|
Context []string `json:"@context,omitempty"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ func NewPerson(accountRoot string) *Person {
|
|||||||
},
|
},
|
||||||
ID: accountRoot,
|
ID: accountRoot,
|
||||||
},
|
},
|
||||||
URL: accountRoot,
|
|
||||||
Following: accountRoot + "/following",
|
Following: accountRoot + "/following",
|
||||||
Followers: accountRoot + "/followers",
|
Followers: accountRoot + "/followers",
|
||||||
Inbox: accountRoot + "/inbox",
|
Inbox: accountRoot + "/inbox",
|
||||||
|
|||||||
Reference in New Issue
Block a user