gogcli/internal/googleapi/cloudidentity.go
salmonumbrella f8b83e5609 feat(groups): add Google Groups commands and calendar team feature
- Add `gog groups list` to list groups user belongs to
- Add `gog groups members <email>` to list group members
- Add `gog calendar team <group-email>` for team calendar queries
- Support --freebusy flag for faster availability checks
- Parallel fetching with event deduplication
- Cloud Identity API client for non-admin group access
- Update README with new commands and examples

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 06:27:58 +01:00

25 lines
819 B
Go

package googleapi
import (
"context"
"fmt"
"google.golang.org/api/cloudidentity/v1"
)
const (
scopeCloudIdentityGroupsRO = "https://www.googleapis.com/auth/cloud-identity.groups.readonly"
)
// NewCloudIdentityGroups creates a Cloud Identity service for reading groups.
// This API allows non-admin users to list groups they belong to and view group members.
func NewCloudIdentityGroups(ctx context.Context, email string) (*cloudidentity.Service, error) {
if opts, err := optionsForAccountScopes(ctx, "cloudidentity", email, []string{scopeCloudIdentityGroupsRO}); err != nil {
return nil, fmt.Errorf("cloudidentity options: %w", err)
} else if svc, err := cloudidentity.NewService(ctx, opts...); err != nil {
return nil, fmt.Errorf("create cloudidentity service: %w", err)
} else {
return svc, nil
}
}