You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: push_handler.go
    path of file: ./repos/encore/runtimes/go/pubsub/internal/gcp
    
    the code of the file until where you have to start completion: package gcp

import (
	"encoding/json"
	"net/http"
	"strings"
	"time"

	"github.com/rs/zerolog"
	"google.golang.org/api/idtoken"

	"encore.dev/appruntime/exported/config"
	"encore.dev/beta/errs"
	"encore.dev/internal/platformauth"
	"encore.dev/pubsub/internal/types"
)

// This is documented in https://cloud.google.com/pubsub/docs/push
type pushPayload struct {
	Message struct {
		Attributes  map[string]string `json:"attributes"`
		Data        []byte            `json:"data"`
		MessageID   string            `json:"messageId"`
		PublishTime time.Time         `json:"publishTime"`
	} `json:"message"`
	Subscription    string `json:"subscription"`
	DeliveryAttempt int    `json:"deliveryAttempt,omitempty"` // F
    
func (mgr *Manager) registerPushEndpoint(logger *zerolog.Logger, subscriptionConfig *config.PubsubSubscription, f types.RawSubscriptionCallback) {
	handler := func(req *http.Request) error {
		// If the request has not come from the Encore platform it must have
		// a valid JWT set by Google.
		if !platformauth.IsEncorePlatformRequest(req.Context()) {
			if err := mgr.validateGoogleJWT(req, subscriptionConfig.GCP.PushServiceAccount); err != nil {
				return errs.Wrap(err, "unable to validate JWT")
			}
		}

		// Decode the payload
		payload := &pushPayload{}
		if err := json.NewDecoder(req.Body).Decode(payload); err != nil {
			return errs.WrapCode(err, errs.InvalidArgument, "invalid push payload")
		}

		// Call the subscription callback
		return f(
			req.Context(),
			payload.Message.MessageID, payload.Message.PublishTime, payload.DeliveryAttempt,
			payload.Message.Attributes, payload.Message.Data,
		)
	}

	mgr.pushRegistry.RegisterPushSubscriptionHandler(
		types.SubscriptionID(subscriptionConfig.ID),
		func(w http.ResponseWriter, request *http.Request) {
			err := handler(request)
			if err != nil {
				logger.Err(err).Msg("error while handling PubSub subscription message")
			}
			errs.HTTPError(w, err)
		},
	)
}