Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
hiranya911 committed Sep 14, 2018
2 parents 10442ce + 255e5ed commit a291d33
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Unreleased

# v3.4.0

- [added] `firebase.App` now provides a new `DatabaseWithURL()` function
for initializing a database client from a URL.

# v3.3.0

- [fixed] Fixing a regression introduced in 3.2.0, where `VerifyIDToken()`
Expand Down
13 changes: 10 additions & 3 deletions firebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
var defaultAuthOverrides = make(map[string]interface{})

// Version of the Firebase Go Admin SDK.
const Version = "3.3.0"
const Version = "3.4.0"

// firebaseEnvName is the name of the environment variable with the Config.
const firebaseEnvName = "FIREBASE_CONFIG"
Expand Down Expand Up @@ -79,11 +79,18 @@ func (a *App) Auth(ctx context.Context) (*auth.Client, error) {
return auth.NewClient(ctx, conf)
}

// Database returns an instance of db.Client.
// Database returns an instance of db.Client to interact with the default Firebase Database
// configured via Config.DatabaseURL.
func (a *App) Database(ctx context.Context) (*db.Client, error) {
return a.DatabaseWithURL(ctx, a.dbURL)
}

// DatabaseWithURL returns an instance of db.Client to interact with the Firebase Database
// identified by the given URL.
func (a *App) DatabaseWithURL(ctx context.Context, url string) (*db.Client, error) {
conf := &internal.DatabaseConfig{
AuthOverride: a.authOverride,
URL: a.dbURL,
URL: url,
Opts: a.opts,
Version: Version,
}
Expand Down
4 changes: 4 additions & 0 deletions firebase_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ func TestDatabase(t *testing.T) {
if c, err := app.Database(ctx); c == nil || err != nil {
t.Errorf("Database() = (%v, %v); want (db, nil)", c, err)
}
url := "https://other-mock-db.firebaseio.com"
if c, err := app.DatabaseWithURL(ctx, url); c == nil || err != nil {
t.Errorf("Database() = (%v, %v); want (db, nil)", c, err)
}
}

func TestDatabaseAuthOverrides(t *testing.T) {
Expand Down
8 changes: 5 additions & 3 deletions iid/iid.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,12 @@ func NewClient(ctx context.Context, c *internal.InstanceIDConfig) (*Client, erro
}, nil
}

// DeleteInstanceID deletes an instance ID from Firebase.
// DeleteInstanceID deletes the specified instance ID and the associated data from Firebase..
//
// This can be used to delete an instance ID and associated user data from a Firebase project,
// pursuant to the General Data protection Regulation (GDPR).
// Note that Google Analytics for Firebase uses its own form of Instance ID to keep track of
// analytics data. Therefore deleting a regular instance ID does not delete Analytics data.
// See https://firebase.google.com/support/privacy/manage-iids#delete_an_instance_id for
// more information.
func (c *Client) DeleteInstanceID(ctx context.Context, iid string) error {
if iid == "" {
return errors.New("instance id must not be empty")
Expand Down

0 comments on commit a291d33

Please sign in to comment.