<!-- PR description--> Wires `IsServiceEnabled` code into `UserHasMailbox`, `UserHasDrive`, and `UserGetMailboxInfo` SDK APIs. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change <!--- Please check the type of change your PR introduces: ---> - [ ] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [x] 🧹 Tech Debt/Cleanup #### Issue(s) <!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. --> * https://github.com/alcionai/corso/issues/3844 #### Test Plan <!-- How will this be tested prior to merging.--> - [ ] 💪 Manual - [x] ⚡ Unit test - [x] 💚 E2E
46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package m365
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/alcionai/clues"
|
|
|
|
"github.com/alcionai/corso/src/pkg/account"
|
|
"github.com/alcionai/corso/src/pkg/control"
|
|
"github.com/alcionai/corso/src/pkg/fault"
|
|
"github.com/alcionai/corso/src/pkg/path"
|
|
"github.com/alcionai/corso/src/pkg/services/m365/api"
|
|
)
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// interfaces & structs
|
|
// ---------------------------------------------------------------------------
|
|
|
|
type getAller[T any] interface {
|
|
GetAll(ctx context.Context, errs *fault.Bus) ([]T, error)
|
|
}
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// helpers
|
|
// ---------------------------------------------------------------------------
|
|
|
|
func makeAC(
|
|
ctx context.Context,
|
|
acct account.Account,
|
|
pst path.ServiceType,
|
|
) (api.Client, error) {
|
|
api.InitConcurrencyLimit(ctx, pst)
|
|
|
|
creds, err := acct.M365Config()
|
|
if err != nil {
|
|
return api.Client{}, clues.Wrap(err, "getting m365 account creds")
|
|
}
|
|
|
|
cli, err := api.NewClient(creds, control.DefaultOptions())
|
|
if err != nil {
|
|
return api.Client{}, clues.Wrap(err, "constructing api client")
|
|
}
|
|
|
|
return cli, nil
|
|
}
|