Update /internal/connector/support/m365Support.go

Issue #2169: Serialization logic for SitePageable data types.
This commit is contained in:
Danny Adams 2023-01-21 19:54:37 -05:00
parent 10efa650c7
commit da2d0d1779

View File

@ -74,6 +74,18 @@ func CreateListFromBytes(bytes []byte) (models.Listable, error) {
return list, nil
}
// CreatePageFromBytes transforms given bytes in models.SitePageable object
func CreatePageFromBytes(bytes []byte) (models.SitePageable, error) {
parsable, err := CreateFromBytes(bytes, models.CreateSitePageFromDiscriminatorValue)
if err != nil {
return nil, errors.Wrap(err, "createing m365 sharepoint.Page object from provided bytes")
}
page := parsable.(models.SitePageable)
return page, nil
}
func HasAttachments(body models.ItemBodyable) bool {
if body.GetContent() == nil || body.GetContentType() == nil ||
*body.GetContentType() == models.TEXT_BODYTYPE || len(*body.GetContent()) == 0 {