lib/app/pdf-helpers.go

29 lines
718 B
Go

package app
import "code.tnxs.net/taxnexus/lib/api/stash/stash_models"
// MarshalToDocument encodes first class object to swagger
func (obj *PDF) MarshalToDocument() *stash_models.Document {
return &stash_models.Document{
ID: obj.ID,
Filename: obj.Filename,
ParentID: obj.ParentID,
Title: obj.Title,
URI: obj.URI,
}
}
// UnMarshalNewPDF decodes swagger to first class object
func UnMarshalNewPDF(swag *stash_models.NewPDF) *PDF {
return &PDF{
Description: swag.Description,
Filename: swag.Filename,
HTML: []byte(swag.HTML),
ObjectType: swag.ObjectType,
OwnerID: swag.OwnerID,
ParentID: swag.ParentID,
Ref: swag.Ref,
Title: swag.Title,
}
}