Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Delivery ¶
type Delivery interface { CanDeliver(req SendRequest) bool Send(ctx context.Context, req SendRequest) error }
Pluggable interface for sending push notifications
type DeliveryMechanism ¶
type DeliveryMechanism struct { Kind DeliveryMechanismKind `json:"kind"` Token string `json:"token"` UpdatedAt time.Time `json:"-"` }
type DeliveryMechanismKind ¶
type DeliveryMechanismKind string
const ( APNS DeliveryMechanismKind = "apns" FCM DeliveryMechanismKind = "fcm" )
type HmacUpdates ¶
type Installation ¶
type Installation struct { Id string `json:"id"` DeliveryMechanism DeliveryMechanism `json:"delivery_mechanism"` }
* An installation represents an app installed on a device. If the app is reinstalled, or installed onto a new device it is expected to generate a fresh installation_id.
type Installations ¶
type Installations interface { Register(ctx context.Context, installation Installation) (*RegisterResponse, error) Delete(ctx context.Context, installationId string) error GetInstallations(ctx context.Context, installationIds []string) ([]Installation, error) }
Pluggable Installation Service interface
type MessageContext ¶
type MessageContext struct { MessageType topics.MessageType `json:"message_type"` ShouldPush *bool `json:"should_push,omitempty"` HmacInputs *[]byte `json:"-"` SenderHmac *[]byte `json:"-"` }
func (MessageContext) IsSender ¶
func (m MessageContext) IsSender(hmacKey []byte) bool
type RegisterResponse ¶
type SendRequest ¶
type SendRequest struct { IdempotencyKey string `json:"idempotency_key"` Message *v1.Envelope `json:"message"` MessageContext MessageContext `json:"message_context"` Installation Installation `json:"installation"` Subscription Subscription `json:"subscription"` }
type Subscription ¶
type SubscriptionInput ¶
type Subscriptions ¶
type Subscriptions interface { Subscribe(ctx context.Context, installationId string, topics []string) error Unsubscribe(ctx context.Context, installationId string, topics []string) error GetSubscriptions(ctx context.Context, topic string, thirtyDayPeriod int) ([]Subscription, error) SubscribeWithMetadata(ctx context.Context, installationId string, subscriptions []SubscriptionInput) error }
This interface is not expected to be pluggable
Click to show internal directories.
Click to hide internal directories.