Add constructors for the streams package.

This commit is contained in:
Cory Slep 2018-11-17 16:59:49 +01:00
parent 2d4695e969
commit 31482f867e
55 changed files with 280 additions and 0 deletions

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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{}}
}

View File

@ -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",