diff --git a/src/internal/connector/graph/cache_container.go b/src/internal/connector/graph/cache_container.go index e792c235e..989698235 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-sdk-go/models" + "github.com/microsoftgraph/msgraph-beta-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 86cec64bd..85ae0c874 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-sdk-go/models/odataerrors" + "github.com/microsoftgraph/msgraph-beta-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 02ac7eb1e..58a86317a 100644 --- a/src/internal/connector/graph/service.go +++ b/src/internal/connector/graph/service.go @@ -4,8 +4,7 @@ import ( "context" absser "github.com/microsoft/kiota-abstractions-go/serialization" - beta "github.com/microsoftgraph/msgraph-beta-sdk-go" - msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" + msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" "github.com/pkg/errors" "github.com/alcionai/corso/src/pkg/account" @@ -46,28 +45,6 @@ func (s Service) Client() *msgraphsdk.GraphServiceClient { return s.client } -// BetaService provides access to API Calls that are present solely in the Beta library. -// Does not fulfill the interface as the base libraries vary. -type BetaService struct { - adapter *beta.GraphRequestAdapter - client *beta.GraphBaseServiceClient -} - -func (bs BetaService) Adapter() *beta.GraphRequestAdapter { - return bs.adapter -} - -func (bs BetaService) Client() *beta.GraphBaseServiceClient { - return bs.client -} - -func NewBetaService(adapter *beta.GraphRequestAdapter) *BetaService { - return &BetaService{ - adapter: adapter, - client: beta.NewGraphBaseServiceClient(adapter), - } -} - // 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) { diff --git a/src/internal/connector/graph/service_helper.go b/src/internal/connector/graph/service_helper.go index 5d680c7f8..b55821b78 100644 --- a/src/internal/connector/graph/service_helper.go +++ b/src/internal/connector/graph/service_helper.go @@ -10,8 +10,7 @@ import ( 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" - beta "github.com/microsoftgraph/msgraph-beta-sdk-go" - msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go" + msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go" msgraphgocore "github.com/microsoftgraph/msgraph-sdk-go-core" "github.com/pkg/errors" @@ -47,28 +46,6 @@ func CreateAdapter(tenant, client, secret string) (*msgraphsdk.GraphRequestAdapt auth, nil, nil, httpClient) } -// CreateBetaAdapter uses the provided credentials with the Kiota Azure Libraries. -// Used to access msgraph-beta-sdk-go specific functionality -func CreateBetaAdapter(tenant, client, secret string) (*beta.GraphRequestAdapter, error) { - cred, err := az.NewClientSecretCredential(tenant, client, secret, nil) - if err != nil { - return nil, errors.Wrap(err, "creating beta m365 client credentials") - } - - auth, err := ka.NewAzureIdentityAuthenticationProviderWithScopes( - cred, - []string{"https://graph.microsoft.com/.default"}, - ) - if err != nil { - return nil, errors.Wrap(err, "creating beta auth token") - } - - httpClient := CreateHTTPClient() - - return beta.NewGraphRequestAdapterWithParseNodeFactoryAndSerializationWriterFactoryAndHttpClient( - auth, nil, nil, httpClient) -} - // CreateHTTPClient creates the httpClient with middlewares and timeout configured func CreateHTTPClient() *http.Client { clientOptions := msgraphsdk.GetDefaultClientOptions() diff --git a/src/internal/connector/graph/service_test.go b/src/internal/connector/graph/service_test.go index c6938a7e3..32e900433 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-sdk-go/models" + "github.com/microsoftgraph/msgraph-beta-sdk-go/models" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" @@ -43,21 +43,6 @@ func (suite *GraphUnitSuite) TestCreateAdapter() { assert.NotNil(t, adpt) } -func (suite *GraphUnitSuite) TestBetaService() { - t := suite.T() - adpt, err := graph.CreateBetaAdapter( - suite.credentials.AzureTenantID, - suite.credentials.AzureClientID, - suite.credentials.AzureClientSecret, - ) - - assert.NoError(t, err) - require.NotNil(t, adpt) - - serv := graph.NewBetaService(adpt) - assert.NotNil(t, serv) -} - func (suite *GraphUnitSuite) TestSerializationEndPoint() { t := suite.T() adpt, err := graph.CreateAdapter(