Documentation
¶
Overview ¶
Package apns owns mobile push device pairing, the relay outbox, and its HTTP routes.
Index ¶
- Constants
- func RegisterApns(api huma.API, service *ApnsService)
- type ApnsHandler
- func (h *ApnsHandler) DeleteDevice(ctx context.Context, input *DeviceIDInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ApnsHandler) PairingToken(ctx context.Context, _ *struct{}) (*handlerutil.Out[apnstypes.PairingToken], error)
- func (h *ApnsHandler) RegisterDevice(ctx context.Context, input *RegisterDeviceInput) (*handlerutil.Out[apnstypes.Device], error)
- func (h *ApnsHandler) Status(ctx context.Context, _ *struct{}) (*handlerutil.Out[apnstypes.Status], error)
- func (h *ApnsHandler) TestDevice(ctx context.Context, input *DeviceIDInput) (*handlerutil.Out[base.MessageResponse], error)
- func (h *ApnsHandler) UpdateDevice(ctx context.Context, input *UpdateDeviceInput) (*handlerutil.Out[apnstypes.Device], error)
- type ApnsService
- func (s *ApnsService) ApplyEnabledUpdates(ctx context.Context, updates []libarcane.SettingUpdate, ...)
- func (s *ApnsService) DeleteDevice(ctx context.Context, userID, id string) error
- func (s *ApnsService) DrainOutbox(ctx context.Context)
- func (s *ApnsService) Enabled(ctx context.Context) bool
- func (s *ApnsService) Enqueue(ctx context.Context, environmentID, environmentName string, ...) error
- func (s *ApnsService) EnsureChannel(ctx context.Context) (string, error)
- func (s *ApnsService) IssuePairingToken(ctx context.Context) (apnstypes.PairingToken, error)
- func (s *ApnsService) RegisterDevice(ctx context.Context, userID string, req apnstypes.RegisterDeviceRequest) (apnstypes.Device, error)
- func (s *ApnsService) RevokeChannel(ctx context.Context) error
- func (s *ApnsService) Status(ctx context.Context, userID string) (apnstypes.Status, error)
- func (s *ApnsService) TestDevice(ctx context.Context, userID, id string) error
- func (s *ApnsService) UpdateDevice(ctx context.Context, userID, id string, req apnstypes.UpdateDeviceRequest) (apnstypes.Device, error)
- type Device
- type DeviceIDInput
- type Module
- type OutboxEntry
- type RegisterDeviceInput
- type UpdateDeviceInput
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 (h *ApnsHandler) TestDevice(ctx context.Context, input *DeviceIDInput) (*handlerutil.Out[base.MessageResponse], error)
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) 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) 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"`
}
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 (*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
}
Click to show internal directories.
Click to hide internal directories.