apns

package
v2.10.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2026 License: BSD-3-Clause Imports: 33 Imported by: 0

Documentation

Overview

Package apns owns mobile push device pairing, the relay outbox, and its HTTP routes.

Index

Constants

View Source
const (
	FeatureName = "mobile-push-v1"
)

Variables

This section is empty.

Functions

func RegisterApns

func RegisterApns(api huma.API, service *ApnsService)

Types

type ApnsHandler

type ApnsHandler struct {
	// contains filtered or unexported fields
}

func (*ApnsHandler) DeleteDevice

func (h *ApnsHandler) DeleteDevice(ctx context.Context, input *DeviceIDInput) (*handlerutil.Out[base.MessageResponse], error)

func (*ApnsHandler) PairingToken

func (h *ApnsHandler) PairingToken(ctx context.Context, _ *struct{}) (*handlerutil.Out[apnstypes.PairingToken], error)

func (*ApnsHandler) RegisterDevice

func (h *ApnsHandler) RegisterDevice(ctx context.Context, input *RegisterDeviceInput) (*handlerutil.Out[apnstypes.Device], error)

func (*ApnsHandler) Status

func (h *ApnsHandler) Status(ctx context.Context, _ *struct{}) (*handlerutil.Out[apnstypes.Status], error)

func (*ApnsHandler) TestDevice

func (*ApnsHandler) UpdateDevice

func (h *ApnsHandler) UpdateDevice(ctx context.Context, input *UpdateDeviceInput) (*handlerutil.Out[apnstypes.Device], error)

type ApnsService

type ApnsService struct {
	// contains filtered or unexported fields
}

func NewApnsService

func NewApnsService(db *database.DB, cfg *config.Config, settingsService *settings.SettingsService, roleService *role.RoleService, eventService *event.EventService, httpClient *http.Client) *ApnsService

func (*ApnsService) ApplyEnabledUpdates

func (s *ApnsService) ApplyEnabledUpdates(ctx context.Context, updates []libarcane.SettingUpdate, rescheduleOutbox func() error)

func (*ApnsService) DeleteDevice

func (s *ApnsService) DeleteDevice(ctx context.Context, userID, id string) error

func (*ApnsService) DrainOutbox

func (s *ApnsService) DrainOutbox(ctx context.Context)

func (*ApnsService) Enabled

func (s *ApnsService) Enabled(ctx context.Context) bool

func (*ApnsService) Enqueue

func (s *ApnsService) Enqueue(ctx context.Context, environmentID, environmentName string, eventType notifications.NotificationEventType, subject string, metadata database.JSON) error

func (*ApnsService) EnsureChannel

func (s *ApnsService) EnsureChannel(ctx context.Context) (string, error)

func (*ApnsService) IssuePairingToken

func (s *ApnsService) IssuePairingToken(ctx context.Context) (apnstypes.PairingToken, error)

func (*ApnsService) RegisterDevice

func (s *ApnsService) RegisterDevice(ctx context.Context, userID string, req apnstypes.RegisterDeviceRequest) (apnstypes.Device, error)

func (*ApnsService) RevokeChannel

func (s *ApnsService) RevokeChannel(ctx context.Context) error

func (*ApnsService) Status

func (s *ApnsService) Status(ctx context.Context, userID string) (apnstypes.Status, error)

func (*ApnsService) TestDevice

func (s *ApnsService) TestDevice(ctx context.Context, userID, id string) error

func (*ApnsService) UpdateDevice

func (s *ApnsService) UpdateDevice(ctx context.Context, userID, id string, req apnstypes.UpdateDeviceRequest) (apnstypes.Device, error)

type Device

type Device struct {
	database.BaseModel

	UserID         string               `json:"userId" gorm:"column:user_id;not null;index"`
	RecipientID    string               `json:"recipientId" gorm:"column:recipient_id;not null;uniqueIndex"`
	Label          string               `json:"label" gorm:"column:label;not null;default:''"`
	Events         map[string]bool      `json:"events" gorm:"column:events;serializer:json"`
	EnvironmentIDs database.StringSlice `json:"environmentIds" gorm:"column:environment_ids;type:text"`
	LastSeenAt     *time.Time           `json:"lastSeenAt,omitempty" gorm:"column:last_seen_at"`
}

func (Device) TableName

func (Device) TableName() string

type DeviceIDInput

type DeviceIDInput struct {
	ID string `path:"id" doc:"Device ID"`
}

type Module

type Module struct {
	// contains filtered or unexported fields
}

func New

func New(service *ApnsService) *Module

func (*Module) RegisterRoutes

func (m *Module) RegisterRoutes(api huma.API)

func (*Module) Service

func (m *Module) Service() *ApnsService

type OutboxEntry

type OutboxEntry struct {
	database.BaseModel

	EventID       string    `gorm:"column:event_id;not null"`
	Envelope      string    `gorm:"column:envelope;not null"`
	Attempts      int       `gorm:"column:attempts;not null;default:0"`
	NextAttemptAt time.Time `gorm:"column:next_attempt_at;not null;index"`
	LastError     *string   `gorm:"column:last_error"`
}

func (OutboxEntry) TableName

func (OutboxEntry) TableName() string

type RegisterDeviceInput

type RegisterDeviceInput struct {
	Body apnstypes.RegisterDeviceRequest
}

type UpdateDeviceInput

type UpdateDeviceInput struct {
	ID   string `path:"id" doc:"Device ID"`
	Body apnstypes.UpdateDeviceRequest
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL