lib/app/pdf-helpers.go

29 lines
718 B
Go
Raw Normal View History

2021-01-14 06:36:35 +00:00
package app
import "code.tnxs.net/taxnexus/lib/api/stash/stash_models"
2021-01-18 03:13:54 +00:00
// MarshalToDocument encodes first class object to swagger
2021-01-14 06:36:35 +00:00
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,
}
}
2021-01-18 03:13:54 +00:00
// UnMarshalNewPDF decodes swagger to first class object
2021-01-17 21:49:00 +00:00
func UnMarshalNewPDF(swag *stash_models.NewPDF) *PDF {
2021-01-14 06:36:35 +00:00
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,
}
}