Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add project management API #616

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions firebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import (
"firebase.google.com/go/v4/iid"
"firebase.google.com/go/v4/internal"
"firebase.google.com/go/v4/messaging"
"firebase.google.com/go/v4/projectmanagement"
"firebase.google.com/go/v4/storage"
"google.golang.org/api/option"
"google.golang.org/api/transport"
Expand Down Expand Up @@ -137,6 +138,15 @@ func (a *App) AppCheck(ctx context.Context) (*appcheck.Client, error) {
return appcheck.NewClient(ctx, conf)
}

// ProjectManagement returns an instance of projects.Client.
func (a *App) ProjectManagement(ctx context.Context) (*projectmanagement.Client, error) {
conf := &internal.ProjectManagementConfig{
ProjectID: a.projectID,
Opts: a.opts,
}
return projectmanagement.NewClient(ctx, conf)
}

// NewApp creates a new App from the provided config and client options.
//
// If the client options contain a valid credential (a service account file, a refresh token
Expand Down
6 changes: 6 additions & 0 deletions internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ type AppCheckConfig struct {
ProjectID string
}

// ProjectManagementConfig represents the configuration of Firebase Management service.
type ProjectManagementConfig struct {
Opts []option.ClientOption
ProjectID string
}

// MockTokenSource is a TokenSource implementation that can be used for testing.
type MockTokenSource struct {
AccessToken string
Expand Down
Loading