ArchAstro.V1.NotificationPreferences (archastro v0.2.0)

Copy Markdown

NotificationPreference API resource.

Summary

Functions

List notification preferences

Delete a notification preference

Create or update a notification preference

Functions

list(client)

List notification preferences

Returns all explicit notification preferences belonging to the authenticated user. Preferences are returned for every (type, channel) combination the user has explicitly configured; slots that have not been overridden are not included and fall back to the type's defaults.

The recipient is derived from the authenticated viewer. You cannot retrieve preferences for any other user through this endpoint. All configured preferences — system-level and app-scoped — are returned together in the data array.

An object with a data array containing all explicit notification preferences for the authenticated user.

remove(client)

@spec remove(ArchAstro.Client.t()) :: {:ok, :ok} | {:error, ArchAstro.Error.reason()}

Delete a notification preference

Removes the authenticated user's explicit notification preference for a given (type, channel) combination, reverting that slot to the type's default channel set.

The app_id param scopes the deletion to a specific app's preference row. Omit app_id to target the system-level (no-app) slot. Because the two slots are stored independently, omitting app_id will not match a row that has one set, and vice versa.

Returns 204 No Content on success. Returns 404 if no preference exists for the given composite key.

Empty response body. A 204 No Content status indicates the preference was deleted successfully.

replace(client, input)

Create or update a notification preference

Creates or replaces the authenticated user's notification preference for a given (type, channel) combination. This is an idempotent PUT: if no preference exists for the composite key, a new row is created; if one already exists, its enabled flag is updated to the value you provide.

The recipient is derived from the authenticated viewer. You cannot set preferences for another user through this endpoint.

Pass app_id to scope the preference to a specific app's notifications — most useful for the app_* notification type family. Omit app_id to configure the system-level (no-app) slot. System-level and app-scoped preferences are stored independently and do not overwrite each other.

The in_app channel is not configurable and will be rejected with a validation error if supplied.

The created or updated notification preference reflecting the new enabled state.