From cf543ff66281bbc7da99d0d5f9ea67d96b42099b Mon Sep 17 00:00:00 2001 From: Hiranya Jayathilaka Date: Mon, 12 Feb 2018 18:17:54 -0800 Subject: [PATCH] Firebase Cloud Messaging API (#81) * Adding Firebase Cloud Messaging (#62) * initial commit for adding Firebase Cloud Messaging * add validator * use http const in messaging test * add client version header for stats * init integration test * add integration test (validated on IOS today) * add comment with URL to enable Firebase Cloud Messaging API * fix broken test * add integration tests * accept a Message instead of RequestMessage + and rename method + send / sendDryRun * update fcm url * rollback url endpoint * fix http constants, change responseMessage visibility, change map[string]interface{} as map[string]string * fix http constants * fix integration tests * fix APNS naming * add validators * Added APNS types; Updated tests * Added more tests; Fixed APNS serialization * Updated documentation * Improved error handling inFCM * Added utils file * Updated integration tests * Implemented topic management operations * Added integration tests * Updated CHANGELOG * Addressing code review comments * Supporting 0 valued Aps.Badge * Addressing some review comments * Removed some unused vars * Accepting prefixed topic names (#84) * Accepting prefixed topic named * Added a comment * Using new FCM error codes (#89) --- CHANGELOG.md | 15 +++++++++++++++ internal/internal.go | 7 +++++++ 2 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3115bec6..93ebcb0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,21 @@ ### Authentication +- [added] A new [`VerifyIDTokenAndCheckRevoked()`](https://godoc.org/firebase.google.com/go/auth#Client.VerifyIDToken) + function has been added to check for revoked ID tokens. +- [added] A new [`RevokeRefreshTokens()`](https://godoc.org/firebase.google.com/go/auth#Client.RevokeRefreshTokens) + function has been added to invalidate all refresh tokens issued to a user. +- [added] A new property `TokensValidAfterMillis` has been added to the + ['UserRecord'](https://godoc.org/firebase.google.com/go/auth#UserRecord) + type, which stores the time of the revocation truncated to 1 second accuracy. + +### Cloud Messaging + +- [feature] Added the `messaging` package for sending Firebase notifications + and managing topic subscriptions. + +### Authentication + - [added] A new [`VerifyIDTokenAndCheckRevoked()`](https://godoc.org/firebase.google.com/go/auth#Client.VerifyIDToken) function has been added to check for revoked ID tokens. - [added] A new [`RevokeRefreshTokens()`](https://godoc.org/firebase.google.com/go/auth#Client.RevokeRefreshTokens) diff --git a/internal/internal.go b/internal/internal.go index 20afef60..5612da69 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -102,6 +102,13 @@ type MockTokenSource struct { AccessToken string } +// MessagingConfig represents the configuration of Firebase Cloud Messaging service. +type MessagingConfig struct { + Opts []option.ClientOption + ProjectID string + Version string +} + // Token returns the test token associated with the TokenSource. func (ts *MockTokenSource) Token() (*oauth2.Token, error) { return &oauth2.Token{AccessToken: ts.AccessToken}, nil