Keepers 5362137116
expose graph options to sdk clients (#4653)
1. moves the m365/graph package from internal to pkg/services/api so that options are accessible to sdk users.
2. exposes graph.Options in the api client.Service call.

---

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🌻 Feature
2023-11-10 19:26:59 +00:00

33 lines
656 B
Go

package sharepoint
import (
"context"
"github.com/alcionai/clues"
"github.com/microsoftgraph/msgraph-sdk-go/models"
"github.com/alcionai/corso/src/pkg/services/m365/api"
"github.com/alcionai/corso/src/pkg/services/m365/api/graph"
)
type getSiteRooter interface {
GetRoot(ctx context.Context, cc api.CallConfig) (models.Siteable, error)
}
func IsServiceEnabled(
ctx context.Context,
gsr getSiteRooter,
resource string,
) (bool, error) {
_, err := gsr.GetRoot(ctx, api.CallConfig{})
if err != nil {
if clues.HasLabel(err, graph.LabelsNoSharePointLicense) {
return false, nil
}
return false, clues.Stack(err)
}
return true, nil
}