This repository has been archived by the owner on Oct 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
GC: Beta Client Package #2205
Merged
Merged
GC: Beta Client Package #2205
Changes from all commits
Commits
Show all changes
105 commits
Select commit
Hold shift + click to select a range
58ad917
Beta packages updated.
dadams39 0a111cd
Updates to the change log to address build times.
dadams39 a9421d7
Beta Servicer created.
dadams39 287dcd6
Testing for new struct added.
dadams39 39155c6
Updates to msgraph-sdk-go to comply with abstraction changes brought in
dadams39 6b1e847
Merge branch 'main' into beta-page-connector
dadams39 29bb06e
Updates to ci.yml
dadams39 4c000c8
Adjust to swap space.
dadams39 0cf21f6
Incremental increase of swap space.
dadams39 d661d45
Update ci.yml
0802e97
Update ci.yml
613de30
Updates to error response. Test to verify time for cache.
dadams39 7ef73b8
Update for Beta Connector.
dadams39 97ca692
Change to msgraph-sdk-beta.
dadams39 519a449
Update /connector/discovery package
dadams39 b82a634
Update /connector/exchange/api package
dadams39 4952b81
Update /connector/graph package
dadams39 3ccdda8
Update /connector/mockconnector package
dadams39 135c07a
Update /connector/exchange package
dadams39 7404c4c
Update /connector/onedrive package
dadams39 2929c9f
Update /connector/sharepoint package
dadams39 4687b13
Update /connector/support package
dadams39 4009a5c
Update /connector/ package
dadams39 77c3b3b
Update /internal/operations package
dadams39 9b30a03
File added in error.
dadams39 b4eae74
Update to /pkg/services/m365/m365.go
dadams39 2cd64c4
Updates to internal/connector/graph_connector_helper_test.go
dadams39 2f125d4
Merge branch 'main' into beta-library-switch
dadams39 f425d24
Update support library to beta.
dadams39 c0112d9
Revert back to original ci.yml.
dadams39 898191f
Removal of whitespace.
dadams39 f44607c
Additonal swap space required for CI compilation.
dadams39 ec87d58
Merge branch 'main' into beta-library-switch
dadams39 2fc8b36
Update to go.mod & go.sum
dadams39 63d2d7f
/connector/graph package reverted back from beta packages.
dadams39 10c605d
Updates to /connector/onedrive package
dadams39 a22803e
Updates ../connector/exchange/api package update
dadams39 2f9f61b
Updates to /connector/graph/cache_container.go
dadams39 4853d6c
Updates to /connector/support package.
dadams39 c221d38
Update to /connector/mockconnector/mock_data_list.go
dadams39 702ec7f
Updates to /connector/exchange package
dadams39 a090bed
Update to /mockconnector/mock_data_collection_test.go
dadams39 ea70fa6
Updates to /connector/sharepoint package
dadams39 2a93dc9
Updates to graph_connector component and helper_test files.
dadams39 5368cd3
Issue #2174: Adds Beta Client to package from generator.
dadams39 988962c
Adds admin file. Temp.
dadams39 2d73ed3
Adds group package temporarily.
dadams39 c3fd313
Adds betaSDK/sites package. Temp
dadams39 66e5609
Adds Kiota-lock.json to betaSDK package.
dadams39 ae69293
Updates kiota-lock.json: Removal of backing store.
dadams39 e937137
Updates beta_client..go
dadams39 1d13f7d
Updates betaSDK/groups package
dadams39 50da437
Updates package name for betasdk package.
dadams39 e51f654
Delete /betaSDK/sites package.
dadams39 b13f5b6
Update shuffle.
dadams39 b1f7ab5
beta_client beta client formatting.
dadams39 0a1e0d2
Package configuration.
dadams39 f5d5144
Inflate admin package.
dadams39 b27ce3d
Inflate Models package.
dadams39 9a6d58b
Inflate admin package.
dadams39 1acc6b9
Hydrate sites package.
dadams39 a51b6e8
Kiota library mismatch from preview.
dadams39 b411862
Kiota library mismatch from preview.
dadams39 9a0dd67
Kiota library mismatch from preview.
dadams39 76cc593
Go.mod: Update to libraries.
dadams39 4fdd165
Hydrate model directory.
dadams39 d2fb427
Hydrate sites command directory.
dadams39 740c8dc
Updates to /graph/betasdk/beta_client.go
dadams39 42a9499
Add file to /graph/betasdk/kiota-lock.json
dadams39 918fd83
Updates library to use betasdk package.
dadams39 dc09508
Updates to /pkg/services/m365 package
dadams39 9bbb479
Changes to /connector/discovery/api/users_test.go
dadams39 9dc487b
Test file created.
dadams39 8f22c4f
Non-Page files removed.
dadams39 f33167d
Updates to .github/workflows/ci.yml
dadams39 a31fe59
Update go.mod
dadams39 775f5ce
Updates to /connector/graph/betasdk/sites
dadams39 3e4fae6
Removal of odataerrors withing betasdk.
dadams39 2f02efe
Reduction to /graph/betasdk/models/package
dadams39 aca2eb5
Updates to betasdk/sites package
dadams39 bcd379f
Updates to betasdk/sites package
dadams39 68f7ac9
Updates to the .yml for additional space.
dadams39 4e3f15f
Update ci.yml
263197b
Updates to /betasdk/sites/ for GOFMT:
dadams39 28ddbca
Merge branch 'beta-library-switch' of github.com:alcionai/corso into …
dadams39 7bc0803
Update to exclude betasdk from linting.
dadams39 03ec1dd
Updates to remove beta library from operations/backup_integration_tes…
dadams39 b7b2de0
Revert back to msgraph-sdk-go package for /connector/graph/errors.go
dadams39 8a474af
Revert back to msgraph-sdk-go library for /support/errors.go
dadams39 05c3216
Removal of beta library package from system.
dadams39 2839d8d
ci.yml --> remove swap space.
dadams39 817a7a2
UPdates to /graph/betasdk/sites package
dadams39 f8d65d6
Updates to /graph/betasdk/beta_client.go
dadams39 b3aec1b
Updates /graph/beasdk/beta_service_test.go
dadams39 57ce0be
Merge branch 'main' into beta-library-switch
db9a91f
Updates to /betasdk/sites/kiota-lock.json
dadams39 d7e077a
Merge branch 'beta-library-switch' of github.com:alcionai/corso into …
dadams39 2133cc4
Update to /graph/betasdk/kiota-lock.json
dadams39 447ae1f
Updates to /graph/betasdk/kiota-lock.json
dadams39 3228bfb
Updates to /graph/betasdk/beta_client.go
dadams39 eab0edb
Merge branch 'main' into beta-library-switch
dadams39 c944fc5
Update to CHANGELOG.md
cd51aae
Update CHANGELOG.md
ef750ba
Merge branch 'main' into beta-library-switch
dadams39 ab08e89
Merge branch 'main' into beta-library-switch
aviator-app[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the ID in this case? Also, the name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Kiota naming conventions favor plural notation when generated. We have implemented this code in other areas: gc.Service.Client().UsersById()
gc.Service.Client().UsersById().MessagesById() |
||
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) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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/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()) | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this get moved to
connector/discovery
? That's where we're currently housing the api layer for resource owners.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. All of the objects within the current
betasdk
layer are auto-generated. Within #2298, it is possible to add custom information there specifically to thebeta_service.go
file. As this file will be propagated for testing in the future.