kiteco-public/kite-go/stackoverflow/xmlgen.go
2021-12-31 23:54:19 -08:00

69 lines
2.5 KiB
Go

package stackoverflow
import "github.com/golang/protobuf/proto"
// NewPost is generated by xmlgen.py, based on XMLPost in stackoverflow-xml.go
func NewPost(s *XMLPost) *Post {
return &Post{
Id: proto.Int64(s.Id),
PostTypeId: proto.Int64(s.PostTypeId),
ParentId: proto.Int64(s.ParentId),
AcceptedAnswerId: proto.Int64(s.AcceptedAnswerId),
CreationDate: proto.String(s.CreationDate),
Score: proto.Int64(s.Score),
ViewCount: proto.Int64(s.ViewCount),
Body: proto.String(s.Body),
OwnerUserId: proto.Int64(s.OwnerUserId),
LastEditorUserId: proto.Int64(s.LastEditorUserId),
LastEditorDisplayName: proto.String(s.LastEditorDisplayName),
LastEditDate: proto.String(s.LastEditDate),
LastActivityDate: proto.String(s.LastActivityDate),
Title: proto.String(s.Title),
Tags: proto.String(s.Tags),
AnswerCount: proto.Int64(s.AnswerCount),
CommentCount: proto.Int64(s.CommentCount),
FavoriteCount: proto.Int64(s.FavoriteCount),
CommunityOwnedDate: proto.String(s.CommunityOwnedDate),
}
}
// NewUser is generated by xmlgen.py, based on XMLUser in stackoverflow-xml.go
func NewUser(s *XMLUser) *User {
return &User{
Id: proto.Uint64(s.Id),
Reputation: proto.Int64(s.Reputation),
CreationDate: proto.String(s.CreationDate),
DisplayName: proto.String(s.DisplayName),
LastAccessDate: proto.String(s.LastAccessDate),
WebsiteUrl: proto.String(s.WebsiteUrl),
Location: proto.String(s.Location),
AboutMe: proto.String(s.AboutMe),
Views: proto.Int64(s.Views),
UpVotes: proto.Int64(s.UpVotes),
DownVotes: proto.Int64(s.DownVotes),
Age: proto.Int64(s.Age),
AccountId: proto.Int64(s.AccountId),
}
}
// NewVote is generated by xmlgen.py, based on XMLVote in stackoverflow-xml.go
func NewVote(s *XMLVote) *Vote {
return &Vote{
Id: proto.Int64(s.Id),
PostId: proto.Int64(s.PostId),
VoteTypeId: proto.Int64(s.VoteTypeId),
CreationDate: proto.String(s.CreationDate),
}
}
// NewPostLink is generated by xmlgen.py, based on XMLPostLink in stackoverflow-xml.go
func NewPostLink(s *XMLPostLink) *PostLink {
return &PostLink{
Id: proto.Int64(s.Id),
CreationDate: proto.String(s.CreationDate),
PostId: proto.Int64(s.PostId),
RelatedPostId: proto.Int64(s.RelatedPostId),
LinkTypeId: proto.Int64(s.LinkTypeId),
}
}