notificationpreferenceep

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ListNotificationPreferencesEndpoint

type ListNotificationPreferencesEndpoint struct{}

Lists the current user's notification preferences for the account they are acting in: their global default plus any per-category overrides.

Only preferences the user has explicitly set are returned, so an empty list means everything falls back to the standard behavior — in-app notifications on, email and push off.

type ListNotificationPreferencesRequest

type ListNotificationPreferencesRequest struct{}

Request to list the caller's notification preferences.

type NotificationPreferenceSvc

type NotificationPreferenceSvc interface {
	ListNotificationPreferences(ctx context.Context, req *ListNotificationPreferencesRequest) (*apiresource.List[apiresource.NotificationPreference], *apierror.APIError)
	UpsertNotificationPreference(ctx context.Context, req *UpsertNotificationPreferenceRequest) (*apiresource.NotificationPreference, *apierror.APIError)
}

NotificationPreferenceSvc backs the notification-preference endpoints via the notification-service MessagingService gRPC client.

type NotificationPreferenceSvcConfig

type NotificationPreferenceSvcConfig struct {
	// MessagingClient (required) is the notification-service MessagingService gRPC client.
	MessagingClient pb.MessagingServiceClient
}

type UpsertNotificationPreferenceEndpoint

type UpsertNotificationPreferenceEndpoint struct{}

Creates or replaces one of the current user's notification preferences, either their global default or the override for a single category.

The preference applies only to the account being acted in, and the category must be one the platform recognizes. Callers without a user membership in that account cannot hold preferences and are refused.

type UpsertNotificationPreferenceRequest

type UpsertNotificationPreferenceRequest struct {
	// The notification category these settings apply to, such as `chat.message`.
	//
	// Leave it out to set the global default used for every category without its own preference.
	Category field.Clearable[string] `json:"category,omitzero"`
	// Whether notifications in this category appear in the user's in-app feed.
	//
	// A direct @mention is always delivered in-app, even when this is off.
	InAppEnabled bool `json:"in_app_enabled"`
	// Whether notifications in this category are also emailed to the user.
	//
	// Email is additionally suppressed for a conversation the user has muted, and only sent on the cadence set by `digest`.
	EmailEnabled bool `json:"email_enabled"`
	// Whether notifications in this category are also sent as push notifications.
	//
	// Push delivery is not available yet; the choice is stored for when it is.
	PushEnabled bool `json:"push_enabled"`
	// How often email for this category is sent.
	//
	// - `instant`: send an email as soon as an eligible notification occurs.
	// - `hourly`: collect eligible notifications into a single hourly email.
	// - `daily`: collect eligible notifications into a single daily email.
	// - `off`: never send email for this category, even when email is otherwise enabled.
	//
	// This governs email only; in-app delivery is unaffected. Batched sending is not running yet, so `hourly` and `daily` currently hold email back in the same way as `off`.
	Digest field.Optional[constants.NotificationDigest] `json:"digest,omitzero" default:"instant"`
}

Request to create or replace one of the caller's notification preferences.

A user has at most one preference per category, so sending the same category again replaces the previous settings outright — every channel is written from this request, not merged with what was there before.

Chat notifications are the only ones these settings currently govern: notifications in every other category reach the in-app feed and are never emailed, whatever is stored here.

func (*UpsertNotificationPreferenceRequest) SchemaExample

func (*UpsertNotificationPreferenceRequest) SchemaExample() any

Jump to

Keyboard shortcuts

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