diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 608934ab7..32acffa53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,12 +42,6 @@ jobs: steps: - uses: actions/checkout@v3 - ## increases swap space for msgraph-beta-sdk-go - - name: Set Swap Space - uses: pierotofy/set-swap-space@master - with: - swap-size-gb: 12 - # single setup and sum cache handling here. # the results will cascade onto both testing and linting. - name: Setup Golang with cache @@ -214,6 +208,7 @@ jobs: CORSO_M365_TEST_USER_ID: ${{ secrets.CORSO_M365_TEST_USER_ID }} CORSO_SECONDARY_M365_TEST_USER_ID: ${{ secrets.CORSO_SECONDARY_M365_TEST_USER_ID }} CORSO_PASSPHRASE: ${{ secrets.INTEGRATION_TEST_CORSO_PASSPHRASE }} + CORSO_LOG_FILE: stderr LOG_GRAPH_REQUESTS: true run: | set -euo pipefail @@ -225,7 +220,7 @@ jobs: -p 1 \ ./... 2>&1 | tee ./testlog/gotest.log | gotestfmt -hide successful-tests - # Upload the original go test log as an artifact for later review. + # Upload the original go test output as an artifact for later review. - name: Upload test log if: failure() uses: actions/upload-artifact@v3 diff --git a/.github/workflows/load_test.yml b/.github/workflows/load_test.yml index c5c8faec1..ced4a80af 100644 --- a/.github/workflows/load_test.yml +++ b/.github/workflows/load_test.yml @@ -53,6 +53,7 @@ jobs: AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} CORSO_LOAD_TESTS: true + CORSO_LOG_FILE: stderr CORSO_M365_LOAD_TEST_USER_ID: ${{ secrets.CORSO_M365_LOAD_TEST_USER_ID }} CORSO_M365_LOAD_TEST_ORG_USERS: ${{ secrets.CORSO_M365_LOAD_TEST_ORG_USERS }} CORSO_PASSPHRASE: ${{ secrets.CORSO_PASSPHRASE }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 547f6f5ba..c1362c45c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - msgraph-beta-sdk-go replaces msgraph-sdk-go for new features. This can lead to long build times. - Handle case where user's drive has not been initialized - Inline attachments (e.g. copy/paste ) are discovered and backed up correctly ([#2163](https://github.com/alcionai/corso/issues/2163)) +- Guest and External users (for cloud accounts) and non-on-premise users (for systems that use on-prem AD syncs) are now excluded from backup and restore operations. +- Remove the M365 license guid check in OneDrive backup which wasn't reliable. + ## [v0.1.0] (alpha) - 2023-01-13 diff --git a/README.md b/README.md index cdb00ddf3..33341e4e7 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ services, possibly beyond M365, will expand based on the interest and needs of t # Getting Started -See the [Corso Documentation](https://corsobackup.io/docs/intro) for more information. +See the [Corso Quickstart](https://corsobackup.io/docs/quickstart/) on our docs page. # Building Corso diff --git a/src/.golangci.yml b/src/.golangci.yml index db883efc4..bda9330be 100644 --- a/src/.golangci.yml +++ b/src/.golangci.yml @@ -3,7 +3,6 @@ run: linters: enable: - - gci - gofmt - gofumpt - errcheck @@ -106,3 +105,14 @@ issues: linters: - forbidigo text: "context.(Background|TODO)" + - path: internal/connector/graph/betasdk + linters: + - wsl + - revive + - gci + - lll + - gofmt + - gofumpt + - misspell + - errcheck + diff --git a/src/cli/backup/exchange.go b/src/cli/backup/exchange.go index 63a1f6393..ac6455522 100644 --- a/src/cli/backup/exchange.go +++ b/src/cli/backup/exchange.go @@ -61,7 +61,7 @@ const ( const ( exchangeServiceCommand = "exchange" - exchangeServiceCommandCreateUseSuffix = "--user | '" + utils.Wildcard + "'" + exchangeServiceCommandCreateUseSuffix = "--user | '" + utils.Wildcard + "'" exchangeServiceCommandDeleteUseSuffix = "--backup " exchangeServiceCommandDetailsUseSuffix = "--backup " ) @@ -115,7 +115,7 @@ func addExchangeCommands(cmd *cobra.Command) *cobra.Command { fs.StringSliceVar( &user, utils.UserFN, nil, - "Backup Exchange data by user ID; accepts '"+utils.Wildcard+"' to select all users") + "Backup Exchange data by a user's email; accepts '"+utils.Wildcard+"' to select all users") fs.StringSliceVar( &exchangeData, utils.DataFN, nil, @@ -274,7 +274,7 @@ func createExchangeCmd(cmd *cobra.Command, args []string) error { users, err := m365.UserPNs(ctx, acct) if err != nil { - return Only(ctx, errors.Wrap(err, "Failed to retrieve M365 users")) + return Only(ctx, errors.Wrap(err, "Failed to retrieve M365 user(s)")) } var ( @@ -347,7 +347,7 @@ func exchangeBackupCreateSelectors(userIDs, data []string) *selectors.ExchangeBa func validateExchangeBackupCreateFlags(userIDs, data []string) error { if len(userIDs) == 0 { - return errors.New("--user requires one or more ids or the wildcard *") + return errors.New("--user requires one or more email addresses or the wildcard '*'") } for _, d := range data { diff --git a/src/cli/backup/onedrive.go b/src/cli/backup/onedrive.go index 3454a9b3b..60a055dce 100644 --- a/src/cli/backup/onedrive.go +++ b/src/cli/backup/onedrive.go @@ -29,7 +29,7 @@ import ( const ( oneDriveServiceCommand = "onedrive" - oneDriveServiceCommandCreateUseSuffix = "--user | '" + utils.Wildcard + "'" + oneDriveServiceCommandCreateUseSuffix = "--user | '" + utils.Wildcard + "'" oneDriveServiceCommandDeleteUseSuffix = "--backup " oneDriveServiceCommandDetailsUseSuffix = "--backup " ) @@ -85,7 +85,7 @@ func addOneDriveCommands(cmd *cobra.Command) *cobra.Command { fs.StringSliceVar(&user, utils.UserFN, nil, - "Backup OneDrive data by user ID; accepts '"+utils.Wildcard+"' to select all users. (required)") + "Backup OneDrive data by user's email address; accepts '"+utils.Wildcard+"' to select all users. (required)") options.AddOperationFlags(c) case listCommand: diff --git a/src/cli/backup/sharepoint.go b/src/cli/backup/sharepoint.go index 55ca9fe00..5ff34f6af 100644 --- a/src/cli/backup/sharepoint.go +++ b/src/cli/backup/sharepoint.go @@ -13,6 +13,7 @@ import ( . "github.com/alcionai/corso/src/cli/print" "github.com/alcionai/corso/src/cli/utils" "github.com/alcionai/corso/src/internal/connector" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/kopia" "github.com/alcionai/corso/src/internal/model" "github.com/alcionai/corso/src/pkg/backup" @@ -223,7 +224,7 @@ func createSharePointCmd(cmd *cobra.Command, args []string) error { defer utils.CloseRepo(ctx, r) - gc, err := connector.NewGraphConnector(ctx, acct, connector.Sites) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), acct, connector.Sites) if err != nil { return Only(ctx, errors.Wrap(err, "Failed to connect to Microsoft APIs")) } diff --git a/src/cli/cli.go b/src/cli/cli.go index be5059809..f06354f0b 100644 --- a/src/cli/cli.go +++ b/src/cli/cli.go @@ -39,7 +39,7 @@ var corsoCmd = &cobra.Command{ func handleCorsoCmd(cmd *cobra.Command, args []string) error { v, _ := cmd.Flags().GetBool("version") if v { - print.Outf(cmd.Context(), "Corso\nversion: "+version.Version) + print.Outf(cmd.Context(), "Corso version: "+version.Version) return nil } diff --git a/src/cli/restore/exchange.go b/src/cli/restore/exchange.go index 6d67fa03e..d0801061f 100644 --- a/src/cli/restore/exchange.go +++ b/src/cli/restore/exchange.go @@ -63,7 +63,7 @@ func addExchangeCommands(cmd *cobra.Command) *cobra.Command { fs.StringSliceVar(&user, utils.UserFN, nil, - "Restore data by user ID; accepts '"+utils.Wildcard+"' to select all users.") + "Restore data by user's email address; accepts '"+utils.Wildcard+"' to select all users.") // email flags fs.StringSliceVar(&email, diff --git a/src/cli/restore/onedrive.go b/src/cli/restore/onedrive.go index 0932461a3..526db414b 100644 --- a/src/cli/restore/onedrive.go +++ b/src/cli/restore/onedrive.go @@ -49,7 +49,7 @@ func addOneDriveCommands(cmd *cobra.Command) *cobra.Command { fs.StringSliceVar(&user, utils.UserFN, nil, - "Restore data by user ID; accepts '"+utils.Wildcard+"' to select all users.") + "Restore data by user's email address; accepts '"+utils.Wildcard+"' to select all users.") // onedrive hierarchy (path/name) flags diff --git a/src/cmd/factory/impl/common.go b/src/cmd/factory/impl/common.go index 369d80d20..585118442 100644 --- a/src/cmd/factory/impl/common.go +++ b/src/cmd/factory/impl/common.go @@ -12,6 +12,7 @@ import ( . "github.com/alcionai/corso/src/cli/print" "github.com/alcionai/corso/src/internal/common" "github.com/alcionai/corso/src/internal/connector" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/mockconnector" "github.com/alcionai/corso/src/internal/data" "github.com/alcionai/corso/src/pkg/account" @@ -111,7 +112,7 @@ func getGCAndVerifyUser(ctx context.Context, userID string) (*connector.GraphCon } // build a graph connector - gc, err := connector.NewGraphConnector(ctx, acct, connector.Users) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), acct, connector.Users) if err != nil { return nil, account.Account{}, errors.Wrap(err, "connecting to graph api") } diff --git a/src/cmd/getM365/getItem.go b/src/cmd/getM365/getItem.go index 9c2f8f135..24ce81d9a 100644 --- a/src/cmd/getM365/getItem.go +++ b/src/cmd/getM365/getItem.go @@ -96,7 +96,7 @@ func runDisplayM365JSON( var ( bs []byte err error - cat = graph.StringToPathCategory(category) + cat = path.ToCategoryType(category) sw = kw.NewJsonSerializationWriter() ) @@ -178,7 +178,7 @@ func getGC(ctx context.Context) (*connector.GraphConnector, account.M365Config, return nil, m365Cfg, Only(ctx, errors.Wrap(err, "finding m365 account details")) } - gc, err := connector.NewGraphConnector(ctx, acct, connector.Users) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), acct, connector.Users) if err != nil { return nil, m365Cfg, Only(ctx, errors.Wrap(err, "connecting to graph API")) } diff --git a/src/cmd/purge/purge.go b/src/cmd/purge/purge.go index a59f7c2b8..32100772d 100644 --- a/src/cmd/purge/purge.go +++ b/src/cmd/purge/purge.go @@ -255,7 +255,7 @@ func getGC(ctx context.Context) (*connector.GraphConnector, error) { } // build a graph connector - gc, err := connector.NewGraphConnector(ctx, acct, connector.Users) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), acct, connector.Users) if err != nil { return nil, Only(ctx, errors.Wrap(err, "connecting to graph api")) } diff --git a/src/go.mod b/src/go.mod index e1e7dac46..3e2eb34db 100644 --- a/src/go.mod +++ b/src/go.mod @@ -2,27 +2,26 @@ module github.com/alcionai/corso/src go 1.19 -replace github.com/kopia/kopia => github.com/alcionai/kopia v0.10.8-0.20230112200734-ac706ef83a1c - require ( github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.2.0 - github.com/aws/aws-sdk-go v1.44.183 + github.com/alcionai/clues v0.0.0-20230120231953-1cf61dbafc40 + github.com/aws/aws-sdk-go v1.44.187 github.com/aws/aws-xray-sdk-go v1.8.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-multierror v1.1.1 - github.com/kopia/kopia v0.12.2-0.20221229232524-ba938cf58cc8 + github.com/kopia/kopia v0.12.2-0.20230123092305-e5387cec0acb github.com/microsoft/kiota-abstractions-go v0.16.0 github.com/microsoft/kiota-authentication-azure-go v0.6.0 github.com/microsoft/kiota-http-go v0.13.0 github.com/microsoft/kiota-serialization-json-go v0.7.2 - github.com/microsoftgraph/msgraph-beta-sdk-go v0.53.0 + github.com/microsoftgraph/msgraph-sdk-go v0.53.0 github.com/microsoftgraph/msgraph-sdk-go-core v0.33.0 github.com/pkg/errors v0.9.1 github.com/rudderlabs/analytics-go v3.3.3+incompatible github.com/spatialcurrent/go-lazy v0.0.0-20211115014721-47315cc003d1 github.com/spf13/cobra v1.6.1 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.14.0 + github.com/spf13/viper v1.15.0 github.com/stretchr/testify v1.8.1 github.com/tidwall/pretty v1.2.1 github.com/tomlazar/table v0.1.2 @@ -40,19 +39,17 @@ require ( github.com/dnaeon/go-vcr v1.2.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/magiconair/properties v1.8.6 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/microsoft/kiota-serialization-form-go v0.2.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect - github.com/pelletier/go-toml/v2 v2.0.5 // indirect - github.com/spf13/afero v1.9.2 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect + github.com/spf13/afero v1.9.3 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect - github.com/subosito/gotenv v1.4.1 // indirect + github.com/subosito/gotenv v1.4.2 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasthttp v1.34.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/yaml.v2 v2.4.0 // indirect ) require ( @@ -114,14 +111,14 @@ require ( go.opentelemetry.io/otel/trace v1.11.2 // indirect go.uber.org/atomic v1.10.0 // indirect go.uber.org/multierr v1.8.0 // indirect - golang.org/x/crypto v0.3.0 // indirect + golang.org/x/crypto v0.5.0 // indirect golang.org/x/mod v0.7.0 // indirect golang.org/x/net v0.5.0 // indirect golang.org/x/sync v0.1.0 // indirect golang.org/x/sys v0.4.0 // indirect golang.org/x/text v0.6.0 // indirect - google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect - google.golang.org/grpc v1.51.0 // indirect + google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect + google.golang.org/grpc v1.52.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/src/go.sum b/src/go.sum index 2d120f6cd..22f9b12a2 100644 --- a/src/go.sum +++ b/src/go.sum @@ -52,8 +52,8 @@ github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1o github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8= github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo= -github.com/alcionai/kopia v0.10.8-0.20230112200734-ac706ef83a1c h1:uUcdEZ4sz7kRYVWB3K49MBHdICRyXCVAzd4ZiY3lvo0= -github.com/alcionai/kopia v0.10.8-0.20230112200734-ac706ef83a1c/go.mod h1:yzJV11S6N6XMboXt7oCO6Jy2jJHPeSMtA+KOJ9Y1548= +github.com/alcionai/clues v0.0.0-20230120231953-1cf61dbafc40 h1:bvAwz0dcJeIyRjudVyzmmawOvc4SqlSerKd0B4dh0yw= +github.com/alcionai/clues v0.0.0-20230120231953-1cf61dbafc40/go.mod h1:UlAs8jkWIpsOMakiC8NxPgQQVQRdvyf1hYMszlYYLb4= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -62,8 +62,8 @@ github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk5 github.com/alessio/shellescape v1.4.1 h1:V7yhSDDn8LP4lc4jS8pFkt0zCnzVJlG5JXy9BVKJUX0= github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY= github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= -github.com/aws/aws-sdk-go v1.44.183 h1:mUk45JZTIMMg9m8GmrbvACCsIOKtKezXRxp06uI5Ahk= -github.com/aws/aws-sdk-go v1.44.183/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.187 h1:D5CsRomPnlwDHJCanL2mtaLIcbhjiWxNh5j8zvaWdJA= +github.com/aws/aws-sdk-go v1.44.187/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-xray-sdk-go v1.8.0 h1:0xncHZ588wB/geLjbM/esoW3FOEThWy2TJyb4VXfLFY= github.com/aws/aws-xray-sdk-go v1.8.0/go.mod h1:7LKe47H+j3evfvS1+q0wzpoaGXGrF3mUsfM+thqVO+A= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= @@ -241,6 +241,8 @@ github.com/klauspost/reedsolomon v1.11.3/go.mod h1:FXLZzlJIdfqEnQLdUKWNRuMZg747h github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kopia/htmluibuild v0.0.0-20220928042710-9fdd02afb1e7 h1:WP5VfIQL7AaYkO4zTNSCsVOawTzudbc4tvLojvg0RKc= +github.com/kopia/kopia v0.12.2-0.20230123092305-e5387cec0acb h1:0jLaKLiloYvRNbuHHpnQkJ7STAgzQ4z6n+KPa6Kyg7I= +github.com/kopia/kopia v0.12.2-0.20230123092305-e5387cec0acb/go.mod h1:dtCyMCsWulG82o9bDopvnny9DpOQe0PnSDczJLuhnWA= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -251,8 +253,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= -github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= @@ -279,8 +281,8 @@ github.com/microsoft/kiota-serialization-json-go v0.7.2 h1:DSb4fNDi5O+DqJwrHo+vR github.com/microsoft/kiota-serialization-json-go v0.7.2/go.mod h1:Ojum5prlijopyCOZ2XctRcVlE2pU8h+43r3tMdiWoDU= github.com/microsoft/kiota-serialization-text-go v0.6.0 h1:3N2vftYZlwKdog69AN7ha+FZT0QxPG7xp/hLv0/W2OQ= github.com/microsoft/kiota-serialization-text-go v0.6.0/go.mod h1:OUA4dNH+f6afiJUs+rQAatJos7QVF5PJkyrqoD89lx4= -github.com/microsoftgraph/msgraph-beta-sdk-go v0.53.0 h1:FITWxC0U8u9J82iUnTUgKhFw048OFq6hNiShpIgJx2k= -github.com/microsoftgraph/msgraph-beta-sdk-go v0.53.0/go.mod h1:hyea6/iVBicq7jjlU8nzmkFys2ajScSI2q1GX9gjnIQ= +github.com/microsoftgraph/msgraph-sdk-go v0.53.0 h1:HpQd1Nvr8yQNeqhDuiVSbqn1fkHsFbRFDmnuhhXJXOQ= +github.com/microsoftgraph/msgraph-sdk-go v0.53.0/go.mod h1:BZLyon4n4T4EuLIAlX+kJ5JgneFTXVQDah1AJuq3FRY= github.com/microsoftgraph/msgraph-sdk-go-core v0.33.0 h1:cDL3ov/IZ2ZarUJdGGPsdR+46ALdd3CRAiDBIylLCoA= github.com/microsoftgraph/msgraph-sdk-go-core v0.33.0/go.mod h1:d0mU3PQAWnN/C4CwPJEZz2QhesrnR5UDnqRu2ODWPkI= github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= @@ -303,10 +305,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A= github.com/natefinch/atomic v1.0.1/go.mod h1:N/D/ELrljoqDyT3rZrsUmtsuzvHkeB/wWjHV22AZRbM= -github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= -github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM= github.com/pierrec/lz4 v2.6.1+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= @@ -362,8 +362,8 @@ github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0 github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/spatialcurrent/go-lazy v0.0.0-20211115014721-47315cc003d1 h1:lQ3JvmcVO1/AMFbabvUSJ4YtJRpEAX9Qza73p5j03sw= github.com/spatialcurrent/go-lazy v0.0.0-20211115014721-47315cc003d1/go.mod h1:4aKqcbhASNqjbrG0h9BmkzcWvPJGxbef4B+j0XfFrZo= -github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= -github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= @@ -372,8 +372,8 @@ github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmq github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= -github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -387,8 +387,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= -github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/tg123/go-htpasswd v1.2.0 h1:UKp34m9H467/xklxUxU15wKRru7fwXoTojtxg25ITF0= github.com/tidwall/gjson v1.14.3 h1:9jvXn7olKEHU1S9vwoMGliaT8jq1vJ7IH/n9zD9Dnlw= github.com/tidwall/gjson v1.14.3/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= @@ -450,8 +450,8 @@ golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220214200702-86341886e292/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.3.0 h1:a06MkbcxBrEFc0w0QIZWXrH/9cCX6KJyWbBOIwAn+7A= -golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.5.0 h1:U/0M97KRkSFvyD/3FSmdP5W5swImpNgle/EHFhOsQPE= +golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -747,8 +747,8 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= -google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 h1:AGXp12e/9rItf6/4QymU7WsAUwCf+ICW75cuR91nJIc= -google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6/go.mod h1:1dOng4TWOomJrDGhpXjfCD35wQC6jnC7HpRmOFRqEV0= +google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef h1:uQ2vjV/sHTsWSqdKeLqmwitzgvjMl7o4IdtHwUDXSJY= +google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -765,8 +765,8 @@ google.golang.org/grpc v1.31.1/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= google.golang.org/grpc v1.34.0/go.mod h1:WotjhfgOW/POjDeRt8vscBtXq+2VjORFy659qA51WJ8= google.golang.org/grpc v1.35.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.52.0 h1:kd48UiU7EHsV4rnLyOJRuP/Il/UHE7gdDAQ+SZI7nZk= +google.golang.org/grpc v1.52.0/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5vorUY= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/src/internal/connector/data_collections.go b/src/internal/connector/data_collections.go index 2ba2e59a4..8481dc948 100644 --- a/src/internal/connector/data_collections.go +++ b/src/internal/connector/data_collections.go @@ -8,8 +8,8 @@ import ( "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/discovery" + "github.com/alcionai/corso/src/internal/connector/discovery/api" "github.com/alcionai/corso/src/internal/connector/exchange" - "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/onedrive" "github.com/alcionai/corso/src/internal/connector/sharepoint" "github.com/alcionai/corso/src/internal/connector/support" @@ -44,7 +44,7 @@ func (gc *GraphConnector) DataCollections( return nil, err } - serviceEnabled, err := checkServiceEnabled(ctx, gc.Service, path.ServiceType(sels.Service), sels.DiscreteOwner) + serviceEnabled, err := checkServiceEnabled(ctx, gc.Owners.Users(), path.ServiceType(sels.Service), sels.DiscreteOwner) if err != nil { return nil, err } @@ -87,8 +87,9 @@ func (gc *GraphConnector) DataCollections( case selectors.ServiceSharePoint: colls, err := sharepoint.DataCollections( ctx, + gc.itemClient, sels, - gc.credentials.AzureTenantID, + gc.credentials, gc.Service, gc, ctrlOpts) @@ -138,7 +139,7 @@ func verifyBackupInputs(sels selectors.Selector, userPNs, siteIDs []string) erro func checkServiceEnabled( ctx context.Context, - gs graph.Servicer, + au api.Users, service path.ServiceType, resource string, ) (bool, error) { @@ -147,7 +148,7 @@ func checkServiceEnabled( return true, nil } - _, info, err := discovery.User(ctx, gs, resource) + _, info, err := discovery.User(ctx, au, resource) if err != nil { return false, err } @@ -198,6 +199,7 @@ func (gc *GraphConnector) OneDriveDataCollections( logger.Ctx(ctx).With("user", user).Debug("Creating OneDrive collections") odcs, err := onedrive.NewCollections( + gc.itemClient, gc.credentials.AzureTenantID, user, onedrive.OneDriveSource, diff --git a/src/internal/connector/data_collections_test.go b/src/internal/connector/data_collections_test.go index e16aa4b51..6eca7e468 100644 --- a/src/internal/connector/data_collections_test.go +++ b/src/internal/connector/data_collections_test.go @@ -10,6 +10,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/alcionai/corso/src/internal/connector/exchange" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/sharepoint" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/pkg/control" @@ -43,7 +44,7 @@ func (suite *ConnectorDataCollectionIntegrationSuite) SetupSuite() { tester.MustGetEnvVars(suite.T(), tester.M365AcctCredEnvs...) - suite.connector = loadConnector(ctx, suite.T(), AllResources) + suite.connector = loadConnector(ctx, suite.T(), graph.LargeItemClient(), AllResources) suite.user = tester.M365UserID(suite.T()) suite.site = tester.M365SiteID(suite.T()) @@ -62,7 +63,7 @@ func (suite *ConnectorDataCollectionIntegrationSuite) TestExchangeDataCollection selUsers := []string{suite.user} - connector := loadConnector(ctx, suite.T(), Users) + connector := loadConnector(ctx, suite.T(), graph.LargeItemClient(), Users) tests := []struct { name string getSelector func(t *testing.T) selectors.Selector @@ -138,7 +139,7 @@ func (suite *ConnectorDataCollectionIntegrationSuite) TestDataCollections_invali owners := []string{"snuffleupagus"} - connector := loadConnector(ctx, suite.T(), Users) + connector := loadConnector(ctx, suite.T(), graph.LargeItemClient(), Users) tests := []struct { name string getSelector func(t *testing.T) selectors.Selector @@ -214,7 +215,7 @@ func (suite *ConnectorDataCollectionIntegrationSuite) TestSharePointDataCollecti selSites := []string{suite.site} - connector := loadConnector(ctx, suite.T(), Sites) + connector := loadConnector(ctx, suite.T(), graph.LargeItemClient(), Sites) tests := []struct { name string expected int @@ -243,8 +244,9 @@ func (suite *ConnectorDataCollectionIntegrationSuite) TestSharePointDataCollecti suite.T().Run(test.name, func(t *testing.T) { collections, err := sharepoint.DataCollections( ctx, + graph.LargeItemClient(), test.getSelector(), - connector.credentials.AzureTenantID, + connector.credentials, connector.Service, connector, control.Options{}) @@ -298,7 +300,7 @@ func (suite *ConnectorCreateSharePointCollectionIntegrationSuite) SetupSuite() { tester.MustGetEnvSets(suite.T(), tester.M365AcctCredEnvs) - suite.connector = loadConnector(ctx, suite.T(), Sites) + suite.connector = loadConnector(ctx, suite.T(), graph.LargeItemClient(), Sites) suite.user = tester.M365UserID(suite.T()) tester.LogTimeOfTest(suite.T()) @@ -311,7 +313,7 @@ func (suite *ConnectorCreateSharePointCollectionIntegrationSuite) TestCreateShar var ( t = suite.T() siteID = tester.M365SiteID(t) - gc = loadConnector(ctx, t, Sites) + gc = loadConnector(ctx, t, graph.LargeItemClient(), Sites) siteIDs = []string{siteID} ) @@ -335,7 +337,7 @@ func (suite *ConnectorCreateSharePointCollectionIntegrationSuite) TestCreateShar var ( t = suite.T() siteID = tester.M365SiteID(t) - gc = loadConnector(ctx, t, Sites) + gc = loadConnector(ctx, t, graph.LargeItemClient(), Sites) siteIDs = []string{siteID} ) diff --git a/src/internal/connector/discovery/api/api.go b/src/internal/connector/discovery/api/api.go new file mode 100644 index 000000000..20fc1b25d --- /dev/null +++ b/src/internal/connector/discovery/api/api.go @@ -0,0 +1,57 @@ +package api + +import ( + "github.com/pkg/errors" + + "github.com/alcionai/corso/src/internal/connector/graph" + "github.com/alcionai/corso/src/pkg/account" +) + +// --------------------------------------------------------------------------- +// interfaces +// --------------------------------------------------------------------------- + +// Client is used to fulfill the interface for discovery +// queries that are traditionally backed by GraphAPI. A +// struct is used in this case, instead of deferring to +// pure function wrappers, so that the boundary separates the +// granular implementation of the graphAPI and kiota away +// from the exchange package's broader intents. +type Client struct { + Credentials account.M365Config + + // The stable service is re-usable for any non-paged request. + // This allows us to maintain performance across async requests. + stable graph.Servicer +} + +// NewClient produces a new exchange api client. Must be used in +// place of creating an ad-hoc client struct. +func NewClient(creds account.M365Config) (Client, error) { + s, err := newService(creds) + if err != nil { + return Client{}, err + } + + return Client{creds, s}, nil +} + +// service generates a new service. Used for paged and other long-running +// requests instead of the client's stable service, so that in-flight state +// within the adapter doesn't get clobbered +func (c Client) service() (*graph.Service, error) { + return newService(c.Credentials) +} + +func newService(creds account.M365Config) (*graph.Service, error) { + adapter, err := graph.CreateAdapter( + creds.AzureTenantID, + creds.AzureClientID, + creds.AzureClientSecret, + ) + if err != nil { + return nil, errors.Wrap(err, "generating graph api service client") + } + + return graph.NewService(adapter), nil +} diff --git a/src/internal/connector/discovery/api/users.go b/src/internal/connector/discovery/api/users.go new file mode 100644 index 000000000..ff41ee06f --- /dev/null +++ b/src/internal/connector/discovery/api/users.go @@ -0,0 +1,166 @@ +package api + +import ( + "context" + + msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/users" + "github.com/pkg/errors" + + "github.com/alcionai/corso/src/internal/connector/graph" + "github.com/alcionai/corso/src/internal/connector/support" + "github.com/alcionai/corso/src/pkg/path" +) + +// --------------------------------------------------------------------------- +// controller +// --------------------------------------------------------------------------- + +func (c Client) Users() Users { + return Users{c} +} + +// Users is an interface-compliant provider of the client. +type Users struct { + Client +} + +// --------------------------------------------------------------------------- +// structs +// --------------------------------------------------------------------------- + +type UserInfo struct { + DiscoveredServices map[path.ServiceType]struct{} +} + +func newUserInfo() *UserInfo { + return &UserInfo{ + DiscoveredServices: map[path.ServiceType]struct{}{ + path.ExchangeService: {}, + path.OneDriveService: {}, + }, + } +} + +// --------------------------------------------------------------------------- +// methods +// --------------------------------------------------------------------------- + +const ( + userSelectID = "id" + userSelectPrincipalName = "userPrincipalName" + userSelectDisplayName = "displayName" +) + +// Filter out both guest users, and (for on-prem installations) non-synced users. +// The latter filter makes an assumption that no on-prem users are guests; this might +// require more fine-tuned controls in the future. +// https://stackoverflow.com/questions/64044266/error-message-unsupported-or-invalid-query-filter-clause-specified-for-property +// +//nolint:lll +var userFilterNoGuests = "onPremisesSyncEnabled eq true OR userType eq 'Member'" + +func userOptions(fs *string) *users.UsersRequestBuilderGetRequestConfiguration { + return &users.UsersRequestBuilderGetRequestConfiguration{ + QueryParameters: &users.UsersRequestBuilderGetQueryParameters{ + Select: []string{userSelectID, userSelectPrincipalName, userSelectDisplayName}, + Filter: fs, + }, + } +} + +// GetAll retrieves all users. +func (c Users) GetAll(ctx context.Context) ([]models.Userable, error) { + service, err := c.service() + if err != nil { + return nil, err + } + + resp, err := service.Client().Users().Get(ctx, userOptions(&userFilterNoGuests)) + if err != nil { + return nil, support.ConnectorStackErrorTraceWrap(err, "getting all users") + } + + iter, err := msgraphgocore.NewPageIterator( + resp, + service.Adapter(), + models.CreateUserCollectionResponseFromDiscriminatorValue) + if err != nil { + return nil, support.ConnectorStackErrorTraceWrap(err, "constructing user iterator") + } + + var ( + iterErrs error + us = make([]models.Userable, 0) + ) + + iterator := func(item any) bool { + u, err := validateUser(item) + if err != nil { + iterErrs = support.WrapAndAppend("validating user", err, iterErrs) + } else { + us = append(us, u) + } + + return true + } + + if err := iter.Iterate(ctx, iterator); err != nil { + return nil, support.ConnectorStackErrorTraceWrap(err, "iterating all users") + } + + return us, iterErrs +} + +func (c Users) GetByID(ctx context.Context, userID string) (models.Userable, error) { + user, err := c.stable.Client().UsersById(userID).Get(ctx, nil) + if err != nil { + return nil, support.ConnectorStackErrorTraceWrap(err, "getting user by id") + } + + return user, nil +} + +func (c Users) GetInfo(ctx context.Context, userID string) (*UserInfo, error) { + // Assume all services are enabled + // then filter down to only services the user has enabled + userInfo := newUserInfo() + + // TODO: OneDrive + + _, err := c.stable.Client().UsersById(userID).MailFolders().Get(ctx, nil) + if err != nil { + if !graph.IsErrExchangeMailFolderNotFound(err) { + return nil, support.ConnectorStackErrorTraceWrap(err, "getting user's exchange mailfolders") + } + + delete(userInfo.DiscoveredServices, path.ExchangeService) + } + + return userInfo, nil +} + +// --------------------------------------------------------------------------- +// helpers +// --------------------------------------------------------------------------- + +// validateUser ensures the item is a Userable, and contains the necessary +// identifiers that we handle with all users. +// returns the item as a Userable model. +func validateUser(item any) (models.Userable, error) { + m, ok := item.(models.Userable) + if !ok { + return nil, errors.Errorf("expected Userable, got %T", item) + } + + if m.GetId() == nil { + return nil, errors.Errorf("missing ID") + } + + if m.GetUserPrincipalName() == nil { + return nil, errors.New("missing principalName") + } + + return m, nil +} diff --git a/src/internal/connector/discovery/discovery_test.go b/src/internal/connector/discovery/api/users_test.go similarity index 80% rename from src/internal/connector/discovery/discovery_test.go rename to src/internal/connector/discovery/api/users_test.go index 15e0f3210..160806cf6 100644 --- a/src/internal/connector/discovery/discovery_test.go +++ b/src/internal/connector/discovery/api/users_test.go @@ -1,22 +1,22 @@ -package discovery +package api import ( "reflect" "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/suite" ) -type DiscoverySuite struct { +type UsersUnitSuite struct { suite.Suite } -func TestDiscoverySuite(t *testing.T) { - suite.Run(t, new(DiscoverySuite)) +func TestUsersUnitSuite(t *testing.T) { + suite.Run(t, new(UsersUnitSuite)) } -func (suite *DiscoverySuite) TestParseUser() { +func (suite *UsersUnitSuite) TestValidateUser() { t := suite.T() name := "testuser" @@ -60,7 +60,7 @@ func (suite *DiscoverySuite) TestParseUser() { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := parseUser(tt.args) + got, err := validateUser(tt.args) if (err != nil) != tt.wantErr { t.Errorf("parseUser() error = %v, wantErr %v", err, tt.wantErr) return diff --git a/src/internal/connector/discovery/discovery.go b/src/internal/connector/discovery/discovery.go index e9d0474db..3f75f74c4 100644 --- a/src/internal/connector/discovery/discovery.go +++ b/src/internal/connector/discovery/discovery.go @@ -3,125 +3,52 @@ package discovery import ( "context" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - msuser "github.com/microsoftgraph/msgraph-beta-sdk-go/users" - msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" - "github.com/alcionai/corso/src/internal/connector/graph" - "github.com/alcionai/corso/src/internal/connector/support" - "github.com/alcionai/corso/src/pkg/path" + "github.com/alcionai/corso/src/internal/connector/discovery/api" ) -const ( - userSelectID = "id" - userSelectPrincipalName = "userPrincipalName" - userSelectDisplayName = "displayName" -) +// --------------------------------------------------------------------------- +// interfaces +// --------------------------------------------------------------------------- -func Users(ctx context.Context, gs graph.Servicer, tenantID string) ([]models.Userable, error) { - users := make([]models.Userable, 0) - - options := &msuser.UsersRequestBuilderGetRequestConfiguration{ - QueryParameters: &msuser.UsersRequestBuilderGetQueryParameters{ - Select: []string{userSelectID, userSelectPrincipalName, userSelectDisplayName}, - }, - } - - response, err := gs.Client().Users().Get(ctx, options) - if err != nil { - return nil, errors.Wrapf( - err, - "retrieving resources for tenant %s: %s", - tenantID, - support.ConnectorStackErrorTrace(err), - ) - } - - iter, err := msgraphgocore.NewPageIterator(response, gs.Adapter(), - models.CreateUserCollectionResponseFromDiscriminatorValue) - if err != nil { - return nil, errors.Wrap(err, support.ConnectorStackErrorTrace(err)) - } - - var iterErrs error - - callbackFunc := func(item interface{}) bool { - u, err := parseUser(item) - if err != nil { - iterErrs = support.WrapAndAppend("discovering users: ", err, iterErrs) - return true - } - - users = append(users, u) - - return true - } - - if err := iter.Iterate(ctx, callbackFunc); err != nil { - return nil, errors.Wrap(err, support.ConnectorStackErrorTrace(err)) - } - - return users, iterErrs +type getAller interface { + GetAll(context.Context) ([]models.Userable, error) } -type UserInfo struct { - DiscoveredServices map[path.ServiceType]struct{} +type getter interface { + GetByID(context.Context, string) (models.Userable, error) } -func User(ctx context.Context, gs graph.Servicer, userID string) (models.Userable, *UserInfo, error) { - user, err := gs.Client().UsersById(userID).Get(ctx, nil) +type getInfoer interface { + GetInfo(context.Context, string) (*api.UserInfo, error) +} + +type getWithInfoer interface { + getter + getInfoer +} + +// --------------------------------------------------------------------------- +// api +// --------------------------------------------------------------------------- + +// Users fetches all users in the tenant. +func Users(ctx context.Context, ga getAller) ([]models.Userable, error) { + return ga.GetAll(ctx) +} + +func User(ctx context.Context, gwi getWithInfoer, userID string) (models.Userable, *api.UserInfo, error) { + u, err := gwi.GetByID(ctx, userID) if err != nil { - return nil, nil, errors.Wrapf( - err, - "retrieving resource for tenant: %s", - support.ConnectorStackErrorTrace(err), - ) + return nil, nil, errors.Wrap(err, "getting user") } - // Assume all services are enabled - userInfo := &UserInfo{ - DiscoveredServices: map[path.ServiceType]struct{}{ - path.ExchangeService: {}, - path.OneDriveService: {}, - }, - } - - // Discover which services the user has enabled - - // Exchange: Query `MailFolders` - _, err = gs.Client().UsersById(userID).MailFolders().Get(ctx, nil) + ui, err := gwi.GetInfo(ctx, userID) if err != nil { - if !graph.IsErrExchangeMailFolderNotFound(err) { - return nil, nil, errors.Wrapf( - err, - "retrieving mail folders for tenant: %s", - support.ConnectorStackErrorTrace(err), - ) - } - - delete(userInfo.DiscoveredServices, path.ExchangeService) + return nil, nil, errors.Wrap(err, "getting user info") } - // TODO: OneDrive - - return user, userInfo, nil -} - -// parseUser extracts information from `models.Userable` we care about -func parseUser(item interface{}) (models.Userable, error) { - m, ok := item.(models.Userable) - if !ok { - return nil, errors.New("iteration retrieved non-User item") - } - - if m.GetId() == nil { - return nil, errors.Errorf("no ID for User") - } - - if m.GetUserPrincipalName() == nil { - return nil, errors.Errorf("no principal name for User: %s", *m.GetId()) - } - - return m, nil + return u, ui, nil } diff --git a/src/internal/connector/exchange/api/contacts.go b/src/internal/connector/exchange/api/contacts.go index 27c21338f..e12f4b795 100644 --- a/src/internal/connector/exchange/api/contacts.go +++ b/src/internal/connector/exchange/api/contacts.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/go-multierror" "github.com/microsoft/kiota-abstractions-go/serialization" kioser "github.com/microsoft/kiota-serialization-json-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - "github.com/microsoftgraph/msgraph-beta-sdk-go/users" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/users" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/graph" diff --git a/src/internal/connector/exchange/api/contacts_test.go b/src/internal/connector/exchange/api/contacts_test.go index b49f9d920..411250146 100644 --- a/src/internal/connector/exchange/api/contacts_test.go +++ b/src/internal/connector/exchange/api/contacts_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" diff --git a/src/internal/connector/exchange/api/events.go b/src/internal/connector/exchange/api/events.go index f9cd5c95f..f78aef76b 100644 --- a/src/internal/connector/exchange/api/events.go +++ b/src/internal/connector/exchange/api/events.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/go-multierror" "github.com/microsoft/kiota-abstractions-go/serialization" kioser "github.com/microsoft/kiota-serialization-json-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - "github.com/microsoftgraph/msgraph-beta-sdk-go/users" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/users" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/common" diff --git a/src/internal/connector/exchange/api/events_test.go b/src/internal/connector/exchange/api/events_test.go index 2cee75525..a41a48e5a 100644 --- a/src/internal/connector/exchange/api/events_test.go +++ b/src/internal/connector/exchange/api/events_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/src/internal/connector/exchange/api/mail.go b/src/internal/connector/exchange/api/mail.go index a1c9f41b9..c83c3f7bb 100644 --- a/src/internal/connector/exchange/api/mail.go +++ b/src/internal/connector/exchange/api/mail.go @@ -8,8 +8,8 @@ import ( "github.com/hashicorp/go-multierror" "github.com/microsoft/kiota-abstractions-go/serialization" kioser "github.com/microsoft/kiota-serialization-json-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - "github.com/microsoftgraph/msgraph-beta-sdk-go/users" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/users" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/graph" diff --git a/src/internal/connector/exchange/api/mail_test.go b/src/internal/connector/exchange/api/mail_test.go index a3b5158ef..5611586e2 100644 --- a/src/internal/connector/exchange/api/mail_test.go +++ b/src/internal/connector/exchange/api/mail_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/suite" "github.com/alcionai/corso/src/pkg/backup/details" diff --git a/src/internal/connector/exchange/api/options.go b/src/internal/connector/exchange/api/options.go index 2d5cbfd2d..49debf334 100644 --- a/src/internal/connector/exchange/api/options.go +++ b/src/internal/connector/exchange/api/options.go @@ -3,7 +3,7 @@ package api import ( "fmt" - "github.com/microsoftgraph/msgraph-beta-sdk-go/users" + "github.com/microsoftgraph/msgraph-sdk-go/users" ) // ----------------------------------------------------------------------- diff --git a/src/internal/connector/exchange/attachment.go b/src/internal/connector/exchange/attachment.go index 757e76ff8..5cbce271c 100644 --- a/src/internal/connector/exchange/attachment.go +++ b/src/internal/connector/exchange/attachment.go @@ -5,7 +5,7 @@ import ( "context" "io" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/uploadsession" diff --git a/src/internal/connector/exchange/attachment_uploadable.go b/src/internal/connector/exchange/attachment_uploadable.go index 89835aba8..5369dcfa6 100644 --- a/src/internal/connector/exchange/attachment_uploadable.go +++ b/src/internal/connector/exchange/attachment_uploadable.go @@ -3,8 +3,8 @@ package exchange import ( "context" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - msusers "github.com/microsoftgraph/msgraph-beta-sdk-go/users" + "github.com/microsoftgraph/msgraph-sdk-go/models" + msusers "github.com/microsoftgraph/msgraph-sdk-go/users" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/graph" diff --git a/src/internal/connector/exchange/exchange_data_collection.go b/src/internal/connector/exchange/exchange_data_collection.go index e168ed082..ce37beab6 100644 --- a/src/internal/connector/exchange/exchange_data_collection.go +++ b/src/internal/connector/exchange/exchange_data_collection.go @@ -257,6 +257,24 @@ func (col *Collection) streamItems(ctx context.Context) { break } + // If the data is no longer available just return here and chalk it up + // as a success. There's no reason to retry and no way we can backup up + // enough information to restore the item anyway. + if e := graph.IsErrDeletedInFlight(err); e != nil { + atomic.AddInt64(&success, 1) + logger.Ctx(ctx).Infow( + "Graph reported item not found", + "error", + e, + "service", + path.ExchangeService.String(), + "category", + col.category.String, + ) + + return + } + if i < numberOfRetries { time.Sleep(time.Duration(3*(i+1)) * time.Second) } @@ -270,6 +288,16 @@ func (col *Collection) streamItems(ctx context.Context) { // attempted items. if e := graph.IsErrDeletedInFlight(err); e != nil { atomic.AddInt64(&success, 1) + logger.Ctx(ctx).Infow( + "Graph reported item not found", + "error", + e, + "service", + path.ExchangeService.String(), + "category", + col.category.String, + ) + return } diff --git a/src/internal/connector/exchange/service_restore.go b/src/internal/connector/exchange/service_restore.go index c6017f09d..d385dab81 100644 --- a/src/internal/connector/exchange/service_restore.go +++ b/src/internal/connector/exchange/service_restore.go @@ -7,7 +7,7 @@ import ( "reflect" "runtime/trace" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/common" diff --git a/src/internal/connector/graph/betasdk/beta_client.go b/src/internal/connector/graph/betasdk/beta_client.go new file mode 100644 index 000000000..515e1de95 --- /dev/null +++ b/src/internal/connector/graph/betasdk/beta_client.go @@ -0,0 +1,86 @@ +package betasdk + +import ( + i1a3c1a5501c5e41b7fd169f2d4c768dce9b096ac28fb5431bf02afcc57295411 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/sites" + absser "github.com/microsoft/kiota-abstractions-go" + kioser "github.com/microsoft/kiota-abstractions-go/serialization" + kform "github.com/microsoft/kiota-serialization-form-go" + kw "github.com/microsoft/kiota-serialization-json-go" + ktext "github.com/microsoft/kiota-serialization-text-go" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" +) + +// BetaClient the main entry point of the SDK, exposes the configuration and the fluent API. +// Minimal Beta Connector: +// Details on how the Code was generated is present in `kioter-lock.json`. +// NOTE: kiota gen file is altered to indicate what files are included in the created +// +// Changes to Sites Directory: +// Access files send requests with an adapter's with ASync() support. +// This feature is not enabled in v1.0. Manually changed in remaining files. +// Additionally, only calls that begin as client.SitesBy(siteID).Pages() have an endpoint. +// +// The use case specific to Pages(). All other requests should be routed to the /internal/connector/graph.Servicer +// Specifics on `betaClient.SitesById(siteID).Pages` are located: sites/site_item_request_builder.go +// +// Required model files are identified as `modelFiles` in kiota-lock.json. Directory -> betasdk/models +// Required access files are identified as `sitesFiles` in kiota-lock.json. Directory -> betasdk/sites +// +// BetaClient minimal msgraph-beta-sdk-go for connecting to msgraph-beta-sdk-go +// for retrieving `SharePoint.Pages`. Code is generated from kiota.dev. +// requestAdapter is registered with the following the serializers: +// -- "Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory", +// -- "Microsoft.Kiota.Serialization.Text.TextParseNodeFactory", +// -- "Microsoft.Kiota.Serialization.Form.FormParseNodeFactory" +type BetaClient struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter *msgraphsdk.GraphRequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// NewBetaClient instantiates a new BetaClient and sets the default values. +// func NewBetaClient(requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*BetaClient) { +func NewBetaClient(requestAdapter *msgraphsdk.GraphRequestAdapter) *BetaClient { + m := &BetaClient{} + m.pathParameters = make(map[string]string) + m.urlTemplate = "{+baseurl}" + m.requestAdapter = requestAdapter + absser.RegisterDefaultSerializer(func() kioser.SerializationWriterFactory { + return kw.NewJsonSerializationWriterFactory() + }) + absser.RegisterDefaultSerializer(func() kioser.SerializationWriterFactory { + return ktext.NewTextSerializationWriterFactory() + }) + absser.RegisterDefaultSerializer(func() kioser.SerializationWriterFactory { + return kform.NewFormSerializationWriterFactory() + }) + absser.RegisterDefaultDeserializer(func() kioser.ParseNodeFactory { + return kw.NewJsonParseNodeFactory() + }) + absser.RegisterDefaultDeserializer(func() kioser.ParseNodeFactory { + return ktext.NewTextParseNodeFactory() + }) + absser.RegisterDefaultDeserializer(func() kioser.ParseNodeFactory { + return kform.NewFormParseNodeFactory() + }) + + if m.requestAdapter.GetBaseUrl() == "" { + m.requestAdapter.SetBaseUrl("https://graph.microsoft.com/beta") + } + return m +} + +// SitesById provides operations to manage the collection of site entities. +func (m *BetaClient) SitesById(id string) *i1a3c1a5501c5e41b7fd169f2d4c768dce9b096ac28fb5431bf02afcc57295411.SiteItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + if id != "" { + urlTplParams["site%2Did"] = id + } + return i1a3c1a5501c5e41b7fd169f2d4c768dce9b096ac28fb5431bf02afcc57295411.NewSiteItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} diff --git a/src/internal/connector/graph/betasdk/beta_client_test.go b/src/internal/connector/graph/betasdk/beta_client_test.go new file mode 100644 index 000000000..16b09a101 --- /dev/null +++ b/src/internal/connector/graph/betasdk/beta_client_test.go @@ -0,0 +1,107 @@ +package betasdk + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "github.com/alcionai/corso/src/internal/connector/graph" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" + "github.com/alcionai/corso/src/internal/tester" + "github.com/alcionai/corso/src/pkg/account" +) + +type BetaClientSuite struct { + suite.Suite + credentials account.M365Config +} + +func TestBetaClientSuite(t *testing.T) { + suite.Run(t, new(BetaClientSuite)) +} + +func (suite *BetaClientSuite) SetupSuite() { + t := suite.T() + a := tester.NewM365Account(t) + m365, err := a.M365Config() + require.NoError(t, err) + + suite.credentials = m365 +} + +func (suite *BetaClientSuite) TestCreateBetaClient() { + t := suite.T() + adpt, err := graph.CreateAdapter( + suite.credentials.AzureTenantID, + suite.credentials.AzureClientID, + suite.credentials.AzureClientSecret, + ) + + require.NoError(t, err) + + client := NewBetaClient(adpt) + assert.NotNil(t, client) +} + +// TestBasicClientGetFunctionality. Tests that adapter is able +// to parse retrieved Site Page. Additional tests should +// be handled within the /internal/connector/sharepoint when +// additional features are added. +func (suite *BetaClientSuite) TestBasicClientGetFunctionality() { + ctx, flush := tester.NewContext() + defer flush() + t := suite.T() + adpt, err := graph.CreateAdapter( + suite.credentials.AzureTenantID, + suite.credentials.AzureClientID, + suite.credentials.AzureClientSecret, + ) + + require.NoError(t, err) + client := NewBetaClient(adpt) + require.NotNil(t, client) + + siteID := tester.M365SiteID(t) + // TODO(dadams39) document allowable calls in main + collection, err := client.SitesById(siteID).Pages().Get(ctx, nil) + // Ensures that the client is able to receive data from beta + // Not Registered Error: content type application/json does not have a factory registered to be parsed + require.NoError(t, err) + + for _, page := range collection.GetValue() { + assert.NotNil(t, page, "betasdk call for page does not return value.") + + if page != nil { + t.Logf("Page :%s ", *page.GetName()) + assert.NotNil(t, page.GetId()) + } + } +} + +func (suite *BetaClientSuite) TestServiceRequirements() { + t := suite.T() + + adpt, err := graph.CreateAdapter( + suite.credentials.AzureTenantID, + suite.credentials.AzureClientID, + suite.credentials.AzureClientSecret, + ) + require.NoError(t, err) + + service := NewService(adpt) + require.NotNil(t, service) + + testPage := models.NewSitePage() + name := "testFile" + desc := "working with parsing" + + testPage.SetName(&name) + testPage.SetDescription(&desc) + + byteArray, err := service.Serialize(testPage) + assert.NotEmpty(t, byteArray) + assert.NoError(t, err) + +} diff --git a/src/internal/connector/graph/betasdk/beta_service.go b/src/internal/connector/graph/betasdk/beta_service.go new file mode 100644 index 000000000..a528c7f9c --- /dev/null +++ b/src/internal/connector/graph/betasdk/beta_service.go @@ -0,0 +1,44 @@ +package betasdk + +import ( + absser "github.com/microsoft/kiota-abstractions-go/serialization" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" + "github.com/pkg/errors" +) + +// Service wraps BetaClient's functionality. +// Abstraction created to comply loosely with graph.Servicer +// methods for ease of switching between v1.0 and beta connnectors +type Service struct { + client *BetaClient +} + +func (s Service) Adapter() *msgraphsdk.GraphRequestAdapter { + return s.client.requestAdapter +} + +func (s Service) Client() *BetaClient { + return s.client +} + +func NewService(adpt *msgraphsdk.GraphRequestAdapter) *Service { + return &Service{ + client: NewBetaClient(adpt), + } +} + +// Seraialize writes an M365 parsable object into a byte array using the built-in +// application/json writer within the adapter. +func (s Service) Serialize(object absser.Parsable) ([]byte, error) { + writer, err := s.Adapter().GetSerializationWriterFactory().GetSerializationWriter("application/json") + if err != nil || writer == nil { + return nil, errors.Wrap(err, "creating json serialization writer") + } + + err = writer.WriteObjectValue("", object) + if err != nil { + return nil, errors.Wrap(err, "writeObjecValue serialization") + } + + return writer.GetSerializedContent() +} diff --git a/src/internal/connector/graph/betasdk/kiota-lock.json b/src/internal/connector/graph/betasdk/kiota-lock.json new file mode 100644 index 000000000..21a111aef --- /dev/null +++ b/src/internal/connector/graph/betasdk/kiota-lock.json @@ -0,0 +1,131 @@ +{ + "lockFileVersion": "1.0.0", + "kiotaVersion": "0.10.0.0", + "clientClassName": "BetaClient", + "clientNamespaceName": "github.com/alcionai/corso/src/internal/connector/graph/betasdk", + "language": "Go", + "betaVersion": "0.53.0", + "usesBackingStore": false, + "includeAdditionalData": true, + "serializers": [ + "Microsoft.Kiota.Serialization.Json.JsonSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Text.TextSerializationWriterFactory", + "Microsoft.Kiota.Serialization.Form.FormSerializationWriterFactory" + ], + "deserializers": [ + "Microsoft.Kiota.Serialization.Json.JsonParseNodeFactory", + "Microsoft.Kiota.Serialization.Text.TextParseNodeFactory", + "Microsoft.Kiota.Serialization.Form.FormParseNodeFactory" + ], + "structuredMimeTypes": [ + "application/json", + "text/plain", + "application/x-www-form-urlencoded" + ], + "includePatterns": [ + "**/sites/**" + ], + "excludePatterns": [ + "**/admin/**", + "**/users/**", + "**/groups/**", + "**/onenote/**" + ], + "sitesFiles": [ + "count_request_builder.go", + "item_pages_count_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_count_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_horizontal_section_item_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_item_columns_count_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_item_columns_horizontal_section_column_item_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_count_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_item_get_position_of_web_part_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_web_part_item_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_item_columns_request_builder.go", + "item_pages_item_canvas_layout_horizontal_sections_request_builder.go", + "item_pages_item_canvas_layout_request_builder.go", + "item_pages_item_canvas_layout_vertical_section_request_builder.go", + "item_pages_item_canvas_layout_vertical_section_webparts_count_request_builder.go", + "item_pages_item_canvas_layout_vertical_section_webparts_item_get_position_of_web_part_request_builder.go", + "item_pages_item_canvas_layout_vertical_section_webparts_request_builder.go", + "item_pages_item_canvas_layout_vertical_section_webparts_web_part_item_request_builder.go", + "item_pages_item_get_web_parts_by_position_post_request_body.go", + "item_pages_item_get_web_parts_by_position_post_request_bodyable.go", + "item_pages_item_get_web_parts_by_position_request_builder.go", + "item_pages_item_get_web_parts_by_position_response.go", + "item_pages_item_get_web_parts_by_position_responseable.go", + "item_pages_item_publish_request_builder.go", + "item_pages_item_web_parts_count_request_builder.go", + "item_pages_item_web_parts_item_get_position_of_web_part_request_builder.go", + "item_pages_item_web_parts_request_builder.go", + "item_pages_item_web_parts_web_part_item_request_builder.go", + "item_pages_request_builder.go", + "item_pages_site_page_item_request_builder.go", + "item_sites_count_request_builder.go", + "item_sites_site_item_request_builder.go", + "site_item_request_builder.go" + ], + "modelFiles":[ + "base_item.go", + "page_layout_type.go", + "standard_web_partable.go", + "canvas_layout.go", + "page_promotion_type.go", + "text_web_part.go", + "canvas_layoutable.go", + "publication_facet.go", + "text_web_part_collection_response.go", + "horizontal_section.go", + "publication_facetable.go", + "text_web_part_collection_responseable.go", + "horizontal_section_collection_response.go", + "reactions_facet.go", + "text_web_partable.go", + "horizontal_section_collection_responseable.go", + "reactions_facetable.go", + "title_area.go", + "horizontal_section_column.go", + "section_emphasis_type.go", + "title_area_layout_type.go", + "horizontal_section_column_collection_response.go", + "server_processed_content.go", + "title_area_text_alignment_type.go", + "horizontal_section_column_collection_responseable.go", + "server_processed_contentable.go", + "title_areaable.go", + "horizontal_section_columnable.go", + "site_access_type.go", + "vertical_section.go", + "horizontal_section_layout_type.go", + "site_page.go", + "vertical_sectionable.go", + "horizontal_sectionable.go", + "site_page_collection_response.go", + "web_part.go", + "meta_data_key_string_pair.go", + "site_page_collection_responseable.go", + "web_part_collection_response.go", + "meta_data_key_string_pair_collection_response.go", + "site_pageable.go", + "web_part_collection_responseable.go", + "meta_data_key_string_pair_collection_responseable.go", + "site_security_level.go", + "web_part_data.go", + "meta_data_key_string_pairable.go", + "site_settings.go", + "web_part_dataable.go", + "meta_data_key_value_pair.go", + "site_settingsable.go", + "web_part_position.go", + "meta_data_key_value_pair_collection_response.go", + "standard_web_part.go", + "web_part_positionable.go", + "meta_data_key_value_pair_collection_responseable.go", + "standard_web_part_collection_response.go", + "web_partable.go", + "meta_data_key_value_pairable.go", + "standard_web_part_collection_responseable.go" + ], + "disabledValidationRules": [] +} diff --git a/src/internal/connector/graph/betasdk/models/base_item.go b/src/internal/connector/graph/betasdk/models/base_item.go new file mode 100644 index 000000000..880262348 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/base_item.go @@ -0,0 +1,379 @@ +package models + +import ( + i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e "time" + + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// BaseItem +type BaseItem struct { + msmodel.Entity + // Identity of the user, device, or application which created the item. Read-only. + createdBy msmodel.IdentitySetable + // The createdByUser property + createdByUser msmodel.Userable + // Date and time of item creation. Read-only. + createdDateTime *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time + // The description property + description *string + // ETag for the item. Read-only. + eTag *string + // Identity of the user, device, and application which last modified the item. Read-only. + lastModifiedBy msmodel.IdentitySetable + // The lastModifiedByUser property + lastModifiedByUser msmodel.Userable + // Date and time the item was last modified. Read-only. + lastModifiedDateTime *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time + // The name of the item. Read-write. + name *string + // Parent information, if the item has a parent. Read-write. + parentReference msmodel.ItemReferenceable + // URL that displays the resource in the browser. Read-only. + webUrl *string +} + +// NewBaseItem instantiates a new baseItem and sets the default values. +func NewBaseItem() *BaseItem { + m := &BaseItem{ + Entity: *msmodel.NewEntity(), + } + return m +} + +// CreateBaseItemFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateBaseItemFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + if parseNode != nil { + mappingValueNode, err := parseNode.GetChildNode("@odata.type") + if err != nil { + return nil, err + } + if mappingValueNode != nil { + mappingValue, err := mappingValueNode.GetStringValue() + if err != nil { + return nil, err + } + if mappingValue != nil { + switch *mappingValue { + case "#microsoft.graph.drive": + return msmodel.NewDrive(), nil + case "#microsoft.graph.driveItem": + return msmodel.NewDriveItem(), nil + case "#microsoft.graph.list": + return msmodel.NewList(), nil + case "#microsoft.graph.listItem": + return msmodel.NewListItem(), nil + case "#microsoft.graph.sharedDriveItem": + return msmodel.NewSharedDriveItem(), nil + case "#microsoft.graph.site": + return msmodel.NewSite(), nil + case "#microsoft.graph.sitePage": + return NewSitePage(), nil + } + } + } + } + return NewBaseItem(), nil +} + +// GetCreatedBy gets the createdBy property value. Identity of the user, device, or application which created the item. Read-only. +func (m *BaseItem) GetCreatedBy() msmodel.IdentitySetable { + return m.createdBy +} + +// GetCreatedByUser gets the createdByUser property value. The createdByUser property +func (m *BaseItem) GetCreatedByUser() msmodel.Userable { + return m.createdByUser +} + +// GetCreatedDateTime gets the createdDateTime property value. Date and time of item creation. Read-only. +func (m *BaseItem) GetCreatedDateTime() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time { + return m.createdDateTime +} + +// GetDescription gets the description property value. The description property +func (m *BaseItem) GetDescription() *string { + return m.description +} + +// GetETag gets the eTag property value. ETag for the item. Read-only. +func (m *BaseItem) GetETag() *string { + return m.eTag +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *BaseItem) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.Entity.GetFieldDeserializers() + res["createdBy"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateIdentitySetFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetCreatedBy(val.(msmodel.IdentitySetable)) + } + return nil + } + res["createdByUser"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateUserFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetCreatedByUser(val.(msmodel.Userable)) + } + return nil + } + res["createdDateTime"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetTimeValue() + if err != nil { + return err + } + if val != nil { + m.SetCreatedDateTime(val) + } + return nil + } + res["description"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetDescription(val) + } + return nil + } + res["eTag"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetETag(val) + } + return nil + } + res["lastModifiedBy"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateIdentitySetFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetLastModifiedBy(val.(msmodel.IdentitySetable)) + } + return nil + } + res["lastModifiedByUser"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateUserFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetLastModifiedByUser(val.(msmodel.Userable)) + } + return nil + } + res["lastModifiedDateTime"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetTimeValue() + if err != nil { + return err + } + if val != nil { + m.SetLastModifiedDateTime(val) + } + return nil + } + res["name"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetName(val) + } + return nil + } + res["parentReference"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateItemReferenceFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetParentReference(val.(msmodel.ItemReferenceable)) + } + return nil + } + res["webUrl"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetWebUrl(val) + } + return nil + } + return res +} + +// GetLastModifiedBy gets the lastModifiedBy property value. Identity of the user, device, and application which last modified the item. Read-only. +func (m *BaseItem) GetLastModifiedBy() msmodel.IdentitySetable { + return m.lastModifiedBy +} + +// GetLastModifiedByUser gets the lastModifiedByUser property value. The lastModifiedByUser property +func (m *BaseItem) GetLastModifiedByUser() msmodel.Userable { + return m.lastModifiedByUser +} + +// GetLastModifiedDateTime gets the lastModifiedDateTime property value. Date and time the item was last modified. Read-only. +func (m *BaseItem) GetLastModifiedDateTime() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time { + return m.lastModifiedDateTime +} + +// GetName gets the name property value. The name of the item. Read-write. +func (m *BaseItem) GetName() *string { + return m.name +} + +// GetParentReference gets the parentReference property value. Parent information, if the item has a parent. Read-write. +func (m *BaseItem) GetParentReference() msmodel.ItemReferenceable { + return m.parentReference +} + +// GetWebUrl gets the webUrl property value. URL that displays the resource in the browser. Read-only. +func (m *BaseItem) GetWebUrl() *string { + return m.webUrl +} + +// Serialize serializes information the current object +func (m *BaseItem) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.Entity.Serialize(writer) + if err != nil { + return err + } + { + err = writer.WriteObjectValue("createdBy", m.GetCreatedBy()) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("createdByUser", m.GetCreatedByUser()) + if err != nil { + return err + } + } + { + err = writer.WriteTimeValue("createdDateTime", m.GetCreatedDateTime()) + if err != nil { + return err + } + } + { + err = writer.WriteStringValue("description", m.GetDescription()) + if err != nil { + return err + } + } + { + err = writer.WriteStringValue("eTag", m.GetETag()) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("lastModifiedBy", m.GetLastModifiedBy()) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("lastModifiedByUser", m.GetLastModifiedByUser()) + if err != nil { + return err + } + } + { + err = writer.WriteTimeValue("lastModifiedDateTime", m.GetLastModifiedDateTime()) + if err != nil { + return err + } + } + { + err = writer.WriteStringValue("name", m.GetName()) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("parentReference", m.GetParentReference()) + if err != nil { + return err + } + } + { + err = writer.WriteStringValue("webUrl", m.GetWebUrl()) + if err != nil { + return err + } + } + return nil +} + +// SetCreatedBy sets the createdBy property value. Identity of the user, device, or application which created the item. Read-only. +func (m *BaseItem) SetCreatedBy(value msmodel.IdentitySetable) { + m.createdBy = value +} + +// SetCreatedByUser sets the createdByUser property value. The createdByUser property +func (m *BaseItem) SetCreatedByUser(value msmodel.Userable) { + m.createdByUser = value +} + +// SetCreatedDateTime sets the createdDateTime property value. Date and time of item creation. Read-only. +func (m *BaseItem) SetCreatedDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { + m.createdDateTime = value +} + +// SetDescription sets the description property value. The description property +func (m *BaseItem) SetDescription(value *string) { + m.description = value +} + +// SetETag sets the eTag property value. ETag for the item. Read-only. +func (m *BaseItem) SetETag(value *string) { + m.eTag = value +} + +// SetLastModifiedBy sets the lastModifiedBy property value. Identity of the user, device, and application which last modified the item. Read-only. +func (m *BaseItem) SetLastModifiedBy(value msmodel.IdentitySetable) { + m.lastModifiedBy = value +} + +// SetLastModifiedByUser sets the lastModifiedByUser property value. The lastModifiedByUser property +func (m *BaseItem) SetLastModifiedByUser(value msmodel.Userable) { + m.lastModifiedByUser = value +} + +// SetLastModifiedDateTime sets the lastModifiedDateTime property value. Date and time the item was last modified. Read-only. +func (m *BaseItem) SetLastModifiedDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time) { + m.lastModifiedDateTime = value +} + +// SetName sets the name property value. The name of the item. Read-write. +func (m *BaseItem) SetName(value *string) { + m.name = value +} + +// SetParentReference sets the parentReference property value. Parent information, if the item has a parent. Read-write. +func (m *BaseItem) SetParentReference(value msmodel.ItemReferenceable) { + m.parentReference = value +} + +// SetWebUrl sets the webUrl property value. URL that displays the resource in the browser. Read-only. +func (m *BaseItem) SetWebUrl(value *string) { + m.webUrl = value +} diff --git a/src/internal/connector/graph/betasdk/models/canvas_layout.go b/src/internal/connector/graph/betasdk/models/canvas_layout.go new file mode 100644 index 000000000..cda577a77 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/canvas_layout.go @@ -0,0 +1,103 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// CanvasLayout +type CanvasLayout struct { + msmodel.Entity + // Collection of horizontal sections on the SharePoint page. + horizontalSections []HorizontalSectionable + // Vertical section on the SharePoint page. + verticalSection VerticalSectionable +} + +// NewCanvasLayout instantiates a new canvasLayout and sets the default values. +func NewCanvasLayout() *CanvasLayout { + m := &CanvasLayout{ + Entity: *msmodel.NewEntity(), + } + return m +} + +// CreateCanvasLayoutFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateCanvasLayoutFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewCanvasLayout(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *CanvasLayout) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.Entity.GetFieldDeserializers() + res["horizontalSections"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateHorizontalSectionFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]HorizontalSectionable, len(val)) + for i, v := range val { + res[i] = v.(HorizontalSectionable) + } + m.SetHorizontalSections(res) + } + return nil + } + res["verticalSection"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateVerticalSectionFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetVerticalSection(val.(VerticalSectionable)) + } + return nil + } + return res +} + +// GetHorizontalSections gets the horizontalSections property value. Collection of horizontal sections on the SharePoint page. +func (m *CanvasLayout) GetHorizontalSections() []HorizontalSectionable { + return m.horizontalSections +} + +// GetVerticalSection gets the verticalSection property value. Vertical section on the SharePoint page. +func (m *CanvasLayout) GetVerticalSection() VerticalSectionable { + return m.verticalSection +} + +// Serialize serializes information the current object +func (m *CanvasLayout) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.Entity.Serialize(writer) + if err != nil { + return err + } + if m.GetHorizontalSections() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHorizontalSections())) + for i, v := range m.GetHorizontalSections() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("horizontalSections", cast) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("verticalSection", m.GetVerticalSection()) + if err != nil { + return err + } + } + return nil +} + +// SetHorizontalSections sets the horizontalSections property value. Collection of horizontal sections on the SharePoint page. +func (m *CanvasLayout) SetHorizontalSections(value []HorizontalSectionable) { + m.horizontalSections = value +} + +// SetVerticalSection sets the verticalSection property value. Vertical section on the SharePoint page. +func (m *CanvasLayout) SetVerticalSection(value VerticalSectionable) { + m.verticalSection = value +} diff --git a/src/internal/connector/graph/betasdk/models/canvas_layoutable.go b/src/internal/connector/graph/betasdk/models/canvas_layoutable.go new file mode 100644 index 000000000..537d5b0df --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/canvas_layoutable.go @@ -0,0 +1,16 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// CanvasLayoutable +type CanvasLayoutable interface { + msmodel.Entityable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetHorizontalSections() []HorizontalSectionable + GetVerticalSection() VerticalSectionable + SetHorizontalSections(value []HorizontalSectionable) + SetVerticalSection(value VerticalSectionable) +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section.go b/src/internal/connector/graph/betasdk/models/horizontal_section.go new file mode 100644 index 000000000..3e143d40f --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section.go @@ -0,0 +1,133 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSection provides operations to call the remove method. +type HorizontalSection struct { + msmodel.Entity + // The set of vertical columns in this section. + columns []HorizontalSectionColumnable + // Enumeration value that indicates the emphasis of the section background. The possible values are: none, netural, soft, strong, unknownFutureValue. + emphasis *SectionEmphasisType + // Layout type of the section. The possible values are: none, oneColumn, twoColumns, threeColumns, oneThirdLeftColumn, oneThirdRightColumn, fullWidth, unknownFutureValue. + layout *HorizontalSectionLayoutType +} + +// NewHorizontalSection instantiates a new horizontalSection and sets the default values. +func NewHorizontalSection() *HorizontalSection { + m := &HorizontalSection{ + Entity: *msmodel.NewEntity(), + } + return m +} + +// CreateHorizontalSectionFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateHorizontalSectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewHorizontalSection(), nil +} + +// GetColumns gets the columns property value. The set of vertical columns in this section. +func (m *HorizontalSection) GetColumns() []HorizontalSectionColumnable { + return m.columns +} + +// GetEmphasis gets the emphasis property value. Enumeration value that indicates the emphasis of the section background. The possible values are: none, netural, soft, strong, unknownFutureValue. +func (m *HorizontalSection) GetEmphasis() *SectionEmphasisType { + return m.emphasis +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *HorizontalSection) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.Entity.GetFieldDeserializers() + res["columns"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateHorizontalSectionColumnFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]HorizontalSectionColumnable, len(val)) + for i, v := range val { + res[i] = v.(HorizontalSectionColumnable) + } + m.SetColumns(res) + } + return nil + } + res["emphasis"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseSectionEmphasisType) + if err != nil { + return err + } + if val != nil { + m.SetEmphasis(val.(*SectionEmphasisType)) + } + return nil + } + res["layout"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseHorizontalSectionLayoutType) + if err != nil { + return err + } + if val != nil { + m.SetLayout(val.(*HorizontalSectionLayoutType)) + } + return nil + } + return res +} + +// GetLayout gets the layout property value. Layout type of the section. The possible values are: none, oneColumn, twoColumns, threeColumns, oneThirdLeftColumn, oneThirdRightColumn, fullWidth, unknownFutureValue. +func (m *HorizontalSection) GetLayout() *HorizontalSectionLayoutType { + return m.layout +} + +// Serialize serializes information the current object +func (m *HorizontalSection) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.Entity.Serialize(writer) + if err != nil { + return err + } + if m.GetColumns() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetColumns())) + for i, v := range m.GetColumns() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("columns", cast) + if err != nil { + return err + } + } + if m.GetEmphasis() != nil { + cast := (*m.GetEmphasis()).String() + err = writer.WriteStringValue("emphasis", &cast) + if err != nil { + return err + } + } + if m.GetLayout() != nil { + cast := (*m.GetLayout()).String() + err = writer.WriteStringValue("layout", &cast) + if err != nil { + return err + } + } + return nil +} + +// SetColumns sets the columns property value. The set of vertical columns in this section. +func (m *HorizontalSection) SetColumns(value []HorizontalSectionColumnable) { + m.columns = value +} + +// SetEmphasis sets the emphasis property value. Enumeration value that indicates the emphasis of the section background. The possible values are: none, netural, soft, strong, unknownFutureValue. +func (m *HorizontalSection) SetEmphasis(value *SectionEmphasisType) { + m.emphasis = value +} + +// SetLayout sets the layout property value. Layout type of the section. The possible values are: none, oneColumn, twoColumns, threeColumns, oneThirdLeftColumn, oneThirdRightColumn, fullWidth, unknownFutureValue. +func (m *HorizontalSection) SetLayout(value *HorizontalSectionLayoutType) { + m.layout = value +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section_collection_response.go b/src/internal/connector/graph/betasdk/models/horizontal_section_collection_response.go new file mode 100644 index 000000000..70fb40959 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section_collection_response.go @@ -0,0 +1,75 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSectionCollectionResponse +type HorizontalSectionCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []HorizontalSectionable +} + +// NewHorizontalSectionCollectionResponse instantiates a new HorizontalSectionCollectionResponse and sets the default values. +func NewHorizontalSectionCollectionResponse() *HorizontalSectionCollectionResponse { + m := &HorizontalSectionCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateHorizontalSectionCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateHorizontalSectionCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewHorizontalSectionCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *HorizontalSectionCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateHorizontalSectionFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]HorizontalSectionable, len(val)) + for i, v := range val { + res[i] = v.(HorizontalSectionable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *HorizontalSectionCollectionResponse) GetValue() []HorizontalSectionable { + return m.value +} + +// Serialize serializes information the current object +func (m *HorizontalSectionCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *HorizontalSectionCollectionResponse) SetValue(value []HorizontalSectionable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section_collection_responseable.go b/src/internal/connector/graph/betasdk/models/horizontal_section_collection_responseable.go new file mode 100644 index 000000000..a46d55060 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSectionCollectionResponseable +type HorizontalSectionCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []HorizontalSectionable + SetValue(value []HorizontalSectionable) +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section_column.go b/src/internal/connector/graph/betasdk/models/horizontal_section_column.go new file mode 100644 index 000000000..f00261c16 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section_column.go @@ -0,0 +1,103 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSectionColumn provides operations to call the remove method. +type HorizontalSectionColumn struct { + msmodel.Entity + // The collection of WebParts in this column. + webparts []WebPartable + // Width of the column. A horizontal section is divided into 12 grids. A column should have a value of 1-12 to represent its range spans. For example, there can be two columns both have a width of 6 in a section. + width *int32 +} + +// NewHorizontalSectionColumn instantiates a new horizontalSectionColumn and sets the default values. +func NewHorizontalSectionColumn() *HorizontalSectionColumn { + m := &HorizontalSectionColumn{ + Entity: *msmodel.NewEntity(), + } + return m +} + +// CreateHorizontalSectionColumnFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateHorizontalSectionColumnFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewHorizontalSectionColumn(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *HorizontalSectionColumn) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.Entity.GetFieldDeserializers() + res["webparts"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateWebPartFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]WebPartable, len(val)) + for i, v := range val { + res[i] = v.(WebPartable) + } + m.SetWebparts(res) + } + return nil + } + res["width"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetWidth(val) + } + return nil + } + return res +} + +// GetWebparts gets the webparts property value. The collection of WebParts in this column. +func (m *HorizontalSectionColumn) GetWebparts() []WebPartable { + return m.webparts +} + +// GetWidth gets the width property value. Width of the column. A horizontal section is divided into 12 grids. A column should have a value of 1-12 to represent its range spans. For example, there can be two columns both have a width of 6 in a section. +func (m *HorizontalSectionColumn) GetWidth() *int32 { + return m.width +} + +// Serialize serializes information the current object +func (m *HorizontalSectionColumn) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.Entity.Serialize(writer) + if err != nil { + return err + } + if m.GetWebparts() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetWebparts())) + for i, v := range m.GetWebparts() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("webparts", cast) + if err != nil { + return err + } + } + { + err = writer.WriteInt32Value("width", m.GetWidth()) + if err != nil { + return err + } + } + return nil +} + +// SetWebparts sets the webparts property value. The collection of WebParts in this column. +func (m *HorizontalSectionColumn) SetWebparts(value []WebPartable) { + m.webparts = value +} + +// SetWidth sets the width property value. Width of the column. A horizontal section is divided into 12 grids. A column should have a value of 1-12 to represent its range spans. For example, there can be two columns both have a width of 6 in a section. +func (m *HorizontalSectionColumn) SetWidth(value *int32) { + m.width = value +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section_column_collection_response.go b/src/internal/connector/graph/betasdk/models/horizontal_section_column_collection_response.go new file mode 100644 index 000000000..081244d8f --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section_column_collection_response.go @@ -0,0 +1,75 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSectionColumnCollectionResponse +type HorizontalSectionColumnCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []HorizontalSectionColumnable +} + +// NewHorizontalSectionColumnCollectionResponse instantiates a new HorizontalSectionColumnCollectionResponse and sets the default values. +func NewHorizontalSectionColumnCollectionResponse() *HorizontalSectionColumnCollectionResponse { + m := &HorizontalSectionColumnCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateHorizontalSectionColumnCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateHorizontalSectionColumnCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewHorizontalSectionColumnCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *HorizontalSectionColumnCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateHorizontalSectionColumnFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]HorizontalSectionColumnable, len(val)) + for i, v := range val { + res[i] = v.(HorizontalSectionColumnable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *HorizontalSectionColumnCollectionResponse) GetValue() []HorizontalSectionColumnable { + return m.value +} + +// Serialize serializes information the current object +func (m *HorizontalSectionColumnCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *HorizontalSectionColumnCollectionResponse) SetValue(value []HorizontalSectionColumnable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section_column_collection_responseable.go b/src/internal/connector/graph/betasdk/models/horizontal_section_column_collection_responseable.go new file mode 100644 index 000000000..b52c33b35 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section_column_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSectionColumnCollectionResponseable +type HorizontalSectionColumnCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []HorizontalSectionColumnable + SetValue(value []HorizontalSectionColumnable) +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section_columnable.go b/src/internal/connector/graph/betasdk/models/horizontal_section_columnable.go new file mode 100644 index 000000000..f4f185a4a --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section_columnable.go @@ -0,0 +1,16 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSectionColumnable +type HorizontalSectionColumnable interface { + msmodel.Entityable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetWebparts() []WebPartable + GetWidth() *int32 + SetWebparts(value []WebPartable) + SetWidth(value *int32) +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_section_layout_type.go b/src/internal/connector/graph/betasdk/models/horizontal_section_layout_type.go new file mode 100644 index 000000000..43c2643a2 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_section_layout_type.go @@ -0,0 +1,52 @@ +package models +import ( + "errors" +) +// Provides operations to call the remove method. +type HorizontalSectionLayoutType int + +const ( + NONE_HORIZONTALSECTIONLAYOUTTYPE HorizontalSectionLayoutType = iota + ONECOLUMN_HORIZONTALSECTIONLAYOUTTYPE + TWOCOLUMNS_HORIZONTALSECTIONLAYOUTTYPE + THREECOLUMNS_HORIZONTALSECTIONLAYOUTTYPE + ONETHIRDLEFTCOLUMN_HORIZONTALSECTIONLAYOUTTYPE + ONETHIRDRIGHTCOLUMN_HORIZONTALSECTIONLAYOUTTYPE + FULLWIDTH_HORIZONTALSECTIONLAYOUTTYPE + UNKNOWNFUTUREVALUE_HORIZONTALSECTIONLAYOUTTYPE +) + +func (i HorizontalSectionLayoutType) String() string { + return []string{"none", "oneColumn", "twoColumns", "threeColumns", "oneThirdLeftColumn", "oneThirdRightColumn", "fullWidth", "unknownFutureValue"}[i] +} +func ParseHorizontalSectionLayoutType(v string) (interface{}, error) { + result := NONE_HORIZONTALSECTIONLAYOUTTYPE + switch v { + case "none": + result = NONE_HORIZONTALSECTIONLAYOUTTYPE + case "oneColumn": + result = ONECOLUMN_HORIZONTALSECTIONLAYOUTTYPE + case "twoColumns": + result = TWOCOLUMNS_HORIZONTALSECTIONLAYOUTTYPE + case "threeColumns": + result = THREECOLUMNS_HORIZONTALSECTIONLAYOUTTYPE + case "oneThirdLeftColumn": + result = ONETHIRDLEFTCOLUMN_HORIZONTALSECTIONLAYOUTTYPE + case "oneThirdRightColumn": + result = ONETHIRDRIGHTCOLUMN_HORIZONTALSECTIONLAYOUTTYPE + case "fullWidth": + result = FULLWIDTH_HORIZONTALSECTIONLAYOUTTYPE + case "unknownFutureValue": + result = UNKNOWNFUTUREVALUE_HORIZONTALSECTIONLAYOUTTYPE + default: + return 0, errors.New("Unknown HorizontalSectionLayoutType value: " + v) + } + return &result, nil +} +func SerializeHorizontalSectionLayoutType(values []HorizontalSectionLayoutType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/horizontal_sectionable.go b/src/internal/connector/graph/betasdk/models/horizontal_sectionable.go new file mode 100644 index 000000000..5ed926080 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/horizontal_sectionable.go @@ -0,0 +1,18 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// HorizontalSectionable +type HorizontalSectionable interface { + msmodel.Entityable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetColumns() []HorizontalSectionColumnable + GetEmphasis() *SectionEmphasisType + GetLayout() *HorizontalSectionLayoutType + SetColumns(value []HorizontalSectionColumnable) + SetEmphasis(value *SectionEmphasisType) + SetLayout(value *HorizontalSectionLayoutType) +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair.go b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair.go new file mode 100644 index 000000000..e7df06165 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair.go @@ -0,0 +1,123 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// MetaDataKeyStringPair +type MetaDataKeyStringPair struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // Key of the meta data. + key *string + // The OdataType property + odataType *string + // Value of the meta data. + value *string +} +// NewMetaDataKeyStringPair instantiates a new metaDataKeyStringPair and sets the default values. +func NewMetaDataKeyStringPair()(*MetaDataKeyStringPair) { + m := &MetaDataKeyStringPair{ + } + m.SetAdditionalData(make(map[string]interface{})); + return m +} +// CreateMetaDataKeyStringPairFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateMetaDataKeyStringPairFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewMetaDataKeyStringPair(), nil +} +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *MetaDataKeyStringPair) GetAdditionalData()(map[string]interface{}) { + return m.additionalData +} +// GetFieldDeserializers the deserialization information for the current model +func (m *MetaDataKeyStringPair) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["key"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetKey(val) + } + return nil + } + res["@odata.type"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["value"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetValue(val) + } + return nil + } + return res +} +// GetKey gets the key property value. Key of the meta data. +func (m *MetaDataKeyStringPair) GetKey()(*string) { + return m.key +} +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *MetaDataKeyStringPair) GetOdataType()(*string) { + return m.odataType +} +// GetValue gets the value property value. Value of the meta data. +func (m *MetaDataKeyStringPair) GetValue()(*string) { + return m.value +} +// Serialize serializes information the current object +func (m *MetaDataKeyStringPair) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteStringValue("key", m.GetKey()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("value", m.GetValue()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *MetaDataKeyStringPair) SetAdditionalData(value map[string]interface{})() { + m.additionalData = value +} +// SetKey sets the key property value. Key of the meta data. +func (m *MetaDataKeyStringPair) SetKey(value *string)() { + m.key = value +} +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *MetaDataKeyStringPair) SetOdataType(value *string)() { + m.odataType = value +} +// SetValue sets the value property value. Value of the meta data. +func (m *MetaDataKeyStringPair) SetValue(value *string)() { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair_collection_response.go b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair_collection_response.go new file mode 100644 index 000000000..b5c88ce49 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair_collection_response.go @@ -0,0 +1,75 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// MetaDataKeyStringPairCollectionResponse +type MetaDataKeyStringPairCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []MetaDataKeyStringPairable +} + +// NewMetaDataKeyStringPairCollectionResponse instantiates a new MetaDataKeyStringPairCollectionResponse and sets the default values. +func NewMetaDataKeyStringPairCollectionResponse() *MetaDataKeyStringPairCollectionResponse { + m := &MetaDataKeyStringPairCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateMetaDataKeyStringPairCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateMetaDataKeyStringPairCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewMetaDataKeyStringPairCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *MetaDataKeyStringPairCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyStringPairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyStringPairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyStringPairable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *MetaDataKeyStringPairCollectionResponse) GetValue() []MetaDataKeyStringPairable { + return m.value +} + +// Serialize serializes information the current object +func (m *MetaDataKeyStringPairCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *MetaDataKeyStringPairCollectionResponse) SetValue(value []MetaDataKeyStringPairable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair_collection_responseable.go b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair_collection_responseable.go new file mode 100644 index 000000000..ad657d982 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pair_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// MetaDataKeyStringPairCollectionResponseable +type MetaDataKeyStringPairCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []MetaDataKeyStringPairable + SetValue(value []MetaDataKeyStringPairable) +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_string_pairable.go b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pairable.go new file mode 100644 index 000000000..49908469e --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_string_pairable.go @@ -0,0 +1,17 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// MetaDataKeyStringPairable +type MetaDataKeyStringPairable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetKey()(*string) + GetOdataType()(*string) + GetValue()(*string) + SetKey(value *string)() + SetOdataType(value *string)() + SetValue(value *string)() +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair.go b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair.go new file mode 100644 index 000000000..a64ebdf0d --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair.go @@ -0,0 +1,135 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// MetaDataKeyValuePair +type MetaDataKeyValuePair struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // Key of the metadata. + key *string + // The OdataType property + odataType *string + // Value of the metadata. Should be an object. + value msmodel.Jsonable +} + +// NewMetaDataKeyValuePair instantiates a new metaDataKeyValuePair and sets the default values. +func NewMetaDataKeyValuePair() *MetaDataKeyValuePair { + m := &MetaDataKeyValuePair{} + m.SetAdditionalData(make(map[string]interface{})) + return m +} + +// CreateMetaDataKeyValuePairFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateMetaDataKeyValuePairFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewMetaDataKeyValuePair(), nil +} + +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *MetaDataKeyValuePair) GetAdditionalData() map[string]interface{} { + return m.additionalData +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *MetaDataKeyValuePair) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error) + res["key"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetKey(val) + } + return nil + } + res["@odata.type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateJsonFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetValue(val.(msmodel.Jsonable)) + } + return nil + } + return res +} + +// GetKey gets the key property value. Key of the metadata. +func (m *MetaDataKeyValuePair) GetKey() *string { + return m.key +} + +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *MetaDataKeyValuePair) GetOdataType() *string { + return m.odataType +} + +// GetValue gets the value property value. Value of the metadata. Should be an object. +func (m *MetaDataKeyValuePair) GetValue() msmodel.Jsonable { + return m.value +} + +// Serialize serializes information the current object +func (m *MetaDataKeyValuePair) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + { + err := writer.WriteStringValue("key", m.GetKey()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteObjectValue("value", m.GetValue()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} + +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *MetaDataKeyValuePair) SetAdditionalData(value map[string]interface{}) { + m.additionalData = value +} + +// SetKey sets the key property value. Key of the metadata. +func (m *MetaDataKeyValuePair) SetKey(value *string) { + m.key = value +} + +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *MetaDataKeyValuePair) SetOdataType(value *string) { + m.odataType = value +} + +// SetValue sets the value property value. Value of the metadata. Should be an object. +func (m *MetaDataKeyValuePair) SetValue(value msmodel.Jsonable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair_collection_response.go b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair_collection_response.go new file mode 100644 index 000000000..747cec59f --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair_collection_response.go @@ -0,0 +1,75 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// MetaDataKeyValuePairCollectionResponse +type MetaDataKeyValuePairCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []MetaDataKeyValuePairable +} + +// NewMetaDataKeyValuePairCollectionResponse instantiates a new MetaDataKeyValuePairCollectionResponse and sets the default values. +func NewMetaDataKeyValuePairCollectionResponse() *MetaDataKeyValuePairCollectionResponse { + m := &MetaDataKeyValuePairCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateMetaDataKeyValuePairCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateMetaDataKeyValuePairCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewMetaDataKeyValuePairCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *MetaDataKeyValuePairCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyValuePairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyValuePairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyValuePairable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *MetaDataKeyValuePairCollectionResponse) GetValue() []MetaDataKeyValuePairable { + return m.value +} + +// Serialize serializes information the current object +func (m *MetaDataKeyValuePairCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *MetaDataKeyValuePairCollectionResponse) SetValue(value []MetaDataKeyValuePairable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair_collection_responseable.go b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair_collection_responseable.go new file mode 100644 index 000000000..b2740c217 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pair_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// MetaDataKeyValuePairCollectionResponseable +type MetaDataKeyValuePairCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []MetaDataKeyValuePairable + SetValue(value []MetaDataKeyValuePairable) +} diff --git a/src/internal/connector/graph/betasdk/models/meta_data_key_value_pairable.go b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pairable.go new file mode 100644 index 000000000..e1bc31e74 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/meta_data_key_value_pairable.go @@ -0,0 +1,18 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// MetaDataKeyValuePairable +type MetaDataKeyValuePairable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetKey() *string + GetOdataType() *string + GetValue() msmodel.Jsonable + SetKey(value *string) + SetOdataType(value *string) + SetValue(value msmodel.Jsonable) +} diff --git a/src/internal/connector/graph/betasdk/models/page_layout_type.go b/src/internal/connector/graph/betasdk/models/page_layout_type.go new file mode 100644 index 000000000..0338a5c30 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/page_layout_type.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// Provides operations to call the remove method. +type PageLayoutType int + +const ( + MICROSOFTRESERVED_PAGELAYOUTTYPE PageLayoutType = iota + ARTICLE_PAGELAYOUTTYPE + HOME_PAGELAYOUTTYPE + UNKNOWNFUTUREVALUE_PAGELAYOUTTYPE +) + +func (i PageLayoutType) String() string { + return []string{"microsoftReserved", "article", "home", "unknownFutureValue"}[i] +} +func ParsePageLayoutType(v string) (interface{}, error) { + result := MICROSOFTRESERVED_PAGELAYOUTTYPE + switch v { + case "microsoftReserved": + result = MICROSOFTRESERVED_PAGELAYOUTTYPE + case "article": + result = ARTICLE_PAGELAYOUTTYPE + case "home": + result = HOME_PAGELAYOUTTYPE + case "unknownFutureValue": + result = UNKNOWNFUTUREVALUE_PAGELAYOUTTYPE + default: + return 0, errors.New("Unknown PageLayoutType value: " + v) + } + return &result, nil +} +func SerializePageLayoutType(values []PageLayoutType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/page_promotion_type.go b/src/internal/connector/graph/betasdk/models/page_promotion_type.go new file mode 100644 index 000000000..a8cbcd058 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/page_promotion_type.go @@ -0,0 +1,40 @@ +package models +import ( + "errors" +) +// Provides operations to call the remove method. +type PagePromotionType int + +const ( + MICROSOFTRESERVED_PAGEPROMOTIONTYPE PagePromotionType = iota + PAGE_PAGEPROMOTIONTYPE + NEWSPOST_PAGEPROMOTIONTYPE + UNKNOWNFUTUREVALUE_PAGEPROMOTIONTYPE +) + +func (i PagePromotionType) String() string { + return []string{"microsoftReserved", "page", "newsPost", "unknownFutureValue"}[i] +} +func ParsePagePromotionType(v string) (interface{}, error) { + result := MICROSOFTRESERVED_PAGEPROMOTIONTYPE + switch v { + case "microsoftReserved": + result = MICROSOFTRESERVED_PAGEPROMOTIONTYPE + case "page": + result = PAGE_PAGEPROMOTIONTYPE + case "newsPost": + result = NEWSPOST_PAGEPROMOTIONTYPE + case "unknownFutureValue": + result = UNKNOWNFUTUREVALUE_PAGEPROMOTIONTYPE + default: + return 0, errors.New("Unknown PagePromotionType value: " + v) + } + return &result, nil +} +func SerializePagePromotionType(values []PagePromotionType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/publication_facet.go b/src/internal/connector/graph/betasdk/models/publication_facet.go new file mode 100644 index 000000000..87e59d34b --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/publication_facet.go @@ -0,0 +1,123 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// PublicationFacet +type PublicationFacet struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // The state of publication for this document. Either published or checkout. Read-only. + level *string + // The OdataType property + odataType *string + // The unique identifier for the version that is visible to the current caller. Read-only. + versionId *string +} +// NewPublicationFacet instantiates a new publicationFacet and sets the default values. +func NewPublicationFacet()(*PublicationFacet) { + m := &PublicationFacet{ + } + m.SetAdditionalData(make(map[string]interface{})); + return m +} +// CreatePublicationFacetFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreatePublicationFacetFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewPublicationFacet(), nil +} +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *PublicationFacet) GetAdditionalData()(map[string]interface{}) { + return m.additionalData +} +// GetFieldDeserializers the deserialization information for the current model +func (m *PublicationFacet) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["level"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetLevel(val) + } + return nil + } + res["@odata.type"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["versionId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetVersionId(val) + } + return nil + } + return res +} +// GetLevel gets the level property value. The state of publication for this document. Either published or checkout. Read-only. +func (m *PublicationFacet) GetLevel()(*string) { + return m.level +} +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *PublicationFacet) GetOdataType()(*string) { + return m.odataType +} +// GetVersionId gets the versionId property value. The unique identifier for the version that is visible to the current caller. Read-only. +func (m *PublicationFacet) GetVersionId()(*string) { + return m.versionId +} +// Serialize serializes information the current object +func (m *PublicationFacet) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteStringValue("level", m.GetLevel()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("versionId", m.GetVersionId()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *PublicationFacet) SetAdditionalData(value map[string]interface{})() { + m.additionalData = value +} +// SetLevel sets the level property value. The state of publication for this document. Either published or checkout. Read-only. +func (m *PublicationFacet) SetLevel(value *string)() { + m.level = value +} +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *PublicationFacet) SetOdataType(value *string)() { + m.odataType = value +} +// SetVersionId sets the versionId property value. The unique identifier for the version that is visible to the current caller. Read-only. +func (m *PublicationFacet) SetVersionId(value *string)() { + m.versionId = value +} diff --git a/src/internal/connector/graph/betasdk/models/publication_facetable.go b/src/internal/connector/graph/betasdk/models/publication_facetable.go new file mode 100644 index 000000000..20d82ccf8 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/publication_facetable.go @@ -0,0 +1,17 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// PublicationFacetable +type PublicationFacetable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetLevel()(*string) + GetOdataType()(*string) + GetVersionId()(*string) + SetLevel(value *string)() + SetOdataType(value *string)() + SetVersionId(value *string)() +} diff --git a/src/internal/connector/graph/betasdk/models/reactions_facet.go b/src/internal/connector/graph/betasdk/models/reactions_facet.go new file mode 100644 index 000000000..b298a9fe1 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/reactions_facet.go @@ -0,0 +1,149 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// ReactionsFacet +type ReactionsFacet struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // Count of comments. + commentCount *int32 + // Count of likes. + likeCount *int32 + // The OdataType property + odataType *string + // Count of shares. + shareCount *int32 +} +// NewReactionsFacet instantiates a new reactionsFacet and sets the default values. +func NewReactionsFacet()(*ReactionsFacet) { + m := &ReactionsFacet{ + } + m.SetAdditionalData(make(map[string]interface{})); + return m +} +// CreateReactionsFacetFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateReactionsFacetFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewReactionsFacet(), nil +} +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ReactionsFacet) GetAdditionalData()(map[string]interface{}) { + return m.additionalData +} +// GetCommentCount gets the commentCount property value. Count of comments. +func (m *ReactionsFacet) GetCommentCount()(*int32) { + return m.commentCount +} +// GetFieldDeserializers the deserialization information for the current model +func (m *ReactionsFacet) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["commentCount"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetCommentCount(val) + } + return nil + } + res["likeCount"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetLikeCount(val) + } + return nil + } + res["@odata.type"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["shareCount"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetShareCount(val) + } + return nil + } + return res +} +// GetLikeCount gets the likeCount property value. Count of likes. +func (m *ReactionsFacet) GetLikeCount()(*int32) { + return m.likeCount +} +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *ReactionsFacet) GetOdataType()(*string) { + return m.odataType +} +// GetShareCount gets the shareCount property value. Count of shares. +func (m *ReactionsFacet) GetShareCount()(*int32) { + return m.shareCount +} +// Serialize serializes information the current object +func (m *ReactionsFacet) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteInt32Value("commentCount", m.GetCommentCount()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("likeCount", m.GetLikeCount()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("shareCount", m.GetShareCount()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ReactionsFacet) SetAdditionalData(value map[string]interface{})() { + m.additionalData = value +} +// SetCommentCount sets the commentCount property value. Count of comments. +func (m *ReactionsFacet) SetCommentCount(value *int32)() { + m.commentCount = value +} +// SetLikeCount sets the likeCount property value. Count of likes. +func (m *ReactionsFacet) SetLikeCount(value *int32)() { + m.likeCount = value +} +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *ReactionsFacet) SetOdataType(value *string)() { + m.odataType = value +} +// SetShareCount sets the shareCount property value. Count of shares. +func (m *ReactionsFacet) SetShareCount(value *int32)() { + m.shareCount = value +} diff --git a/src/internal/connector/graph/betasdk/models/reactions_facetable.go b/src/internal/connector/graph/betasdk/models/reactions_facetable.go new file mode 100644 index 000000000..4e5086047 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/reactions_facetable.go @@ -0,0 +1,19 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// ReactionsFacetable +type ReactionsFacetable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetCommentCount()(*int32) + GetLikeCount()(*int32) + GetOdataType()(*string) + GetShareCount()(*int32) + SetCommentCount(value *int32)() + SetLikeCount(value *int32)() + SetOdataType(value *string)() + SetShareCount(value *int32)() +} diff --git a/src/internal/connector/graph/betasdk/models/section_emphasis_type.go b/src/internal/connector/graph/betasdk/models/section_emphasis_type.go new file mode 100644 index 000000000..0016aec10 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/section_emphasis_type.go @@ -0,0 +1,43 @@ +package models +import ( + "errors" +) +// Provides operations to call the remove method. +type SectionEmphasisType int + +const ( + NONE_SECTIONEMPHASISTYPE SectionEmphasisType = iota + NEUTRAL_SECTIONEMPHASISTYPE + SOFT_SECTIONEMPHASISTYPE + STRONG_SECTIONEMPHASISTYPE + UNKNOWNFUTUREVALUE_SECTIONEMPHASISTYPE +) + +func (i SectionEmphasisType) String() string { + return []string{"none", "neutral", "soft", "strong", "unknownFutureValue"}[i] +} +func ParseSectionEmphasisType(v string) (interface{}, error) { + result := NONE_SECTIONEMPHASISTYPE + switch v { + case "none": + result = NONE_SECTIONEMPHASISTYPE + case "neutral": + result = NEUTRAL_SECTIONEMPHASISTYPE + case "soft": + result = SOFT_SECTIONEMPHASISTYPE + case "strong": + result = STRONG_SECTIONEMPHASISTYPE + case "unknownFutureValue": + result = UNKNOWNFUTUREVALUE_SECTIONEMPHASISTYPE + default: + return 0, errors.New("Unknown SectionEmphasisType value: " + v) + } + return &result, nil +} +func SerializeSectionEmphasisType(values []SectionEmphasisType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/server_processed_content.go b/src/internal/connector/graph/betasdk/models/server_processed_content.go new file mode 100644 index 000000000..572a5f87a --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/server_processed_content.go @@ -0,0 +1,294 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// ServerProcessedContent +type ServerProcessedContent struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // A key-value map where keys are string identifiers and values are component ids. SharePoint servers might decide to use this hint to preload the script for corresponding components for performance boost. + componentDependencies []MetaDataKeyStringPairable + // A key-value map where keys are string identifier and values are object of custom key-value pair. + customMetadata []MetaDataKeyValuePairable + // A key-value map where keys are string identifiers and values are rich text with HTML format. SharePoint servers treat the values as HTML content and run services like safety checks, search index and link fixup on them. + htmlStrings []MetaDataKeyStringPairable + // A key-value map where keys are string identifiers and values are image sources. SharePoint servers treat the values as image sources and run services like search index and link fixup on them. + imageSources []MetaDataKeyStringPairable + // A key-value map where keys are string identifiers and values are links. SharePoint servers treat the values as links and run services like link fixup on them. + links []MetaDataKeyStringPairable + // The OdataType property + odataType *string + // A key-value map where keys are string identifiers and values are strings that should be search indexed. + searchablePlainTexts []MetaDataKeyStringPairable +} + +// NewServerProcessedContent instantiates a new serverProcessedContent and sets the default values. +func NewServerProcessedContent() *ServerProcessedContent { + m := &ServerProcessedContent{} + m.SetAdditionalData(make(map[string]interface{})) + return m +} + +// CreateServerProcessedContentFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateServerProcessedContentFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewServerProcessedContent(), nil +} + +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ServerProcessedContent) GetAdditionalData() map[string]interface{} { + return m.additionalData +} + +// GetComponentDependencies gets the componentDependencies property value. A key-value map where keys are string identifiers and values are component ids. SharePoint servers might decide to use this hint to preload the script for corresponding components for performance boost. +func (m *ServerProcessedContent) GetComponentDependencies() []MetaDataKeyStringPairable { + return m.componentDependencies +} + +// GetCustomMetadata gets the customMetadata property value. A key-value map where keys are string identifier and values are object of custom key-value pair. +func (m *ServerProcessedContent) GetCustomMetadata() []MetaDataKeyValuePairable { + return m.customMetadata +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *ServerProcessedContent) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error) + res["componentDependencies"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyStringPairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyStringPairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyStringPairable) + } + m.SetComponentDependencies(res) + } + return nil + } + res["customMetadata"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyValuePairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyValuePairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyValuePairable) + } + m.SetCustomMetadata(res) + } + return nil + } + res["htmlStrings"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyStringPairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyStringPairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyStringPairable) + } + m.SetHtmlStrings(res) + } + return nil + } + res["imageSources"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyStringPairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyStringPairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyStringPairable) + } + m.SetImageSources(res) + } + return nil + } + res["links"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyStringPairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyStringPairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyStringPairable) + } + m.SetLinks(res) + } + return nil + } + res["@odata.type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["searchablePlainTexts"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateMetaDataKeyStringPairFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]MetaDataKeyStringPairable, len(val)) + for i, v := range val { + res[i] = v.(MetaDataKeyStringPairable) + } + m.SetSearchablePlainTexts(res) + } + return nil + } + return res +} + +// GetHtmlStrings gets the htmlStrings property value. A key-value map where keys are string identifiers and values are rich text with HTML format. SharePoint servers treat the values as HTML content and run services like safety checks, search index and link fixup on them. +func (m *ServerProcessedContent) GetHtmlStrings() []MetaDataKeyStringPairable { + return m.htmlStrings +} + +// GetImageSources gets the imageSources property value. A key-value map where keys are string identifiers and values are image sources. SharePoint servers treat the values as image sources and run services like search index and link fixup on them. +func (m *ServerProcessedContent) GetImageSources() []MetaDataKeyStringPairable { + return m.imageSources +} + +// GetLinks gets the links property value. A key-value map where keys are string identifiers and values are links. SharePoint servers treat the values as links and run services like link fixup on them. +func (m *ServerProcessedContent) GetLinks() []MetaDataKeyStringPairable { + return m.links +} + +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *ServerProcessedContent) GetOdataType() *string { + return m.odataType +} + +// GetSearchablePlainTexts gets the searchablePlainTexts property value. A key-value map where keys are string identifiers and values are strings that should be search indexed. +func (m *ServerProcessedContent) GetSearchablePlainTexts() []MetaDataKeyStringPairable { + return m.searchablePlainTexts +} + +// Serialize serializes information the current object +func (m *ServerProcessedContent) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + if m.GetComponentDependencies() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetComponentDependencies())) + for i, v := range m.GetComponentDependencies() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err := writer.WriteCollectionOfObjectValues("componentDependencies", cast) + if err != nil { + return err + } + } + if m.GetCustomMetadata() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetCustomMetadata())) + for i, v := range m.GetCustomMetadata() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err := writer.WriteCollectionOfObjectValues("customMetadata", cast) + if err != nil { + return err + } + } + if m.GetHtmlStrings() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetHtmlStrings())) + for i, v := range m.GetHtmlStrings() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err := writer.WriteCollectionOfObjectValues("htmlStrings", cast) + if err != nil { + return err + } + } + if m.GetImageSources() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetImageSources())) + for i, v := range m.GetImageSources() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err := writer.WriteCollectionOfObjectValues("imageSources", cast) + if err != nil { + return err + } + } + if m.GetLinks() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetLinks())) + for i, v := range m.GetLinks() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err := writer.WriteCollectionOfObjectValues("links", cast) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + if m.GetSearchablePlainTexts() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetSearchablePlainTexts())) + for i, v := range m.GetSearchablePlainTexts() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err := writer.WriteCollectionOfObjectValues("searchablePlainTexts", cast) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} + +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *ServerProcessedContent) SetAdditionalData(value map[string]interface{}) { + m.additionalData = value +} + +// SetComponentDependencies sets the componentDependencies property value. A key-value map where keys are string identifiers and values are component ids. SharePoint servers might decide to use this hint to preload the script for corresponding components for performance boost. +func (m *ServerProcessedContent) SetComponentDependencies(value []MetaDataKeyStringPairable) { + m.componentDependencies = value +} + +// SetCustomMetadata sets the customMetadata property value. A key-value map where keys are string identifier and values are object of custom key-value pair. +func (m *ServerProcessedContent) SetCustomMetadata(value []MetaDataKeyValuePairable) { + m.customMetadata = value +} + +// SetHtmlStrings sets the htmlStrings property value. A key-value map where keys are string identifiers and values are rich text with HTML format. SharePoint servers treat the values as HTML content and run services like safety checks, search index and link fixup on them. +func (m *ServerProcessedContent) SetHtmlStrings(value []MetaDataKeyStringPairable) { + m.htmlStrings = value +} + +// SetImageSources sets the imageSources property value. A key-value map where keys are string identifiers and values are image sources. SharePoint servers treat the values as image sources and run services like search index and link fixup on them. +func (m *ServerProcessedContent) SetImageSources(value []MetaDataKeyStringPairable) { + m.imageSources = value +} + +// SetLinks sets the links property value. A key-value map where keys are string identifiers and values are links. SharePoint servers treat the values as links and run services like link fixup on them. +func (m *ServerProcessedContent) SetLinks(value []MetaDataKeyStringPairable) { + m.links = value +} + +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *ServerProcessedContent) SetOdataType(value *string) { + m.odataType = value +} + +// SetSearchablePlainTexts sets the searchablePlainTexts property value. A key-value map where keys are string identifiers and values are strings that should be search indexed. +func (m *ServerProcessedContent) SetSearchablePlainTexts(value []MetaDataKeyStringPairable) { + m.searchablePlainTexts = value +} diff --git a/src/internal/connector/graph/betasdk/models/server_processed_contentable.go b/src/internal/connector/graph/betasdk/models/server_processed_contentable.go new file mode 100644 index 000000000..5f9faed1a --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/server_processed_contentable.go @@ -0,0 +1,25 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// ServerProcessedContentable +type ServerProcessedContentable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetComponentDependencies() []MetaDataKeyStringPairable + GetCustomMetadata() []MetaDataKeyValuePairable + GetHtmlStrings() []MetaDataKeyStringPairable + GetImageSources() []MetaDataKeyStringPairable + GetLinks() []MetaDataKeyStringPairable + GetOdataType() *string + GetSearchablePlainTexts() []MetaDataKeyStringPairable + SetComponentDependencies(value []MetaDataKeyStringPairable) + SetCustomMetadata(value []MetaDataKeyValuePairable) + SetHtmlStrings(value []MetaDataKeyStringPairable) + SetImageSources(value []MetaDataKeyStringPairable) + SetLinks(value []MetaDataKeyStringPairable) + SetOdataType(value *string) + SetSearchablePlainTexts(value []MetaDataKeyStringPairable) +} diff --git a/src/internal/connector/graph/betasdk/models/site_access_type.go b/src/internal/connector/graph/betasdk/models/site_access_type.go new file mode 100644 index 000000000..052a2efdb --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_access_type.go @@ -0,0 +1,37 @@ +package models +import ( + "errors" +) +// Provides operations to call the remove method. +type SiteAccessType int + +const ( + BLOCK_SITEACCESSTYPE SiteAccessType = iota + FULL_SITEACCESSTYPE + LIMITED_SITEACCESSTYPE +) + +func (i SiteAccessType) String() string { + return []string{"block", "full", "limited"}[i] +} +func ParseSiteAccessType(v string) (interface{}, error) { + result := BLOCK_SITEACCESSTYPE + switch v { + case "block": + result = BLOCK_SITEACCESSTYPE + case "full": + result = FULL_SITEACCESSTYPE + case "limited": + result = LIMITED_SITEACCESSTYPE + default: + return 0, errors.New("Unknown SiteAccessType value: " + v) + } + return &result, nil +} +func SerializeSiteAccessType(values []SiteAccessType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/site_page.go b/src/internal/connector/graph/betasdk/models/site_page.go new file mode 100644 index 000000000..7555fed52 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_page.go @@ -0,0 +1,387 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// SitePage provides operations to call the remove method. +type SitePage struct { + BaseItem + // Indicates the layout of the content in a given SharePoint page, including horizontal sections and vertical section + canvasLayout CanvasLayoutable + // Inherited from baseItem. + contentType msmodel.ContentTypeInfoable + // The name of the page layout of the page. The possible values are: microsoftReserved, article, home, unknownFutureValue. + pageLayout *PageLayoutType + // Indicates the promotion kind of the sitePage. The possible values are: microsoftReserved, page, newsPost, unknownFutureValue. + promotionKind *PagePromotionType + // The publishing status and the MM.mm version of the page. + publishingState PublicationFacetable + // Reactions information for the page. + reactions 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 + thumbnailWebUrl *string + // Title of the sitePage. + title *string + // Title area on the SharePoint page. + titleArea TitleAreaable + // Collection of webparts on the SharePoint page + webParts []WebPartable +} + +// NewSitePage instantiates a new sitePage and sets the default values. +func NewSitePage() *SitePage { + m := &SitePage{ + BaseItem: *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 i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewSitePage(), nil +} + +// GetCanvasLayout gets the canvasLayout property value. Indicates the layout of the content in a given SharePoint page, including horizontal sections and vertical section +func (m *SitePage) GetCanvasLayout() CanvasLayoutable { + return m.canvasLayout +} + +// GetContentType gets the contentType property value. Inherited from baseItem. +func (m *SitePage) GetContentType() msmodel.ContentTypeInfoable { + return m.contentType +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *SitePage) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseItem.GetFieldDeserializers() + res["canvasLayout"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateCanvasLayoutFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetCanvasLayout(val.(CanvasLayoutable)) + } + return nil + } + res["contentType"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateContentTypeInfoFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetContentType(val.(msmodel.ContentTypeInfoable)) + } + return nil + } + res["pageLayout"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParsePageLayoutType) + if err != nil { + return err + } + if val != nil { + m.SetPageLayout(val.(*PageLayoutType)) + } + return nil + } + res["promotionKind"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParsePagePromotionType) + if err != nil { + return err + } + if val != nil { + m.SetPromotionKind(val.(*PagePromotionType)) + } + return nil + } + res["publishingState"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreatePublicationFacetFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetPublishingState(val.(PublicationFacetable)) + } + return nil + } + res["reactions"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateReactionsFacetFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetReactions(val.(ReactionsFacetable)) + } + return nil + } + res["showComments"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetShowComments(val) + } + return nil + } + res["showRecommendedPages"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetShowRecommendedPages(val) + } + return nil + } + res["thumbnailWebUrl"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetThumbnailWebUrl(val) + } + return nil + } + res["title"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetTitle(val) + } + return nil + } + res["titleArea"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateTitleAreaFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetTitleArea(val.(TitleAreaable)) + } + return nil + } + res["webParts"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateWebPartFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]WebPartable, len(val)) + for i, v := range val { + res[i] = v.(WebPartable) + } + m.SetWebParts(res) + } + return nil + } + return res +} + +// GetPageLayout gets the pageLayout property value. The name of the page layout of the page. The possible values are: microsoftReserved, article, home, unknownFutureValue. +func (m *SitePage) GetPageLayout() *PageLayoutType { + return m.pageLayout +} + +// GetPromotionKind gets the promotionKind property value. Indicates the promotion kind of the sitePage. The possible values are: microsoftReserved, page, newsPost, unknownFutureValue. +func (m *SitePage) GetPromotionKind() *PagePromotionType { + return m.promotionKind +} + +// GetPublishingState gets the publishingState property value. The publishing status and the MM.mm version of the page. +func (m *SitePage) GetPublishingState() PublicationFacetable { + return m.publishingState +} + +// GetReactions gets the reactions property value. Reactions information for the page. +func (m *SitePage) GetReactions() ReactionsFacetable { + return m.reactions +} + +// 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 +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 +} + +// GetTitleArea gets the titleArea property value. Title area on the SharePoint page. +func (m *SitePage) GetTitleArea() TitleAreaable { + return m.titleArea +} + +// GetWebParts gets the webParts property value. Collection of webparts on the SharePoint page +func (m *SitePage) GetWebParts() []WebPartable { + return m.webParts +} + +// Serialize serializes information the current object +func (m *SitePage) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseItem.Serialize(writer) + if err != nil { + return err + } + { + err = writer.WriteObjectValue("canvasLayout", m.GetCanvasLayout()) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("contentType", m.GetContentType()) + if err != nil { + return err + } + } + if m.GetPageLayout() != nil { + cast := (*m.GetPageLayout()).String() + err = writer.WriteStringValue("pageLayout", &cast) + if err != nil { + return err + } + } + if m.GetPromotionKind() != nil { + cast := (*m.GetPromotionKind()).String() + err = writer.WriteStringValue("promotionKind", &cast) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("publishingState", m.GetPublishingState()) + if err != nil { + return err + } + } + { + err = writer.WriteObjectValue("reactions", m.GetReactions()) + 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 + } + } + { + err = writer.WriteObjectValue("titleArea", m.GetTitleArea()) + if err != nil { + return err + } + } + if m.GetWebParts() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetWebParts())) + for i, v := range m.GetWebParts() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("webParts", cast) + if err != nil { + return err + } + } + return nil +} + +// SetCanvasLayout sets the canvasLayout property value. Indicates the layout of the content in a given SharePoint page, including horizontal sections and vertical section +func (m *SitePage) SetCanvasLayout(value CanvasLayoutable) { + m.canvasLayout = value +} + +// SetContentType sets the contentType property value. Inherited from baseItem. +func (m *SitePage) SetContentType(value msmodel.ContentTypeInfoable) { + m.contentType = value +} + +// SetPageLayout sets the pageLayout property value. The name of the page layout of the page. The possible values are: microsoftReserved, article, home, unknownFutureValue. +func (m *SitePage) SetPageLayout(value *PageLayoutType) { + m.pageLayout = value +} + +// SetPromotionKind sets the promotionKind property value. Indicates the promotion kind of the sitePage. The possible values are: microsoftReserved, page, newsPost, unknownFutureValue. +func (m *SitePage) SetPromotionKind(value *PagePromotionType) { + m.promotionKind = value +} + +// SetPublishingState sets the publishingState property value. The publishing status and the MM.mm version of the page. +func (m *SitePage) SetPublishingState(value PublicationFacetable) { + m.publishingState = value +} + +// SetReactions sets the reactions property value. Reactions information for the page. +func (m *SitePage) SetReactions(value ReactionsFacetable) { + m.reactions = 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 +func (m *SitePage) SetThumbnailWebUrl(value *string) { + m.thumbnailWebUrl = value +} + +// SetTitle sets the title property value. Title of the sitePage. +func (m *SitePage) SetTitle(value *string) { + m.title = value +} + +// SetTitleArea sets the titleArea property value. Title area on the SharePoint page. +func (m *SitePage) SetTitleArea(value TitleAreaable) { + m.titleArea = value +} + +// SetWebParts sets the webParts property value. Collection of webparts on the SharePoint page +func (m *SitePage) SetWebParts(value []WebPartable) { + m.webParts = value +} diff --git a/src/internal/connector/graph/betasdk/models/site_page_collection_response.go b/src/internal/connector/graph/betasdk/models/site_page_collection_response.go new file mode 100644 index 000000000..f66cdafdf --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_page_collection_response.go @@ -0,0 +1,76 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// SitePageCollectionResponse provides operations to manage the pages property of the microsoft.graph.site entity. +type SitePageCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []SitePageable +} + +// NewSitePageCollectionResponse instantiates a new SitePageCollectionResponse and sets the default values. +func NewSitePageCollectionResponse() *SitePageCollectionResponse { + m := &SitePageCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateSitePageCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateSitePageCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewSitePageCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *SitePageCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateSitePageFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]SitePageable, len(val)) + for i, v := range val { + res[i] = v.(SitePageable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *SitePageCollectionResponse) GetValue() []SitePageable { + return m.value +} + +// Serialize serializes information the current object +func (m *SitePageCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *SitePageCollectionResponse) SetValue(value []SitePageable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/site_page_collection_responseable.go b/src/internal/connector/graph/betasdk/models/site_page_collection_responseable.go new file mode 100644 index 000000000..30cceeb11 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_page_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// SitePageCollectionResponseable +type SitePageCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []SitePageable + SetValue(value []SitePageable) +} diff --git a/src/internal/connector/graph/betasdk/models/site_pageable.go b/src/internal/connector/graph/betasdk/models/site_pageable.go new file mode 100644 index 000000000..1131bfa9d --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_pageable.go @@ -0,0 +1,36 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// SitePageable +type SitePageable interface { + msmodel.BaseItemable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetCanvasLayout() CanvasLayoutable + GetContentType() msmodel.ContentTypeInfoable + GetPageLayout() *PageLayoutType + GetPromotionKind() *PagePromotionType + GetPublishingState() PublicationFacetable + GetReactions() ReactionsFacetable + GetShowComments() *bool + GetShowRecommendedPages() *bool + GetThumbnailWebUrl() *string + GetTitle() *string + GetTitleArea() TitleAreaable + GetWebParts() []WebPartable + SetCanvasLayout(value CanvasLayoutable) + SetContentType(value msmodel.ContentTypeInfoable) + SetPageLayout(value *PageLayoutType) + SetPromotionKind(value *PagePromotionType) + SetPublishingState(value PublicationFacetable) + SetReactions(value ReactionsFacetable) + SetShowComments(value *bool) + SetShowRecommendedPages(value *bool) + SetThumbnailWebUrl(value *string) + SetTitle(value *string) + SetTitleArea(value TitleAreaable) + SetWebParts(value []WebPartable) +} diff --git a/src/internal/connector/graph/betasdk/models/site_security_level.go b/src/internal/connector/graph/betasdk/models/site_security_level.go new file mode 100644 index 000000000..d2733ce47 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_security_level.go @@ -0,0 +1,52 @@ +package models +import ( + "errors" +) +// Provides operations to call the add method. +type SiteSecurityLevel int + +const ( + // User Defined, default value, no intent. + USERDEFINED_SITESECURITYLEVEL SiteSecurityLevel = iota + // Low. + LOW_SITESECURITYLEVEL + // Medium-low. + MEDIUMLOW_SITESECURITYLEVEL + // Medium. + MEDIUM_SITESECURITYLEVEL + // Medium-high. + MEDIUMHIGH_SITESECURITYLEVEL + // High. + HIGH_SITESECURITYLEVEL +) + +func (i SiteSecurityLevel) String() string { + return []string{"userDefined", "low", "mediumLow", "medium", "mediumHigh", "high"}[i] +} +func ParseSiteSecurityLevel(v string) (interface{}, error) { + result := USERDEFINED_SITESECURITYLEVEL + switch v { + case "userDefined": + result = USERDEFINED_SITESECURITYLEVEL + case "low": + result = LOW_SITESECURITYLEVEL + case "mediumLow": + result = MEDIUMLOW_SITESECURITYLEVEL + case "medium": + result = MEDIUM_SITESECURITYLEVEL + case "mediumHigh": + result = MEDIUMHIGH_SITESECURITYLEVEL + case "high": + result = HIGH_SITESECURITYLEVEL + default: + return 0, errors.New("Unknown SiteSecurityLevel value: " + v) + } + return &result, nil +} +func SerializeSiteSecurityLevel(values []SiteSecurityLevel) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/site_settings.go b/src/internal/connector/graph/betasdk/models/site_settings.go new file mode 100644 index 000000000..a2a36d94a --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_settings.go @@ -0,0 +1,123 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// SiteSettings +type SiteSettings struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // The language tag for the language used on this site. + languageTag *string + // The OdataType property + odataType *string + // Indicates the time offset for the time zone of the site from Coordinated Universal Time (UTC). + timeZone *string +} +// NewSiteSettings instantiates a new siteSettings and sets the default values. +func NewSiteSettings()(*SiteSettings) { + m := &SiteSettings{ + } + m.SetAdditionalData(make(map[string]interface{})); + return m +} +// CreateSiteSettingsFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateSiteSettingsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewSiteSettings(), nil +} +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *SiteSettings) GetAdditionalData()(map[string]interface{}) { + return m.additionalData +} +// GetFieldDeserializers the deserialization information for the current model +func (m *SiteSettings) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["languageTag"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetLanguageTag(val) + } + return nil + } + res["@odata.type"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["timeZone"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetTimeZone(val) + } + return nil + } + return res +} +// GetLanguageTag gets the languageTag property value. The language tag for the language used on this site. +func (m *SiteSettings) GetLanguageTag()(*string) { + return m.languageTag +} +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *SiteSettings) GetOdataType()(*string) { + return m.odataType +} +// GetTimeZone gets the timeZone property value. Indicates the time offset for the time zone of the site from Coordinated Universal Time (UTC). +func (m *SiteSettings) GetTimeZone()(*string) { + return m.timeZone +} +// Serialize serializes information the current object +func (m *SiteSettings) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteStringValue("languageTag", m.GetLanguageTag()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("timeZone", m.GetTimeZone()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *SiteSettings) SetAdditionalData(value map[string]interface{})() { + m.additionalData = value +} +// SetLanguageTag sets the languageTag property value. The language tag for the language used on this site. +func (m *SiteSettings) SetLanguageTag(value *string)() { + m.languageTag = value +} +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *SiteSettings) SetOdataType(value *string)() { + m.odataType = value +} +// SetTimeZone sets the timeZone property value. Indicates the time offset for the time zone of the site from Coordinated Universal Time (UTC). +func (m *SiteSettings) SetTimeZone(value *string)() { + m.timeZone = value +} diff --git a/src/internal/connector/graph/betasdk/models/site_settingsable.go b/src/internal/connector/graph/betasdk/models/site_settingsable.go new file mode 100644 index 000000000..0423550ea --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/site_settingsable.go @@ -0,0 +1,17 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// SiteSettingsable +type SiteSettingsable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetLanguageTag()(*string) + GetOdataType()(*string) + GetTimeZone()(*string) + SetLanguageTag(value *string)() + SetOdataType(value *string)() + SetTimeZone(value *string)() +} diff --git a/src/internal/connector/graph/betasdk/models/standard_web_part.go b/src/internal/connector/graph/betasdk/models/standard_web_part.go new file mode 100644 index 000000000..0b7b4427a --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/standard_web_part.go @@ -0,0 +1,88 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// StandardWebPart +type StandardWebPart struct { + WebPart + // Data of the webPart. + data WebPartDataable + // A Guid which indicates the type of the webParts + webPartType *string +} +// NewStandardWebPart instantiates a new StandardWebPart and sets the default values. +func NewStandardWebPart()(*StandardWebPart) { + m := &StandardWebPart{ + WebPart: *NewWebPart(), + } + odataTypeValue := "#microsoft.graph.standardWebPart"; + m.SetOdataType(&odataTypeValue); + return m +} +// CreateStandardWebPartFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateStandardWebPartFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewStandardWebPart(), nil +} +// GetData gets the data property value. Data of the webPart. +func (m *StandardWebPart) GetData()(WebPartDataable) { + return m.data +} +// GetFieldDeserializers the deserialization information for the current model +func (m *StandardWebPart) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := m.WebPart.GetFieldDeserializers() + res["data"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateWebPartDataFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetData(val.(WebPartDataable)) + } + return nil + } + res["webPartType"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetWebPartType(val) + } + return nil + } + return res +} +// GetWebPartType gets the webPartType property value. A Guid which indicates the type of the webParts +func (m *StandardWebPart) GetWebPartType()(*string) { + return m.webPartType +} +// Serialize serializes information the current object +func (m *StandardWebPart) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + err := m.WebPart.Serialize(writer) + if err != nil { + return err + } + { + err = writer.WriteObjectValue("data", m.GetData()) + if err != nil { + return err + } + } + { + err = writer.WriteStringValue("webPartType", m.GetWebPartType()) + if err != nil { + return err + } + } + return nil +} +// SetData sets the data property value. Data of the webPart. +func (m *StandardWebPart) SetData(value WebPartDataable)() { + m.data = value +} +// SetWebPartType sets the webPartType property value. A Guid which indicates the type of the webParts +func (m *StandardWebPart) SetWebPartType(value *string)() { + m.webPartType = value +} diff --git a/src/internal/connector/graph/betasdk/models/standard_web_part_collection_response.go b/src/internal/connector/graph/betasdk/models/standard_web_part_collection_response.go new file mode 100644 index 000000000..084496a8a --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/standard_web_part_collection_response.go @@ -0,0 +1,75 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// StandardWebPartCollectionResponse +type StandardWebPartCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []StandardWebPartable +} + +// NewStandardWebPartCollectionResponse instantiates a new StandardWebPartCollectionResponse and sets the default values. +func NewStandardWebPartCollectionResponse() *StandardWebPartCollectionResponse { + m := &StandardWebPartCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateStandardWebPartCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateStandardWebPartCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewStandardWebPartCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *StandardWebPartCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateStandardWebPartFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]StandardWebPartable, len(val)) + for i, v := range val { + res[i] = v.(StandardWebPartable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *StandardWebPartCollectionResponse) GetValue() []StandardWebPartable { + return m.value +} + +// Serialize serializes information the current object +func (m *StandardWebPartCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *StandardWebPartCollectionResponse) SetValue(value []StandardWebPartable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/standard_web_part_collection_responseable.go b/src/internal/connector/graph/betasdk/models/standard_web_part_collection_responseable.go new file mode 100644 index 000000000..9e1f4d0d7 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/standard_web_part_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// StandardWebPartCollectionResponseable +type StandardWebPartCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []StandardWebPartable + SetValue(value []StandardWebPartable) +} diff --git a/src/internal/connector/graph/betasdk/models/standard_web_partable.go b/src/internal/connector/graph/betasdk/models/standard_web_partable.go new file mode 100644 index 000000000..e09160b2b --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/standard_web_partable.go @@ -0,0 +1,15 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// StandardWebPartable +type StandardWebPartable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + WebPartable + GetData()(WebPartDataable) + GetWebPartType()(*string) + SetData(value WebPartDataable)() + SetWebPartType(value *string)() +} diff --git a/src/internal/connector/graph/betasdk/models/text_web_part.go b/src/internal/connector/graph/betasdk/models/text_web_part.go new file mode 100644 index 000000000..f607ffa31 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/text_web_part.go @@ -0,0 +1,62 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// TextWebPart +type TextWebPart struct { + WebPart + // The HTML string in text web part. + innerHtml *string +} +// NewTextWebPart instantiates a new TextWebPart and sets the default values. +func NewTextWebPart()(*TextWebPart) { + m := &TextWebPart{ + WebPart: *NewWebPart(), + } + odataTypeValue := "#microsoft.graph.textWebPart"; + m.SetOdataType(&odataTypeValue); + return m +} +// CreateTextWebPartFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateTextWebPartFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewTextWebPart(), nil +} +// GetFieldDeserializers the deserialization information for the current model +func (m *TextWebPart) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := m.WebPart.GetFieldDeserializers() + res["innerHtml"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetInnerHtml(val) + } + return nil + } + return res +} +// GetInnerHtml gets the innerHtml property value. The HTML string in text web part. +func (m *TextWebPart) GetInnerHtml()(*string) { + return m.innerHtml +} +// Serialize serializes information the current object +func (m *TextWebPart) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + err := m.WebPart.Serialize(writer) + if err != nil { + return err + } + { + err = writer.WriteStringValue("innerHtml", m.GetInnerHtml()) + if err != nil { + return err + } + } + return nil +} +// SetInnerHtml sets the innerHtml property value. The HTML string in text web part. +func (m *TextWebPart) SetInnerHtml(value *string)() { + m.innerHtml = value +} diff --git a/src/internal/connector/graph/betasdk/models/text_web_part_collection_response.go b/src/internal/connector/graph/betasdk/models/text_web_part_collection_response.go new file mode 100644 index 000000000..ea07beae7 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/text_web_part_collection_response.go @@ -0,0 +1,75 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// TextWebPartCollectionResponse +type TextWebPartCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []TextWebPartable +} + +// NewTextWebPartCollectionResponse instantiates a new TextWebPartCollectionResponse and sets the default values. +func NewTextWebPartCollectionResponse() *TextWebPartCollectionResponse { + m := &TextWebPartCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateTextWebPartCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateTextWebPartCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewTextWebPartCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *TextWebPartCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateTextWebPartFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]TextWebPartable, len(val)) + for i, v := range val { + res[i] = v.(TextWebPartable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *TextWebPartCollectionResponse) GetValue() []TextWebPartable { + return m.value +} + +// Serialize serializes information the current object +func (m *TextWebPartCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *TextWebPartCollectionResponse) SetValue(value []TextWebPartable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/text_web_part_collection_responseable.go b/src/internal/connector/graph/betasdk/models/text_web_part_collection_responseable.go new file mode 100644 index 000000000..785618756 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/text_web_part_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// TextWebPartCollectionResponseable +type TextWebPartCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []TextWebPartable + SetValue(value []TextWebPartable) +} diff --git a/src/internal/connector/graph/betasdk/models/text_web_partable.go b/src/internal/connector/graph/betasdk/models/text_web_partable.go new file mode 100644 index 000000000..45e21d92b --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/text_web_partable.go @@ -0,0 +1,13 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// TextWebPartable +type TextWebPartable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + WebPartable + GetInnerHtml()(*string) + SetInnerHtml(value *string)() +} diff --git a/src/internal/connector/graph/betasdk/models/title_area.go b/src/internal/connector/graph/betasdk/models/title_area.go new file mode 100644 index 000000000..77b61ec7c --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/title_area.go @@ -0,0 +1,360 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// TitleArea +type TitleArea struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // Alternative text on the title area. + alternativeText *string + // Indicates whether the title area has a gradient effect enabled. + enableGradientEffect *bool + // URL of the image in the title area. + imageWebUrl *string + // Enumeration value that indicates the layout of the title area. The possible values are: imageAndTitle, plain, colorBlock, overlap, unknownFutureValue. + layout *TitleAreaLayoutType + // The OdataType property + odataType *string + // Contains collections of data that can be processed by server side services like search index and link fixup. + serverProcessedContent ServerProcessedContentable + // Indicates whether the author should be shown in title area. + showAuthor *bool + // Indicates whether the published date should be shown in title area. + showPublishedDate *bool + // Indicates whether the text block above title should be shown in title area. + showTextBlockAboveTitle *bool + // The text above title line. + textAboveTitle *string + // Enumeration value that indicates the text alignment of the title area. The possible values are: left, center, unknownFutureValue. + textAlignment *TitleAreaTextAlignmentType +} + +// NewTitleArea instantiates a new titleArea and sets the default values. +func NewTitleArea() *TitleArea { + m := &TitleArea{} + m.SetAdditionalData(make(map[string]interface{})) + return m +} + +// CreateTitleAreaFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateTitleAreaFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewTitleArea(), nil +} + +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *TitleArea) GetAdditionalData() map[string]interface{} { + return m.additionalData +} + +// GetAlternativeText gets the alternativeText property value. Alternative text on the title area. +func (m *TitleArea) GetAlternativeText() *string { + return m.alternativeText +} + +// GetEnableGradientEffect gets the enableGradientEffect property value. Indicates whether the title area has a gradient effect enabled. +func (m *TitleArea) GetEnableGradientEffect() *bool { + return m.enableGradientEffect +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *TitleArea) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error) + res["alternativeText"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetAlternativeText(val) + } + return nil + } + res["enableGradientEffect"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetEnableGradientEffect(val) + } + return nil + } + res["imageWebUrl"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetImageWebUrl(val) + } + return nil + } + res["layout"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseTitleAreaLayoutType) + if err != nil { + return err + } + if val != nil { + m.SetLayout(val.(*TitleAreaLayoutType)) + } + return nil + } + res["@odata.type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["serverProcessedContent"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateServerProcessedContentFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetServerProcessedContent(val.(ServerProcessedContentable)) + } + return nil + } + res["showAuthor"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetShowAuthor(val) + } + return nil + } + res["showPublishedDate"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetShowPublishedDate(val) + } + return nil + } + res["showTextBlockAboveTitle"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetShowTextBlockAboveTitle(val) + } + return nil + } + res["textAboveTitle"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetTextAboveTitle(val) + } + return nil + } + res["textAlignment"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseTitleAreaTextAlignmentType) + if err != nil { + return err + } + if val != nil { + m.SetTextAlignment(val.(*TitleAreaTextAlignmentType)) + } + return nil + } + return res +} + +// GetImageWebUrl gets the imageWebUrl property value. URL of the image in the title area. +func (m *TitleArea) GetImageWebUrl() *string { + return m.imageWebUrl +} + +// GetLayout gets the layout property value. Enumeration value that indicates the layout of the title area. The possible values are: imageAndTitle, plain, colorBlock, overlap, unknownFutureValue. +func (m *TitleArea) GetLayout() *TitleAreaLayoutType { + return m.layout +} + +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *TitleArea) GetOdataType() *string { + return m.odataType +} + +// GetServerProcessedContent gets the serverProcessedContent property value. Contains collections of data that can be processed by server side services like search index and link fixup. +func (m *TitleArea) GetServerProcessedContent() ServerProcessedContentable { + return m.serverProcessedContent +} + +// GetShowAuthor gets the showAuthor property value. Indicates whether the author should be shown in title area. +func (m *TitleArea) GetShowAuthor() *bool { + return m.showAuthor +} + +// GetShowPublishedDate gets the showPublishedDate property value. Indicates whether the published date should be shown in title area. +func (m *TitleArea) GetShowPublishedDate() *bool { + return m.showPublishedDate +} + +// GetShowTextBlockAboveTitle gets the showTextBlockAboveTitle property value. Indicates whether the text block above title should be shown in title area. +func (m *TitleArea) GetShowTextBlockAboveTitle() *bool { + return m.showTextBlockAboveTitle +} + +// GetTextAboveTitle gets the textAboveTitle property value. The text above title line. +func (m *TitleArea) GetTextAboveTitle() *string { + return m.textAboveTitle +} + +// GetTextAlignment gets the textAlignment property value. Enumeration value that indicates the text alignment of the title area. The possible values are: left, center, unknownFutureValue. +func (m *TitleArea) GetTextAlignment() *TitleAreaTextAlignmentType { + return m.textAlignment +} + +// Serialize serializes information the current object +func (m *TitleArea) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + { + err := writer.WriteStringValue("alternativeText", m.GetAlternativeText()) + if err != nil { + return err + } + } + { + err := writer.WriteBoolValue("enableGradientEffect", m.GetEnableGradientEffect()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("imageWebUrl", m.GetImageWebUrl()) + if err != nil { + return err + } + } + if m.GetLayout() != nil { + cast := (*m.GetLayout()).String() + err := writer.WriteStringValue("layout", &cast) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteObjectValue("serverProcessedContent", m.GetServerProcessedContent()) + if err != nil { + return err + } + } + { + err := writer.WriteBoolValue("showAuthor", m.GetShowAuthor()) + if err != nil { + return err + } + } + { + err := writer.WriteBoolValue("showPublishedDate", m.GetShowPublishedDate()) + if err != nil { + return err + } + } + { + err := writer.WriteBoolValue("showTextBlockAboveTitle", m.GetShowTextBlockAboveTitle()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("textAboveTitle", m.GetTextAboveTitle()) + if err != nil { + return err + } + } + if m.GetTextAlignment() != nil { + cast := (*m.GetTextAlignment()).String() + err := writer.WriteStringValue("textAlignment", &cast) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} + +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *TitleArea) SetAdditionalData(value map[string]interface{}) { + m.additionalData = value +} + +// SetAlternativeText sets the alternativeText property value. Alternative text on the title area. +func (m *TitleArea) SetAlternativeText(value *string) { + m.alternativeText = value +} + +// SetEnableGradientEffect sets the enableGradientEffect property value. Indicates whether the title area has a gradient effect enabled. +func (m *TitleArea) SetEnableGradientEffect(value *bool) { + m.enableGradientEffect = value +} + +// SetImageWebUrl sets the imageWebUrl property value. URL of the image in the title area. +func (m *TitleArea) SetImageWebUrl(value *string) { + m.imageWebUrl = value +} + +// SetLayout sets the layout property value. Enumeration value that indicates the layout of the title area. The possible values are: imageAndTitle, plain, colorBlock, overlap, unknownFutureValue. +func (m *TitleArea) SetLayout(value *TitleAreaLayoutType) { + m.layout = value +} + +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *TitleArea) SetOdataType(value *string) { + m.odataType = value +} + +// SetServerProcessedContent sets the serverProcessedContent property value. Contains collections of data that can be processed by server side services like search index and link fixup. +func (m *TitleArea) SetServerProcessedContent(value ServerProcessedContentable) { + m.serverProcessedContent = value +} + +// SetShowAuthor sets the showAuthor property value. Indicates whether the author should be shown in title area. +func (m *TitleArea) SetShowAuthor(value *bool) { + m.showAuthor = value +} + +// SetShowPublishedDate sets the showPublishedDate property value. Indicates whether the published date should be shown in title area. +func (m *TitleArea) SetShowPublishedDate(value *bool) { + m.showPublishedDate = value +} + +// SetShowTextBlockAboveTitle sets the showTextBlockAboveTitle property value. Indicates whether the text block above title should be shown in title area. +func (m *TitleArea) SetShowTextBlockAboveTitle(value *bool) { + m.showTextBlockAboveTitle = value +} + +// SetTextAboveTitle sets the textAboveTitle property value. The text above title line. +func (m *TitleArea) SetTextAboveTitle(value *string) { + m.textAboveTitle = value +} + +// SetTextAlignment sets the textAlignment property value. Enumeration value that indicates the text alignment of the title area. The possible values are: left, center, unknownFutureValue. +func (m *TitleArea) SetTextAlignment(value *TitleAreaTextAlignmentType) { + m.textAlignment = value +} diff --git a/src/internal/connector/graph/betasdk/models/title_area_layout_type.go b/src/internal/connector/graph/betasdk/models/title_area_layout_type.go new file mode 100644 index 000000000..375b68874 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/title_area_layout_type.go @@ -0,0 +1,43 @@ +package models +import ( + "errors" +) +// Provides operations to call the remove method. +type TitleAreaLayoutType int + +const ( + IMAGEANDTITLE_TITLEAREALAYOUTTYPE TitleAreaLayoutType = iota + PLAIN_TITLEAREALAYOUTTYPE + COLORBLOCK_TITLEAREALAYOUTTYPE + OVERLAP_TITLEAREALAYOUTTYPE + UNKNOWNFUTUREVALUE_TITLEAREALAYOUTTYPE +) + +func (i TitleAreaLayoutType) String() string { + return []string{"imageAndTitle", "plain", "colorBlock", "overlap", "unknownFutureValue"}[i] +} +func ParseTitleAreaLayoutType(v string) (interface{}, error) { + result := IMAGEANDTITLE_TITLEAREALAYOUTTYPE + switch v { + case "imageAndTitle": + result = IMAGEANDTITLE_TITLEAREALAYOUTTYPE + case "plain": + result = PLAIN_TITLEAREALAYOUTTYPE + case "colorBlock": + result = COLORBLOCK_TITLEAREALAYOUTTYPE + case "overlap": + result = OVERLAP_TITLEAREALAYOUTTYPE + case "unknownFutureValue": + result = UNKNOWNFUTUREVALUE_TITLEAREALAYOUTTYPE + default: + return 0, errors.New("Unknown TitleAreaLayoutType value: " + v) + } + return &result, nil +} +func SerializeTitleAreaLayoutType(values []TitleAreaLayoutType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/title_area_text_alignment_type.go b/src/internal/connector/graph/betasdk/models/title_area_text_alignment_type.go new file mode 100644 index 000000000..27b1e1dba --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/title_area_text_alignment_type.go @@ -0,0 +1,37 @@ +package models +import ( + "errors" +) +// Provides operations to call the remove method. +type TitleAreaTextAlignmentType int + +const ( + LEFT_TITLEAREATEXTALIGNMENTTYPE TitleAreaTextAlignmentType = iota + CENTER_TITLEAREATEXTALIGNMENTTYPE + UNKNOWNFUTUREVALUE_TITLEAREATEXTALIGNMENTTYPE +) + +func (i TitleAreaTextAlignmentType) String() string { + return []string{"left", "center", "unknownFutureValue"}[i] +} +func ParseTitleAreaTextAlignmentType(v string) (interface{}, error) { + result := LEFT_TITLEAREATEXTALIGNMENTTYPE + switch v { + case "left": + result = LEFT_TITLEAREATEXTALIGNMENTTYPE + case "center": + result = CENTER_TITLEAREATEXTALIGNMENTTYPE + case "unknownFutureValue": + result = UNKNOWNFUTUREVALUE_TITLEAREATEXTALIGNMENTTYPE + default: + return 0, errors.New("Unknown TitleAreaTextAlignmentType value: " + v) + } + return &result, nil +} +func SerializeTitleAreaTextAlignmentType(values []TitleAreaTextAlignmentType) []string { + result := make([]string, len(values)) + for i, v := range values { + result[i] = v.String() + } + return result +} diff --git a/src/internal/connector/graph/betasdk/models/title_areaable.go b/src/internal/connector/graph/betasdk/models/title_areaable.go new file mode 100644 index 000000000..fb36bf576 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/title_areaable.go @@ -0,0 +1,33 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// TitleAreaable +type TitleAreaable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetAlternativeText() *string + GetEnableGradientEffect() *bool + GetImageWebUrl() *string + GetLayout() *TitleAreaLayoutType + GetOdataType() *string + GetServerProcessedContent() ServerProcessedContentable + GetShowAuthor() *bool + GetShowPublishedDate() *bool + GetShowTextBlockAboveTitle() *bool + GetTextAboveTitle() *string + GetTextAlignment() *TitleAreaTextAlignmentType + SetAlternativeText(value *string) + SetEnableGradientEffect(value *bool) + SetImageWebUrl(value *string) + SetLayout(value *TitleAreaLayoutType) + SetOdataType(value *string) + SetServerProcessedContent(value ServerProcessedContentable) + SetShowAuthor(value *bool) + SetShowPublishedDate(value *bool) + SetShowTextBlockAboveTitle(value *bool) + SetTextAboveTitle(value *string) + SetTextAlignment(value *TitleAreaTextAlignmentType) +} diff --git a/src/internal/connector/graph/betasdk/models/vertical_section.go b/src/internal/connector/graph/betasdk/models/vertical_section.go new file mode 100644 index 000000000..e4e8f6ed5 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/vertical_section.go @@ -0,0 +1,104 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// VerticalSection +type VerticalSection struct { + msmodel.Entity + // Enumeration value that indicates the emphasis of the section background. The possible values are: none, netural, soft, strong, unknownFutureValue. + emphasis *SectionEmphasisType + // The set of web parts in this section. + webparts []WebPartable +} + +// NewVerticalSection instantiates a new verticalSection and sets the default values. +func NewVerticalSection() *VerticalSection { + m := &VerticalSection{ + Entity: *msmodel.NewEntity(), + } + return m +} + +// CreateVerticalSectionFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateVerticalSectionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewVerticalSection(), nil +} + +// GetEmphasis gets the emphasis property value. Enumeration value that indicates the emphasis of the section background. The possible values are: none, netural, soft, strong, unknownFutureValue. +func (m *VerticalSection) GetEmphasis() *SectionEmphasisType { + return m.emphasis +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *VerticalSection) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.Entity.GetFieldDeserializers() + res["emphasis"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetEnumValue(ParseSectionEmphasisType) + if err != nil { + return err + } + if val != nil { + m.SetEmphasis(val.(*SectionEmphasisType)) + } + return nil + } + res["webparts"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateWebPartFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]WebPartable, len(val)) + for i, v := range val { + res[i] = v.(WebPartable) + } + m.SetWebparts(res) + } + return nil + } + return res +} + +// GetWebparts gets the webparts property value. The set of web parts in this section. +func (m *VerticalSection) GetWebparts() []WebPartable { + return m.webparts +} + +// Serialize serializes information the current object +func (m *VerticalSection) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.Entity.Serialize(writer) + if err != nil { + return err + } + if m.GetEmphasis() != nil { + cast := (*m.GetEmphasis()).String() + err = writer.WriteStringValue("emphasis", &cast) + if err != nil { + return err + } + } + if m.GetWebparts() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetWebparts())) + for i, v := range m.GetWebparts() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("webparts", cast) + if err != nil { + return err + } + } + return nil +} + +// SetEmphasis sets the emphasis property value. Enumeration value that indicates the emphasis of the section background. The possible values are: none, netural, soft, strong, unknownFutureValue. +func (m *VerticalSection) SetEmphasis(value *SectionEmphasisType) { + m.emphasis = value +} + +// SetWebparts sets the webparts property value. The set of web parts in this section. +func (m *VerticalSection) SetWebparts(value []WebPartable) { + m.webparts = value +} diff --git a/src/internal/connector/graph/betasdk/models/vertical_sectionable.go b/src/internal/connector/graph/betasdk/models/vertical_sectionable.go new file mode 100644 index 000000000..f4f0a991b --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/vertical_sectionable.go @@ -0,0 +1,16 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// VerticalSectionable +type VerticalSectionable interface { + msmodel.Entityable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetEmphasis() *SectionEmphasisType + GetWebparts() []WebPartable + SetEmphasis(value *SectionEmphasisType) + SetWebparts(value []WebPartable) +} diff --git a/src/internal/connector/graph/betasdk/models/web_part.go b/src/internal/connector/graph/betasdk/models/web_part.go new file mode 100644 index 000000000..3287051b1 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_part.go @@ -0,0 +1,59 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// WebPart provides operations to call the remove method. +type WebPart struct { + msmodel.Entity +} + +// NewWebPart instantiates a new webPart and sets the default values. +func NewWebPart() *WebPart { + m := &WebPart{ + Entity: *msmodel.NewEntity(), + } + return m +} + +// CreateWebPartFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateWebPartFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + if parseNode != nil { + mappingValueNode, err := parseNode.GetChildNode("@odata.type") + if err != nil { + return nil, err + } + if mappingValueNode != nil { + mappingValue, err := mappingValueNode.GetStringValue() + if err != nil { + return nil, err + } + if mappingValue != nil { + switch *mappingValue { + case "#microsoft.graph.standardWebPart": + return NewStandardWebPart(), nil + case "#microsoft.graph.textWebPart": + return NewTextWebPart(), nil + } + } + } + } + return NewWebPart(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *WebPart) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.Entity.GetFieldDeserializers() + return res +} + +// Serialize serializes information the current object +func (m *WebPart) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.Entity.Serialize(writer) + if err != nil { + return err + } + return nil +} diff --git a/src/internal/connector/graph/betasdk/models/web_part_collection_response.go b/src/internal/connector/graph/betasdk/models/web_part_collection_response.go new file mode 100644 index 000000000..e590431b2 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_part_collection_response.go @@ -0,0 +1,75 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// WebPartCollectionResponse provides operations to manage the webParts property of the microsoft.graph.sitePage entity. +type WebPartCollectionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []WebPartable +} + +// NewWebPartCollectionResponse instantiates a new WebPartCollectionResponse and sets the default values. +func NewWebPartCollectionResponse() *WebPartCollectionResponse { + m := &WebPartCollectionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateWebPartCollectionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateWebPartCollectionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewWebPartCollectionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *WebPartCollectionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateWebPartFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]WebPartable, len(val)) + for i, v := range val { + res[i] = v.(WebPartable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +func (m *WebPartCollectionResponse) GetValue() []WebPartable { + return m.value +} + +// Serialize serializes information the current object +func (m *WebPartCollectionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +func (m *WebPartCollectionResponse) SetValue(value []WebPartable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/models/web_part_collection_responseable.go b/src/internal/connector/graph/betasdk/models/web_part_collection_responseable.go new file mode 100644 index 000000000..63aa0cae2 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_part_collection_responseable.go @@ -0,0 +1,14 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// WebPartCollectionResponseable +type WebPartCollectionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []WebPartable + SetValue(value []WebPartable) +} diff --git a/src/internal/connector/graph/betasdk/models/web_part_data.go b/src/internal/connector/graph/betasdk/models/web_part_data.go new file mode 100644 index 000000000..251ed2dc9 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_part_data.go @@ -0,0 +1,251 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// WebPartData +type WebPartData struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // Audience information of the web part. By using this property, specific content will be prioritized to specific audiences. + audiences []string + // Data version of the web part. The value is defined by the web part developer. Different dataVersions usually refers to a different property structure. + dataVersion *string + // Description of the web part. + description *string + // The OdataType property + odataType *string + // Properties bag of the web part. + properties msmodel.Jsonable + // Contains collections of data that can be processed by server side services like search index and link fixup. + serverProcessedContent ServerProcessedContentable + // Title of the web part. + title *string +} + +// NewWebPartData instantiates a new webPartData and sets the default values. +func NewWebPartData() *WebPartData { + m := &WebPartData{} + m.SetAdditionalData(make(map[string]interface{})) + return m +} + +// CreateWebPartDataFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateWebPartDataFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewWebPartData(), nil +} + +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *WebPartData) GetAdditionalData() map[string]interface{} { + return m.additionalData +} + +// GetAudiences gets the audiences property value. Audience information of the web part. By using this property, specific content will be prioritized to specific audiences. +func (m *WebPartData) GetAudiences() []string { + return m.audiences +} + +// GetDataVersion gets the dataVersion property value. Data version of the web part. The value is defined by the web part developer. Different dataVersions usually refers to a different property structure. +func (m *WebPartData) GetDataVersion() *string { + return m.dataVersion +} + +// GetDescription gets the description property value. Description of the web part. +func (m *WebPartData) GetDescription() *string { + return m.description +} + +// GetFieldDeserializers the deserialization information for the current model +func (m *WebPartData) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error) + res["audiences"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfPrimitiveValues("string") + if err != nil { + return err + } + if val != nil { + res := make([]string, len(val)) + for i, v := range val { + res[i] = *(v.(*string)) + } + m.SetAudiences(res) + } + return nil + } + res["dataVersion"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetDataVersion(val) + } + return nil + } + res["description"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetDescription(val) + } + return nil + } + res["@odata.type"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["properties"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(msmodel.CreateJsonFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetProperties(val.(msmodel.Jsonable)) + } + return nil + } + res["serverProcessedContent"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetObjectValue(CreateServerProcessedContentFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + m.SetServerProcessedContent(val.(ServerProcessedContentable)) + } + return nil + } + res["title"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetTitle(val) + } + return nil + } + return res +} + +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *WebPartData) GetOdataType() *string { + return m.odataType +} + +// GetProperties gets the properties property value. Properties bag of the web part. +func (m *WebPartData) GetProperties() msmodel.Jsonable { + return m.properties +} + +// GetServerProcessedContent gets the serverProcessedContent property value. Contains collections of data that can be processed by server side services like search index and link fixup. +func (m *WebPartData) GetServerProcessedContent() ServerProcessedContentable { + return m.serverProcessedContent +} + +// GetTitle gets the title property value. Title of the web part. +func (m *WebPartData) GetTitle() *string { + return m.title +} + +// Serialize serializes information the current object +func (m *WebPartData) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + if m.GetAudiences() != nil { + err := writer.WriteCollectionOfStringValues("audiences", m.GetAudiences()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("dataVersion", m.GetDataVersion()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("description", m.GetDescription()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteObjectValue("properties", m.GetProperties()) + if err != nil { + return err + } + } + { + err := writer.WriteObjectValue("serverProcessedContent", m.GetServerProcessedContent()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("title", m.GetTitle()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} + +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *WebPartData) SetAdditionalData(value map[string]interface{}) { + m.additionalData = value +} + +// SetAudiences sets the audiences property value. Audience information of the web part. By using this property, specific content will be prioritized to specific audiences. +func (m *WebPartData) SetAudiences(value []string) { + m.audiences = value +} + +// SetDataVersion sets the dataVersion property value. Data version of the web part. The value is defined by the web part developer. Different dataVersions usually refers to a different property structure. +func (m *WebPartData) SetDataVersion(value *string) { + m.dataVersion = value +} + +// SetDescription sets the description property value. Description of the web part. +func (m *WebPartData) SetDescription(value *string) { + m.description = value +} + +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *WebPartData) SetOdataType(value *string) { + m.odataType = value +} + +// SetProperties sets the properties property value. Properties bag of the web part. +func (m *WebPartData) SetProperties(value msmodel.Jsonable) { + m.properties = value +} + +// SetServerProcessedContent sets the serverProcessedContent property value. Contains collections of data that can be processed by server side services like search index and link fixup. +func (m *WebPartData) SetServerProcessedContent(value ServerProcessedContentable) { + m.serverProcessedContent = value +} + +// SetTitle sets the title property value. Title of the web part. +func (m *WebPartData) SetTitle(value *string) { + m.title = value +} diff --git a/src/internal/connector/graph/betasdk/models/web_part_dataable.go b/src/internal/connector/graph/betasdk/models/web_part_dataable.go new file mode 100644 index 000000000..a27a6d158 --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_part_dataable.go @@ -0,0 +1,26 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// WebPartDataable +type WebPartDataable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetAudiences() []string + GetDataVersion() *string + GetDescription() *string + GetOdataType() *string + GetProperties() msmodel.Jsonable + GetServerProcessedContent() ServerProcessedContentable + GetTitle() *string + SetAudiences(value []string) + SetDataVersion(value *string) + SetDescription(value *string) + SetOdataType(value *string) + SetProperties(value msmodel.Jsonable) + SetServerProcessedContent(value ServerProcessedContentable) + SetTitle(value *string) +} diff --git a/src/internal/connector/graph/betasdk/models/web_part_position.go b/src/internal/connector/graph/betasdk/models/web_part_position.go new file mode 100644 index 000000000..f2f1c3c9e --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_part_position.go @@ -0,0 +1,175 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// WebPartPosition +type WebPartPosition struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // Indicates the identifier of the column where the web part is located. + columnId *float64 + // Indicates the horizontal section where the web part is located. + horizontalSectionId *float64 + // Indicates whether the web part is located in the vertical section. + isInVerticalSection *bool + // The OdataType property + odataType *string + // Index of the current web part. Represents the order of the web part in this column or section. + webPartIndex *float64 +} +// NewWebPartPosition instantiates a new webPartPosition and sets the default values. +func NewWebPartPosition()(*WebPartPosition) { + m := &WebPartPosition{ + } + m.SetAdditionalData(make(map[string]interface{})); + return m +} +// CreateWebPartPositionFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +func CreateWebPartPositionFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewWebPartPosition(), nil +} +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *WebPartPosition) GetAdditionalData()(map[string]interface{}) { + return m.additionalData +} +// GetColumnId gets the columnId property value. Indicates the identifier of the column where the web part is located. +func (m *WebPartPosition) GetColumnId()(*float64) { + return m.columnId +} +// GetFieldDeserializers the deserialization information for the current model +func (m *WebPartPosition) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["columnId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetFloat64Value() + if err != nil { + return err + } + if val != nil { + m.SetColumnId(val) + } + return nil + } + res["horizontalSectionId"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetFloat64Value() + if err != nil { + return err + } + if val != nil { + m.SetHorizontalSectionId(val) + } + return nil + } + res["isInVerticalSection"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetIsInVerticalSection(val) + } + return nil + } + res["@odata.type"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetOdataType(val) + } + return nil + } + res["webPartIndex"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetFloat64Value() + if err != nil { + return err + } + if val != nil { + m.SetWebPartIndex(val) + } + return nil + } + return res +} +// GetHorizontalSectionId gets the horizontalSectionId property value. Indicates the horizontal section where the web part is located. +func (m *WebPartPosition) GetHorizontalSectionId()(*float64) { + return m.horizontalSectionId +} +// GetIsInVerticalSection gets the isInVerticalSection property value. Indicates whether the web part is located in the vertical section. +func (m *WebPartPosition) GetIsInVerticalSection()(*bool) { + return m.isInVerticalSection +} +// GetOdataType gets the @odata.type property value. The OdataType property +func (m *WebPartPosition) GetOdataType()(*string) { + return m.odataType +} +// GetWebPartIndex gets the webPartIndex property value. Index of the current web part. Represents the order of the web part in this column or section. +func (m *WebPartPosition) GetWebPartIndex()(*float64) { + return m.webPartIndex +} +// Serialize serializes information the current object +func (m *WebPartPosition) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteFloat64Value("columnId", m.GetColumnId()) + if err != nil { + return err + } + } + { + err := writer.WriteFloat64Value("horizontalSectionId", m.GetHorizontalSectionId()) + if err != nil { + return err + } + } + { + err := writer.WriteBoolValue("isInVerticalSection", m.GetIsInVerticalSection()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("@odata.type", m.GetOdataType()) + if err != nil { + return err + } + } + { + err := writer.WriteFloat64Value("webPartIndex", m.GetWebPartIndex()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *WebPartPosition) SetAdditionalData(value map[string]interface{})() { + m.additionalData = value +} +// SetColumnId sets the columnId property value. Indicates the identifier of the column where the web part is located. +func (m *WebPartPosition) SetColumnId(value *float64)() { + m.columnId = value +} +// SetHorizontalSectionId sets the horizontalSectionId property value. Indicates the horizontal section where the web part is located. +func (m *WebPartPosition) SetHorizontalSectionId(value *float64)() { + m.horizontalSectionId = value +} +// SetIsInVerticalSection sets the isInVerticalSection property value. Indicates whether the web part is located in the vertical section. +func (m *WebPartPosition) SetIsInVerticalSection(value *bool)() { + m.isInVerticalSection = value +} +// SetOdataType sets the @odata.type property value. The OdataType property +func (m *WebPartPosition) SetOdataType(value *string)() { + m.odataType = value +} +// SetWebPartIndex sets the webPartIndex property value. Index of the current web part. Represents the order of the web part in this column or section. +func (m *WebPartPosition) SetWebPartIndex(value *float64)() { + m.webPartIndex = value +} diff --git a/src/internal/connector/graph/betasdk/models/web_part_positionable.go b/src/internal/connector/graph/betasdk/models/web_part_positionable.go new file mode 100644 index 000000000..f0939db2e --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_part_positionable.go @@ -0,0 +1,21 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// WebPartPositionable +type WebPartPositionable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetColumnId()(*float64) + GetHorizontalSectionId()(*float64) + GetIsInVerticalSection()(*bool) + GetOdataType()(*string) + GetWebPartIndex()(*float64) + SetColumnId(value *float64)() + SetHorizontalSectionId(value *float64)() + SetIsInVerticalSection(value *bool)() + SetOdataType(value *string)() + SetWebPartIndex(value *float64)() +} diff --git a/src/internal/connector/graph/betasdk/models/web_partable.go b/src/internal/connector/graph/betasdk/models/web_partable.go new file mode 100644 index 000000000..ac8a2a84d --- /dev/null +++ b/src/internal/connector/graph/betasdk/models/web_partable.go @@ -0,0 +1,12 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +// WebPartable +type WebPartable interface { + msmodel.Entityable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable +} diff --git a/src/internal/connector/graph/betasdk/sites/count_request_builder.go b/src/internal/connector/graph/betasdk/sites/count_request_builder.go new file mode 100644 index 000000000..f36f1c220 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/count_request_builder.go @@ -0,0 +1,116 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// CountRequestBuilder provides operations to count the resources in the collection. +type CountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// CountRequestBuilderGetQueryParameters get the number of the resource +type CountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// CountRequestBuilderGetRequestConfiguration configuration for the request such as headers, +// query parameters, and middleware options. +type CountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *CountRequestBuilderGetQueryParameters +} + +// NewCountRequestBuilderInternal instantiates a new CountRequestBuilder and sets the default values. +func NewCountRequestBuilderInternal( + pathParameters map[string]string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *CountRequestBuilder { + m := &CountRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + + return m +} + +// NewCountRequestBuilder instantiates a new CountRequestBuilder and sets the default values. +func NewCountRequestBuilder( + rawURL string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *CountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawURL + + return NewCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +func (m *CountRequestBuilder) CreateGetRequestInformation( + ctx context.Context, + requestConfiguration *CountRequestBuilderGetRequestConfiguration, +) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// Get get the number of the resource +// +//nolint:lll +func (m *CountRequestBuilder) Get(ctx context.Context, requestConfiguration *CountRequestBuilderGetRequestConfiguration) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_count_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_count_request_builder.go new file mode 100644 index 000000000..284366a30 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_count_request_builder.go @@ -0,0 +1,115 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesCountRequestBuilder provides operations to count the resources in the collection. +type ItemPagesCountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesCountRequestBuilderGetQueryParameters get the number of the resource +type ItemPagesCountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// ItemPagesCountRequestBuilderGetRequestConfiguration configuration for the request +// such as headers, query parameters, and middleware options. +type ItemPagesCountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesCountRequestBuilderGetQueryParameters +} + +// NewItemPagesCountRequestBuilderInternal instantiates a new CountRequestBuilder and sets the default values. +func NewItemPagesCountRequestBuilderInternal( + pathParameters map[string]string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *ItemPagesCountRequestBuilder { + m := &ItemPagesCountRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + + return m +} + +// NewItemPagesCountRequestBuilder instantiates a new CountRequestBuilder and sets the default values. +func NewItemPagesCountRequestBuilder( + rawURL string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *ItemPagesCountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawURL + + return NewItemPagesCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +// +//nolint:lll +func (m *ItemPagesCountRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesCountRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// Get get the number of the resource +// +//nolint:lll +func (m *ItemPagesCountRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesCountRequestBuilderGetRequestConfiguration) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_count_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_count_request_builder.go new file mode 100644 index 000000000..deec0ca5f --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_count_request_builder.go @@ -0,0 +1,122 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder provides +// operations to count the resources in the collection. +type ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderGetQueryParameters get the number of the resource +type ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderGetRequestConfiguration configuration for +// the request such as headers, query parameters, and middleware options. +type ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderGetQueryParameters +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderInternal instantiates a +// new CountRequestBuilder and sets the default values. +func NewItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderInternal( + pathParameters map[string]string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder{} + //nolint:lll + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder instantiates a +// new CountRequestBuilder and sets the default values. +func NewItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder( + rawURL string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawURL + + return NewItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder) CreateGetRequestInformation( + ctx context.Context, + requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderGetRequestConfiguration, +) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error, +) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// Get get the number of the resource +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder) Get( + ctx context.Context, + requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderGetRequestConfiguration, +) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_horizontal_section_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_horizontal_section_item_request_builder.go new file mode 100644 index 000000000..0845ecee4 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_horizontal_section_item_request_builder.go @@ -0,0 +1,260 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder +// provides operations to manage the horizontalSections property of the microsoft.graph.canvasLayout entity. +type ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderDeleteRequestConfiguration +// configuration for the request such as headers, query parameters, and middleware options. +type ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderGetQueryParameters +// collection of horizontal sections on the SharePoint page. +type ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderGetRequestConfiguration +// configuration for the request such as headers, query parameters, and middleware options. +type ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderPatchRequestConfiguration +// configuration for the request such as headers, query parameters, and middleware options. +type ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// Columns provides operations to manage the columns property of the microsoft.graph.horizontalSection entity. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) Columns() *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder { + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// ColumnsById provides operations to manage the columns property of the microsoft.graph.horizontalSection entity. +// +//nolint:revive +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) ColumnsById(id string, +) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + + if id != "" { + urlTplParams["horizontalSectionColumn%2Did"] = id + } + //nolint:lll + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderInternal +// instantiates a new HorizontalSectionItemRequestBuilder and sets the default values. +func NewItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderInternal( + pathParameters map[string]string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder{} + //nolint:lll + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder instantiates a +// new HorizontalSectionItemRequestBuilder and sets the default values. +func NewItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder( + rawURL string, + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter, +) *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawURL + + return NewItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderInternal( + urlParams, + requestAdapter, + ) +} + +// CreateDeleteRequestInformation delete navigation property horizontalSections for sites +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) CreateDeleteRequestInformation( + ctx context.Context, + requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderDeleteRequestConfiguration, +) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// CreateGetRequestInformation collection of horizontal sections on the SharePoint page. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) CreateGetRequestInformation( + ctx context.Context, + requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderGetRequestConfiguration, +) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property horizontalSections in sites +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + + err := requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if err != nil { + return nil, err + } + + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// Delete delete navigation property horizontalSections for sites +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + + if err != nil { + return err + } + + return nil +} + +// Get collection of horizontal sections on the SharePoint page. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable), nil +} + +// Patch update the navigation property horizontalSections in sites +// nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_count_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_count_request_builder.go new file mode 100644 index 000000000..95a2e7314 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_count_request_builder.go @@ -0,0 +1,117 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder +// provides operations to count the resources in the collection. +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderGetQueryParameters get the number of the resource +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderGetQueryParameters +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderInternal instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:lll +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}/columns/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:lll +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder(rawURL string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawURL + + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// Get get the number of the resource +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderGetRequestConfiguration) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_horizontal_section_column_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_horizontal_section_column_item_request_builder.go new file mode 100644 index 000000000..c1a8315ce --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_horizontal_section_column_item_request_builder.go @@ -0,0 +1,247 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder provides operations to manage the columns property of the microsoft.graph.horizontalSection entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderDeleteRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderGetQueryParameters the set of vertical columns in this section. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderInternal instantiates a new HorizontalSectionColumnItemRequestBuilder and sets the default values. +// +//nolint:lll +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}/columns/{horizontalSectionColumn%2Did}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder instantiates a new HorizontalSectionColumnItemRequestBuilder and sets the default values. +// +//nolint:lll, revive +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateDeleteRequestInformation delete navigation property columns for sites +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderDeleteRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// CreateGetRequestInformation the set of vertical columns in this section. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property columns in sites +// +//nolint:lll,errcheck +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// Delete delete navigation property columns for sites +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + + return nil +} + +// Get the set of vertical columns in this section. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionColumnFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable), nil +} + +// Patch update the navigation property columns in sites +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionColumnFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + + if res == nil { + return nil, nil + } + + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable), nil +} + +// Webparts provides operations to manage the webparts property of the microsoft.graph.horizontalSectionColumn entity. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) Webparts() *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder { + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// WebpartsById provides operations to manage the webparts property of the microsoft.graph.horizontalSectionColumn entity. +// +//nolint:lll,revive +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsHorizontalSectionColumnItemRequestBuilder) WebpartsById(id string) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + + if id != "" { + urlTplParams["webPart%2Did"] = id + } + + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_count_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_count_request_builder.go new file mode 100644 index 000000000..b5c6e3a40 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_count_request_builder.go @@ -0,0 +1,111 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder provides operations to count the resources in the collection. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderGetQueryParameters get the number of the resource +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderGetQueryParameters +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderInternal instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:lll +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}/columns/{horizontalSectionColumn%2Did}/webparts/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:lll, revive +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get the number of the resource +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderGetRequestConfiguration) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_item_get_position_of_web_part_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_item_get_position_of_web_part_request_builder.go new file mode 100644 index 000000000..14429d80f --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_item_get_position_of_web_part_request_builder.go @@ -0,0 +1,96 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder provides operations to call the getPositionOfWebPart method. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderInternal instantiates a new GetPositionOfWebPartRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}/columns/{horizontalSectionColumn%2Did}/webparts/{webPart%2Did}/microsoft.graph.getPositionOfWebPart" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder instantiates a new GetPositionOfWebPartRequestBuilder and sets the default values. +// +//nolint:lll,revive,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreatePostRequestInformation invoke action getPositionOfWebPart +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder) CreatePostRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// nolint:lll,wsl +// Post invoke action getPositionOfWebPart +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/webpart-getposition?view=graph-rest-1.0 +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder) Post(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartPositionable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartPositionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartPositionable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_request_builder.go new file mode 100644 index 000000000..4d2a94186 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_request_builder.go @@ -0,0 +1,180 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder provides operations to manage the webparts property of the microsoft.graph.horizontalSectionColumn entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderGetQueryParameters get the webPart resources from a sitePage. Sort by the order in which they appear on the page. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderGetQueryParameters struct { + // Include count of items + Count *bool `uriparametername:"%24count"` + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Order items by property values + Orderby []string `uriparametername:"%24orderby"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` + // Skip the first n items + Skip *int32 `uriparametername:"%24skip"` + // Show only the first n items + Top *int32 `uriparametername:"%24top"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderInternal instantiates a new WebpartsRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}/columns/{horizontalSectionColumn%2Did}/webparts{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder instantiates a new WebpartsRequestBuilder and sets the default values. +// +//nolint:lll,revive,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderInternal(urlParams, requestAdapter) +} + +// Count provides operations to count the resources in the collection. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder) Count() *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilder { + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsCountRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// CreateGetRequestInformation get the webPart resources from a sitePage. Sort by the order in which they appear on the page. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePostRequestInformation create new navigation property to webparts for sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder) CreatePostRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get the webPart resources from a sitePage. Sort by the order in which they appear on the page. +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/webpart-list?view=graph-rest-1.0 +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartCollectionResponseable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartCollectionResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartCollectionResponseable), nil +} + +// Post create new navigation property to webparts for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilder) Post(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_web_part_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_web_part_item_request_builder.go new file mode 100644 index 000000000..0ce7becda --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_item_webparts_web_part_item_request_builder.go @@ -0,0 +1,209 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder provides operations to manage the webparts property of the microsoft.graph.horizontalSectionColumn entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderGetQueryParameters the collection of WebParts in this column. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderInternal instantiates a new WebPartItemRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}/columns/{horizontalSectionColumn%2Did}/webparts/{webPart%2Did}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder instantiates a new WebPartItemRequestBuilder and sets the default values. +// +//nolint:lll,revive,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateDeleteRequestInformation delete navigation property webparts for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreateGetRequestInformation the collection of WebParts in this column. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property webparts in sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Delete delete navigation property webparts for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} + +// Get the collection of WebParts in this column. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} + +// GetPositionOfWebPart provides operations to call the getPositionOfWebPart method. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder) GetPositionOfWebPart() *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilder { + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsItemGetPositionOfWebPartRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// Patch update the navigation property webparts in sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsItemWebpartsWebPartItemRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_request_builder.go new file mode 100644 index 000000000..368738104 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_item_columns_request_builder.go @@ -0,0 +1,180 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder provides operations to manage the columns property of the microsoft.graph.horizontalSection entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderGetQueryParameters get a list of the horizontalSectionColumn objects and their properties. Sort by `id` in ascending order. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderGetQueryParameters struct { + // Include count of items + Count *bool `uriparametername:"%24count"` + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Order items by property values + Orderby []string `uriparametername:"%24orderby"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` + // Skip the first n items + Skip *int32 `uriparametername:"%24skip"` + // Show only the first n items + Top *int32 `uriparametername:"%24top"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderInternal instantiates a new ColumnsRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections/{horizontalSection%2Did}/columns{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder instantiates a new ColumnsRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderInternal(urlParams, requestAdapter) +} + +// Count provides operations to count the resources in the collection. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder) Count() *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilder { + return NewItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsCountRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// CreateGetRequestInformation get a list of the horizontalSectionColumn objects and their properties. Sort by `id` in ascending order. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePostRequestInformation create new navigation property to columns for sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder) CreatePostRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get a list of the horizontalSectionColumn objects and their properties. Sort by `id` in ascending order. +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/horizontalsectioncolumn-list?view=graph-rest-1.0 +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnCollectionResponseable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionColumnCollectionResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnCollectionResponseable), nil +} + +// Post create new navigation property to columns for sites +// +//nolint:lll, wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilder) Post(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsItemColumnsRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionColumnFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionColumnable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_request_builder.go new file mode 100644 index 000000000..829b830f0 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_horizontal_sections_request_builder.go @@ -0,0 +1,179 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder provides operations to manage the horizontalSections property of the microsoft.graph.canvasLayout entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderGetQueryParameters get a list of the horizontalSection objects and their properties. Sort by `id` in ascending order. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderGetQueryParameters struct { + // Include count of items + Count *bool `uriparametername:"%24count"` + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Order items by property values + Orderby []string `uriparametername:"%24orderby"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` + // Skip the first n items + Skip *int32 `uriparametername:"%24skip"` + // Show only the first n items + Top *int32 `uriparametername:"%24top"` +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderInternal instantiates a new HorizontalSectionsRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder { + m := &ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/horizontalSections{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder instantiates a new HorizontalSectionsRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderInternal(urlParams, requestAdapter) +} + +// Count provides operations to count the resources in the collection. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder) Count() *ItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilder { + return NewItemPagesItemCanvasLayoutHorizontalSectionsCountRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// CreateGetRequestInformation get a list of the horizontalSection objects and their properties. Sort by `id` in ascending order. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePostRequestInformation create new navigation property to horizontalSections for sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder) CreatePostRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get a list of the horizontalSection objects and their properties. Sort by `id` in ascending order. +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/horizontalsection-list?view=graph-rest-1.0 +// +//nolint:lll, wsl +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionCollectionResponseable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionCollectionResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionCollectionResponseable), nil +} + +// nolint:lll,wsl +// Post create new navigation property to horizontalSections for sites +func (m *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder) Post(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable, requestConfiguration *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateHorizontalSectionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.HorizontalSectionable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_request_builder.go new file mode 100644 index 000000000..bbca05a9b --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_request_builder.go @@ -0,0 +1,230 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutRequestBuilder provides operations to manage the canvasLayout property of the microsoft.graph.sitePage entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutRequestBuilderDeleteRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesItemCanvasLayoutRequestBuilderGetQueryParameters indicates the layout of the content in a given SharePoint page, including horizontal sections and vertical section +// +//nolint:lll +type ItemPagesItemCanvasLayoutRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesItemCanvasLayoutRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutRequestBuilderInternal instantiates a new CanvasLayoutRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutRequestBuilder { + m := &ItemPagesItemCanvasLayoutRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutRequestBuilder instantiates a new CanvasLayoutRequestBuilder and sets the default values. +// +//nolint:lll,revive,wsl +func NewItemPagesItemCanvasLayoutRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateDeleteRequestInformation delete navigation property canvasLayout for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutRequestBuilderDeleteRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreateGetRequestInformation indicates the layout of the content in a given SharePoint page, including horizontal sections and vertical section +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property canvasLayout in sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CanvasLayoutable, requestConfiguration *ItemPagesItemCanvasLayoutRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Delete delete navigation property canvasLayout for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} + +// Get indicates the layout of the content in a given SharePoint page, including horizontal sections and vertical section +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CanvasLayoutable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateCanvasLayoutFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CanvasLayoutable), nil +} + +// HorizontalSections provides operations to manage the horizontalSections property of the microsoft.graph.canvasLayout entity. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutRequestBuilder) HorizontalSections() *ItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilder { + return NewItemPagesItemCanvasLayoutHorizontalSectionsRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// HorizontalSectionsById provides operations to manage the horizontalSections property of the microsoft.graph.canvasLayout entity. +// +//nolint:lll,wsl,revive +func (m *ItemPagesItemCanvasLayoutRequestBuilder) HorizontalSectionsById(id string) *ItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + if id != "" { + urlTplParams["horizontalSection%2Did"] = id + } + return NewItemPagesItemCanvasLayoutHorizontalSectionsHorizontalSectionItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} + +// Patch update the navigation property canvasLayout in sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CanvasLayoutable, requestConfiguration *ItemPagesItemCanvasLayoutRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CanvasLayoutable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateCanvasLayoutFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CanvasLayoutable), nil +} + +// VerticalSection provides operations to manage the verticalSection property of the microsoft.graph.canvasLayout entity. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutRequestBuilder) VerticalSection() *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder { + return NewItemPagesItemCanvasLayoutVerticalSectionRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_request_builder.go new file mode 100644 index 000000000..3fbb916ca --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_request_builder.go @@ -0,0 +1,226 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder provides operations to manage the verticalSection property of the microsoft.graph.canvasLayout entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderDeleteRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderGetQueryParameters read the properties and relationships of a verticalSection object. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutVerticalSectionRequestBuilderInternal instantiates a new VerticalSectionRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutVerticalSectionRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder { + m := &ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/verticalSection{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutVerticalSectionRequestBuilder instantiates a new VerticalSectionRequestBuilder and sets the default values. +// +//nolint:lll,revive,wsl +func NewItemPagesItemCanvasLayoutVerticalSectionRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutVerticalSectionRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateDeleteRequestInformation delete navigation property verticalSection for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderDeleteRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreateGetRequestInformation read the properties and relationships of a verticalSection object. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property verticalSection in sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.VerticalSectionable, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Delete delete navigation property verticalSection for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} + +// Get read the properties and relationships of a verticalSection object. +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/verticalsection-get?view=graph-rest-1.0 +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.VerticalSectionable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateVerticalSectionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.VerticalSectionable), nil +} + +// Patch update the navigation property verticalSection in sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.VerticalSectionable, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.VerticalSectionable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateVerticalSectionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.VerticalSectionable), nil +} + +// Webparts provides operations to manage the webparts property of the microsoft.graph.verticalSection entity. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) Webparts() *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder { + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// WebpartsById provides operations to manage the webparts property of the microsoft.graph.verticalSection entity. +// +//nolint:lll,wsl,revive +func (m *ItemPagesItemCanvasLayoutVerticalSectionRequestBuilder) WebpartsById(id string) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + if id != "" { + urlTplParams["webPart%2Did"] = id + } + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_count_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_count_request_builder.go new file mode 100644 index 000000000..774c55f28 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_count_request_builder.go @@ -0,0 +1,107 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder provides operations to count the resources in the collection. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderGetQueryParameters get the number of the resource +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderGetQueryParameters +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderInternal instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder { + m := &ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/verticalSection/webparts/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get the number of the resource +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderGetRequestConfiguration) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_item_get_position_of_web_part_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_item_get_position_of_web_part_request_builder.go new file mode 100644 index 000000000..d63ff729a --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_item_get_position_of_web_part_request_builder.go @@ -0,0 +1,97 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder provides operations to call the getPositionOfWebPart method. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderInternal instantiates a new GetPositionOfWebPartRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder { + m := &ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/verticalSection/webparts/{webPart%2Did}/microsoft.graph.getPositionOfWebPart" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder instantiates a new GetPositionOfWebPartRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreatePostRequestInformation invoke action getPositionOfWebPart +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder) CreatePostRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Post invoke action getPositionOfWebPart +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/webpart-getposition?view=graph-rest-1.0 +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder) Post(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartPositionable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartPositionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartPositionable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_request_builder.go new file mode 100644 index 000000000..bd1885be1 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_request_builder.go @@ -0,0 +1,177 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder provides operations to manage the webparts property of the microsoft.graph.verticalSection entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderGetQueryParameters the set of web parts in this section. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderGetQueryParameters struct { + // Include count of items + Count *bool `uriparametername:"%24count"` + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Order items by property values + Orderby []string `uriparametername:"%24orderby"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` + // Skip the first n items + Skip *int32 `uriparametername:"%24skip"` + // Show only the first n items + Top *int32 `uriparametername:"%24top"` +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderInternal instantiates a new WebpartsRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder { + m := &ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/verticalSection/webparts{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder instantiates a new WebpartsRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderInternal(urlParams, requestAdapter) +} + +// Count provides operations to count the resources in the collection. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder) Count() *ItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilder { + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsCountRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// CreateGetRequestInformation the set of web parts in this section. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePostRequestInformation create new navigation property to webparts for sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder) CreatePostRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get the set of web parts in this section. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartCollectionResponseable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartCollectionResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartCollectionResponseable), nil +} + +// Post create new navigation property to webparts for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilder) Post(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_web_part_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_web_part_item_request_builder.go new file mode 100644 index 000000000..fdb5025c5 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_canvas_layout_vertical_section_webparts_web_part_item_request_builder.go @@ -0,0 +1,209 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder provides operations to manage the webparts property of the microsoft.graph.verticalSection entity. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderGetQueryParameters the set of web parts in this section. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderGetQueryParameters +} + +// ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderInternal instantiates a new WebPartItemRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder { + m := &ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/canvasLayout/verticalSection/webparts/{webPart%2Did}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder instantiates a new WebPartItemRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateDeleteRequestInformation delete navigation property webparts for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreateGetRequestInformation the set of web parts in this section. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property webparts in sites +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Delete delete navigation property webparts for sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} + +// Get the set of web parts in this section. +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} + +// GetPositionOfWebPart provides operations to call the getPositionOfWebPart method. +// +//nolint:lll +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder) GetPositionOfWebPart() *ItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilder { + return NewItemPagesItemCanvasLayoutVerticalSectionWebpartsItemGetPositionOfWebPartRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// Patch update the navigation property webparts in sites +// +//nolint:lll,wsl +func (m *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemCanvasLayoutVerticalSectionWebpartsWebPartItemRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_post_request_body.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_post_request_body.go new file mode 100644 index 000000000..5150584d8 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_post_request_body.go @@ -0,0 +1,182 @@ +package sites + +import i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + +// ItemPagesItemGetWebPartsByPositionPostRequestBody provides operations to call the getWebPartsByPosition method. +// +//nolint:lll,revive +type ItemPagesItemGetWebPartsByPositionPostRequestBody struct { + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]interface{} + // The columnId property + columnId *float64 + // The horizontalSectionId property + horizontalSectionId *float64 + // The isInVerticalSection property + isInVerticalSection *bool + // The webPartIndex property + webPartIndex *float64 +} + +// NewItemPagesItemGetWebPartsByPositionPostRequestBody instantiates a new ItemPagesItemGetWebPartsByPositionPostRequestBody and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemGetWebPartsByPositionPostRequestBody() *ItemPagesItemGetWebPartsByPositionPostRequestBody { + m := &ItemPagesItemGetWebPartsByPositionPostRequestBody{} + m.SetAdditionalData(make(map[string]interface{})) + return m +} + +// CreateItemPagesItemGetWebPartsByPositionPostRequestBodyFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// +//nolint:lll +func CreateItemPagesItemGetWebPartsByPositionPostRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemPagesItemGetWebPartsByPositionPostRequestBody(), nil +} + +// GetAdditionalData gets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// +//nolint:lll +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) GetAdditionalData() map[string]interface{} { + return m.additionalData +} + +// GetColumnId gets the columnId property value. The columnId property +// +//nolint:lll,revive +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) GetColumnId() *float64 { + return m.columnId +} + +// GetFieldDeserializers the deserialization information for the current model +// +//nolint:lll,wsl,revive +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error) + res["columnId"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetFloat64Value() + if err != nil { + return err + } + if val != nil { + m.SetColumnId(val) + } + return nil + } + res["horizontalSectionId"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetFloat64Value() + if err != nil { + return err + } + if val != nil { + m.SetHorizontalSectionId(val) + } + return nil + } + res["isInVerticalSection"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetBoolValue() + if err != nil { + return err + } + if val != nil { + m.SetIsInVerticalSection(val) + } + return nil + } + res["webPartIndex"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetFloat64Value() + if err != nil { + return err + } + if val != nil { + m.SetWebPartIndex(val) + } + return nil + } + return res +} + +// GetHorizontalSectionId gets the horizontalSectionId property value. The horizontalSectionId property +// +//nolint:lll,revive +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) GetHorizontalSectionId() *float64 { + return m.horizontalSectionId +} + +// GetIsInVerticalSection gets the isInVerticalSection property value. The isInVerticalSection property +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) GetIsInVerticalSection() *bool { + return m.isInVerticalSection +} + +// GetWebPartIndex gets the webPartIndex property value. The webPartIndex property +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) GetWebPartIndex() *float64 { + return m.webPartIndex +} + +// Serialize serializes information the current object +// +//nolint:lll,wsl +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + { + err := writer.WriteFloat64Value("columnId", m.GetColumnId()) + if err != nil { + return err + } + } + { + err := writer.WriteFloat64Value("horizontalSectionId", m.GetHorizontalSectionId()) + if err != nil { + return err + } + } + { + err := writer.WriteBoolValue("isInVerticalSection", m.GetIsInVerticalSection()) + if err != nil { + return err + } + } + { + err := writer.WriteFloat64Value("webPartIndex", m.GetWebPartIndex()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} + +// SetAdditionalData sets the additionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// +//nolint:lll +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) SetAdditionalData(value map[string]interface{}) { + m.additionalData = value +} + +// SetColumnId sets the columnId property value. The columnId property +// +//nolint:lll,revive +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) SetColumnId(value *float64) { + m.columnId = value +} + +// SetHorizontalSectionId sets the horizontalSectionId property value. The horizontalSectionId property +// +//nolint:revive +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) SetHorizontalSectionId(value *float64) { + m.horizontalSectionId = value +} + +// SetIsInVerticalSection sets the isInVerticalSection property value. The isInVerticalSection property +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) SetIsInVerticalSection(value *bool) { + m.isInVerticalSection = value +} + +// SetWebPartIndex sets the webPartIndex property value. The webPartIndex property +func (m *ItemPagesItemGetWebPartsByPositionPostRequestBody) SetWebPartIndex(value *float64) { + m.webPartIndex = value +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_post_request_bodyable.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_post_request_bodyable.go new file mode 100644 index 000000000..9cad4e760 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_post_request_bodyable.go @@ -0,0 +1,17 @@ +package sites + +import i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + +// ItemPagesItemGetWebPartsByPositionPostRequestBodyable +type ItemPagesItemGetWebPartsByPositionPostRequestBodyable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetColumnId() *float64 + GetHorizontalSectionId() *float64 + GetIsInVerticalSection() *bool + GetWebPartIndex() *float64 + SetColumnId(value *float64) + SetHorizontalSectionId(value *float64) + SetIsInVerticalSection(value *bool) + SetWebPartIndex(value *float64) +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_request_builder.go new file mode 100644 index 000000000..29ff2090b --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_request_builder.go @@ -0,0 +1,91 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemGetWebPartsByPositionRequestBuilder provides operations to call the getWebPartsByPosition method. +type ItemPagesItemGetWebPartsByPositionRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemGetWebPartsByPositionRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemGetWebPartsByPositionRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemGetWebPartsByPositionRequestBuilderInternal instantiates a new GetWebPartsByPositionRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemGetWebPartsByPositionRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemGetWebPartsByPositionRequestBuilder { + m := &ItemPagesItemGetWebPartsByPositionRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/microsoft.graph.getWebPartsByPosition" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemGetWebPartsByPositionRequestBuilder instantiates a new GetWebPartsByPositionRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemGetWebPartsByPositionRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemGetWebPartsByPositionRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemGetWebPartsByPositionRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreatePostRequestInformation invoke action getWebPartsByPosition +// +//nolint:lll,wsl,errcheck +func (m *ItemPagesItemGetWebPartsByPositionRequestBuilder) CreatePostRequestInformation(ctx context.Context, body ItemPagesItemGetWebPartsByPositionPostRequestBodyable, requestConfiguration *ItemPagesItemGetWebPartsByPositionRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Post invoke action getWebPartsByPosition +// +//nolint:lll,wsl +func (m *ItemPagesItemGetWebPartsByPositionRequestBuilder) Post(ctx context.Context, body ItemPagesItemGetWebPartsByPositionPostRequestBodyable, requestConfiguration *ItemPagesItemGetWebPartsByPositionRequestBuilderPostRequestConfiguration) (ItemPagesItemGetWebPartsByPositionResponseable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, CreateItemPagesItemGetWebPartsByPositionResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ItemPagesItemGetWebPartsByPositionResponseable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_response.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_response.go new file mode 100644 index 000000000..fa89d8855 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_response.go @@ -0,0 +1,89 @@ +package sites + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemGetWebPartsByPositionResponse provides operations to call the getWebPartsByPosition method. +type ItemPagesItemGetWebPartsByPositionResponse struct { + msmodel.BaseCollectionPaginationCountResponse + // The value property + value []ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable +} + +// NewItemPagesItemGetWebPartsByPositionResponse instantiates a new ItemPagesItemGetWebPartsByPositionResponse and sets the default values. +// +//nolint:wsl,lll +func NewItemPagesItemGetWebPartsByPositionResponse() *ItemPagesItemGetWebPartsByPositionResponse { + m := &ItemPagesItemGetWebPartsByPositionResponse{ + BaseCollectionPaginationCountResponse: *msmodel.NewBaseCollectionPaginationCountResponse(), + } + return m +} + +// CreateItemPagesItemGetWebPartsByPositionResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// +//nolint:lll +func CreateItemPagesItemGetWebPartsByPositionResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) (i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewItemPagesItemGetWebPartsByPositionResponse(), nil +} + +// GetFieldDeserializers the deserialization information for the current model +// +//nolint:lll,wsl +func (m *ItemPagesItemGetWebPartsByPositionResponse) GetFieldDeserializers() map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + res := m.BaseCollectionPaginationCountResponse.GetFieldDeserializers() + res["value"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, len(val)) + for i, v := range val { + res[i] = v.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable) + } + m.SetValue(res) + } + return nil + } + return res +} + +// GetValue gets the value property value. The value property +// +//nolint:lll +func (m *ItemPagesItemGetWebPartsByPositionResponse) GetValue() []ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable { + return m.value +} + +// Serialize serializes information the current object +// +//nolint:lll,wsl +func (m *ItemPagesItemGetWebPartsByPositionResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter) error { + err := m.BaseCollectionPaginationCountResponse.Serialize(writer) + if err != nil { + return err + } + if m.GetValue() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetValue())) + for i, v := range m.GetValue() { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + err = writer.WriteCollectionOfObjectValues("value", cast) + if err != nil { + return err + } + } + return nil +} + +// SetValue sets the value property value. The value property +// +//nolint:lll +func (m *ItemPagesItemGetWebPartsByPositionResponse) SetValue(value []ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable) { + m.value = value +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_responseable.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_responseable.go new file mode 100644 index 000000000..f862929ab --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_get_web_parts_by_position_responseable.go @@ -0,0 +1,16 @@ +package sites + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesItemGetWebPartsByPositionResponseable +type ItemPagesItemGetWebPartsByPositionResponseable interface { + msmodel.BaseCollectionPaginationCountResponseable + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetValue() []ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable + SetValue(value []ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable) +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_publish_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_publish_request_builder.go new file mode 100644 index 000000000..56197e940 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_publish_request_builder.go @@ -0,0 +1,82 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemPublishRequestBuilder provides operations to call the publish method. +type ItemPagesItemPublishRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// nolint:lll +// ItemPagesItemPublishRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +type ItemPagesItemPublishRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// nolint:lll,wsl +// NewItemPagesItemPublishRequestBuilderInternal instantiates a new PublishRequestBuilder and sets the default values. +func NewItemPagesItemPublishRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemPublishRequestBuilder { + m := &ItemPagesItemPublishRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/microsoft.graph.publish" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemPublishRequestBuilder instantiates a new PublishRequestBuilder and sets the default values. +// +//nolint:lll,wsl,revive +func NewItemPagesItemPublishRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemPublishRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemPublishRequestBuilderInternal(urlParams, requestAdapter) +} + +// //nolint:wsl,revive,lll +// CreatePostRequestInformation invoke action publish +func (m *ItemPagesItemPublishRequestBuilder) CreatePostRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemPublishRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// //nolint:wsl,revive,lll +// Post invoke action publish +func (m *ItemPagesItemPublishRequestBuilder) Post(ctx context.Context, requestConfiguration *ItemPagesItemPublishRequestBuilderPostRequestConfiguration) error { + requestInfo, err := m.CreatePostRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_count_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_count_request_builder.go new file mode 100644 index 000000000..57c875179 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_count_request_builder.go @@ -0,0 +1,103 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemWebPartsCountRequestBuilder provides operations to count the resources in the collection. +type ItemPagesItemWebPartsCountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemWebPartsCountRequestBuilderGetQueryParameters get the number of the resource +type ItemPagesItemWebPartsCountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// ItemPagesItemWebPartsCountRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemWebPartsCountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemWebPartsCountRequestBuilderGetQueryParameters +} + +// NewItemPagesItemWebPartsCountRequestBuilderInternal instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesItemWebPartsCountRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsCountRequestBuilder { + m := &ItemPagesItemWebPartsCountRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/webParts/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemWebPartsCountRequestBuilder instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesItemWebPartsCountRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsCountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemWebPartsCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsCountRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsCountRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get the number of the resource +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsCountRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsCountRequestBuilderGetRequestConfiguration) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_item_get_position_of_web_part_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_item_get_position_of_web_part_request_builder.go new file mode 100644 index 000000000..4bb325673 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_item_get_position_of_web_part_request_builder.go @@ -0,0 +1,96 @@ +package sites + +import ( + "context" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder provides operations to call the getPositionOfWebPart method. +// +//nolint:lll +type ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderInternal instantiates a new GetPositionOfWebPartRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder { + m := &ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/webParts/{webPart%2Did}/microsoft.graph.getPositionOfWebPart" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder instantiates a new GetPositionOfWebPartRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreatePostRequestInformation invoke action getPositionOfWebPart +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder) CreatePostRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Post invoke action getPositionOfWebPart +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/webpart-getposition?view=graph-rest-1.0 +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder) Post(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartPositionable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartPositionFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartPositionable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_request_builder.go new file mode 100644 index 000000000..0e349df74 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_request_builder.go @@ -0,0 +1,172 @@ +package sites + +import ( + "context" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemWebPartsRequestBuilder provides operations to manage the webParts property of the microsoft.graph.sitePage entity. +// +//nolint:lll +type ItemPagesItemWebPartsRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemWebPartsRequestBuilderGetQueryParameters collection of webparts on the SharePoint page +type ItemPagesItemWebPartsRequestBuilderGetQueryParameters struct { + // Include count of items + Count *bool `uriparametername:"%24count"` + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Order items by property values + Orderby []string `uriparametername:"%24orderby"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` + // Skip the first n items + Skip *int32 `uriparametername:"%24skip"` + // Show only the first n items + Top *int32 `uriparametername:"%24top"` +} + +// ItemPagesItemWebPartsRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemWebPartsRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemWebPartsRequestBuilderGetQueryParameters +} + +// ItemPagesItemWebPartsRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesItemWebPartsRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemWebPartsRequestBuilderInternal instantiates a new WebPartsRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewItemPagesItemWebPartsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsRequestBuilder { + m := &ItemPagesItemWebPartsRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/webParts{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemWebPartsRequestBuilder instantiates a new WebPartsRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesItemWebPartsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemWebPartsRequestBuilderInternal(urlParams, requestAdapter) +} + +// Count provides operations to count the resources in the collection. +func (m *ItemPagesItemWebPartsRequestBuilder) Count() *ItemPagesItemWebPartsCountRequestBuilder { + return NewItemPagesItemWebPartsCountRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// CreateGetRequestInformation collection of webparts on the SharePoint page +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePostRequestInformation create new navigation property to webParts for sites +// +//nolint:wsl,revive,lll,errcheck +func (m *ItemPagesItemWebPartsRequestBuilder) CreatePostRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemWebPartsRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get collection of webparts on the SharePoint page +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartCollectionResponseable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartCollectionResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartCollectionResponseable), nil +} + +// Post create new navigation property to webParts for sites +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsRequestBuilder) Post(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemWebPartsRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_web_part_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_web_part_item_request_builder.go new file mode 100644 index 000000000..25dba98cf --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_item_web_parts_web_part_item_request_builder.go @@ -0,0 +1,209 @@ +package sites + +import ( + "context" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesItemWebPartsWebPartItemRequestBuilder provides operations to manage the webParts property of the microsoft.graph.sitePage entity. +// +//nolint:wsl,revive,lll +type ItemPagesItemWebPartsWebPartItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesItemWebPartsWebPartItemRequestBuilderDeleteRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:wsl,revive,lll +type ItemPagesItemWebPartsWebPartItemRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesItemWebPartsWebPartItemRequestBuilderGetQueryParameters collection of webparts on the SharePoint page +// +//nolint:wsl,revive,lll +type ItemPagesItemWebPartsWebPartItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesItemWebPartsWebPartItemRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:wsl,revive,lll +type ItemPagesItemWebPartsWebPartItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesItemWebPartsWebPartItemRequestBuilderGetQueryParameters +} + +// ItemPagesItemWebPartsWebPartItemRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:wsl,revive,lll +type ItemPagesItemWebPartsWebPartItemRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesItemWebPartsWebPartItemRequestBuilderInternal instantiates a new WebPartItemRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesItemWebPartsWebPartItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsWebPartItemRequestBuilder { + m := &ItemPagesItemWebPartsWebPartItemRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}/webParts/{webPart%2Did}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesItemWebPartsWebPartItemRequestBuilder instantiates a new WebPartItemRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesItemWebPartsWebPartItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesItemWebPartsWebPartItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesItemWebPartsWebPartItemRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateDeleteRequestInformation delete navigation property webParts for sites +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsWebPartItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsWebPartItemRequestBuilderDeleteRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreateGetRequestInformation collection of webparts on the SharePoint page +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsWebPartItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsWebPartItemRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property webParts in sites +// +//nolint:wsl,revive,lll,errcheck +func (m *ItemPagesItemWebPartsWebPartItemRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemWebPartsWebPartItemRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Delete delete navigation property webParts for sites +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsWebPartItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsWebPartItemRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} + +// Get collection of webparts on the SharePoint page +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsWebPartItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesItemWebPartsWebPartItemRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} + +// GetPositionOfWebPart provides operations to call the getPositionOfWebPart method. +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsWebPartItemRequestBuilder) GetPositionOfWebPart() *ItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilder { + return NewItemPagesItemWebPartsItemGetPositionOfWebPartRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// Patch update the navigation property webParts in sites +// +//nolint:wsl,revive,lll +func (m *ItemPagesItemWebPartsWebPartItemRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, requestConfiguration *ItemPagesItemWebPartsWebPartItemRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateWebPartFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.WebPartable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_request_builder.go new file mode 100644 index 000000000..43f503439 --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_request_builder.go @@ -0,0 +1,176 @@ +package sites + +import ( + "context" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemPagesRequestBuilder provides operations to manage the pages property of the microsoft.graph.site entity. +type ItemPagesRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesRequestBuilderGetQueryParameters get the collection of [sitePage][] objects from the site pages [list][] in a site [site][]. All pages in the site are returned (with pagination). Sort alphabetically by `name` in ascending order. +// +//nolint:lll +type ItemPagesRequestBuilderGetQueryParameters struct { + // Include count of items + Count *bool `uriparametername:"%24count"` + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Order items by property values + Orderby []string `uriparametername:"%24orderby"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` + // Skip the first n items + Skip *int32 `uriparametername:"%24skip"` + // Show only the first n items + Top *int32 `uriparametername:"%24top"` +} + +// ItemPagesRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:wsl,revive,lll +type ItemPagesRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesRequestBuilderGetQueryParameters +} + +// ItemPagesRequestBuilderPostRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:wsl,revive,lll +type ItemPagesRequestBuilderPostRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// NewItemPagesRequestBuilderInternal instantiates a new PagesRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesRequestBuilder { + m := &ItemPagesRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages{?%24top,%24skip,%24search,%24filter,%24count,%24orderby,%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesRequestBuilder instantiates a new PagesRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesRequestBuilderInternal(urlParams, requestAdapter) +} + +// Count provides operations to count the resources in the collection. +func (m *ItemPagesRequestBuilder) Count() *ItemPagesCountRequestBuilder { + return NewItemPagesCountRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// CreateGetRequestInformation get the collection of [sitePage][] objects from the site pages [list][] in a site [site][]. All pages in the site are returned (with pagination). Sort alphabetically by `name` in ascending order. +// +//nolint:wsl,revive,lll +func (m *ItemPagesRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePostRequestInformation create a new [sitePage][] in the site pages [list][] in a [site][]. +// +//nolint:errcheck,lll,wsl +func (m *ItemPagesRequestBuilder) CreatePostRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable, requestConfiguration *ItemPagesRequestBuilderPostRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get the collection of [sitePage][] objects from the site pages [list][] in a site [site][]. All pages in the site are returned (with pagination). Sort alphabetically by `name` in ascending order. +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/sitepage-list?view=graph-rest-1.0 +// //nolint:wsl,revive,lll +func (m *ItemPagesRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageCollectionResponseable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateSitePageCollectionResponseFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageCollectionResponseable), nil +} + +// Post create a new [sitePage][] in the site pages [list][] in a [site][]. +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/sitepage-create?view=graph-rest-1.0 +// nolint:wsl,revive,lll +func (m *ItemPagesRequestBuilder) Post(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable, requestConfiguration *ItemPagesRequestBuilderPostRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable, error) { + requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateSitePageFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_pages_site_page_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_pages_site_page_item_request_builder.go new file mode 100644 index 000000000..29fda72bd --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_pages_site_page_item_request_builder.go @@ -0,0 +1,237 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + + ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354 "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" +) + +// ItemPagesSitePageItemRequestBuilder provides operations to manage the pages property of the microsoft.graph.site entity. +// +//nolint:lll +type ItemPagesSitePageItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemPagesSitePageItemRequestBuilderDeleteRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesSitePageItemRequestBuilderDeleteRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// ItemPagesSitePageItemRequestBuilderGetQueryParameters the collection of pages in the SitePages list in this site. +type ItemPagesSitePageItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemPagesSitePageItemRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemPagesSitePageItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemPagesSitePageItemRequestBuilderGetQueryParameters +} + +// ItemPagesSitePageItemRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:wsl,revive,lll +type ItemPagesSitePageItemRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// CanvasLayout provides operations to manage the canvasLayout property of the microsoft.graph.sitePage entity. +func (m *ItemPagesSitePageItemRequestBuilder) CanvasLayout() *ItemPagesItemCanvasLayoutRequestBuilder { + return NewItemPagesItemCanvasLayoutRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// NewItemPagesSitePageItemRequestBuilderInternal instantiates a new SitePageItemRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesSitePageItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesSitePageItemRequestBuilder { + m := &ItemPagesSitePageItemRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/pages/{sitePage%2Did}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemPagesSitePageItemRequestBuilder instantiates a new SitePageItemRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemPagesSitePageItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemPagesSitePageItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemPagesSitePageItemRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateDeleteRequestInformation delete navigation property pages for sites +// +//nolint:wsl,revive,lll +func (m *ItemPagesSitePageItemRequestBuilder) CreateDeleteRequestInformation(ctx context.Context, requestConfiguration *ItemPagesSitePageItemRequestBuilderDeleteRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreateGetRequestInformation the collection of pages in the SitePages list in this site. +// +//nolint:wsl,revive,lll +func (m *ItemPagesSitePageItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemPagesSitePageItemRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePatchRequestInformation update the navigation property pages in sites +// +//nolint:errcheck,lll,wsl +func (m *ItemPagesSitePageItemRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable, requestConfiguration *ItemPagesSitePageItemRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Delete delete navigation property pages for sites +// +//nolint:wsl,revive,lll +func (m *ItemPagesSitePageItemRequestBuilder) Delete(ctx context.Context, requestConfiguration *ItemPagesSitePageItemRequestBuilderDeleteRequestConfiguration) error { + requestInfo, err := m.CreateDeleteRequestInformation(ctx, requestConfiguration) + if err != nil { + return err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + err = m.requestAdapter.SendNoContent(ctx, requestInfo, errorMapping) + if err != nil { + return err + } + return nil +} + +// Get the collection of pages in the SitePages list in this site. +// +//nolint:wsl,revive,lll +func (m *ItemPagesSitePageItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemPagesSitePageItemRequestBuilderGetRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateSitePageFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable), nil +} + +// GetWebPartsByPosition provides operations to call the getWebPartsByPosition method. +// +//nolint:wsl,revive,lll +func (m *ItemPagesSitePageItemRequestBuilder) GetWebPartsByPosition() *ItemPagesItemGetWebPartsByPositionRequestBuilder { + return NewItemPagesItemGetWebPartsByPositionRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// Patch update the navigation property pages in sites +// +//nolint:wsl,revive,lll +func (m *ItemPagesSitePageItemRequestBuilder) Patch(ctx context.Context, body ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable, requestConfiguration *ItemPagesSitePageItemRequestBuilderPatchRequestConfiguration) (ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.CreateSitePageFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(ifda19816f54f079134d70c11e75d6b26799300cf72079e282f1d3bb9a6750354.SitePageable), nil +} + +// Publish provides operations to call the publish method. +func (m *ItemPagesSitePageItemRequestBuilder) Publish() *ItemPagesItemPublishRequestBuilder { + return NewItemPagesItemPublishRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// WebParts provides operations to manage the webParts property of the microsoft.graph.sitePage entity. +func (m *ItemPagesSitePageItemRequestBuilder) WebParts() *ItemPagesItemWebPartsRequestBuilder { + return NewItemPagesItemWebPartsRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// WebPartsById provides operations to manage the webParts property of the microsoft.graph.sitePage entity. +// +//nolint:revive,wsl +func (m *ItemPagesSitePageItemRequestBuilder) WebPartsById(id string) *ItemPagesItemWebPartsWebPartItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + if id != "" { + urlTplParams["webPart%2Did"] = id + } + return NewItemPagesItemWebPartsWebPartItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} diff --git a/src/internal/connector/graph/betasdk/sites/item_sites_count_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_sites_count_request_builder.go new file mode 100644 index 000000000..5a83c959c --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_sites_count_request_builder.go @@ -0,0 +1,103 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemSitesCountRequestBuilder provides operations to count the resources in the collection. +type ItemSitesCountRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemSitesCountRequestBuilderGetQueryParameters get the number of the resource +type ItemSitesCountRequestBuilderGetQueryParameters struct { + // Filter items by property values + Filter *string `uriparametername:"%24filter"` + // Search items by search phrases + Search *string `uriparametername:"%24search"` +} + +// ItemSitesCountRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemSitesCountRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemSitesCountRequestBuilderGetQueryParameters +} + +// NewItemSitesCountRequestBuilderInternal instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:wsl,lll +func NewItemSitesCountRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemSitesCountRequestBuilder { + m := &ItemSitesCountRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/sites/$count{?%24search,%24filter}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemSitesCountRequestBuilder instantiates a new CountRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemSitesCountRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemSitesCountRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemSitesCountRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation get the number of the resource +// +//nolint:wsl,revive,lll +func (m *ItemSitesCountRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemSitesCountRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "text/plain") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get get the number of the resource +// +//nolint:wsl,revive,lll +func (m *ItemSitesCountRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemSitesCountRequestBuilderGetRequestConfiguration) (*int32, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.SendPrimitive(ctx, requestInfo, "int32", errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(*int32), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/item_sites_site_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/item_sites_site_item_request_builder.go new file mode 100644 index 000000000..c5959b0ff --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/item_sites_site_item_request_builder.go @@ -0,0 +1,104 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// ItemSitesSiteItemRequestBuilder provides operations to manage the sites property of the microsoft.graph.site entity. +type ItemSitesSiteItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// ItemSitesSiteItemRequestBuilderGetQueryParameters the collection of the sub-sites under this site. +type ItemSitesSiteItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// ItemSitesSiteItemRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type ItemSitesSiteItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *ItemSitesSiteItemRequestBuilderGetQueryParameters +} + +// NewItemSitesSiteItemRequestBuilderInternal instantiates a new SiteItemRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemSitesSiteItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemSitesSiteItemRequestBuilder { + m := &ItemSitesSiteItemRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}/sites/{site%2Did1}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewItemSitesSiteItemRequestBuilder instantiates a new SiteItemRequestBuilder and sets the default values. +// +//nolint:wsl,revive,lll +func NewItemSitesSiteItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *ItemSitesSiteItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemSitesSiteItemRequestBuilderInternal(urlParams, requestAdapter) +} + +// CreateGetRequestInformation the collection of the sub-sites under this site. +// +//nolint:wsl,revive,lll +func (m *ItemSitesSiteItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *ItemSitesSiteItemRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// Get the collection of the sub-sites under this site. +// +//nolint:wsl,revive,lll +func (m *ItemSitesSiteItemRequestBuilder) Get(ctx context.Context, requestConfiguration *ItemSitesSiteItemRequestBuilderGetRequestConfiguration) (msmodel.Siteable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, msmodel.CreateSiteFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(msmodel.Siteable), nil +} diff --git a/src/internal/connector/graph/betasdk/sites/site_item_request_builder.go b/src/internal/connector/graph/betasdk/sites/site_item_request_builder.go new file mode 100644 index 000000000..3746a736c --- /dev/null +++ b/src/internal/connector/graph/betasdk/sites/site_item_request_builder.go @@ -0,0 +1,249 @@ +package sites + +import ( + "context" + + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + msmodel "github.com/microsoftgraph/msgraph-sdk-go/models" + i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0 "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" +) + +// SiteItemRequestBuilder provides operations to manage the collection of site entities. +type SiteItemRequestBuilder struct { + // Path parameters for the request + pathParameters map[string]string + // The request adapter to use to execute the requests. + requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter + // Url template to use to build the URL for the current request builder + urlTemplate string +} + +// SiteItemRequestBuilderGetQueryParameters retrieve properties and relationships for a [site][] resource.A **site** resource represents a team site in SharePoint. +// +//nolint:lll +type SiteItemRequestBuilderGetQueryParameters struct { + // Expand related entities + Expand []string `uriparametername:"%24expand"` + // Select properties to be returned + Select []string `uriparametername:"%24select"` +} + +// SiteItemRequestBuilderGetRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type SiteItemRequestBuilderGetRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption + // Request query parameters + QueryParameters *SiteItemRequestBuilderGetQueryParameters +} + +// SiteItemRequestBuilderPatchRequestConfiguration configuration for the request such as headers, query parameters, and middleware options. +// +//nolint:lll +type SiteItemRequestBuilderPatchRequestConfiguration struct { + // Request headers + Headers *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestHeaders + // Request options + Options []i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestOption +} + +// Analytics provides operations to manage the analytics property of the microsoft.graph.site entity. +// REMOVED Analytics for minimial + +// Columns provides operations to manage the columns property of the microsoft.graph.site entity. + +// ColumnsById provides operations to manage the columns property of the microsoft.graph.site entity. + +// NewSiteItemRequestBuilderInternal instantiates a new SiteItemRequestBuilder and sets the default values. +// +//nolint:lll,wsl +func NewSiteItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *SiteItemRequestBuilder { + m := &SiteItemRequestBuilder{} + m.urlTemplate = "{+baseurl}/sites/{site%2Did}{?%24select,%24expand}" + urlTplParams := make(map[string]string) + for idx, item := range pathParameters { + urlTplParams[idx] = item + } + m.pathParameters = urlTplParams + m.requestAdapter = requestAdapter + return m +} + +// NewSiteItemRequestBuilder instantiates a new SiteItemRequestBuilder and sets the default values. +// +//nolint:lll,revive,wsl +func NewSiteItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter) *SiteItemRequestBuilder { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewSiteItemRequestBuilderInternal(urlParams, requestAdapter) +} + +// ContentTypes provides operations to manage the contentTypes property of the microsoft.graph.site entity. + +// ContentTypesById provides operations to manage the contentTypes property of the microsoft.graph.site entity. +// CreateGetRequestInformation retrieve properties and relationships for a [site][] resource.A **site** resource represents a team site in SharePoint. +// +//nolint:lll,wsl +func (m *SiteItemRequestBuilder) CreateGetRequestInformation(ctx context.Context, requestConfiguration *SiteItemRequestBuilderGetRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET + requestInfo.Headers.Add("Accept", "application/json") + if requestConfiguration != nil { + if requestConfiguration.QueryParameters != nil { + requestInfo.AddQueryParameters(*(requestConfiguration.QueryParameters)) + } + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + return requestInfo, nil +} + +// CreatePatchRequestInformation update entity in sites by key (id) +// +//nolint:lll,errcheck,wsl +func (m *SiteItemRequestBuilder) CreatePatchRequestInformation(ctx context.Context, body msmodel.Siteable, requestConfiguration *SiteItemRequestBuilderPatchRequestConfiguration) (*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation() + requestInfo.UrlTemplate = m.urlTemplate + requestInfo.PathParameters = m.pathParameters + requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH + requestInfo.Headers.Add("Accept", "application/json") + requestInfo.SetContentFromParsable(ctx, m.requestAdapter, "application/json", body) + + if requestConfiguration != nil { + requestInfo.Headers.AddAll(requestConfiguration.Headers) + requestInfo.AddRequestOptions(requestConfiguration.Options) + } + + return requestInfo, nil +} + +// Drive provides operations to manage the drive property of the microsoft.graph.site entity. +// Removed Drive() for minimial connector + +// Drives provides operations to manage the drives property of the microsoft.graph.site entity. +// Removed Drives() + +// DrivesById provides operations to manage the drives property of the microsoft.graph.site entity. + +// ExternalColumns provides operations to manage the externalColumns property of the microsoft.graph.site entity. + +// // ExternalColumnsById provides operations to manage the externalColumns property of the microsoft.graph.site entity. +// +// func (m *SiteItemRequestBuilder) ExternalColumnsById(id string) *ItemExternalColumnsColumnDefinitionItemRequestBuilder { +// urlTplParams := make(map[string]string) +// for idx, item := range m.pathParameters { +// urlTplParams[idx] = item +// } +// if id != "" { +// urlTplParams["columnDefinition%2Did"] = id +// } +// return NewItemExternalColumnsColumnDefinitionItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +// } +// +// Get retrieve properties and relationships for a [site][] resource.A **site** resource represents a team site in SharePoint. +// [Find more info here] +// +// [Find more info here]: https://docs.microsoft.com/graph/api/site-get?view=graph-rest-1.0 +// +//nolint:wsl,revive,lll +func (m *SiteItemRequestBuilder) Get(ctx context.Context, requestConfiguration *SiteItemRequestBuilderGetRequestConfiguration) (msmodel.Siteable, error) { + requestInfo, err := m.CreateGetRequestInformation(ctx, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, msmodel.CreateSiteFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(msmodel.Siteable), nil +} + +//nolint:lll +// GetActivitiesByIntervalWithStartDateTimeWithEndDateTimeWithInterval provides operations to call the getActivitiesByInterval method. +// GetApplicableContentTypesForListWithListId provides operations to call the getApplicableContentTypesForList method. +// GetByPathWithPath provides operations to call the getByPath method. +// InformationProtection provides operations to manage the informationProtection property of the microsoft.graph.site entity. +// Items provides operations to manage the items property of the microsoft.graph.site entity. +// ItemsById provides operations to manage the items property of the microsoft.graph.site entity. +// Lists provides operations to manage the lists property of the microsoft.graph.site entity. +// ListsById provides operations to manage the lists property of the microsoft.graph.site entity. +// Onenote provides operations to manage the onenote property of the microsoft.graph.site entity. +// Operations provides operations to manage the operations property of the microsoft.graph.site entity. +// OperationsById provides operations to manage the operations property of the microsoft.graph.site entity. + +// Pages provides operations to manage the pages property of the microsoft.graph.site entity. +func (m *SiteItemRequestBuilder) Pages() *ItemPagesRequestBuilder { + return NewItemPagesRequestBuilderInternal(m.pathParameters, m.requestAdapter) +} + +// PagesById provides operations to manage the pages property of the microsoft.graph.site entity. +// +//nolint:revive,wsl +func (m *SiteItemRequestBuilder) PagesById(id string) *ItemPagesSitePageItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + if id != "" { + urlTplParams["sitePage%2Did"] = id + } + return NewItemPagesSitePageItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} + +// Patch update entity in sites by key (id) +// +//nolint:wsl,revive,lll +func (m *SiteItemRequestBuilder) Patch( + ctx context.Context, + body msmodel.Siteable, + requestConfiguration *SiteItemRequestBuilderPatchRequestConfiguration, +) (msmodel.Siteable, error) { + requestInfo, err := m.CreatePatchRequestInformation(ctx, body, requestConfiguration) + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings{ + "4XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + "5XX": i7ad325c11fbf3db4d761c429267362d8b24daa1eda0081f914ebc3cdc85181a0.CreateODataErrorFromDiscriminatorValue, + } + res, err := m.requestAdapter.Send(ctx, requestInfo, msmodel.CreateSiteFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + if res == nil { + return nil, nil + } + return res.(msmodel.Siteable), nil +} + +// Permissions provides operations to manage the permissions property of the microsoft.graph.site entity. +// PermissionsById provides operations to manage the permissions property of the microsoft.graph.site entity. +// Sites provides operations to manage the sites property of the microsoft.graph.site entity. +// func (m *SiteItemRequestBuilder) Sites() +// SitesById provides operations to manage the sites property of the microsoft.graph.site entity. +// +//nolint:revive,wsl +func (m *SiteItemRequestBuilder) SitesById(id string) *ItemSitesSiteItemRequestBuilder { + urlTplParams := make(map[string]string) + for idx, item := range m.pathParameters { + urlTplParams[idx] = item + } + if id != "" { + urlTplParams["site%2Did1"] = id + } + return NewItemSitesSiteItemRequestBuilderInternal(urlTplParams, m.requestAdapter) +} + +// TermStore provides operations to manage the termStore property of the microsoft.graph.site entity. diff --git a/src/internal/connector/graph/cache_container.go b/src/internal/connector/graph/cache_container.go index 989698235..e792c235e 100644 --- a/src/internal/connector/graph/cache_container.go +++ b/src/internal/connector/graph/cache_container.go @@ -1,7 +1,7 @@ package graph import ( - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" "github.com/alcionai/corso/src/pkg/path" diff --git a/src/internal/connector/graph/errors.go b/src/internal/connector/graph/errors.go index 85ae0c874..86cec64bd 100644 --- a/src/internal/connector/graph/errors.go +++ b/src/internal/connector/graph/errors.go @@ -5,7 +5,7 @@ import ( "net/url" "os" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors" + "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" "github.com/pkg/errors" "golang.org/x/exp/slices" diff --git a/src/internal/connector/graph/service.go b/src/internal/connector/graph/service.go index 58a86317a..7780e7941 100644 --- a/src/internal/connector/graph/service.go +++ b/src/internal/connector/graph/service.go @@ -4,7 +4,7 @@ import ( "context" absser "github.com/microsoft/kiota-abstractions-go/serialization" - msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" "github.com/pkg/errors" "github.com/alcionai/corso/src/pkg/account" diff --git a/src/internal/connector/graph/service_helper.go b/src/internal/connector/graph/service_helper.go index b55821b78..900919406 100644 --- a/src/internal/connector/graph/service_helper.go +++ b/src/internal/connector/graph/service_helper.go @@ -4,18 +4,16 @@ import ( "net/http" "net/http/httputil" "os" - "strings" "time" az "github.com/Azure/azure-sdk-for-go/sdk/azidentity" ka "github.com/microsoft/kiota-authentication-azure-go" khttp "github.com/microsoft/kiota-http-go" - msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core" "github.com/pkg/errors" "github.com/alcionai/corso/src/pkg/logger" - "github.com/alcionai/corso/src/pkg/path" ) const ( @@ -57,6 +55,23 @@ func CreateHTTPClient() *http.Client { return httpClient } +// LargeItemClient generates a client that's configured to handle +// large file downloads. This client isn't suitable for other queries +// due to loose restrictions on timeouts and such. +// +// Re-use of http clients is critical, or else we leak os resources +// and consume relatively unbound socket connections. It is important +// to centralize this client to be passed downstream where api calls +// can utilize it on a per-download basis. +// +// TODO: this should get owned by an API client layer, not the GC itself. +func LargeItemClient() *http.Client { + httpClient := CreateHTTPClient() + httpClient.Timeout = 0 // infinite timeout for pulling large files + + return httpClient +} + // --------------------------------------------------------------------------- // Logging Middleware // --------------------------------------------------------------------------- @@ -87,6 +102,10 @@ func (handler *LoggingMiddleware) Intercept( logger.Ctx(ctx).Infow("graph api throttling", "method", req.Method, "url", req.URL) } + if resp.StatusCode != http.StatusTooManyRequests && (resp.StatusCode/100) != 2 { + logger.Ctx(ctx).Infow("graph api error", "method", req.Method, "url", req.URL) + } + if logger.DebugAPI || os.Getenv(logGraphRequestsEnvKey) != "" { respDump, _ := httputil.DumpResponse(resp, true) @@ -104,26 +123,3 @@ func (handler *LoggingMiddleware) Intercept( return resp, err } - -// --------------------------------------------------------------------------- -// Other Helpers -// --------------------------------------------------------------------------- - -func StringToPathCategory(input string) path.CategoryType { - param := strings.ToLower(input) - - switch param { - case "email": - return path.EmailCategory - case "contacts": - return path.ContactsCategory - case "events": - return path.EventsCategory - case "files": - return path.FilesCategory - case "libraries": - return path.LibrariesCategory - default: - return path.UnknownCategory - } -} diff --git a/src/internal/connector/graph/service_test.go b/src/internal/connector/graph/service_test.go index 32e900433..ee8c6bc29 100644 --- a/src/internal/connector/graph/service_test.go +++ b/src/internal/connector/graph/service_test.go @@ -3,7 +3,7 @@ package graph_test import ( "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/src/internal/connector/graph_connector.go b/src/internal/connector/graph_connector.go index fd0a8c4e2..3dbc0e60c 100644 --- a/src/internal/connector/graph_connector.go +++ b/src/internal/connector/graph_connector.go @@ -4,17 +4,19 @@ package connector import ( "context" + "net/http" "runtime/trace" "strings" "sync" "github.com/microsoft/kiota-abstractions-go/serialization" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" "golang.org/x/exp/maps" "github.com/alcionai/corso/src/internal/connector/discovery" + "github.com/alcionai/corso/src/internal/connector/discovery/api" "github.com/alcionai/corso/src/internal/connector/exchange" "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/onedrive" @@ -37,7 +39,10 @@ import ( // GraphRequestAdapter from the msgraph-sdk-go. Additional fields are for // bookkeeping and interfacing with other component. type GraphConnector struct { - Service graph.Servicer + Service graph.Servicer + Owners api.Client + itemClient *http.Client // configured to handle large item downloads + tenant string Users map[string]string // key value Sites map[string]string // key value @@ -61,25 +66,34 @@ const ( Sites ) -func NewGraphConnector(ctx context.Context, acct account.Account, r resource) (*GraphConnector, error) { +func NewGraphConnector( + ctx context.Context, + itemClient *http.Client, + acct account.Account, + r resource, +) (*GraphConnector, error) { m365, err := acct.M365Config() if err != nil { return nil, errors.Wrap(err, "retrieving m365 account configuration") } gc := GraphConnector{ + itemClient: itemClient, tenant: m365.AzureTenantID, Users: make(map[string]string, 0), wg: &sync.WaitGroup{}, credentials: m365, } - gService, err := gc.createService() + gc.Service, err = gc.createService() if err != nil { return nil, errors.Wrap(err, "creating service connection") } - gc.Service = gService + gc.Owners, err = api.NewClient(m365) + if err != nil { + return nil, errors.Wrap(err, "creating api client") + } // TODO(ashmrtn): When selectors only encapsulate a single resource owner that // is not a wildcard don't populate users or sites when making the connector. @@ -121,7 +135,7 @@ func (gc *GraphConnector) setTenantUsers(ctx context.Context) error { ctx, end := D.Span(ctx, "gc:setTenantUsers") defer end() - users, err := discovery.Users(ctx, gc.Service, gc.tenant) + users, err := discovery.Users(ctx, gc.Owners.Users()) if err != nil { return err } diff --git a/src/internal/connector/graph_connector_disconnected_test.go b/src/internal/connector/graph_connector_disconnected_test.go index f7f583ebd..711e55ff8 100644 --- a/src/internal/connector/graph_connector_disconnected_test.go +++ b/src/internal/connector/graph_connector_disconnected_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/pkg/account" @@ -65,7 +66,7 @@ func (suite *DisconnectedGraphConnectorSuite) TestBadConnection() { for _, test := range table { suite.T().Run(test.name, func(t *testing.T) { - gc, err := NewGraphConnector(ctx, test.acct(t), Users) + gc, err := NewGraphConnector(ctx, graph.LargeItemClient(), test.acct(t), Users) assert.Nil(t, gc, test.name+" failed") assert.NotNil(t, err, test.name+"failed") }) diff --git a/src/internal/connector/graph_connector_helper_test.go b/src/internal/connector/graph_connector_helper_test.go index 953855957..698ee8527 100644 --- a/src/internal/connector/graph_connector_helper_test.go +++ b/src/internal/connector/graph_connector_helper_test.go @@ -3,10 +3,11 @@ package connector import ( "context" "io" + "net/http" "reflect" "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -978,9 +979,9 @@ func getSelectorWith( } } -func loadConnector(ctx context.Context, t *testing.T, r resource) *GraphConnector { +func loadConnector(ctx context.Context, t *testing.T, itemClient *http.Client, r resource) *GraphConnector { a := tester.NewM365Account(t) - connector, err := NewGraphConnector(ctx, a, r) + connector, err := NewGraphConnector(ctx, itemClient, a, r) require.NoError(t, err) return connector diff --git a/src/internal/connector/graph_connector_test.go b/src/internal/connector/graph_connector_test.go index d635ee6f9..85ad3f45f 100644 --- a/src/internal/connector/graph_connector_test.go +++ b/src/internal/connector/graph_connector_test.go @@ -12,6 +12,7 @@ import ( "github.com/stretchr/testify/suite" "golang.org/x/exp/maps" + "github.com/alcionai/corso/src/internal/connector/discovery/api" "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/mockconnector" "github.com/alcionai/corso/src/internal/connector/support" @@ -155,7 +156,7 @@ func (suite *GraphConnectorIntegrationSuite) SetupSuite() { tester.MustGetEnvSets(suite.T(), tester.M365AcctCredEnvs) - suite.connector = loadConnector(ctx, suite.T(), Users) + suite.connector = loadConnector(ctx, suite.T(), graph.LargeItemClient(), Users) suite.user = tester.M365UserID(suite.T()) suite.acct = tester.NewM365Account(suite.T()) @@ -174,10 +175,10 @@ func (suite *GraphConnectorIntegrationSuite) TestSetTenantUsers() { ctx, flush := tester.NewContext() defer flush() - service, err := newConnector.createService() + owners, err := api.NewClient(suite.connector.credentials) require.NoError(suite.T(), err) - newConnector.Service = service + newConnector.Owners = owners suite.Empty(len(newConnector.Users)) err = newConnector.setTenantUsers(ctx) @@ -379,7 +380,7 @@ func runRestoreBackupTest( start := time.Now() - restoreGC := loadConnector(ctx, t, test.resource) + restoreGC := loadConnector(ctx, t, graph.LargeItemClient(), test.resource) restoreSel := getSelectorWith(t, test.service, resourceOwners, true) deets, err := restoreGC.RestoreDataCollections( ctx, @@ -418,7 +419,7 @@ func runRestoreBackupTest( }) } - backupGC := loadConnector(ctx, t, test.resource) + backupGC := loadConnector(ctx, t, graph.LargeItemClient(), test.resource) backupSel := backupSelectorForExpected(t, test.service, expectedDests) t.Logf("Selective backup of %s\n", backupSel) @@ -869,7 +870,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames dest.ContainerName, ) - restoreGC := loadConnector(ctx, t, test.resource) + restoreGC := loadConnector(ctx, t, graph.LargeItemClient(), test.resource) deets, err := restoreGC.RestoreDataCollections(ctx, suite.acct, restoreSel, dest, collections) require.NoError(t, err) require.NotNil(t, deets) @@ -887,7 +888,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames // Run a backup and compare its output with what we put in. - backupGC := loadConnector(ctx, t, test.resource) + backupGC := loadConnector(ctx, t, graph.LargeItemClient(), test.resource) backupSel := backupSelectorForExpected(t, test.service, expectedDests) t.Log("Selective backup of", backupSel) diff --git a/src/internal/connector/mockconnector/mock_data_collection_test.go b/src/internal/connector/mockconnector/mock_data_collection_test.go index 224969750..2af9236c4 100644 --- a/src/internal/connector/mockconnector/mock_data_collection_test.go +++ b/src/internal/connector/mockconnector/mock_data_collection_test.go @@ -6,7 +6,7 @@ import ( "testing" kioser "github.com/microsoft/kiota-serialization-json-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/src/internal/connector/mockconnector/mock_data_list.go b/src/internal/connector/mockconnector/mock_data_list.go index fb60ca87c..2994dd275 100644 --- a/src/internal/connector/mockconnector/mock_data_list.go +++ b/src/internal/connector/mockconnector/mock_data_list.go @@ -6,7 +6,7 @@ import ( "testing" kw "github.com/microsoft/kiota-serialization-json-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/require" "github.com/alcionai/corso/src/internal/data" diff --git a/src/internal/connector/onedrive/collection.go b/src/internal/connector/onedrive/collection.go index 438ffc835..ac0aa9fb3 100644 --- a/src/internal/connector/onedrive/collection.go +++ b/src/internal/connector/onedrive/collection.go @@ -4,11 +4,13 @@ package onedrive import ( "context" "io" + "net/http" "sync" "sync/atomic" "time" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/pkg/errors" "github.com/spatialcurrent/go-lazy/pkg/lazy" "github.com/alcionai/corso/src/internal/connector/graph" @@ -43,6 +45,9 @@ var ( // Collection represents a set of OneDrive objects retrieved from M365 type Collection struct { + // configured to handle large item downloads + itemClient *http.Client + // data is used to share data streams with the collection consumer data chan data.Stream // folderPath indicates what level in the hierarchy this collection @@ -64,12 +69,13 @@ type Collection struct { // itemReadFunc returns a reader for the specified item type itemReaderFunc func( - ctx context.Context, + hc *http.Client, item models.DriveItemable, ) (itemInfo details.ItemInfo, itemData io.ReadCloser, err error) // NewCollection creates a Collection func NewCollection( + itemClient *http.Client, folderPath path.Path, driveID string, service graph.Servicer, @@ -78,6 +84,7 @@ func NewCollection( ctrlOpts control.Options, ) *Collection { c := &Collection{ + itemClient: itemClient, folderPath: folderPath, driveItems: map[string]models.DriveItemable{}, driveID: driveID, @@ -198,11 +205,16 @@ func (oc *Collection) populateItems(ctx context.Context) { m.Unlock() } - for _, item := range oc.driveItems { + for id, item := range oc.driveItems { if oc.ctrl.FailFast && errs != nil { break } + if item == nil { + errUpdater(id, errors.New("nil item")) + continue + } + semaphoreCh <- struct{}{} wg.Add(1) @@ -219,10 +231,9 @@ func (oc *Collection) populateItems(ctx context.Context) { ) for i := 1; i <= maxRetries; i++ { - itemInfo, itemData, err = oc.itemReader(ctx, item) - - // retry on Timeout type errors, break otherwise. + itemInfo, itemData, err = oc.itemReader(oc.itemClient, item) if err == nil || graph.IsErrTimeout(err) == nil { + // retry on Timeout type errors, break otherwise. break } diff --git a/src/internal/connector/onedrive/collection_test.go b/src/internal/connector/onedrive/collection_test.go index 4e8876a92..a36db58c9 100644 --- a/src/internal/connector/onedrive/collection_test.go +++ b/src/internal/connector/onedrive/collection_test.go @@ -2,19 +2,19 @@ package onedrive import ( "bytes" - "context" - "errors" "io" + "net/http" "sync" "testing" "time" - msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/internal/data" "github.com/alcionai/corso/src/pkg/backup/details" @@ -73,7 +73,7 @@ func (suite *CollectionUnitTestSuite) TestCollection() { name: "oneDrive, no duplicates", numInstances: 1, source: OneDriveSource, - itemReader: func(context.Context, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { + itemReader: func(*http.Client, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { return details.ItemInfo{OneDrive: &details.OneDriveInfo{ItemName: testItemName, Modified: now}}, io.NopCloser(bytes.NewReader(testItemData)), nil @@ -87,7 +87,7 @@ func (suite *CollectionUnitTestSuite) TestCollection() { name: "oneDrive, duplicates", numInstances: 3, source: OneDriveSource, - itemReader: func(context.Context, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { + itemReader: func(*http.Client, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { return details.ItemInfo{OneDrive: &details.OneDriveInfo{ItemName: testItemName, Modified: now}}, io.NopCloser(bytes.NewReader(testItemData)), nil @@ -101,7 +101,7 @@ func (suite *CollectionUnitTestSuite) TestCollection() { name: "sharePoint, no duplicates", numInstances: 1, source: SharePointSource, - itemReader: func(context.Context, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { + itemReader: func(*http.Client, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { return details.ItemInfo{SharePoint: &details.SharePointInfo{ItemName: testItemName, Modified: now}}, io.NopCloser(bytes.NewReader(testItemData)), nil @@ -115,7 +115,7 @@ func (suite *CollectionUnitTestSuite) TestCollection() { name: "sharePoint, duplicates", numInstances: 3, source: SharePointSource, - itemReader: func(context.Context, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { + itemReader: func(*http.Client, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { return details.ItemInfo{SharePoint: &details.SharePointInfo{ItemName: testItemName, Modified: now}}, io.NopCloser(bytes.NewReader(testItemData)), nil @@ -140,6 +140,7 @@ func (suite *CollectionUnitTestSuite) TestCollection() { require.NoError(t, err) coll := NewCollection( + graph.LargeItemClient(), folderPath, "drive-id", suite, @@ -224,6 +225,7 @@ func (suite *CollectionUnitTestSuite) TestCollectionReadError() { require.NoError(t, err) coll := NewCollection( + graph.LargeItemClient(), folderPath, "fakeDriveID", suite, @@ -235,10 +237,8 @@ func (suite *CollectionUnitTestSuite) TestCollectionReadError() { mockItem.SetId(&testItemID) coll.Add(mockItem) - readError := errors.New("Test error") - - coll.itemReader = func(context.Context, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { - return details.ItemInfo{}, nil, readError + coll.itemReader = func(*http.Client, models.DriveItemable) (details.ItemInfo, io.ReadCloser, error) { + return details.ItemInfo{}, nil, assert.AnError } coll.Items() diff --git a/src/internal/connector/onedrive/collections.go b/src/internal/connector/onedrive/collections.go index 0cd261b24..f446aa246 100644 --- a/src/internal/connector/onedrive/collections.go +++ b/src/internal/connector/onedrive/collections.go @@ -3,10 +3,12 @@ package onedrive import ( "context" "fmt" + "net/http" "strings" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" + "golang.org/x/exp/maps" "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/support" @@ -45,6 +47,9 @@ type folderMatcher interface { // Collections is used to retrieve drive data for a // resource owner, which can be either a user or a sharepoint site. type Collections struct { + // configured to handle large item downloads + itemClient *http.Client + tenant string resourceOwner string source driveSource @@ -65,6 +70,7 @@ type Collections struct { } func NewCollections( + itemClient *http.Client, tenant string, resourceOwner string, source driveSource, @@ -74,6 +80,7 @@ func NewCollections( ctrlOpts control.Options, ) *Collections { return &Collections{ + itemClient: itemClient, tenant: tenant, resourceOwner: resourceOwner, source: source, @@ -98,6 +105,12 @@ func (c *Collections) Get(ctx context.Context) ([]data.Collection, error) { deltaURLs = map[string]string{} // Drive ID -> folder ID -> folder path folderPaths = map[string]map[string]string{} + // Items that should be excluded when sourcing data from the base backup. + // TODO(ashmrtn): This list contains the M365 IDs of deleted items so while + // it's technically safe to pass all the way through to kopia (files are + // unlikely to be named their M365 ID) we should wait to do that until we've + // switched to using those IDs for file names in kopia. + excludedItems = map[string]struct{}{} ) // Update the collection map with items from each drive @@ -105,7 +118,13 @@ func (c *Collections) Get(ctx context.Context) ([]data.Collection, error) { driveID := *d.GetId() driveName := *d.GetName() - delta, paths, err := collectItems(ctx, c.service, driveID, driveName, c.UpdateCollections) + delta, paths, excluded, err := collectItems( + ctx, + c.service, + driveID, + driveName, + c.UpdateCollections, + ) if err != nil { return nil, err } @@ -121,6 +140,8 @@ func (c *Collections) Get(ctx context.Context) ([]data.Collection, error) { folderPaths[driveID][id] = p } } + + maps.Copy(excludedItems, excluded) } observe.Message(ctx, fmt.Sprintf("Discovered %d items to backup", c.NumItems)) @@ -161,12 +182,17 @@ func (c *Collections) Get(ctx context.Context) ([]data.Collection, error) { } // UpdateCollections initializes and adds the provided drive items to Collections -// A new collection is created for every drive folder (or package) +// A new collection is created for every drive folder (or package). +// oldPaths is the unchanged data that was loaded from the metadata file. +// newPaths starts as a copy of oldPaths and is updated as changes are found in +// the returned results. func (c *Collections) UpdateCollections( ctx context.Context, driveID, driveName string, items []models.DriveItemable, - paths map[string]string, + oldPaths map[string]string, + newPaths map[string]string, + excluded map[string]struct{}, ) error { for _, item := range items { if item.GetRoot() != nil { @@ -197,31 +223,61 @@ func (c *Collections) UpdateCollections( switch { case item.GetFolder() != nil, item.GetPackage() != nil: - // Eventually, deletions of folders will be handled here so we may as well - // start off by saving the path.Path of the item instead of just the - // OneDrive parentRef or such. + if item.GetDeleted() != nil { + // Nested folders also return deleted delta results so we don't have to + // worry about doing a prefix search in the map to remove the subtree of + // the deleted folder/package. + delete(newPaths, *item.GetId()) + + // TODO(ashmrtn): Create a collection with state Deleted. + + break + } + + // Deletions of folders are handled in this case so we may as well start + // off by saving the path.Path of the item instead of just the OneDrive + // parentRef or such. folderPath, err := collectionPath.Append(*item.GetName(), false) if err != nil { logger.Ctx(ctx).Errorw("failed building collection path", "error", err) return err } - // TODO(ashmrtn): Handle deletions by removing this entry from the map. - // TODO(ashmrtn): Handle moves by setting the collection state if the - // collection doesn't already exist/have that state. - paths[*item.GetId()] = folderPath.String() + // Moved folders don't cause delta results for any subfolders nested in + // them. We need to go through and update paths to handle that. We only + // update newPaths so we don't accidentally clobber previous deletes. + // + // TODO(ashmrtn): Since we're also getting notifications about folder + // moves we may need to handle updates to a path of a collection we've + // already created and partially populated. + updatePath(newPaths, *item.GetId(), folderPath.String()) case item.GetFile() != nil: + if item.GetDeleted() != nil { + excluded[*item.GetId()] = struct{}{} + // Exchange counts items streamed through it which includes deletions so + // add that here too. + c.NumFiles++ + c.NumItems++ + + continue + } + + // TODO(ashmrtn): Figure what when an item was moved (maybe) and add it to + // the exclude list. + col, found := c.CollectionMap[collectionPath.String()] if !found { + // TODO(ashmrtn): Compare old and new path and set collection state + // accordingly. col = NewCollection( + c.itemClient, collectionPath, driveID, c.service, c.statusUpdater, c.source, - c.ctrl, - ) + c.ctrl) c.CollectionMap[collectionPath.String()] = col c.NumContainers++ @@ -286,3 +342,27 @@ func includePath(ctx context.Context, m folderMatcher, folderPath path.Path) boo return m.Matches(folderPathString) } + +func updatePath(paths map[string]string, id, newPath string) { + oldPath := paths[id] + if len(oldPath) == 0 { + paths[id] = newPath + return + } + + if oldPath == newPath { + return + } + + // We need to do a prefix search on the rest of the map to update the subtree. + // We don't need to make collections for all of these, as hierarchy merging in + // other components should take care of that. We do need to ensure that the + // resulting map contains all folders though so we know the next time around. + for folderID, p := range paths { + if !strings.HasPrefix(p, oldPath) { + continue + } + + paths[folderID] = strings.Replace(p, oldPath, newPath, 1) + } +} diff --git a/src/internal/connector/onedrive/collections_test.go b/src/internal/connector/onedrive/collections_test.go index b45d6f185..21ca061a9 100644 --- a/src/internal/connector/onedrive/collections_test.go +++ b/src/internal/connector/onedrive/collections_test.go @@ -4,11 +4,13 @@ import ( "strings" "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "golang.org/x/exp/maps" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/selectors" @@ -96,6 +98,7 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { tests := []struct { testCase string items []models.DriveItemable + inputFolderMap map[string]string scope selectors.OneDriveScope expect assert.ErrorAssertionFunc expectedCollectionPaths []string @@ -103,23 +106,27 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { expectedContainerCount int expectedFileCount int expectedMetadataPaths map[string]string + expectedExcludes map[string]struct{} }{ { testCase: "Invalid item", items: []models.DriveItemable{ driveItem("item", "item", testBaseDrivePath, false, false, false), }, + inputFolderMap: map[string]string{}, scope: anyFolder, expect: assert.Error, expectedMetadataPaths: map[string]string{}, + expectedExcludes: map[string]struct{}{}, }, { testCase: "Single File", items: []models.DriveItemable{ driveItem("file", "file", testBaseDrivePath, true, false, false), }, - scope: anyFolder, - expect: assert.NoError, + inputFolderMap: map[string]string{}, + scope: anyFolder, + expect: assert.NoError, expectedCollectionPaths: expectedPathAsSlice( suite.T(), tenant, @@ -131,12 +138,14 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { expectedContainerCount: 1, // Root folder is skipped since it's always present. expectedMetadataPaths: map[string]string{}, + expectedExcludes: map[string]struct{}{}, }, { testCase: "Single Folder", items: []models.DriveItemable{ driveItem("folder", "folder", testBaseDrivePath, false, true, false), }, + inputFolderMap: map[string]string{}, scope: anyFolder, expect: assert.NoError, expectedCollectionPaths: []string{}, @@ -148,12 +157,14 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { testBaseDrivePath+"/folder", )[0], }, + expectedExcludes: map[string]struct{}{}, }, { testCase: "Single Package", items: []models.DriveItemable{ driveItem("package", "package", testBaseDrivePath, false, false, true), }, + inputFolderMap: map[string]string{}, scope: anyFolder, expect: assert.NoError, expectedCollectionPaths: []string{}, @@ -165,6 +176,7 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { testBaseDrivePath+"/package", )[0], }, + expectedExcludes: map[string]struct{}{}, }, { testCase: "1 root file, 1 folder, 1 package, 2 files, 3 collections", @@ -175,8 +187,9 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { driveItem("fileInFolder", "fileInFolder", testBaseDrivePath+folder, true, false, false), driveItem("fileInPackage", "fileInPackage", testBaseDrivePath+pkg, true, false, false), }, - scope: anyFolder, - expect: assert.NoError, + inputFolderMap: map[string]string{}, + scope: anyFolder, + expect: assert.NoError, expectedCollectionPaths: expectedPathAsSlice( suite.T(), tenant, @@ -202,6 +215,7 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { testBaseDrivePath+"/package", )[0], }, + expectedExcludes: map[string]struct{}{}, }, { testCase: "contains folder selector", @@ -215,8 +229,9 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { driveItem("fileInFolder2", "fileInFolder2", testBaseDrivePath+folderSub+folder, true, false, false), driveItem("fileInFolderPackage", "fileInPackage", testBaseDrivePath+pkg, true, false, false), }, - scope: (&selectors.OneDriveBackup{}).Folders([]string{"folder"})[0], - expect: assert.NoError, + inputFolderMap: map[string]string{}, + scope: (&selectors.OneDriveBackup{}).Folders([]string{"folder"})[0], + expect: assert.NoError, expectedCollectionPaths: append( expectedPathAsSlice( suite.T(), @@ -250,6 +265,7 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { testBaseDrivePath+"/folder/subfolder/folder", )[0], }, + expectedExcludes: map[string]struct{}{}, }, { testCase: "prefix subfolder selector", @@ -257,12 +273,13 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { driveItem("fileInRoot", "fileInRoot", testBaseDrivePath, true, false, false), driveItem("folder", "folder", testBaseDrivePath, false, true, false), driveItem("subfolder", "subfolder", testBaseDrivePath+folder, false, true, false), - driveItem("folder", "folder", testBaseDrivePath+folderSub, false, true, false), + driveItem("folder2", "folder", testBaseDrivePath+folderSub, false, true, false), driveItem("package", "package", testBaseDrivePath, false, false, true), driveItem("fileInFolder", "fileInFolder", testBaseDrivePath+folder, true, false, false), driveItem("fileInFolder2", "fileInFolder2", testBaseDrivePath+folderSub+folder, true, false, false), driveItem("fileInPackage", "fileInPackage", testBaseDrivePath+pkg, true, false, false), }, + inputFolderMap: map[string]string{}, scope: (&selectors.OneDriveBackup{}). Folders([]string{"/folder/subfolder"}, selectors.PrefixMatch())[0], expect: assert.NoError, @@ -276,13 +293,14 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { expectedFileCount: 1, expectedContainerCount: 1, expectedMetadataPaths: map[string]string{ - "folder": expectedPathAsSlice( + "folder2": expectedPathAsSlice( suite.T(), tenant, user, testBaseDrivePath+"/folder/subfolder/folder", )[0], }, + expectedExcludes: map[string]struct{}{}, }, { testCase: "match subfolder selector", @@ -295,8 +313,9 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { driveItem("fileInSubfolder", "fileInSubfolder", testBaseDrivePath+folderSub, true, false, false), driveItem("fileInPackage", "fileInPackage", testBaseDrivePath+pkg, true, false, false), }, - scope: (&selectors.OneDriveBackup{}).Folders([]string{"folder/subfolder"})[0], - expect: assert.NoError, + inputFolderMap: map[string]string{}, + scope: (&selectors.OneDriveBackup{}).Folders([]string{"folder/subfolder"})[0], + expect: assert.NoError, expectedCollectionPaths: expectedPathAsSlice( suite.T(), tenant, @@ -308,6 +327,255 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { expectedContainerCount: 1, // No child folders for subfolder so nothing here. expectedMetadataPaths: map[string]string{}, + expectedExcludes: map[string]struct{}{}, + }, + { + testCase: "not moved folder tree", + items: []models.DriveItemable{ + driveItem("folder", "folder", testBaseDrivePath, false, true, false), + }, + inputFolderMap: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder/subfolder", + )[0], + }, + scope: anyFolder, + expect: assert.NoError, + expectedCollectionPaths: []string{}, + expectedItemCount: 0, + expectedFileCount: 0, + expectedContainerCount: 0, + expectedMetadataPaths: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder/subfolder", + )[0], + }, + expectedExcludes: map[string]struct{}{}, + }, + { + testCase: "moved folder tree", + items: []models.DriveItemable{ + driveItem("folder", "folder", testBaseDrivePath, false, true, false), + }, + inputFolderMap: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/a-folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/a-folder/subfolder", + )[0], + }, + scope: anyFolder, + expect: assert.NoError, + expectedCollectionPaths: []string{}, + expectedItemCount: 0, + expectedFileCount: 0, + expectedContainerCount: 0, + expectedMetadataPaths: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder/subfolder", + )[0], + }, + expectedExcludes: map[string]struct{}{}, + }, + { + testCase: "moved folder tree and subfolder 1", + items: []models.DriveItemable{ + driveItem("folder", "folder", testBaseDrivePath, false, true, false), + driveItem("subfolder", "subfolder", testBaseDrivePath, false, true, false), + }, + inputFolderMap: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/a-folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/a-folder/subfolder", + )[0], + }, + scope: anyFolder, + expect: assert.NoError, + expectedCollectionPaths: []string{}, + expectedItemCount: 0, + expectedFileCount: 0, + expectedContainerCount: 0, + expectedMetadataPaths: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/subfolder", + )[0], + }, + expectedExcludes: map[string]struct{}{}, + }, + { + testCase: "moved folder tree and subfolder 2", + items: []models.DriveItemable{ + driveItem("subfolder", "subfolder", testBaseDrivePath, false, true, false), + driveItem("folder", "folder", testBaseDrivePath, false, true, false), + }, + inputFolderMap: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/a-folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/a-folder/subfolder", + )[0], + }, + scope: anyFolder, + expect: assert.NoError, + expectedCollectionPaths: []string{}, + expectedItemCount: 0, + expectedFileCount: 0, + expectedContainerCount: 0, + expectedMetadataPaths: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/subfolder", + )[0], + }, + expectedExcludes: map[string]struct{}{}, + }, + { + testCase: "deleted folder and package", + items: []models.DriveItemable{ + delItem("folder", testBaseDrivePath, false, true, false), + delItem("package", testBaseDrivePath, false, false, true), + }, + inputFolderMap: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder", + )[0], + "package": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/package", + )[0], + }, + scope: anyFolder, + expect: assert.NoError, + expectedCollectionPaths: []string{}, + expectedItemCount: 0, + expectedFileCount: 0, + expectedContainerCount: 0, + expectedMetadataPaths: map[string]string{}, + expectedExcludes: map[string]struct{}{}, + }, + { + testCase: "delete folder tree move subfolder", + items: []models.DriveItemable{ + delItem("folder", testBaseDrivePath, false, true, false), + driveItem("subfolder", "subfolder", testBaseDrivePath, false, true, false), + }, + inputFolderMap: map[string]string{ + "folder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder", + )[0], + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/folder/subfolder", + )[0], + }, + scope: anyFolder, + expect: assert.NoError, + expectedCollectionPaths: []string{}, + expectedItemCount: 0, + expectedFileCount: 0, + expectedContainerCount: 0, + expectedMetadataPaths: map[string]string{ + "subfolder": expectedPathAsSlice( + suite.T(), + tenant, + user, + testBaseDrivePath+"/subfolder", + )[0], + }, + expectedExcludes: map[string]struct{}{}, + }, + { + testCase: "delete file", + items: []models.DriveItemable{ + delItem("item", testBaseDrivePath, true, false, false), + }, + inputFolderMap: map[string]string{}, + scope: anyFolder, + expect: assert.NoError, + expectedCollectionPaths: []string{}, + expectedItemCount: 1, + expectedFileCount: 1, + expectedContainerCount: 0, + expectedMetadataPaths: map[string]string{}, + expectedExcludes: map[string]struct{}{ + "item": {}, + }, }, } @@ -316,8 +584,11 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { ctx, flush := tester.NewContext() defer flush() - paths := map[string]string{} + excludes := map[string]struct{}{} + outputFolderMap := map[string]string{} + maps.Copy(outputFolderMap, tt.inputFolderMap) c := NewCollections( + graph.LargeItemClient(), tenant, user, OneDriveSource, @@ -326,7 +597,15 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { nil, control.Options{}) - err := c.UpdateCollections(ctx, "driveID", "General", tt.items, paths) + err := c.UpdateCollections( + ctx, + "driveID", + "General", + tt.items, + tt.inputFolderMap, + outputFolderMap, + excludes, + ) tt.expect(t, err) assert.Equal(t, len(tt.expectedCollectionPaths), len(c.CollectionMap), "collection paths") assert.Equal(t, tt.expectedItemCount, c.NumItems, "item count") @@ -336,7 +615,8 @@ func (suite *OneDriveCollectionsSuite) TestUpdateCollections() { assert.Contains(t, c.CollectionMap, collPath) } - assert.Equal(t, tt.expectedMetadataPaths, paths) + assert.Equal(t, tt.expectedMetadataPaths, outputFolderMap) + assert.Equal(t, tt.expectedExcludes, excludes) }) } } @@ -361,3 +641,26 @@ func driveItem(id string, name string, path string, isFile, isFolder, isPackage return item } + +// delItem creates a DriveItemable that is marked as deleted. path must be set +// to the base drive path. +func delItem(id string, path string, isFile, isFolder, isPackage bool) models.DriveItemable { + item := models.NewDriveItem() + item.SetId(&id) + item.SetDeleted(models.NewDeleted()) + + parentReference := models.NewItemReference() + parentReference.SetPath(&path) + item.SetParentReference(parentReference) + + switch { + case isFile: + item.SetFile(models.NewFile()) + case isFolder: + item.SetFolder(models.NewFolder()) + case isPackage: + item.SetPackage(models.NewPackage_escaped()) + } + + return item +} diff --git a/src/internal/connector/onedrive/drive.go b/src/internal/connector/onedrive/drive.go index 07da01521..c765e3719 100644 --- a/src/internal/connector/onedrive/drive.go +++ b/src/internal/connector/onedrive/drive.go @@ -6,68 +6,20 @@ import ( "strings" "time" - msdrive "github.com/microsoftgraph/msgraph-beta-sdk-go/drive" - msdrives "github.com/microsoftgraph/msgraph-beta-sdk-go/drives" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors" - "github.com/microsoftgraph/msgraph-beta-sdk-go/sites" - msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core" + msdrive "github.com/microsoftgraph/msgraph-sdk-go/drive" + msdrives "github.com/microsoftgraph/msgraph-sdk-go/drives" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" + "github.com/microsoftgraph/msgraph-sdk-go/sites" "github.com/pkg/errors" + "golang.org/x/exp/maps" "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/pkg/logger" ) -var ( - errFolderNotFound = errors.New("folder not found") - - // nolint:lll - // OneDrive associated SKUs located at: - // https://learn.microsoft.com/en-us/azure/active-directory/enterprise-users/licensing-service-plan-reference - skuIDs = []string{ - // Microsoft 365 Apps for Business 0365 - "cdd28e44-67e3-425e-be4c-737fab2899d3", - // Microsoft 365 Apps for Business SMB_Business - "b214fe43-f5a3-4703-beeb-fa97188220fc", - // Microsoft 365 Apps for enterprise - "c2273bd0-dff7-4215-9ef5-2c7bcfb06425", - // Microsoft 365 Apps for Faculty - "12b8c807-2e20-48fc-b453-542b6ee9d171", - // Microsoft 365 Apps for Students - "c32f9321-a627-406d-a114-1f9c81aaafac", - // OneDrive for Business (Plan 1) - "e6778190-713e-4e4f-9119-8b8238de25df", - // OneDrive for Business (Plan 2) - "ed01faf2-1d88-4947-ae91-45ca18703a96", - // Visio Plan 1 - "ca7f3140-d88c-455b-9a1c-7f0679e31a76", - // Visio Plan 2 - "38b434d2-a15e-4cde-9a98-e737c75623e1", - // Visio Online Plan 1 - "4b244418-9658-4451-a2b8-b5e2b364e9bd", - // Visio Online Plan 2 - "c5928f49-12ba-48f7-ada3-0d743a3601d5", - // Visio Plan 2 for GCC - "4ae99959-6b0f-43b0-b1ce-68146001bdba", - // ONEDRIVEENTERPRISE - "afcafa6a-d966-4462-918c-ec0b4e0fe642", - // Microsoft 365 E5 Developer - "c42b9cae-ea4f-4ab7-9717-81576235ccac", - // Microsoft 365 E5 - "06ebc4ee-1bb5-47dd-8120-11324bc54e06", - // Office 365 E4 - "1392051d-0cb9-4b7a-88d5-621fee5e8711", - // Microsoft 365 E3 - "05e9a617-0261-4cee-bb44-138d3ef5d965", - // Microsoft 365 Business Premium - "cbdc14ab-d96c-4c30-b9f4-6ada7cdc1d46", - // Microsoft 365 Business Standard - "f245ecc8-75af-4f8e-b61f-27d8114de5f3", - // Microsoft 365 Business Basic - "3b555118-da6a-4418-894f-7df1e2096870", - } -) +var errFolderNotFound = errors.New("folder not found") const ( // nextLinkKey is used to find the next link in a paged @@ -115,21 +67,11 @@ func siteDrives(ctx context.Context, service graph.Servicer, site string) ([]mod func userDrives(ctx context.Context, service graph.Servicer, user string) ([]models.Driveable, error) { var ( - hasDrive bool numberOfRetries = 3 r models.DriveCollectionResponseable + err error ) - hasDrive, err := hasDriveLicense(ctx, service, user) - if err != nil { - return nil, errors.Wrap(err, user) - } - - if !hasDrive { - logger.Ctx(ctx).Debugf("User %s does not have a license for OneDrive", user) - return make([]models.Driveable, 0), nil // no license - } - // Retry Loop for Drive retrieval. Request can timeout for i := 0; i <= numberOfRetries; i++ { r, err = service.Client().UsersById(user).Drives().Get(ctx, nil) @@ -137,7 +79,7 @@ func userDrives(ctx context.Context, service graph.Servicer, user string) ([]mod detailedError := support.ConnectorStackErrorTrace(err) if strings.Contains(detailedError, userMysiteURLNotFound) || strings.Contains(detailedError, userMysiteNotFound) { - logger.Ctx(ctx).Debugf("User %s does not have a drive", user) + logger.Ctx(ctx).Infof("User %s does not have a drive", user) return make([]models.Driveable, 0), nil // no license } @@ -167,7 +109,9 @@ type itemCollector func( ctx context.Context, driveID, driveName string, driveItems []models.DriveItemable, - paths map[string]string, + oldPaths map[string]string, + newPaths map[string]string, + excluded map[string]struct{}, ) error // collectItems will enumerate all items in the specified drive and hand them to the @@ -177,14 +121,18 @@ func collectItems( service graph.Servicer, driveID, driveName string, collector itemCollector, -) (string, map[string]string, error) { +) (string, map[string]string, map[string]struct{}, error) { var ( newDeltaURL = "" // TODO(ashmrtn): Eventually this should probably be a parameter so we can // take in previous paths. - paths = map[string]string{} + oldPaths = map[string]string{} + newPaths = map[string]string{} + excluded = map[string]struct{}{} ) + maps.Copy(newPaths, oldPaths) + // TODO: Specify a timestamp in the delta query // https://docs.microsoft.com/en-us/graph/api/driveitem-delta? // view=graph-rest-1.0&tabs=http#example-4-retrieving-delta-results-using-a-timestamp @@ -214,16 +162,16 @@ func collectItems( for { r, err := builder.Get(ctx, requestConfig) if err != nil { - return "", nil, errors.Wrapf( + return "", nil, nil, errors.Wrapf( err, "failed to query drive items. details: %s", support.ConnectorStackErrorTrace(err), ) } - err = collector(ctx, driveID, driveName, r.GetValue(), paths) + err = collector(ctx, driveID, driveName, r.GetValue(), oldPaths, newPaths, excluded) if err != nil { - return "", nil, err + return "", nil, nil, err } if r.GetOdataDeltaLink() != nil && len(*r.GetOdataDeltaLink()) > 0 { @@ -240,7 +188,7 @@ func collectItems( builder = msdrives.NewItemRootDeltaRequestBuilder(*nextLink, service.Adapter()) } - return newDeltaURL, paths, nil + return newDeltaURL, newPaths, excluded, nil } // getFolder will lookup the specified folder name under `parentFolderID` @@ -347,7 +295,7 @@ func GetAllFolders( folders := map[string]*Displayable{} for _, d := range drives { - _, _, err = collectItems( + _, _, _, err = collectItems( ctx, gs, *d.GetId(), @@ -356,7 +304,9 @@ func GetAllFolders( innerCtx context.Context, driveID, driveName string, items []models.DriveItemable, - paths map[string]string, + oldPaths map[string]string, + newPaths map[string]string, + excluded map[string]struct{}, ) error { for _, item := range items { // Skip the root item. @@ -413,56 +363,3 @@ func DeleteItem( return nil } - -// hasDriveLicense utility function that queries M365 server -// to investigate the user's includes access to OneDrive. -func hasDriveLicense( - ctx context.Context, - service graph.Servicer, - user string, -) (bool, error) { - var hasDrive bool - - resp, err := service.Client().UsersById(user).LicenseDetails().Get(ctx, nil) - if err != nil { - return false, - errors.Wrap(err, "failure obtaining license details for user") - } - - iter, err := msgraphgocore.NewPageIterator( - resp, service.Adapter(), - models.CreateLicenseDetailsCollectionResponseFromDiscriminatorValue, - ) - if err != nil { - return false, err - } - - cb := func(pageItem any) bool { - entry, ok := pageItem.(models.LicenseDetailsable) - if !ok { - err = errors.New("casting item to models.LicenseDetailsable") - return false - } - - sku := entry.GetSkuId() - if sku == nil { - return true - } - - for _, license := range skuIDs { - if sku.String() == license { - hasDrive = true - return false - } - } - - return true - } - - if err := iter.Iterate(ctx, cb); err != nil { - return false, - errors.Wrap(err, support.ConnectorStackErrorTrace(err)) - } - - return hasDrive, nil -} diff --git a/src/internal/connector/onedrive/drive_test.go b/src/internal/connector/onedrive/drive_test.go index 7f6901621..755b7293b 100644 --- a/src/internal/connector/onedrive/drive_test.go +++ b/src/internal/connector/onedrive/drive_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/suite" "github.com/alcionai/corso/src/internal/common" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/logger" @@ -146,6 +147,7 @@ func (suite *OneDriveSuite) TestOneDriveNewCollections() { NewOneDriveBackup([]string{test.user}). AllData()[0] odcs, err := NewCollections( + graph.LargeItemClient(), creds.AzureTenantID, test.user, OneDriveSource, diff --git a/src/internal/connector/onedrive/item.go b/src/internal/connector/onedrive/item.go index f936de4a1..3e4e9e516 100644 --- a/src/internal/connector/onedrive/item.go +++ b/src/internal/connector/onedrive/item.go @@ -4,15 +4,17 @@ import ( "context" "fmt" "io" + "net/http" "strings" - msdrives "github.com/microsoftgraph/msgraph-beta-sdk-go/drives" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + msdrives "github.com/microsoftgraph/msgraph-sdk-go/drives" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/internal/connector/uploadsession" + "github.com/alcionai/corso/src/internal/version" "github.com/alcionai/corso/src/pkg/backup/details" "github.com/alcionai/corso/src/pkg/logger" ) @@ -27,7 +29,7 @@ const ( // It crafts this by querying M365 for a download URL for the item // and using a http client to initialize a reader func sharePointItemReader( - ctx context.Context, + hc *http.Client, item models.DriveItemable, ) (details.ItemInfo, io.ReadCloser, error) { url, ok := item.GetAdditionalData()[downloadURLKey].(*string) @@ -35,7 +37,7 @@ func sharePointItemReader( return details.ItemInfo{}, nil, fmt.Errorf("failed to get url for %s", *item.GetName()) } - rc, err := driveItemReader(ctx, *url) + resp, err := hc.Get(*url) if err != nil { return details.ItemInfo{}, nil, err } @@ -44,14 +46,14 @@ func sharePointItemReader( SharePoint: sharePointItemInfo(item, *item.GetSize()), } - return dii, rc, nil + return dii, resp.Body, nil } // oneDriveItemReader will return a io.ReadCloser for the specified item // It crafts this by querying M365 for a download URL for the item // and using a http client to initialize a reader func oneDriveItemReader( - ctx context.Context, + hc *http.Client, item models.DriveItemable, ) (details.ItemInfo, io.ReadCloser, error) { url, ok := item.GetAdditionalData()[downloadURLKey].(*string) @@ -59,7 +61,17 @@ func oneDriveItemReader( return details.ItemInfo{}, nil, fmt.Errorf("failed to get url for %s", *item.GetName()) } - rc, err := driveItemReader(ctx, *url) + req, err := http.NewRequest(http.MethodGet, *url, nil) + if err != nil { + return details.ItemInfo{}, nil, err + } + + // Decorate the traffic + //nolint:lll + // See https://learn.microsoft.com/en-us/sharepoint/dev/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online#how-to-decorate-your-http-traffic + req.Header.Set("User-Agent", "ISV|Alcion|Corso/"+version.Version) + + resp, err := hc.Do(req) if err != nil { return details.ItemInfo{}, nil, err } @@ -68,25 +80,7 @@ func oneDriveItemReader( OneDrive: oneDriveItemInfo(item, *item.GetSize()), } - return dii, rc, nil -} - -// driveItemReader will return a io.ReadCloser for the specified item -// It crafts this by querying M365 for a download URL for the item -// and using a http client to initialize a reader -func driveItemReader( - ctx context.Context, - url string, -) (io.ReadCloser, error) { - httpClient := graph.CreateHTTPClient() - httpClient.Timeout = 0 // infinite timeout for pulling large files - - resp, err := httpClient.Get(url) - if err != nil { - return nil, errors.Wrapf(err, "failed to download file from %s", url) - } - - return resp.Body, nil + return dii, resp.Body, nil } // oneDriveItemInfo will populate a details.OneDriveInfo struct @@ -97,7 +91,7 @@ func driveItemReader( func oneDriveItemInfo(di models.DriveItemable, itemSize int64) *details.OneDriveInfo { var email, parent string - if di.GetCreatedBy().GetUser() != nil { + if di.GetCreatedBy() != nil && di.GetCreatedBy().GetUser() != nil { // User is sometimes not available when created via some // external applications (like backup/restore solutions) ed, ok := di.GetCreatedBy().GetUser().GetAdditionalData()["email"] @@ -106,11 +100,9 @@ func oneDriveItemInfo(di models.DriveItemable, itemSize int64) *details.OneDrive } } - if di.GetParentReference() != nil { - if di.GetParentReference().GetName() != nil { - // EndPoint is not always populated from external apps - parent = *di.GetParentReference().GetName() - } + if di.GetParentReference() != nil && di.GetParentReference().GetName() != nil { + // EndPoint is not always populated from external apps + parent = *di.GetParentReference().GetName() } return &details.OneDriveInfo{ diff --git a/src/internal/connector/onedrive/item_test.go b/src/internal/connector/onedrive/item_test.go index 7c94b0ea7..2b28f0910 100644 --- a/src/internal/connector/onedrive/item_test.go +++ b/src/internal/connector/onedrive/item_test.go @@ -6,8 +6,8 @@ import ( "io" "testing" - msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -99,7 +99,9 @@ func (suite *ItemIntegrationSuite) TestItemReader_oneDrive() { ctx context.Context, driveID, driveName string, items []models.DriveItemable, - paths map[string]string, + oldPaths map[string]string, + newPaths map[string]string, + excluded map[string]struct{}, ) error { for _, item := range items { if item.GetFile() != nil { @@ -110,7 +112,7 @@ func (suite *ItemIntegrationSuite) TestItemReader_oneDrive() { return nil } - _, _, err := collectItems(ctx, suite, suite.userDriveID, "General", itemCollector) + _, _, _, err := collectItems(ctx, suite, suite.userDriveID, "General", itemCollector) require.NoError(suite.T(), err) // Test Requirement 2: Need a file @@ -124,7 +126,7 @@ func (suite *ItemIntegrationSuite) TestItemReader_oneDrive() { // Read data for the file - itemInfo, itemData, err := oneDriveItemReader(ctx, driveItem) + itemInfo, itemData, err := oneDriveItemReader(graph.LargeItemClient(), driveItem) require.NoError(suite.T(), err) require.NotNil(suite.T(), itemInfo.OneDrive) require.NotEmpty(suite.T(), itemInfo.OneDrive.ItemName) diff --git a/src/internal/connector/onedrive/service_test.go b/src/internal/connector/onedrive/service_test.go index dd9a9a6ff..00a791f1e 100644 --- a/src/internal/connector/onedrive/service_test.go +++ b/src/internal/connector/onedrive/service_test.go @@ -3,7 +3,7 @@ package onedrive import ( "testing" - msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" "github.com/stretchr/testify/require" "github.com/alcionai/corso/src/internal/connector/graph" diff --git a/src/internal/connector/sharepoint/collection.go b/src/internal/connector/sharepoint/collection.go index 3f924cded..458be0a74 100644 --- a/src/internal/connector/sharepoint/collection.go +++ b/src/internal/connector/sharepoint/collection.go @@ -3,6 +3,7 @@ package sharepoint import ( "bytes" "context" + "fmt" "io" "time" @@ -11,6 +12,7 @@ import ( "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/graph" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk" "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/internal/data" "github.com/alcionai/corso/src/internal/observe" @@ -57,6 +59,7 @@ type Collection struct { category DataCategory service graph.Servicer ctrl control.Options + betaService *betasdk.Service statusUpdater support.StatusUpdater } @@ -260,7 +263,12 @@ func (sc *Collection) retrievePages( metrics numMetrics ) - pages, err := GetSitePages(ctx, sc.service, sc.fullPath.ResourceOwner(), sc.jobs) + betaService := sc.betaService + if betaService == nil { + return metrics, fmt.Errorf("beta service not found in collection") + } + + pages, err := GetSitePages(ctx, betaService, sc.fullPath.ResourceOwner(), sc.jobs) if err != nil { return metrics, errors.Wrap(err, sc.fullPath.ResourceOwner()) } diff --git a/src/internal/connector/sharepoint/collection_test.go b/src/internal/connector/sharepoint/collection_test.go index 482a6b5be..1a5ea2218 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-beta-sdk-go/sites" + "github.com/microsoftgraph/msgraph-sdk-go/sites" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -35,7 +35,7 @@ func TestSharePointCollectionSuite(t *testing.T) { suite.Run(t, new(SharePointCollectionSuite)) } -func (suite *SharePointCollectionSuite) TestSharePointDataReader_Valid() { +func (suite *SharePointCollectionSuite) TestCollection_Item_Read() { t := suite.T() m := []byte("test message") name := "aFile" @@ -50,9 +50,9 @@ func (suite *SharePointCollectionSuite) TestSharePointDataReader_Valid() { assert.Equal(t, readData, m) } -// TestSharePointListCollection tests basic functionality to create +// TestListCollection tests basic functionality to create // SharePoint collection and to use the data stream channel. -func (suite *SharePointCollectionSuite) TestSharePointListCollection() { +func (suite *SharePointCollectionSuite) TestListCollection() { t := suite.T() ow := kioser.NewJsonSerializationWriter() @@ -96,7 +96,7 @@ func (suite *SharePointCollectionSuite) TestSharePointListCollection() { assert.Equal(t, testName, shareInfo.Info().SharePoint.ItemName) } -func (suite *SharePointCollectionSuite) TestSharePointPageCollection_Populate() { +func (suite *SharePointCollectionSuite) TestPageCollection() { ctx, flush := tester.NewContext() defer flush() @@ -107,8 +107,7 @@ func (suite *SharePointCollectionSuite) TestSharePointPageCollection_Populate() account, err := a.M365Config() require.NoError(t, err) - service, err := createTestService(account) - require.NoError(t, err) + service := createTestBetaService(t, account) tuples, err := fetchPages(ctx, service, siteID) require.NoError(t, err) @@ -123,8 +122,9 @@ func (suite *SharePointCollectionSuite) TestSharePointPageCollection_Populate() ) require.NoError(t, err) - col := NewCollection(dir, service, Pages, nil, control.Defaults()) + col := NewCollection(dir, nil, Pages, nil, control.Defaults()) col.jobs = []string{tuples[0].id} + col.betaService = service streamChannel := col.Items() @@ -142,7 +142,7 @@ func (suite *SharePointCollectionSuite) TestSharePointPageCollection_Populate() } // TestRestoreListCollection verifies Graph Restore API for the List Collection -func (suite *SharePointCollectionSuite) TestRestoreListCollection() { +func (suite *SharePointCollectionSuite) TestListCollection_Restore() { ctx, flush := tester.NewContext() defer flush() @@ -152,9 +152,7 @@ func (suite *SharePointCollectionSuite) TestRestoreListCollection() { account, err := a.M365Config() require.NoError(t, err) - service, err := createTestService(account) - require.NoError(t, err) - + service := createTestService(t, account) listing := mockconnector.GetMockListDefault("Mock List") testName := "MockListing" listing.SetDisplayName(&testName) @@ -218,9 +216,7 @@ func (suite *SharePointCollectionSuite) TestRestoreLocation() { account, err := a.M365Config() require.NoError(t, err) - service, err := createTestService(account) - require.NoError(t, err) - + service := createTestService(t, account) rootFolder := "General_" + common.FormatNow(common.SimpleTimeTesting) siteID := tester.M365SiteID(t) diff --git a/src/internal/connector/sharepoint/data_collections.go b/src/internal/connector/sharepoint/data_collections.go index ba0788422..700915d81 100644 --- a/src/internal/connector/sharepoint/data_collections.go +++ b/src/internal/connector/sharepoint/data_collections.go @@ -2,14 +2,18 @@ package sharepoint import ( "context" + "fmt" + "net/http" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector/graph" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk" "github.com/alcionai/corso/src/internal/connector/onedrive" "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/internal/data" "github.com/alcionai/corso/src/internal/observe" + "github.com/alcionai/corso/src/pkg/account" "github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/logger" "github.com/alcionai/corso/src/pkg/path" @@ -24,8 +28,9 @@ type statusUpdater interface { // for the specified user func DataCollections( ctx context.Context, + itemClient *http.Client, selector selectors.Selector, - tenantID string, + creds account.M365Config, serv graph.Servicer, su statusUpdater, ctrlOpts control.Options, @@ -55,7 +60,7 @@ func DataCollections( spcs, err = collectLists( ctx, serv, - tenantID, + creds.AzureTenantID, site, su, ctrlOpts) @@ -66,8 +71,9 @@ func DataCollections( case path.LibrariesCategory: spcs, err = collectLibraries( ctx, + itemClient, serv, - tenantID, + creds.AzureTenantID, site, scope, su, @@ -78,10 +84,9 @@ func DataCollections( case path.PagesCategory: spcs, err = collectPages( ctx, + creds, serv, - tenantID, site, - scope, su, ctrlOpts) if err != nil { @@ -136,6 +141,7 @@ func collectLists( // all the drives associated with the site. func collectLibraries( ctx context.Context, + itemClient *http.Client, serv graph.Servicer, tenantID, siteID string, scope selectors.SharePointScope, @@ -150,6 +156,7 @@ func collectLibraries( logger.Ctx(ctx).With("site", siteID).Debug("Creating SharePoint Library collections") colls := onedrive.NewCollections( + itemClient, tenantID, siteID, onedrive.SharePointSource, @@ -171,9 +178,9 @@ func collectLibraries( // TODO: Credentials necessary to create separate HTTP client func collectPages( ctx context.Context, + creds account.M365Config, serv graph.Servicer, - tenantID, siteID string, - scope selectors.SharePointScope, + siteID string, updater statusUpdater, ctrlOpts control.Options, ) ([]data.Collection, error) { @@ -181,7 +188,16 @@ func collectPages( spcs := make([]data.Collection, 0) - tuples, err := fetchPages(ctx, serv, siteID) + // make the betaClient + // Need to receive From DataCollection Call + adpt, err := graph.CreateAdapter(creds.AzureTenantID, creds.AzureClientID, creds.AzureClientSecret) + if err != nil { + return nil, fmt.Errorf("unable to create adapter w/ env credentials") + } + + betaService := betasdk.NewService(adpt) + + tuples, err := fetchPages(ctx, betaService, siteID) if err != nil { return nil, err } @@ -189,7 +205,7 @@ func collectPages( for _, tuple := range tuples { dir, err := path.Builder{}.Append(tuple.name). ToDataLayerSharePointPath( - tenantID, + creds.AzureTenantID, siteID, path.PagesCategory, false) @@ -198,6 +214,7 @@ func collectPages( } collection := NewCollection(dir, serv, Pages, updater.UpdateStatus, ctrlOpts) + collection.betaService = betaService collection.AddJob(tuple.id) spcs = append(spcs, collection) diff --git a/src/internal/connector/sharepoint/data_collections_test.go b/src/internal/connector/sharepoint/data_collections_test.go index 2227eefda..4b4b82b8f 100644 --- a/src/internal/connector/sharepoint/data_collections_test.go +++ b/src/internal/connector/sharepoint/data_collections_test.go @@ -3,11 +3,14 @@ package sharepoint import ( "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/connector/onedrive" + "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/internal/tester" "github.com/alcionai/corso/src/pkg/control" "github.com/alcionai/corso/src/pkg/selectors" @@ -88,7 +91,10 @@ func (suite *SharePointLibrariesSuite) TestUpdateCollections() { defer flush() paths := map[string]string{} + newPaths := map[string]string{} + excluded := map[string]struct{}{} c := onedrive.NewCollections( + graph.LargeItemClient(), tenant, site, onedrive.SharePointSource, @@ -96,7 +102,7 @@ func (suite *SharePointLibrariesSuite) TestUpdateCollections() { &MockGraphService{}, nil, control.Options{}) - err := c.UpdateCollections(ctx, "driveID", "General", test.items, paths) + err := c.UpdateCollections(ctx, "driveID", "General", test.items, paths, newPaths, excluded) test.expect(t, err) assert.Equal(t, len(test.expectedCollectionPaths), len(c.CollectionMap), "collection paths") assert.Equal(t, test.expectedItemCount, c.NumItems, "item count") @@ -124,3 +130,37 @@ func driveItem(name string, path string, isFile bool) models.DriveItemable { return item } + +type SharePointPagesSuite struct { + suite.Suite +} + +func TestSharePointPagesSuite(t *testing.T) { + tester.RunOnAny( + t, + tester.CorsoCITests, + tester.CorsoGraphConnectorTests, + tester.CorsoGraphConnectorSharePointTests) + suite.Run(t, new(SharePointPagesSuite)) +} + +func (suite *SharePointPagesSuite) TestCollectPages() { + ctx, flush := tester.NewContext() + defer flush() + + t := suite.T() + siteID := tester.M365SiteID(t) + a := tester.NewM365Account(t) + account, err := a.M365Config() + require.NoError(t, err) + serv := createTestService(t, account) + updateFunc := func(*support.ConnectorOperationStatus) { + t.Log("Updater Called ") + } + + updater := &MockUpdater{UpdateState: updateFunc} + + col, err := collectPages(ctx, account, serv, siteID, updater, control.Options{}) + assert.NoError(t, err) + assert.NotEmpty(t, col) +} diff --git a/src/internal/connector/sharepoint/helper_test.go b/src/internal/connector/sharepoint/helper_test.go index f798f8c72..b4148fd02 100644 --- a/src/internal/connector/sharepoint/helper_test.go +++ b/src/internal/connector/sharepoint/helper_test.go @@ -3,12 +3,13 @@ package sharepoint import ( "testing" - msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" - "github.com/pkg/errors" + msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" "github.com/stretchr/testify/require" "github.com/alcionai/corso/src/internal/connector/graph" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk" "github.com/alcionai/corso/src/internal/connector/onedrive" + "github.com/alcionai/corso/src/internal/connector/support" "github.com/alcionai/corso/src/pkg/account" ) @@ -17,6 +18,16 @@ import ( // --------------------------------------------------------------------------- type MockGraphService struct{} +type MockUpdater struct { + UpdateState func(*support.ConnectorOperationStatus) +} + +func (mu *MockUpdater) UpdateStatus(input *support.ConnectorOperationStatus) { + if mu.UpdateState != nil { + mu.UpdateState(input) + } +} + //------------------------------------------------------------ // Interface Functions: @See graph.Service //------------------------------------------------------------ @@ -33,17 +44,26 @@ func (ms *MockGraphService) Adapter() *msgraphsdk.GraphRequestAdapter { // Helper Functions // --------------------------------------------------------------------------- -func createTestService(credentials account.M365Config) (*graph.Service, error) { +func createTestService(t *testing.T, credentials account.M365Config) *graph.Service { adapter, err := graph.CreateAdapter( credentials.AzureTenantID, credentials.AzureClientID, credentials.AzureClientSecret, ) - if err != nil { - return nil, errors.Wrap(err, "creating microsoft graph service for exchange") - } + require.NoError(t, err, "creating microsoft graph service for exchange") - return graph.NewService(adapter), nil + return graph.NewService(adapter) +} + +func createTestBetaService(t *testing.T, credentials account.M365Config) *betasdk.Service { + adapter, err := graph.CreateAdapter( + credentials.AzureTenantID, + credentials.AzureClientID, + credentials.AzureClientSecret, + ) + require.NoError(t, err) + + return betasdk.NewService(adapter) } func expectedPathAsSlice(t *testing.T, tenant, user string, rest ...string) []string { diff --git a/src/internal/connector/sharepoint/list.go b/src/internal/connector/sharepoint/list.go index 7f8e3523a..101de9722 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-beta-sdk-go/models" - mssite "github.com/microsoftgraph/msgraph-beta-sdk-go/sites" + "github.com/microsoftgraph/msgraph-sdk-go/models" + mssite "github.com/microsoftgraph/msgraph-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 bb8e18d62..3472c915f 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-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-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 0cee792ee..f56b1a396 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-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" diff --git a/src/internal/connector/sharepoint/list_test.go b/src/internal/connector/sharepoint/list_test.go index c798be368..2571c9183 100644 --- a/src/internal/connector/sharepoint/list_test.go +++ b/src/internal/connector/sharepoint/list_test.go @@ -49,9 +49,7 @@ func (suite *SharePointSuite) TestLoadList() { defer flush() t := suite.T() - service, err := createTestService(suite.creds) - require.NoError(t, err) - + service := createTestService(t, suite.creds) tuples, err := preFetchLists(ctx, service, "root") require.NoError(t, err) diff --git a/src/internal/connector/sharepoint/pageInfo.go b/src/internal/connector/sharepoint/pageInfo.go index 103beec83..40fd69404 100644 --- a/src/internal/connector/sharepoint/pageInfo.go +++ b/src/internal/connector/sharepoint/pageInfo.go @@ -3,8 +3,7 @@ package sharepoint import ( "time" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - + "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" "github.com/alcionai/corso/src/pkg/backup/details" ) diff --git a/src/internal/connector/sharepoint/pageInfo_test.go b/src/internal/connector/sharepoint/pageInfo_test.go index 16a32c432..81b9f27fb 100644 --- a/src/internal/connector/sharepoint/pageInfo_test.go +++ b/src/internal/connector/sharepoint/pageInfo_test.go @@ -3,9 +3,9 @@ package sharepoint import ( "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" "github.com/stretchr/testify/assert" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" "github.com/alcionai/corso/src/pkg/backup/details" ) diff --git a/src/internal/connector/sharepoint/queries.go b/src/internal/connector/sharepoint/queries.go index 5e5807974..806cf0e97 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-beta-sdk-go/sites" + mssite "github.com/microsoftgraph/msgraph-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 c0c16fd0f..ef2b940bb 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-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-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 index e5faa6cfe..e8ba0ab42 100644 --- a/src/internal/connector/sharepoint/site_page.go +++ b/src/internal/connector/sharepoint/site_page.go @@ -3,10 +3,9 @@ package sharepoint import ( "context" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" - "github.com/microsoftgraph/msgraph-beta-sdk-go/sites" - - "github.com/alcionai/corso/src/internal/connector/graph" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk/models" + "github.com/alcionai/corso/src/internal/connector/graph/betasdk/sites" "github.com/alcionai/corso/src/internal/connector/support" ) @@ -14,7 +13,7 @@ import ( // Returns error if error experienced during the call func GetSitePages( ctx context.Context, - serv graph.Servicer, + serv *betasdk.Service, siteID string, pages []string, ) ([]models.SitePageable, error) { @@ -34,7 +33,7 @@ func GetSitePages( } // fetchPages utility function to return the tuple of item -func fetchPages(ctx context.Context, bs graph.Servicer, siteID string) ([]listTuple, error) { +func fetchPages(ctx context.Context, bs *betasdk.Service, siteID string) ([]listTuple, error) { var ( builder = bs.Client().SitesById(siteID).Pages() opts = fetchPageOptions() diff --git a/src/internal/connector/sharepoint/site_page_test.go b/src/internal/connector/sharepoint/site_page_test.go new file mode 100644 index 000000000..741bb5da4 --- /dev/null +++ b/src/internal/connector/sharepoint/site_page_test.go @@ -0,0 +1,71 @@ +package sharepoint + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "github.com/alcionai/corso/src/internal/tester" + "github.com/alcionai/corso/src/pkg/account" +) + +type SharePointPageSuite struct { + suite.Suite + + creds account.M365Config +} + +func (suite *SharePointPageSuite) SetupSuite() { + t := suite.T() + a := tester.NewM365Account(t) + m365, err := a.M365Config() + require.NoError(t, err) + + suite.creds = m365 +} + +func TestSharePointPageSuite(t *testing.T) { + tester.RunOnAny( + t, + tester.CorsoCITests, + tester.CorsoGraphConnectorSharePointTests) + suite.Run(t, new(SharePointPageSuite)) +} + +func (suite *SharePointPageSuite) TestFetchPages() { + ctx, flush := tester.NewContext() + defer flush() + + t := suite.T() + siteID := tester.M365SiteID(t) + service := createTestBetaService(t, suite.creds) + + pgs, err := fetchPages(ctx, service, siteID) + assert.NoError(t, err) + require.NotNil(t, pgs) + assert.NotZero(t, len(pgs)) + + for _, entry := range pgs { + t.Logf("id: %s\t name: %s\n", entry.id, entry.name) + } +} + +func (suite *SharePointPageSuite) TestGetSitePage() { + ctx, flush := tester.NewContext() + defer flush() + + t := suite.T() + siteID := tester.M365SiteID(t) + + service := createTestBetaService(t, suite.creds) + tuples, err := fetchPages(ctx, service, siteID) + require.NoError(t, err) + require.NotNil(t, tuples) + + jobs := []string{tuples[0].id} + pages, err := GetSitePages(ctx, service, siteID, jobs) + assert.NoError(t, err) + assert.NotEmpty(t, pages) +} diff --git a/src/internal/connector/support/attendee.go b/src/internal/connector/support/attendee.go index 691f3c9e0..9c55d9890 100644 --- a/src/internal/connector/support/attendee.go +++ b/src/internal/connector/support/attendee.go @@ -3,7 +3,7 @@ package support import ( "fmt" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" ) type attendee struct { diff --git a/src/internal/connector/support/errors.go b/src/internal/connector/support/errors.go index e577acb66..8f73ea8fa 100644 --- a/src/internal/connector/support/errors.go +++ b/src/internal/connector/support/errors.go @@ -6,7 +6,7 @@ import ( "strings" multierror "github.com/hashicorp/go-multierror" - msgraph_errors "github.com/microsoftgraph/msgraph-beta-sdk-go/models/odataerrors" + msgraph_errors "github.com/microsoftgraph/msgraph-sdk-go/models/odataerrors" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/common" diff --git a/src/internal/connector/support/m365Support.go b/src/internal/connector/support/m365Support.go index c75787045..99cb95577 100644 --- a/src/internal/connector/support/m365Support.go +++ b/src/internal/connector/support/m365Support.go @@ -5,7 +5,7 @@ import ( absser "github.com/microsoft/kiota-abstractions-go/serialization" js "github.com/microsoft/kiota-serialization-json-go" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" ) diff --git a/src/internal/connector/support/m365Support_test.go b/src/internal/connector/support/m365Support_test.go index 387e79b7d..dedde3536 100644 --- a/src/internal/connector/support/m365Support_test.go +++ b/src/internal/connector/support/m365Support_test.go @@ -3,7 +3,7 @@ package support import ( "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/src/internal/connector/support/m365Transform.go b/src/internal/connector/support/m365Transform.go index 27e0215e4..651689430 100644 --- a/src/internal/connector/support/m365Transform.go +++ b/src/internal/connector/support/m365Transform.go @@ -3,7 +3,7 @@ package support import ( "strings" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" ) // CloneMessageableFields places data from original data into new message object. diff --git a/src/internal/connector/support/m365Transform_test.go b/src/internal/connector/support/m365Transform_test.go index 92aae990b..90d8e757b 100644 --- a/src/internal/connector/support/m365Transform_test.go +++ b/src/internal/connector/support/m365Transform_test.go @@ -3,7 +3,7 @@ package support import ( "testing" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/src/internal/connector/support/status.go b/src/internal/connector/support/status.go index fb08ea1c4..3f2435263 100644 --- a/src/internal/connector/support/status.go +++ b/src/internal/connector/support/status.go @@ -4,6 +4,7 @@ import ( "context" "fmt" + multierror "github.com/hashicorp/go-multierror" bytesize "github.com/inhies/go-bytesize" "github.com/alcionai/corso/src/pkg/logger" @@ -21,6 +22,7 @@ type ConnectorOperationStatus struct { FolderCount int Successful int ErrorCount int + Err error incomplete bool incompleteReason string additionalDetails string @@ -70,6 +72,7 @@ func CreateStatus( FolderCount: folders, Successful: cm.Successes, ErrorCount: numErr, + Err: err, incomplete: hasErrors, incompleteReason: reason, bytes: cm.TotalBytes, @@ -115,6 +118,7 @@ func MergeStatus(one, two ConnectorOperationStatus) ConnectorOperationStatus { FolderCount: one.FolderCount + two.FolderCount, Successful: one.Successful + two.Successful, ErrorCount: one.ErrorCount + two.ErrorCount, + Err: multierror.Append(one.Err, two.Err).ErrorOrNil(), bytes: one.bytes + two.bytes, incomplete: hasErrors, incompleteReason: one.incompleteReason + ", " + two.incompleteReason, diff --git a/src/internal/kopia/upload.go b/src/internal/kopia/upload.go index d9320f2a6..5301e6872 100644 --- a/src/internal/kopia/upload.go +++ b/src/internal/kopia/upload.go @@ -134,6 +134,7 @@ type corsoProgress struct { toMerge map[string]path.Path mu sync.RWMutex totalBytes int64 + errs *multierror.Error } // Kopia interface function used as a callback when kopia finishes processing a @@ -162,8 +163,13 @@ func (cp *corsoProgress) FinishedFile(relativePath string, err error) { // These items were sourced from a base snapshot or were cached in kopia so we // never had to materialize their details in-memory. if d.info == nil { - // TODO(ashmrtn): We should probably be returning an error here? if d.prevPath == nil { + cp.errs = multierror.Append(cp.errs, errors.Errorf( + "item sourced from previous backup with no previous path. Service: %s, Category: %s", + d.repoPath.Service().String(), + d.repoPath.Category().String(), + )) + return } @@ -339,6 +345,7 @@ func streamBaseEntries( prevPath path.Path, dir fs.Directory, encodedSeen map[string]struct{}, + globalExcludeSet map[string]struct{}, progress *corsoProgress, ) error { if dir == nil { @@ -367,6 +374,12 @@ func streamBaseEntries( return errors.Wrapf(err, "unable to decode entry name %s", entry.Name()) } + // This entry was marked as deleted by a service that can't tell us the + // previous path of deleted items, only the item ID. + if _, ok := globalExcludeSet[entName]; ok { + return nil + } + // For now assuming that item IDs don't need escaping. itemPath, err := curPath.Append(entName, true) if err != nil { @@ -415,6 +428,7 @@ func getStreamItemFunc( staticEnts []fs.Entry, streamedEnts data.Collection, baseDir fs.Directory, + globalExcludeSet map[string]struct{}, progress *corsoProgress, ) func(context.Context, func(context.Context, fs.Entry) error) error { return func(ctx context.Context, cb func(context.Context, fs.Entry) error) error { @@ -437,6 +451,7 @@ func getStreamItemFunc( prevPath, baseDir, seen, + globalExcludeSet, progress, ); err != nil { errs = multierror.Append( @@ -451,21 +466,22 @@ func getStreamItemFunc( // buildKopiaDirs recursively builds a directory hierarchy from the roots up. // Returned directories are virtualfs.StreamingDirectory. -func buildKopiaDirs(dirName string, dir *treeMap, progress *corsoProgress) (fs.Directory, error) { +func buildKopiaDirs( + dirName string, + dir *treeMap, + globalExcludeSet map[string]struct{}, + progress *corsoProgress, +) (fs.Directory, error) { // Reuse kopia directories directly if the subtree rooted at them is // unchanged. // - // TODO(ashmrtn): This will need updated when we have OneDrive backups where - // items have been deleted because we can't determine which directory used to - // have the item. - // // TODO(ashmrtn): We could possibly also use this optimization if we know that // the collection has no items in it. In that case though, we may need to take // extra care to ensure the name of the directory is properly represented. For // example, a directory that has been renamed but with no additional items may // not be able to directly use kopia's version of the directory due to the // rename. - if dir.collection == nil && len(dir.childDirs) == 0 && dir.baseDir != nil { + if dir.collection == nil && len(dir.childDirs) == 0 && dir.baseDir != nil && len(globalExcludeSet) == 0 { return dir.baseDir, nil } @@ -474,7 +490,7 @@ func buildKopiaDirs(dirName string, dir *treeMap, progress *corsoProgress) (fs.D var childDirs []fs.Entry for childName, childDir := range dir.childDirs { - child, err := buildKopiaDirs(childName, childDir, progress) + child, err := buildKopiaDirs(childName, childDir, globalExcludeSet, progress) if err != nil { return nil, err } @@ -490,6 +506,7 @@ func buildKopiaDirs(dirName string, dir *treeMap, progress *corsoProgress) (fs.D childDirs, dir.collection, dir.baseDir, + globalExcludeSet, progress, ), ), nil @@ -873,11 +890,19 @@ func inflateBaseTree( // virtualfs.StreamingDirectory with the given DataCollections if there is one // for that node. Tags can be used in future backups to fetch old snapshots for // caching reasons. +// +// globalExcludeSet represents a set of items, represented with file names, to +// exclude from base directories when uploading the snapshot. As items in *all* +// base directories will be checked for in every base directory, this assumes +// that items in the bases are unique. Deletions of directories or subtrees +// should be represented as changes in the status of a Collection, not an entry +// in the globalExcludeSet. func inflateDirTree( ctx context.Context, loader snapshotLoader, baseSnaps []IncrementalBase, collections []data.Collection, + globalExcludeSet map[string]struct{}, progress *corsoProgress, ) (fs.Directory, error) { roots, updatedPaths, err := inflateCollectionTree(ctx, collections) @@ -909,7 +934,7 @@ func inflateDirTree( var res fs.Directory for dirName, dir := range roots { - tmp, err := buildKopiaDirs(dirName, dir, progress) + tmp, err := buildKopiaDirs(dirName, dir, globalExcludeSet, progress) if err != nil { return nil, err } diff --git a/src/internal/kopia/upload_test.go b/src/internal/kopia/upload_test.go index a3a865cd8..1cc4daf47 100644 --- a/src/internal/kopia/upload_test.go +++ b/src/internal/kopia/upload_test.go @@ -468,7 +468,7 @@ func (suite *CorsoProgressUnitSuite) TestFinishedFile() { for k, v := range ci { if cachedTest.cached { - cp.CachedFile(k, 42) + cp.CachedFile(k, v.totalBytes) } cp.FinishedFile(k, v.err) @@ -489,6 +489,38 @@ func (suite *CorsoProgressUnitSuite) TestFinishedFile() { } } +func (suite *CorsoProgressUnitSuite) TestFinishedFileCachedNoPrevPathErrors() { + t := suite.T() + bd := &details.Builder{} + cachedItems := map[string]testInfo{ + suite.targetFileName: { + info: &itemDetails{info: nil, repoPath: suite.targetFilePath}, + err: nil, + totalBytes: 100, + }, + } + cp := corsoProgress{ + UploadProgress: &snapshotfs.NullUploadProgress{}, + deets: bd, + pending: map[string]*itemDetails{}, + } + + for k, v := range cachedItems { + cp.put(k, v.info) + } + + require.Len(t, cp.pending, len(cachedItems)) + + for k, v := range cachedItems { + cp.CachedFile(k, v.totalBytes) + cp.FinishedFile(k, v.err) + } + + assert.Empty(t, cp.pending) + assert.Empty(t, bd.Details().Entries) + assert.Error(t, cp.errs.ErrorOrNil()) +} + func (suite *CorsoProgressUnitSuite) TestFinishedFileBuildsHierarchyNewItem() { t := suite.T() // Order of folders in hierarchy from root to leaf (excluding the item). @@ -673,7 +705,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree() { // - emails // - Inbox // - 42 separate files - dirTree, err := inflateDirTree(ctx, nil, nil, collections, progress) + dirTree, err := inflateDirTree(ctx, nil, nil, collections, nil, progress) require.NoError(t, err) assert.Equal(t, encodeAsPath(testTenant), dirTree.Name()) @@ -761,7 +793,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_MixedDirectory() suite.T().Run(test.name, func(t *testing.T) { progress := &corsoProgress{pending: map[string]*itemDetails{}} - dirTree, err := inflateDirTree(ctx, nil, nil, test.layout, progress) + dirTree, err := inflateDirTree(ctx, nil, nil, test.layout, nil, progress) require.NoError(t, err) assert.Equal(t, encodeAsPath(testTenant), dirTree.Name()) @@ -857,7 +889,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTree_Fails() { defer flush() suite.T().Run(test.name, func(t *testing.T) { - _, err := inflateDirTree(ctx, nil, nil, test.layout, nil) + _, err := inflateDirTree(ctx, nil, nil, test.layout, nil, nil) assert.Error(t, err) }) } @@ -960,7 +992,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeErrors() { cols = append(cols, mc) } - _, err := inflateDirTree(ctx, nil, nil, cols, progress) + _, err := inflateDirTree(ctx, nil, nil, cols, nil, progress) require.Error(t, err) }) } @@ -995,7 +1027,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() { virtualfs.StreamingFileWithModTimeFromReader( encodeElements(testFileName)[0], time.Time{}, - bytes.NewReader(testFileData), + io.NopCloser(bytes.NewReader(testFileData)), ), }, ), @@ -1229,6 +1261,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() { mockIncrementalBase("", testTenant, testUser, path.ExchangeService, path.EmailCategory), }, test.inputCollections(), + nil, progress, ) require.NoError(t, err) @@ -1249,7 +1282,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto []string{testTenant, service, testUser, category, testInboxDir}, false, ) - inboxFileName1 := testFileName4 + inboxFileName1 := testFileName inboxFileData1 := testFileData4 inboxFileName2 := testFileName5 inboxFileData2 := testFileData5 @@ -1259,7 +1292,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto append(inboxPath.Elements(), personalDir), false, ) - personalFileName1 := testFileName + personalFileName1 := inboxFileName1 personalFileName2 := testFileName2 workPath := makePath( @@ -1280,7 +1313,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto // - user1 // - email // - Inbox - // - file4 + // - file1 // - personal // - file1 // - file2 @@ -1301,7 +1334,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto virtualfs.StreamingFileWithModTimeFromReader( encodeElements(inboxFileName1)[0], time.Time{}, - bytes.NewReader(inboxFileData1), + io.NopCloser(bytes.NewReader(inboxFileData1)), ), virtualfs.NewStaticDirectory( encodeElements(personalDir)[0], @@ -1309,12 +1342,12 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto virtualfs.StreamingFileWithModTimeFromReader( encodeElements(personalFileName1)[0], time.Time{}, - bytes.NewReader(testFileData), + io.NopCloser(bytes.NewReader(testFileData)), ), virtualfs.StreamingFileWithModTimeFromReader( encodeElements(personalFileName2)[0], time.Time{}, - bytes.NewReader(testFileData2), + io.NopCloser(bytes.NewReader(testFileData2)), ), }, ), @@ -1324,7 +1357,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto virtualfs.StreamingFileWithModTimeFromReader( encodeElements(workFileName1)[0], time.Time{}, - bytes.NewReader(testFileData3), + io.NopCloser(bytes.NewReader(testFileData3)), ), }, ), @@ -1337,8 +1370,51 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto table := []struct { name string inputCollections func(t *testing.T) []data.Collection + inputExcludes map[string]struct{} expected *expectedNode }{ + { + name: "GlobalExcludeSet", + inputCollections: func(t *testing.T) []data.Collection { + return nil + }, + inputExcludes: map[string]struct{}{ + inboxFileName1: {}, + }, + expected: expectedTreeWithChildren( + []string{ + testTenant, + service, + testUser, + category, + }, + []*expectedNode{ + { + name: testInboxDir, + children: []*expectedNode{ + { + name: personalDir, + children: []*expectedNode{ + { + name: personalFileName2, + children: []*expectedNode{}, + }, + }, + }, + { + name: workDir, + children: []*expectedNode{ + { + name: workFileName1, + children: []*expectedNode{}, + }, + }, + }, + }, + }, + }, + ), + }, { name: "MovesSubtree", inputCollections: func(t *testing.T) []data.Collection { @@ -1887,6 +1963,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeMultipleSubdirecto mockIncrementalBase("", testTenant, testUser, path.ExchangeService, path.EmailCategory), }, test.inputCollections(t), + test.inputExcludes, progress, ) require.NoError(t, err) @@ -1941,7 +2018,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSkipsDeletedSubtre virtualfs.StreamingFileWithModTimeFromReader( encodeElements(testFileName)[0], time.Time{}, - bytes.NewReader(testFileData), + io.NopCloser(bytes.NewReader(testFileData)), ), }, ), @@ -1951,7 +2028,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSkipsDeletedSubtre virtualfs.StreamingFileWithModTimeFromReader( encodeElements(testFileName2)[0], time.Time{}, - bytes.NewReader(testFileData2), + io.NopCloser(bytes.NewReader(testFileData2)), ), }, ), @@ -1966,7 +2043,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSkipsDeletedSubtre virtualfs.StreamingFileWithModTimeFromReader( encodeElements(testFileName3)[0], time.Time{}, - bytes.NewReader(testFileData3), + io.NopCloser(bytes.NewReader(testFileData3)), ), }, ), @@ -1976,7 +2053,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSkipsDeletedSubtre virtualfs.StreamingFileWithModTimeFromReader( encodeElements(testFileName4)[0], time.Time{}, - bytes.NewReader(testFileData4), + io.NopCloser(bytes.NewReader(testFileData4)), ), }, ), @@ -2047,6 +2124,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSkipsDeletedSubtre mockIncrementalBase("", testTenant, testUser, path.ExchangeService, path.EmailCategory), }, collections, + nil, progress, ) require.NoError(t, err) @@ -2123,7 +2201,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSelectsCorrectSubt virtualfs.StreamingFileWithModTimeFromReader( encodeElements(inboxFileName1)[0], time.Time{}, - bytes.NewReader(inboxFileData1), + io.NopCloser(bytes.NewReader(inboxFileData1)), ), }, ), @@ -2138,7 +2216,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSelectsCorrectSubt virtualfs.StreamingFileWithModTimeFromReader( encodeElements(contactsFileName1)[0], time.Time{}, - bytes.NewReader(contactsFileData1), + io.NopCloser(bytes.NewReader(contactsFileData1)), ), }, ), @@ -2196,7 +2274,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSelectsCorrectSubt virtualfs.StreamingFileWithModTimeFromReader( encodeElements(eventsFileName1)[0], time.Time{}, - bytes.NewReader(eventsFileData1), + io.NopCloser(bytes.NewReader(eventsFileData1)), ), }, ), @@ -2293,6 +2371,7 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSelectsCorrectSubt mockIncrementalBase("id2", testTenant, testUser, path.ExchangeService, path.EmailCategory), }, collections, + nil, progress, ) require.NoError(t, err) diff --git a/src/internal/kopia/wrapper.go b/src/internal/kopia/wrapper.go index feab0e687..13db75ac4 100644 --- a/src/internal/kopia/wrapper.go +++ b/src/internal/kopia/wrapper.go @@ -129,7 +129,11 @@ func (w Wrapper) BackupCollections( ctx, end := D.Span(ctx, "kopia:backupCollections") defer end() - if len(collections) == 0 { + // TODO(ashmrtn): Make this a parameter when actually enabling the global + // exclude set. + var globalExcludeSet map[string]struct{} + + if len(collections) == 0 && len(globalExcludeSet) == 0 { return &BackupStats{}, &details.Builder{}, nil, nil } @@ -147,7 +151,14 @@ func (w Wrapper) BackupCollections( base = previousSnapshots } - dirTree, err := inflateDirTree(ctx, w.c, base, collections, progress) + dirTree, err := inflateDirTree( + ctx, + w.c, + base, + collections, + globalExcludeSet, + progress, + ) if err != nil { return nil, nil, nil, errors.Wrap(err, "building kopia directories") } @@ -160,10 +171,11 @@ func (w Wrapper) BackupCollections( progress, ) if err != nil { - return nil, nil, nil, err + combinedErrs := multierror.Append(nil, err, progress.errs) + return nil, nil, nil, combinedErrs.ErrorOrNil() } - return s, progress.deets, progress.toMerge, nil + return s, progress.deets, progress.toMerge, progress.errs.ErrorOrNil() } func (w Wrapper) makeSnapshotWithRoot( diff --git a/src/internal/operations/backup.go b/src/internal/operations/backup.go index 89dbb340d..a5a955150 100644 --- a/src/internal/operations/backup.go +++ b/src/internal/operations/backup.go @@ -4,6 +4,7 @@ import ( "context" "time" + "github.com/alcionai/clues" "github.com/google/uuid" multierror "github.com/hashicorp/go-multierror" "github.com/pkg/errors" @@ -119,6 +120,14 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { op.Results.BackupID = model.StableID(uuid.NewString()) + ctx = clues.AddAll( + ctx, + "tenant_id", tenantID, // TODO: pii + "resource_owner", op.ResourceOwner, // TODO: pii + "backup_id", op.Results.BackupID, + "service", op.Selectors.Service, + "incremental", uib) + op.bus.Event( ctx, events.BackupStart, @@ -174,6 +183,8 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { return opStats.readErr } + ctx = clues.Add(ctx, "collections", len(cs)) + opStats.k, backupDetails, toMerge, err = consumeBackupDataCollections( ctx, op.kopia, @@ -205,10 +216,19 @@ func (op *BackupOperation) Run(ctx context.Context) (err error) { return opStats.writeErr } + opStats.gc = gc.AwaitStatus() + + if opStats.gc.ErrorCount > 0 { + merr := multierror.Append(opStats.readErr, errors.Wrap(opStats.gc.Err, "retrieving data")) + opStats.readErr = merr.ErrorOrNil() + + // Need to exit before we set started to true else we'll report no errors. + return opStats.readErr + } + // should always be 1, since backups are 1:1 with resourceOwners. opStats.resourceCount = 1 opStats.started = true - opStats.gc = gc.AwaitStatus() return err } diff --git a/src/internal/operations/backup_integration_test.go b/src/internal/operations/backup_integration_test.go index 0c39ced10..83748baa2 100644 --- a/src/internal/operations/backup_integration_test.go +++ b/src/internal/operations/backup_integration_test.go @@ -7,7 +7,7 @@ import ( "time" "github.com/google/uuid" - "github.com/microsoftgraph/msgraph-beta-sdk-go/users" + "github.com/microsoftgraph/msgraph-sdk-go/users" "github.com/pkg/errors" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -655,7 +655,7 @@ func (suite *BackupOpIntegrationSuite) TestBackup_Run_exchangeIncrementals() { m365, err := acct.M365Config() require.NoError(t, err) - gc, err := connector.NewGraphConnector(ctx, acct, connector.Users) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), acct, connector.Users) require.NoError(t, err) ac, err := api.NewClient(m365) diff --git a/src/internal/operations/operation.go b/src/internal/operations/operation.go index 30770bdf5..e5382b022 100644 --- a/src/internal/operations/operation.go +++ b/src/internal/operations/operation.go @@ -7,6 +7,7 @@ import ( "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/internal/events" "github.com/alcionai/corso/src/internal/kopia" "github.com/alcionai/corso/src/internal/observe" @@ -107,7 +108,7 @@ func connectToM365( resource = connector.Sites } - gc, err := connector.NewGraphConnector(ctx, acct, resource) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), acct, resource) if err != nil { return nil, err } diff --git a/src/internal/operations/restore.go b/src/internal/operations/restore.go index f7505fa7d..03c203b05 100644 --- a/src/internal/operations/restore.go +++ b/src/internal/operations/restore.go @@ -5,6 +5,7 @@ import ( "fmt" "time" + "github.com/alcionai/clues" "github.com/google/uuid" multierror "github.com/hashicorp/go-multierror" "github.com/pkg/errors" @@ -129,6 +130,12 @@ func (op *RestoreOperation) Run(ctx context.Context) (restoreDetails *details.De detailsStore := streamstore.New(op.kopia, op.account.ID(), op.Selectors.PathService()) + ctx = clues.AddAll( + ctx, + "tenant_id", op.account.ID(), // TODO: pii + "backup_id", op.BackupID, + "service", op.Selectors.Service) + bup, deets, err := getBackupAndDetailsFromID( ctx, op.BackupID, @@ -142,6 +149,8 @@ func (op *RestoreOperation) Run(ctx context.Context) (restoreDetails *details.De return nil, err } + ctx = clues.Add(ctx, "resource_owner", bup.Selector.DiscreteOwner) + op.bus.Event( ctx, events.RestoreStart, @@ -159,6 +168,8 @@ func (op *RestoreOperation) Run(ctx context.Context) (restoreDetails *details.De return nil, err } + ctx = clues.Add(ctx, "details_paths", len(paths)) + observe.Message(ctx, fmt.Sprintf("Discovered %d items in backup %s to restore", len(paths), op.BackupID)) kopiaComplete, closer := observe.MessageWithCompletion(ctx, "Enumerating items in repository") @@ -174,6 +185,8 @@ func (op *RestoreOperation) Run(ctx context.Context) (restoreDetails *details.De } kopiaComplete <- struct{}{} + ctx = clues.Add(ctx, "collections", len(dcs)) + opStats.cs = dcs opStats.resourceCount = len(data.ResourceOwnerSet(dcs)) diff --git a/src/pkg/fault/example_fault_test.go b/src/pkg/fault/example_fault_test.go new file mode 100644 index 000000000..4ad5945d2 --- /dev/null +++ b/src/pkg/fault/example_fault_test.go @@ -0,0 +1,291 @@ +package fault_test + +import ( + "fmt" + + "github.com/pkg/errors" + + "github.com/alcionai/corso/src/pkg/fault" +) + +// --------------------------------------------------------------------------- +// mock helpers +// --------------------------------------------------------------------------- + +var ( + ctrl any + items = []string{} +) + +type mockController struct { + errors any +} + +func connectClient() error { return nil } +func dependencyCall() error { return nil } +func getIthItem(i string) error { return nil } +func getData() ([]string, error) { return nil, nil } +func storeData([]string, *fault.Errors) {} + +type mockOper struct { + Errors *fault.Errors +} + +func newOperation() mockOper { return mockOper{fault.New(true)} } +func (m mockOper) Run() *fault.Errors { return m.Errors } + +// --------------------------------------------------------------------------- +// examples +// --------------------------------------------------------------------------- + +// ExampleNewErrors highlights assumptions and best practices +// for generating Errors structs. +func Example_new() { + // Errors should only be generated during the construction of + // another controller, such as a new Backup or Restore Operations. + // Configurations like failFast are set during construction. + // + // Generating new fault.Errors structs outside of an operation + // controller is a smell, and should be avoided. If you need + // to aggregate errors, you should accept an interface and pass + // an Errors instance into it. + ctrl = mockController{ + errors: fault.New(false), + } +} + +// ExampleErrorsFail describes the assumptions and best practices +// for setting the Failure error. +func Example_errors_Fail() { + errs := fault.New(false) + + // Fail() should be used to record any error that highlights a + // non-recoverable failure in a process. + // + // Fail() should only get called in the last step before returning + // a fault.Errors from a controller. In all other cases, you + // should simply return an error and expect the upstream controller + // to call Fail() for you. + if err := connectClient(); err != nil { + // normally, you'd want to + // return errs.Fail(err) + errs.Fail(err) + } + + // Only the topmost handler of the error should set the Fail() err. + // This will normally be the operation controller itself. + // IE: Fail() is not Wrap(). In lower levels, errors should get + // wrapped and returned like normal, and only handled by errors + // at the end. + lowLevelCall := func() error { + if err := dependencyCall(); err != nil { + // wrap here, deeper into the stack + return errors.Wrap(err, "dependency") + } + + return nil + } + + if err := lowLevelCall(); err != nil { + // fail here, at the top of the stack + errs.Fail(err) + } +} + +// ExampleErrorsAdd describes the assumptions and best practices +// for aggregating iterable or recoverable errors. +func Example_errors_Add() { + errs := fault.New(false) + + // Add() should be used to record any error in a recoverable + // part of processing. + // + // Add() should only get called in the last step in handling an + // error within a loop or stream that does not otherwise return + // an error. In all other cases, you should simply return an error + // and expect the upstream point of iteration to call Add() for you. + for _, i := range items { + if err := getIthItem(i); err != nil { + errs.Add(err) + } + } + + // In case of failFast behavior, iteration should exit as soon + // as an error occurs. Errors does not expose the failFast flag + // directly. Instead, iterators should check the value of Err(). + // If it is non-nil, then the loop shold break. + for _, i := range items { + if errs.Err() != nil { + break + } + + errs.Add(getIthItem(i)) + } + + // Only the topmost handler of the error should Add() the err. + // This will normally be the iteration loop itself. + // IE: Add() is not Wrap(). In lower levels, errors should get + // wrapped and returned like normally, and only added to the + // errors at the end. + clientBasedGetter := func(s string) error { + if err := dependencyCall(); err != nil { + // wrap here, deeper into the stack + return errors.Wrap(err, "dependency") + } + + return nil + } + + for _, i := range items { + if err := clientBasedGetter(i); err != nil { + // add here, within the iteraton loop + errs.Add(err) + } + } +} + +// ExampleErrorsErr describes retrieving the non-recoverable error. +func Example_errors_Err() { + errs := fault.New(false) + errs.Fail(errors.New("catastrophe")) + + // Err() gets the primary failure error. + err := errs.Err() + fmt.Println(err) + + // if multiple Failures occur, each one after the first gets + // added to the Errs slice. + errs.Fail(errors.New("another catastrophe")) + errSl := errs.Errs() + + for _, e := range errSl { + fmt.Println(e) + } + + // If Err() is nil, then you can assume the operation completed. + // A complete operation is not necessarily an error-free operation. + // + // Even if Err() is nil, Errs() can be non-empty. + // Make sure you check both. + + errs = fault.New(true) + + // If failFast is set to true, then the first error Add()ed gets + // promoted to the Err() position. + + errs.Add(errors.New("not catastrophic, but still becomes the Err()")) + err = errs.Err() + fmt.Println(err) + + // Output: catastrophe + // another catastrophe + // not catastrophic, but still becomes the Err() +} + +// ExampleErrorsErrs describes retrieving individual errors. +func Example_errors_Errs() { + errs := fault.New(false) + errs.Add(errors.New("not catastrophic")) + errs.Add(errors.New("something unwanted")) + + // Errs() gets the slice errors that were recorded, but were + // considered recoverable. + errSl := errs.Errs() + for _, err := range errSl { + fmt.Println(err) + } + + // Errs() only needs to be investigated by the end user at the + // conclusion of an operation. Checking Errs() within lower- + // layer code is a smell. Funcs should return an error if they + // need upstream handlers to recognize failure states. + // + // If Errs() is nil, then you can assume that no recoverable or + // iteration-based errors occurred. But that does not necessarily + // mean the operation was able to complete. + // + // Even if Errs() contains zero items, Err() can be non-nil. + // Make sure you check both. + + // Output: not catastrophic + // something unwanted +} + +// ExampleErrorsE2e showcases a more complex integration. +func Example_errors_e2e() { + oper := newOperation() + + // imagine that we're a user, calling into corso SDK. + // (fake funcs used here to minimize example bloat) + // + // The operation is our controller, we expect it to + // generate a new fault.Errors when constructed, and + // to return that struct when we call Run() + errs := oper.Run() + + // Let's investigate what went on inside. Since we're at + // the top of our controller, and returning a fault.Errors, + // all the error handlers set the Fail() case. + /* Run() */ + func() *fault.Errors { + if err := connectClient(); err != nil { + // Fail() here; we're top level in the controller + // and this is a non-recoverable issue + return oper.Errors.Fail(err) + } + + data, err := getData() + if err != nil { + return oper.Errors.Fail(err) + } + + // storeData will aggregate iterated errors into + // oper.Errors. + storeData(data, oper.Errors) + + // return oper.Errors here, in part to ensure it's + // non-nil, and because we don't know if we've + // aggregated any iterated errors yet. + return oper.Errors + }() + + // What about the lower level handling? storeData didn't + // return an error, so what's happening there? + /* storeData */ + func(data []any, errs *fault.Errors) { + // this is downstream in our code somewhere + storer := func(a any) error { + if err := dependencyCall(); err != nil { + // we're not passing in or calling fault.Errors here, + // because this isn't the iteration handler, it's just + // a regular error. + return errors.Wrap(err, "dependency") + } + + return nil + } + + for _, d := range data { + if errs.Err() != nil { + break + } + + if err := storer(d); err != nil { + // Since we're at the top of the iteration, we need + // to add each error to the fault.Errors struct. + errs.Add(err) + } + } + }(nil, nil) + + // then at the end of the oper.Run, we investigate the results. + if errs.Err() != nil { + // handle the primary error + fmt.Println("err occurred", errs.Err()) + } + + for _, err := range errs.Errs() { + // handle each recoverable error + fmt.Println("recoverable err occurred", err) + } +} diff --git a/src/pkg/fault/fault.go b/src/pkg/fault/fault.go new file mode 100644 index 000000000..f4171ce77 --- /dev/null +++ b/src/pkg/fault/fault.go @@ -0,0 +1,127 @@ +package fault + +import ( + "sync" + + "golang.org/x/exp/slices" +) + +type Errors struct { + mu *sync.Mutex + + // err identifies non-recoverable errors. This includes + // non-start cases (ex: cannot connect to client), hard- + // stop issues (ex: credentials expired) or conscious exit + // cases (ex: iteration error + failFast config). + err error + + // errs is the accumulation of recoverable or iterated + // errors. Eg: if a process is retrieving N items, and + // 1 of the items fails to be retrieved, but the rest of + // them succeed, we'd expect to see 1 error added to this + // slice. + errs []error + + // if failFast is true, the first errs addition will + // get promoted to the err value. This signifies a + // non-recoverable processing state, causing any running + // processes to exit. + failFast bool +} + +// ErrorsData provides the errors data alone, without sync +// controls, allowing the data to be persisted. +type ErrorsData struct { + Err error `json:"err"` + Errs []error `json:"errs"` + FailFast bool `json:"failFast"` +} + +// New constructs a new error with default values in place. +func New(failFast bool) *Errors { + return &Errors{ + mu: &sync.Mutex{}, + errs: []error{}, + failFast: failFast, + } +} + +// Err returns the primary error. If not nil, this +// indicates the operation exited prior to completion. +func (e *Errors) Err() error { + return e.err +} + +// Errs returns the slice of recoverable and +// iterated errors. +func (e *Errors) Errs() []error { + return e.errs +} + +// Data returns the plain set of error data +// without any sync properties. +func (e *Errors) Data() ErrorsData { + return ErrorsData{ + Err: e.err, + Errs: slices.Clone(e.errs), + FailFast: e.failFast, + } +} + +// TODO: introduce Failer interface + +// Fail sets the non-recoverable error (ie: errors.err) +// in the errors struct. If a non-recoverable error is +// already present, the error gets added to the errs slice. +func (e *Errors) Fail(err error) *Errors { + if err == nil { + return e + } + + e.mu.Lock() + defer e.mu.Unlock() + + return e.setErr(err) +} + +// setErr handles setting errors.err. Sync locking gets +// handled upstream of this call. +func (e *Errors) setErr(err error) *Errors { + if e.err != nil { + return e.addErr(err) + } + + e.err = err + + return e +} + +// TODO: introduce Adder interface + +// Add appends the error to the slice of recoverable and +// iterated errors (ie: errors.errs). If failFast is true, +// the first Added error will get copied to errors.err, +// causing the errors struct to identify as non-recoverably +// failed. +func (e *Errors) Add(err error) *Errors { + if err == nil { + return e + } + + e.mu.Lock() + defer e.mu.Unlock() + + return e.addErr(err) +} + +// addErr handles adding errors to errors.errs. Sync locking +// gets handled upstream of this call. +func (e *Errors) addErr(err error) *Errors { + if e.err == nil && e.failFast { + e.setErr(err) + } + + e.errs = append(e.errs, err) + + return e +} diff --git a/src/pkg/fault/fault_test.go b/src/pkg/fault/fault_test.go new file mode 100644 index 000000000..3f5ad127c --- /dev/null +++ b/src/pkg/fault/fault_test.go @@ -0,0 +1,202 @@ +package fault_test + +import ( + "errors" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "github.com/alcionai/corso/src/pkg/fault" +) + +type FaultErrorsUnitSuite struct { + suite.Suite +} + +func TestFaultErrorsUnitSuite(t *testing.T) { + suite.Run(t, new(FaultErrorsUnitSuite)) +} + +func (suite *FaultErrorsUnitSuite) TestNew() { + t := suite.T() + + n := fault.New(false) + assert.NotNil(t, n) + + n = fault.New(true) + assert.NotNil(t, n) +} + +func (suite *FaultErrorsUnitSuite) TestErr() { + table := []struct { + name string + failFast bool + fail error + add error + expect assert.ErrorAssertionFunc + }{ + { + name: "nil", + expect: assert.NoError, + }, + { + name: "nil, failFast", + failFast: true, + expect: assert.NoError, + }, + { + name: "failed", + fail: assert.AnError, + expect: assert.Error, + }, + { + name: "failed, failFast", + fail: assert.AnError, + failFast: true, + expect: assert.Error, + }, + { + name: "added", + add: assert.AnError, + expect: assert.NoError, + }, + { + name: "added, failFast", + add: assert.AnError, + failFast: true, + expect: assert.Error, + }, + } + for _, test := range table { + suite.T().Run(test.name, func(t *testing.T) { + n := fault.New(test.failFast) + require.NotNil(t, n) + + e := n.Fail(test.fail) + require.NotNil(t, e) + + e = n.Add(test.add) + require.NotNil(t, e) + + test.expect(t, n.Err()) + }) + } +} + +func (suite *FaultErrorsUnitSuite) TestFail() { + t := suite.T() + + n := fault.New(false) + require.NotNil(t, n) + + n.Fail(assert.AnError) + assert.Error(t, n.Err()) + assert.Empty(t, n.Errs()) + + n.Fail(assert.AnError) + assert.Error(t, n.Err()) + assert.NotEmpty(t, n.Errs()) +} + +func (suite *FaultErrorsUnitSuite) TestErrs() { + table := []struct { + name string + failFast bool + fail error + add error + expect assert.ValueAssertionFunc + }{ + { + name: "nil", + expect: assert.Empty, + }, + { + name: "nil, failFast", + failFast: true, + expect: assert.Empty, + }, + { + name: "failed", + fail: assert.AnError, + expect: assert.Empty, + }, + { + name: "failed, failFast", + fail: assert.AnError, + failFast: true, + expect: assert.Empty, + }, + { + name: "added", + add: assert.AnError, + expect: assert.NotEmpty, + }, + { + name: "added, failFast", + add: assert.AnError, + failFast: true, + expect: assert.NotEmpty, + }, + } + for _, test := range table { + suite.T().Run(test.name, func(t *testing.T) { + n := fault.New(test.failFast) + require.NotNil(t, n) + + e := n.Fail(test.fail) + require.NotNil(t, e) + + e = n.Add(test.add) + require.NotNil(t, e) + + test.expect(t, n.Errs()) + }) + } +} + +func (suite *FaultErrorsUnitSuite) TestAdd() { + t := suite.T() + + n := fault.New(true) + require.NotNil(t, n) + + n.Add(assert.AnError) + assert.Error(t, n.Err()) + assert.Len(t, n.Errs(), 1) + + n.Add(assert.AnError) + assert.Error(t, n.Err()) + assert.Len(t, n.Errs(), 2) +} + +func (suite *FaultErrorsUnitSuite) TestData() { + t := suite.T() + + // not fail-fast + n := fault.New(false) + require.NotNil(t, n) + + n.Fail(errors.New("fail")) + n.Add(errors.New("1")) + n.Add(errors.New("2")) + + d := n.Data() + assert.Equal(t, n.Err(), d.Err) + assert.ElementsMatch(t, n.Errs(), d.Errs) + assert.False(t, d.FailFast) + + // fail-fast + n = fault.New(true) + require.NotNil(t, n) + + n.Fail(errors.New("fail")) + n.Add(errors.New("1")) + n.Add(errors.New("2")) + + d = n.Data() + assert.Equal(t, n.Err(), d.Err) + assert.ElementsMatch(t, n.Errs(), d.Errs) + assert.True(t, d.FailFast) +} diff --git a/src/pkg/logger/logger.go b/src/pkg/logger/logger.go index bead584b5..f64febe2e 100644 --- a/src/pkg/logger/logger.go +++ b/src/pkg/logger/logger.go @@ -106,6 +106,11 @@ func PreloadLoggingFlags() (string, string) { return "info", dlf } + // if not specified, attempt to fall back to env declaration. + if len(logfile) == 0 { + logfile = os.Getenv("CORSO_LOG_FILE") + } + if logfile == "-" { logfile = "stdout" } diff --git a/src/pkg/path/resource_path.go b/src/pkg/path/resource_path.go index c66cd300e..07f9f429c 100644 --- a/src/pkg/path/resource_path.go +++ b/src/pkg/path/resource_path.go @@ -1,6 +1,8 @@ package path import ( + "strings" + "github.com/pkg/errors" ) @@ -30,18 +32,20 @@ const ( ) func toServiceType(service string) ServiceType { - switch service { - case ExchangeService.String(): + s := strings.ToLower(service) + + switch s { + case strings.ToLower(ExchangeService.String()): return ExchangeService - case OneDriveService.String(): + case strings.ToLower(OneDriveService.String()): return OneDriveService - case SharePointService.String(): + case strings.ToLower(SharePointService.String()): return SharePointService - case ExchangeMetadataService.String(): + case strings.ToLower(ExchangeMetadataService.String()): return ExchangeMetadataService - case OneDriveMetadataService.String(): + case strings.ToLower(OneDriveMetadataService.String()): return OneDriveMetadataService - case SharePointMetadataService.String(): + case strings.ToLower(SharePointMetadataService.String()): return SharePointMetadataService default: return UnknownService @@ -70,22 +74,24 @@ const ( ) func ToCategoryType(category string) CategoryType { - switch category { - case EmailCategory.String(): + cat := strings.ToLower(category) + + switch cat { + case strings.ToLower(EmailCategory.String()): return EmailCategory - case ContactsCategory.String(): + case strings.ToLower(ContactsCategory.String()): return ContactsCategory - case EventsCategory.String(): + case strings.ToLower(EventsCategory.String()): return EventsCategory - case FilesCategory.String(): + case strings.ToLower(FilesCategory.String()): return FilesCategory - case LibrariesCategory.String(): + case strings.ToLower(LibrariesCategory.String()): return LibrariesCategory - case ListsCategory.String(): + case strings.ToLower(ListsCategory.String()): return ListsCategory - case PagesCategory.String(): + case strings.ToLower(PagesCategory.String()): return PagesCategory - case DetailsCategory.String(): + case strings.ToLower(DetailsCategory.String()): return DetailsCategory default: return UnknownCategory diff --git a/src/pkg/path/service_category_test.go b/src/pkg/path/service_category_test.go index 915e48dc5..a97f22cd8 100644 --- a/src/pkg/path/service_category_test.go +++ b/src/pkg/path/service_category_test.go @@ -1,6 +1,7 @@ package path import ( + "strings" "testing" "github.com/stretchr/testify/assert" @@ -128,3 +129,51 @@ func (suite *ServiceCategoryUnitSuite) TestValidateServiceAndCategory() { }) } } + +func (suite *ServiceCategoryUnitSuite) TestToServiceType() { + table := []struct { + name string + service string + expected ServiceType + }{ + { + name: "SameCase", + service: ExchangeMetadataService.String(), + expected: ExchangeMetadataService, + }, + { + name: "DifferentCase", + service: strings.ToUpper(ExchangeMetadataService.String()), + expected: ExchangeMetadataService, + }, + } + for _, test := range table { + suite.T().Run(test.name, func(t *testing.T) { + assert.Equal(t, test.expected, toServiceType(test.service)) + }) + } +} + +func (suite *ServiceCategoryUnitSuite) TestToCategoryType() { + table := []struct { + name string + category string + expected CategoryType + }{ + { + name: "SameCase", + category: EmailCategory.String(), + expected: EmailCategory, + }, + { + name: "DifferentCase", + category: strings.ToUpper(EmailCategory.String()), + expected: EmailCategory, + }, + } + for _, test := range table { + suite.T().Run(test.name, func(t *testing.T) { + assert.Equal(t, test.expected, ToCategoryType(test.category)) + }) + } +} diff --git a/src/pkg/selectors/sharepoint_test.go b/src/pkg/selectors/sharepoint_test.go index b9334a492..4ce3859cd 100644 --- a/src/pkg/selectors/sharepoint_test.go +++ b/src/pkg/selectors/sharepoint_test.go @@ -193,9 +193,13 @@ func (suite *SharePointSelectorSuite) TestToSharePointRestore() { func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() { var ( - item = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderA/folderB", "item") - item2 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderA/folderC", "item2") - item3 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderD/folderE", "item3") + pairAC = "folderA/folderC" + pairGH = "folderG/folderH" + item = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderA/folderB", "item") + item2 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", pairAC, "item2") + item3 = stubRepoRef(path.SharePointService, path.LibrariesCategory, "sid", "folderD/folderE", "item3") + item4 = stubRepoRef(path.SharePointService, path.PagesCategory, "sid", pairGH, "item4") + item5 = stubRepoRef(path.SharePointService, path.PagesCategory, "sid", pairGH, "item5") ) deets := &details.Details{ @@ -225,6 +229,22 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() { }, }, }, + { + RepoRef: item4, + ItemInfo: details.ItemInfo{ + SharePoint: &details.SharePointInfo{ + ItemType: details.SharePointItem, + }, + }, + }, + { + RepoRef: item5, + ItemInfo: details.ItemInfo{ + SharePoint: &details.SharePointInfo{ + ItemType: details.SharePointItem, + }, + }, + }, }, }, } @@ -247,7 +267,7 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() { odr.Include(odr.AllData()) return odr }, - expect: arr(item, item2, item3), + expect: arr(item, item2, item3, item4, item5), }, { name: "only match item", @@ -264,11 +284,21 @@ func (suite *SharePointSelectorSuite) TestSharePointRestore_Reduce() { deets: deets, makeSelector: func() *SharePointRestore { odr := NewSharePointRestore([]string{"sid"}) - odr.Include(odr.Libraries([]string{"folderA/folderB", "folderA/folderC"})) + odr.Include(odr.Libraries([]string{"folderA/folderB", pairAC})) return odr }, expect: arr(item, item2), }, + { + name: "pages match folder", + deets: deets, + makeSelector: func() *SharePointRestore { + odr := NewSharePointRestore([]string{"sid"}) + odr.Include(odr.Pages([]string{pairGH, pairAC})) + return odr + }, + expect: arr(item4, item5), + }, } for _, test := range table { suite.T().Run(test.name, func(t *testing.T) { diff --git a/src/pkg/services/m365/m365.go b/src/pkg/services/m365/m365.go index 4a1ec407b..e0dd75af9 100644 --- a/src/pkg/services/m365/m365.go +++ b/src/pkg/services/m365/m365.go @@ -3,11 +3,12 @@ package m365 import ( "context" - "github.com/microsoftgraph/msgraph-beta-sdk-go/models" + "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/pkg/errors" "github.com/alcionai/corso/src/internal/connector" "github.com/alcionai/corso/src/internal/connector/discovery" + "github.com/alcionai/corso/src/internal/connector/graph" "github.com/alcionai/corso/src/pkg/account" ) @@ -20,12 +21,12 @@ type User struct { // Users returns a list of users in the specified M365 tenant // TODO: Implement paging support func Users(ctx context.Context, m365Account account.Account) ([]*User, error) { - gc, err := connector.NewGraphConnector(ctx, m365Account, connector.Users) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), m365Account, connector.Users) if err != nil { return nil, errors.Wrap(err, "could not initialize M365 graph connection") } - users, err := discovery.Users(ctx, gc.Service, m365Account.ID()) + users, err := discovery.Users(ctx, gc.Owners.Users()) if err != nil { return nil, err } @@ -76,7 +77,7 @@ func UserPNs(ctx context.Context, m365Account account.Account) ([]string, error) // SiteURLs returns a list of SharePoint site WebURLs in the specified M365 tenant func SiteURLs(ctx context.Context, m365Account account.Account) ([]string, error) { - gc, err := connector.NewGraphConnector(ctx, m365Account, connector.Sites) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), m365Account, connector.Sites) if err != nil { return nil, errors.Wrap(err, "could not initialize M365 graph connection") } @@ -86,7 +87,7 @@ func SiteURLs(ctx context.Context, m365Account account.Account) ([]string, error // SiteURLs returns a list of SharePoint sites IDs in the specified M365 tenant func SiteIDs(ctx context.Context, m365Account account.Account) ([]string, error) { - gc, err := connector.NewGraphConnector(ctx, m365Account, connector.Sites) + gc, err := connector.NewGraphConnector(ctx, graph.LargeItemClient(), m365Account, connector.Sites) if err != nil { return nil, errors.Wrap(err, "could not initialize M365 graph connection") } diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index ea99ddc6e..375df5a88 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -47,7 +47,7 @@ const config = { sidebarPath: require.resolve('./sidebars.js'), remarkPlugins: [require('mdx-mermaid')], editUrl: - 'https://github.com/alcionai/corso/tree/main/docs', + 'https://github.com/alcionai/corso/tree/main/website', }, blog: { showReadingTime: true, diff --git a/website/package-lock.json b/website/package-lock.json index ef0577fb2..0662eb756 100644 --- a/website/package-lock.json +++ b/website/package-lock.json @@ -26,7 +26,7 @@ "react-dom": "^17.0.2", "sass": "^1.57.1", "tw-elements": "^1.0.0-alpha13", - "wowjs": "^1.1.3" + "wow.js": "^1.2.2" }, "devDependencies": { "@docusaurus/module-type-aliases": "2.2.0", @@ -13220,9 +13220,9 @@ } }, "node_modules/ua-parser-js": { - "version": "0.7.32", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.32.tgz", - "integrity": "sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==", + "version": "0.7.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", + "integrity": "sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==", "funding": [ { "type": "opencollective", @@ -13233,7 +13233,6 @@ "url": "https://paypal.me/faisalman" } ], - "license": "MIT", "engines": { "node": "*" } @@ -14543,13 +14542,11 @@ "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==", "license": "MIT" }, - "node_modules/wowjs": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wowjs/-/wowjs-1.1.3.tgz", - "integrity": "sha512-HQp1gi56wYmjOYYOMZ08TnDGpT+AO21RJVa0t1NJ3jU8l3dMyP+sY7TO/lilzVp4JFjW88bBY87RnpxdpSKofA==", - "dependencies": { - "animate.css": "latest" - } + "node_modules/wow.js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/wow.js/-/wow.js-1.2.2.tgz", + "integrity": "sha512-YTW9eiZimHCJDWofsiz2507txaPteUiQD461I/D8533AiRAn3+Y68/1LDuQ3OTgPjagGZLPYKrpoSgjzeQrO6A==", + "deprecated": "deprecated in favour of aos (Animate On Scroll)" }, "node_modules/wrap-ansi": { "version": "8.0.1", @@ -23420,9 +23417,9 @@ "peer": true }, "ua-parser-js": { - "version": "0.7.32", - "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.32.tgz", - "integrity": "sha512-f9BESNVhzlhEFf2CHMSj40NWOjYPl1YKYbrvIr/hFTDEmLq7SRbWvm7FcdcpCYT95zrOhC7gZSxjdnnTpBcwVw==" + "version": "0.7.33", + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.33.tgz", + "integrity": "sha512-s8ax/CeZdK9R/56Sui0WM6y9OFREJarMRHqLB2EwkovemBxNQ+Bqu8GAsUnVcXKgphb++ghr/B2BZx4mahujPw==" }, "unherit": { "version": "1.1.3", @@ -24231,13 +24228,10 @@ "resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.0.tgz", "integrity": "sha512-JcKqAHLPxcdb9KM49dufGXn2x3ssnfjbcaQdLlfZsL9rH9wgDQjUtDxbo8NE0F6SFvydeu1VhZe7hZuHsB2/pw==" }, - "wowjs": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wowjs/-/wowjs-1.1.3.tgz", - "integrity": "sha512-HQp1gi56wYmjOYYOMZ08TnDGpT+AO21RJVa0t1NJ3jU8l3dMyP+sY7TO/lilzVp4JFjW88bBY87RnpxdpSKofA==", - "requires": { - "animate.css": "latest" - } + "wow.js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/wow.js/-/wow.js-1.2.2.tgz", + "integrity": "sha512-YTW9eiZimHCJDWofsiz2507txaPteUiQD461I/D8533AiRAn3+Y68/1LDuQ3OTgPjagGZLPYKrpoSgjzeQrO6A==" }, "wrap-ansi": { "version": "8.0.1", diff --git a/website/package.json b/website/package.json index 6c27fe784..0cb897b46 100644 --- a/website/package.json +++ b/website/package.json @@ -32,7 +32,7 @@ "react-dom": "^17.0.2", "sass": "^1.57.1", "tw-elements": "^1.0.0-alpha13", - "wowjs": "^1.1.3" + "wow.js": "^1.2.2" }, "devDependencies": { "@docusaurus/module-type-aliases": "2.2.0", diff --git a/website/src/components/parts/KeyLoveFAQ.js b/website/src/components/parts/KeyLoveFAQ.js index c07c35aba..fb13be58d 100644 --- a/website/src/components/parts/KeyLoveFAQ.js +++ b/website/src/components/parts/KeyLoveFAQ.js @@ -5,12 +5,12 @@ export default function KeyLoveFAQ() { const jarallaxRef = useRef(null); useEffect(() => { if (typeof window !== "undefined") { - const WOW = require("wowjs"); + const WOW = require("wow.js"); const father = require("feather-icons"); const jarallax = require("jarallax"); require("tw-elements"); - new WOW.WOW({ + new WOW({ live: false, }).init(); father.replace();