Add constructors for the streams package.
This commit is contained in:
parent
2d4695e969
commit
31482f867e
|
@ -2494,3 +2494,8 @@ func (t *Accept) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewAccept returns a new instance of Accept
|
||||
func NewAccept() (n *Accept) {
|
||||
return &Accept{raw: &vocab.Accept{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Activity) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewActivity returns a new instance of Activity
|
||||
func NewActivity() (n *Activity) {
|
||||
return &Activity{raw: &vocab.Activity{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Add) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewAdd returns a new instance of Add
|
||||
func NewAdd() (n *Add) {
|
||||
return &Add{raw: &vocab.Add{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Announce) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewAnnounce returns a new instance of Announce
|
||||
func NewAnnounce() (n *Announce) {
|
||||
return &Announce{raw: &vocab.Announce{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Application) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewApplication returns a new instance of Application
|
||||
func NewApplication() (n *Application) {
|
||||
return &Application{raw: &vocab.Application{}}
|
||||
}
|
||||
|
|
|
@ -2442,3 +2442,8 @@ func (t *Arrive) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewArrive returns a new instance of Arrive
|
||||
func NewArrive() (n *Arrive) {
|
||||
return &Arrive{raw: &vocab.Arrive{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Article) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewArticle returns a new instance of Article
|
||||
func NewArticle() (n *Article) {
|
||||
return &Article{raw: &vocab.Article{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Audio) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewAudio returns a new instance of Audio
|
||||
func NewAudio() (n *Audio) {
|
||||
return &Audio{raw: &vocab.Audio{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Block) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewBlock returns a new instance of Block
|
||||
func NewBlock() (n *Block) {
|
||||
return &Block{raw: &vocab.Block{}}
|
||||
}
|
||||
|
|
|
@ -2348,3 +2348,8 @@ func (t *Collection) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewCollection returns a new instance of Collection
|
||||
func NewCollection() (n *Collection) {
|
||||
return &Collection{raw: &vocab.Collection{}}
|
||||
}
|
||||
|
|
|
@ -2462,3 +2462,8 @@ func (t *CollectionPage) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewCollectionPage returns a new instance of CollectionPage
|
||||
func NewCollectionPage() (n *CollectionPage) {
|
||||
return &CollectionPage{raw: &vocab.CollectionPage{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Create) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewCreate returns a new instance of Create
|
||||
func NewCreate() (n *Create) {
|
||||
return &Create{raw: &vocab.Create{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Delete) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewDelete returns a new instance of Delete
|
||||
func NewDelete() (n *Delete) {
|
||||
return &Delete{raw: &vocab.Delete{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Dislike) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewDislike returns a new instance of Dislike
|
||||
func NewDislike() (n *Dislike) {
|
||||
return &Dislike{raw: &vocab.Dislike{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Document) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewDocument returns a new instance of Document
|
||||
func NewDocument() (n *Document) {
|
||||
return &Document{raw: &vocab.Document{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Event) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewEvent returns a new instance of Event
|
||||
func NewEvent() (n *Event) {
|
||||
return &Event{raw: &vocab.Event{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Flag) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewFlag returns a new instance of Flag
|
||||
func NewFlag() (n *Flag) {
|
||||
return &Flag{raw: &vocab.Flag{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Follow) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewFollow returns a new instance of Follow
|
||||
func NewFollow() (n *Follow) {
|
||||
return &Follow{raw: &vocab.Follow{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Group) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewGroup returns a new instance of Group
|
||||
func NewGroup() (n *Group) {
|
||||
return &Group{raw: &vocab.Group{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Ignore) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewIgnore returns a new instance of Ignore
|
||||
func NewIgnore() (n *Ignore) {
|
||||
return &Ignore{raw: &vocab.Ignore{}}
|
||||
}
|
||||
|
|
|
@ -2203,3 +2203,8 @@ func (t *Image) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewImage returns a new instance of Image
|
||||
func NewImage() (n *Image) {
|
||||
return &Image{raw: &vocab.Image{}}
|
||||
}
|
||||
|
|
|
@ -2442,3 +2442,8 @@ func (t *IntransitiveActivity) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewIntransitiveActivity returns a new instance of IntransitiveActivity
|
||||
func NewIntransitiveActivity() (n *IntransitiveActivity) {
|
||||
return &IntransitiveActivity{raw: &vocab.IntransitiveActivity{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Invite) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewInvite returns a new instance of Invite
|
||||
func NewInvite() (n *Invite) {
|
||||
return &Invite{raw: &vocab.Invite{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Join) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewJoin returns a new instance of Join
|
||||
func NewJoin() (n *Join) {
|
||||
return &Join{raw: &vocab.Join{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Leave) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewLeave returns a new instance of Leave
|
||||
func NewLeave() (n *Leave) {
|
||||
return &Leave{raw: &vocab.Leave{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Like) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewLike returns a new instance of Like
|
||||
func NewLike() (n *Like) {
|
||||
return &Like{raw: &vocab.Like{}}
|
||||
}
|
||||
|
|
|
@ -579,3 +579,8 @@ func (t *Link) PrependPreviewLink(i vocab.LinkType) {
|
|||
t.raw.PrependPreviewLink(i)
|
||||
|
||||
}
|
||||
|
||||
// NewLink returns a new instance of Link
|
||||
func NewLink() (n *Link) {
|
||||
return &Link{raw: &vocab.Link{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Listen) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewListen returns a new instance of Listen
|
||||
func NewListen() (n *Listen) {
|
||||
return &Listen{raw: &vocab.Listen{}}
|
||||
}
|
||||
|
|
|
@ -579,3 +579,8 @@ func (t *Mention) PrependPreviewLink(i vocab.LinkType) {
|
|||
t.raw.PrependPreviewLink(i)
|
||||
|
||||
}
|
||||
|
||||
// NewMention returns a new instance of Mention
|
||||
func NewMention() (n *Mention) {
|
||||
return &Mention{raw: &vocab.Mention{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Move) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewMove returns a new instance of Move
|
||||
func NewMove() (n *Move) {
|
||||
return &Move{raw: &vocab.Move{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Note) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewNote returns a new instance of Note
|
||||
func NewNote() (n *Note) {
|
||||
return &Note{raw: &vocab.Note{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Object) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewObject returns a new instance of Object
|
||||
func NewObject() (n *Object) {
|
||||
return &Object{raw: &vocab.Object{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Offer) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewOffer returns a new instance of Offer
|
||||
func NewOffer() (n *Offer) {
|
||||
return &Offer{raw: &vocab.Offer{}}
|
||||
}
|
||||
|
|
|
@ -2348,3 +2348,8 @@ func (t *OrderedCollection) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewOrderedCollection returns a new instance of OrderedCollection
|
||||
func NewOrderedCollection() (n *OrderedCollection) {
|
||||
return &OrderedCollection{raw: &vocab.OrderedCollection{}}
|
||||
}
|
||||
|
|
|
@ -2496,3 +2496,8 @@ func (t *OrderedCollectionPage) SetPartOf(i vocab.LinkType) {
|
|||
t.raw.SetPartOfLink(i)
|
||||
|
||||
}
|
||||
|
||||
// NewOrderedCollectionPage returns a new instance of OrderedCollectionPage
|
||||
func NewOrderedCollectionPage() (n *OrderedCollectionPage) {
|
||||
return &OrderedCollectionPage{raw: &vocab.OrderedCollectionPage{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Organization) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewOrganization returns a new instance of Organization
|
||||
func NewOrganization() (n *Organization) {
|
||||
return &Organization{raw: &vocab.Organization{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Page) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewPage returns a new instance of Page
|
||||
func NewPage() (n *Page) {
|
||||
return &Page{raw: &vocab.Page{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Person) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewPerson returns a new instance of Person
|
||||
func NewPerson() (n *Person) {
|
||||
return &Person{raw: &vocab.Person{}}
|
||||
}
|
||||
|
|
|
@ -2305,3 +2305,8 @@ func (t *Place) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewPlace returns a new instance of Place
|
||||
func NewPlace() (n *Place) {
|
||||
return &Place{raw: &vocab.Place{}}
|
||||
}
|
||||
|
|
|
@ -2169,3 +2169,8 @@ func (t *Profile) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewProfile returns a new instance of Profile
|
||||
func NewProfile() (n *Profile) {
|
||||
return &Profile{raw: &vocab.Profile{}}
|
||||
}
|
||||
|
|
|
@ -2636,3 +2636,8 @@ func (t *Question) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewQuestion returns a new instance of Question
|
||||
func NewQuestion() (n *Question) {
|
||||
return &Question{raw: &vocab.Question{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Read) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewRead returns a new instance of Read
|
||||
func NewRead() (n *Read) {
|
||||
return &Read{raw: &vocab.Read{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Reject) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewReject returns a new instance of Reject
|
||||
func NewReject() (n *Reject) {
|
||||
return &Reject{raw: &vocab.Reject{}}
|
||||
}
|
||||
|
|
|
@ -2268,3 +2268,8 @@ func (t *Relationship) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewRelationship returns a new instance of Relationship
|
||||
func NewRelationship() (n *Relationship) {
|
||||
return &Relationship{raw: &vocab.Relationship{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Remove) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewRemove returns a new instance of Remove
|
||||
func NewRemove() (n *Remove) {
|
||||
return &Remove{raw: &vocab.Remove{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Service) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewService returns a new instance of Service
|
||||
func NewService() (n *Service) {
|
||||
return &Service{raw: &vocab.Service{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *TentativeAccept) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewTentativeAccept returns a new instance of TentativeAccept
|
||||
func NewTentativeAccept() (n *TentativeAccept) {
|
||||
return &TentativeAccept{raw: &vocab.TentativeAccept{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *TentativeReject) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewTentativeReject returns a new instance of TentativeReject
|
||||
func NewTentativeReject() (n *TentativeReject) {
|
||||
return &TentativeReject{raw: &vocab.TentativeReject{}}
|
||||
}
|
||||
|
|
|
@ -2225,3 +2225,8 @@ func (t *Tombstone) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewTombstone returns a new instance of Tombstone
|
||||
func NewTombstone() (n *Tombstone) {
|
||||
return &Tombstone{raw: &vocab.Tombstone{}}
|
||||
}
|
||||
|
|
|
@ -2442,3 +2442,8 @@ func (t *Travel) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewTravel returns a new instance of Travel
|
||||
func NewTravel() (n *Travel) {
|
||||
return &Travel{raw: &vocab.Travel{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Undo) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewUndo returns a new instance of Undo
|
||||
func NewUndo() (n *Undo) {
|
||||
return &Undo{raw: &vocab.Undo{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *Update) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewUpdate returns a new instance of Update
|
||||
func NewUpdate() (n *Update) {
|
||||
return &Update{raw: &vocab.Update{}}
|
||||
}
|
||||
|
|
|
@ -2135,3 +2135,8 @@ func (t *Video) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewVideo returns a new instance of Video
|
||||
func NewVideo() (n *Video) {
|
||||
return &Video{raw: &vocab.Video{}}
|
||||
}
|
||||
|
|
|
@ -2494,3 +2494,8 @@ func (t *View) SetShares(i vocab.CollectionType) {
|
|||
t.raw.SetSharesCollection(i)
|
||||
|
||||
}
|
||||
|
||||
// NewView returns a new instance of View
|
||||
func NewView() (n *View) {
|
||||
return &View{raw: &vocab.View{}}
|
||||
}
|
||||
|
|
|
@ -270,6 +270,16 @@ func generateDefinitions(t *defs.Type) (fd []*defs.FunctionDef, sd []*defs.Struc
|
|||
},
|
||||
},
|
||||
}...)
|
||||
fd = append(fd, &defs.FunctionDef{
|
||||
Name: fmt.Sprintf("New%s", t.Name),
|
||||
Comment: fmt.Sprintf("New%s returns a new instance of %s", t.Name, t.Name),
|
||||
Return: []*defs.FunctionVarDef{{"n", "*" + t.Name}},
|
||||
Body: func() string {
|
||||
var b bytes.Buffer
|
||||
b.WriteString(fmt.Sprintf("return &%s{%s: &vocab.%s{}}", t.Name, rawMemberName, t.Name))
|
||||
return b.String()
|
||||
},
|
||||
})
|
||||
if t.GetTypeMetadata().HasIsPublicMethod {
|
||||
this.F = append(this.F, &defs.MemberFunctionDef{
|
||||
Name: "IsPublic",
|
||||
|
|
Loading…
Reference in New Issue