From 2929c9f25e37014cddaa0edfd444cb9da76dc2b5 Mon Sep 17 00:00:00 2001 From: Danny Adams Date: Fri, 20 Jan 2023 09:23:41 -0500 Subject: [PATCH] Update /connector/sharepoint package Beta Library replaces msgraph v1.0 --- .../connector/sharepoint/collection.go | 2 +- .../connector/sharepoint/collection_test.go | 2 +- .../sharepoint/data_collections_test.go | 2 +- .../connector/sharepoint/helper_test.go | 2 +- src/internal/connector/sharepoint/list.go | 4 +- src/internal/connector/sharepoint/listInfo.go | 2 +- .../connector/sharepoint/listInfo_test.go | 2 +- src/internal/connector/sharepoint/pageInfo.go | 4 +- .../connector/sharepoint/pageInfo_test.go | 11 +- src/internal/connector/sharepoint/queries.go | 2 +- src/internal/connector/sharepoint/restore.go | 2 +- .../connector/sharepoint/site_page.go | 187 ------------------ .../connector/sharepoint/site_pageable.go | 24 --- 13 files changed, 19 insertions(+), 227 deletions(-) delete mode 100644 src/internal/connector/sharepoint/site_page.go delete mode 100644 src/internal/connector/sharepoint/site_pageable.go diff --git a/src/internal/connector/sharepoint/collection.go b/src/internal/connector/sharepoint/collection.go index ff6af4132..e875e5359 100644 --- a/src/internal/connector/sharepoint/collection.go +++ b/src/internal/connector/sharepoint/collection.go @@ -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" diff --git a/src/internal/connector/sharepoint/collection_test.go b/src/internal/connector/sharepoint/collection_test.go index f049ab26f..3b91b1241 100644 --- a/src/internal/connector/sharepoint/collection_test.go +++ b/src/internal/connector/sharepoint/collection_test.go @@ -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" diff --git a/src/internal/connector/sharepoint/data_collections_test.go b/src/internal/connector/sharepoint/data_collections_test.go index 2934b2fa1..2227eefda 100644 --- a/src/internal/connector/sharepoint/data_collections_test.go +++ b/src/internal/connector/sharepoint/data_collections_test.go @@ -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" diff --git a/src/internal/connector/sharepoint/helper_test.go b/src/internal/connector/sharepoint/helper_test.go index e716a5bae..f798f8c72 100644 --- a/src/internal/connector/sharepoint/helper_test.go +++ b/src/internal/connector/sharepoint/helper_test.go @@ -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" diff --git a/src/internal/connector/sharepoint/list.go b/src/internal/connector/sharepoint/list.go index 101de9722..7f8e3523a 100644 --- a/src/internal/connector/sharepoint/list.go +++ b/src/internal/connector/sharepoint/list.go @@ -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" diff --git a/src/internal/connector/sharepoint/listInfo.go b/src/internal/connector/sharepoint/listInfo.go index 3472c915f..bb8e18d62 100644 --- a/src/internal/connector/sharepoint/listInfo.go +++ b/src/internal/connector/sharepoint/listInfo.go @@ -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" ) diff --git a/src/internal/connector/sharepoint/listInfo_test.go b/src/internal/connector/sharepoint/listInfo_test.go index f56b1a396..0cee792ee 100644 --- a/src/internal/connector/sharepoint/listInfo_test.go +++ b/src/internal/connector/sharepoint/listInfo_test.go @@ -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" diff --git a/src/internal/connector/sharepoint/pageInfo.go b/src/internal/connector/sharepoint/pageInfo.go index 2c11863cb..103beec83 100644 --- a/src/internal/connector/sharepoint/pageInfo.go +++ b/src/internal/connector/sharepoint/pageInfo.go @@ -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 diff --git a/src/internal/connector/sharepoint/pageInfo_test.go b/src/internal/connector/sharepoint/pageInfo_test.go index 6ea070fbe..16a32c432 100644 --- a/src/internal/connector/sharepoint/pageInfo_test.go +++ b/src/internal/connector/sharepoint/pageInfo_test.go @@ -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, diff --git a/src/internal/connector/sharepoint/queries.go b/src/internal/connector/sharepoint/queries.go index 806cf0e97..5e5807974 100644 --- a/src/internal/connector/sharepoint/queries.go +++ b/src/internal/connector/sharepoint/queries.go @@ -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" ) diff --git a/src/internal/connector/sharepoint/restore.go b/src/internal/connector/sharepoint/restore.go index ef2b940bb..c0c16fd0f 100644 --- a/src/internal/connector/sharepoint/restore.go +++ b/src/internal/connector/sharepoint/restore.go @@ -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" diff --git a/src/internal/connector/sharepoint/site_page.go b/src/internal/connector/sharepoint/site_page.go deleted file mode 100644 index 56bf7ad27..000000000 --- a/src/internal/connector/sharepoint/site_page.go +++ /dev/null @@ -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 -} diff --git a/src/internal/connector/sharepoint/site_pageable.go b/src/internal/connector/sharepoint/site_pageable.go deleted file mode 100644 index d0626321b..000000000 --- a/src/internal/connector/sharepoint/site_pageable.go +++ /dev/null @@ -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) -}