Update /connector/sharepoint package

Beta Library replaces msgraph v1.0
This commit is contained in:
Danny Adams 2023-01-20 09:23:41 -05:00
parent 7404c4c8b0
commit 2929c9f25e
13 changed files with 19 additions and 227 deletions

View File

@ -7,7 +7,7 @@ import (
"time"
kw "github.com/microsoft/kiota-serialization-json-go"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
"github.com/alcionai/corso/src/internal/connector/graph"
"github.com/alcionai/corso/src/internal/connector/support"

View File

@ -6,7 +6,7 @@ import (
"testing"
kioser "github.com/microsoft/kiota-serialization-json-go"
"github.com/microsoftgraph/msgraph-sdk-go/sites"
"github.com/microsoftgraph/msgraph-beta-sdk-go/sites"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

View File

@ -3,7 +3,7 @@ package sharepoint
import (
"testing"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"

View File

@ -3,7 +3,7 @@ package sharepoint
import (
"testing"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
"github.com/pkg/errors"
"github.com/stretchr/testify/require"

View File

@ -4,8 +4,8 @@ import (
"context"
"fmt"
"github.com/microsoftgraph/msgraph-sdk-go/models"
mssite "github.com/microsoftgraph/msgraph-sdk-go/sites"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
mssite "github.com/microsoftgraph/msgraph-beta-sdk-go/sites"
"github.com/pkg/errors"
"github.com/alcionai/corso/src/internal/connector/graph"

View File

@ -3,7 +3,7 @@ package sharepoint
import (
"time"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
"github.com/alcionai/corso/src/pkg/backup/details"
)

View File

@ -3,7 +3,7 @@ package sharepoint
import (
"testing"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/suite"

View File

@ -3,13 +3,15 @@ package sharepoint
import (
"time"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
"github.com/alcionai/corso/src/pkg/backup/details"
)
// sharePointPageInfo propagates metadata from the SharePoint Page data type
// into searchable content.
// Page Details: https://learn.microsoft.com/en-us/graph/api/resources/sitepage?view=graph-rest-beta
func sharePointPageInfo(page SitePageable, size int64) *details.SharePointInfo {
func sharePointPageInfo(page models.SitePageable, size int64) *details.SharePointInfo {
var (
name, webURL string
created, modified time.Time

View File

@ -3,6 +3,7 @@ package sharepoint
import (
"testing"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
"github.com/stretchr/testify/assert"
"github.com/alcionai/corso/src/pkg/backup/details"
@ -11,20 +12,20 @@ import (
func (suite *SharePointInfoSuite) TestSharePointInfo_Pages() {
tests := []struct {
name string
pageAndDeets func() (SitePageable, *details.SharePointInfo)
pageAndDeets func() (models.SitePageable, *details.SharePointInfo)
}{
{
name: "Empty Page",
pageAndDeets: func() (SitePageable, *details.SharePointInfo) {
pageAndDeets: func() (models.SitePageable, *details.SharePointInfo) {
deets := &details.SharePointInfo{ItemType: details.SharePointItem}
return NewSitePage(), deets
return models.NewSitePage(), deets
},
},
{
name: "Only Name",
pageAndDeets: func() (SitePageable, *details.SharePointInfo) {
pageAndDeets: func() (models.SitePageable, *details.SharePointInfo) {
title := "Blank Page"
sPage := NewSitePage()
sPage := models.NewSitePage()
sPage.SetTitle(&title)
deets := &details.SharePointInfo{
ItemType: details.SharePointItem,

View File

@ -4,7 +4,7 @@ import (
"context"
absser "github.com/microsoft/kiota-abstractions-go/serialization"
mssite "github.com/microsoftgraph/msgraph-sdk-go/sites"
mssite "github.com/microsoftgraph/msgraph-beta-sdk-go/sites"
"github.com/alcionai/corso/src/internal/connector/graph"
)

View File

@ -6,7 +6,7 @@ import (
"io"
"runtime/trace"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/microsoftgraph/msgraph-beta-sdk-go/models"
"github.com/pkg/errors"
"github.com/alcionai/corso/src/internal/connector/graph"

View File

@ -1,187 +0,0 @@
package sharepoint
import (
kioser "github.com/microsoft/kiota-abstractions-go/serialization"
"github.com/microsoftgraph/msgraph-sdk-go/models"
)
// SitePage provides operations to manage the minimal creation of a Site Page.
// Altered from original: github.com/microsoftgraph/msgraph-beta-sdk-go/models
// TODO: remove when Issue #2086 resolved
type SitePage struct {
models.BaseItem
// Indicates the layout of the content in a given SharePoint page, including horizontal sections and vertical section
// canvasLayout models.CanvasLayoutable
// Inherited from baseItem.
contentType models.ContentTypeInfoable
// The name of the page layout of the page.
// The possible values are: microsoftReserved, article, home, unknownFutureValue.
// pageLayout *models.PageLayoutType
// Indicates the promotion kind of the sitePage. The possible values are:
// microsoftReserved, page, newsPost, unknownFutureValue.
// promotionKind *models.PagePromotionType
// The publishing status and the MM.mm version of the page.
publishingState models.PublicationFacetable
// Reactions information for the page.
// reactions models.ReactionsFacetable
// Determines whether or not to show comments at the bottom of the page.
showComments *bool
// Determines whether or not to show recommended pages at the bottom of the page.
showRecommendedPages *bool
// Url of the sitePage's thumbnail image
//revive:disable:var-naming
thumbnailWebUrl *string
//revive:enable:var-naming
// Title of the sitePage.
title *string
}
// Title area on the SharePoint page.
// titleArea models.TitleAreaable
// Collection of webparts on the SharePoint page
// webParts []models.WebPartable
var _ SitePageable = &SitePage{}
// NewSitePage instantiates a new sitePage and sets the default values.
func NewSitePage() *SitePage {
m := &SitePage{
BaseItem: *models.NewBaseItem(),
}
odataTypeValue := "#microsoft.graph.sitePage"
m.SetOdataType(&odataTypeValue)
return m
}
// CreateSitePageFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
func CreateSitePageFromDiscriminatorValue(parseNode kioser.ParseNode) (kioser.Parsable, error) {
return NewSitePage(), nil
}
// GetContentType gets the contentType property value. Inherited from baseItem.
func (m *SitePage) GetContentType() models.ContentTypeInfoable {
return m.contentType
}
// GetFieldDeserializers the deserialization information for the current model
// Altered from original.
func (m *SitePage) GetFieldDeserializers() map[string]func(kioser.ParseNode) error {
res := m.BaseItem.GetFieldDeserializers()
return res
}
// GetPublishingState gets the publishingState property value. The publishing status and the MM.mm version of the page.
func (m *SitePage) GetPublishingState() models.PublicationFacetable {
return m.publishingState
}
// GetShowComments gets the showComments property value.
// Determines whether or not to show comments at the bottom of the page.
func (m *SitePage) GetShowComments() *bool {
return m.showComments
}
// GetShowRecommendedPages gets the showRecommendedPages property value.
// Determines whether or not to show recommended pages at the bottom of the page.
func (m *SitePage) GetShowRecommendedPages() *bool {
return m.showRecommendedPages
}
// GetThumbnailWebUrl gets the thumbnailWebUrl property value. Url of the sitePage's thumbnail image
//
//revive:disable:var-naming
func (m *SitePage) GetThumbnailWebUrl() *string {
return m.thumbnailWebUrl
}
// GetTitle gets the title property value. Title of the sitePage.
func (m *SitePage) GetTitle() *string {
return m.title
}
// Serialize serializes information the current object
func (m *SitePage) Serialize(writer kioser.SerializationWriter) error {
err := m.BaseItem.Serialize(writer)
if err != nil {
return err
}
if m.GetContentType() != nil {
err = writer.WriteObjectValue("contentType", m.GetContentType())
if err != nil {
return err
}
}
if m.GetPublishingState() != nil {
err = writer.WriteObjectValue("publishingState", m.GetPublishingState())
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("showComments", m.GetShowComments())
if err != nil {
return err
}
}
{
err = writer.WriteBoolValue("showRecommendedPages", m.GetShowRecommendedPages())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("thumbnailWebUrl", m.GetThumbnailWebUrl())
if err != nil {
return err
}
}
{
err = writer.WriteStringValue("title", m.GetTitle())
if err != nil {
return err
}
}
return nil
}
// SetContentType sets the contentType property value. Inherited from baseItem.
func (m *SitePage) SetContentType(value models.ContentTypeInfoable) {
m.contentType = value
}
// SetPublishingState sets the publishingState property value. The publishing status and the MM.mm version of the page.
func (m *SitePage) SetPublishingState(value models.PublicationFacetable) {
m.publishingState = value
}
// SetShowComments sets the showComments property value.
// Determines whether or not to show comments at the bottom of the page.
func (m *SitePage) SetShowComments(value *bool) {
m.showComments = value
}
// SetShowRecommendedPages sets the showRecommendedPages property value.
// Determines whether or not to show recommended pages at the bottom of the page.
func (m *SitePage) SetShowRecommendedPages(value *bool) {
m.showRecommendedPages = value
}
// SetThumbnailWebUrl sets the thumbnailWebUrl property value.
// Url of the sitePage's thumbnail image
//
//revive:disable:var-naming
func (m *SitePage) SetThumbnailWebUrl(value *string) {
m.thumbnailWebUrl = value
}
//revive:enable:var-naming
// SetTitle sets the title property value. Title of the sitePage.
func (m *SitePage) SetTitle(value *string) {
m.title = value
}

View File

@ -1,24 +0,0 @@
package sharepoint
import (
"github.com/microsoft/kiota-abstractions-go/serialization"
"github.com/microsoftgraph/msgraph-sdk-go/models"
)
// SitePageable adjusted from msgraph-beta-sdk-go for temporary testing
type SitePageable interface {
models.BaseItemable
serialization.Parsable
GetContentType() models.ContentTypeInfoable
GetPublishingState() models.PublicationFacetable
GetShowComments() *bool
GetShowRecommendedPages() *bool
GetThumbnailWebUrl() *string
GetTitle() *string
SetContentType(value models.ContentTypeInfoable)
SetPublishingState(value models.PublicationFacetable)
SetShowComments(value *bool)
SetShowRecommendedPages(value *bool)
SetThumbnailWebUrl(value *string)
SetTitle(value *string)
}