archastro.platform.v1.resources.notification_preferences

  1# Copyright (c) 2026 ArchAstro Inc. All Rights Reserved.
  2# This file is auto-generated by @archastro/sdk-generator. Do not edit.
  3# Content hash: 5bcb1ed4773e
  4
  5from __future__ import annotations
  6
  7from typing import Required, TypedDict
  8
  9from ...runtime.http_client import HttpClient, SyncHttpClient
 10from ...types.notifications import NotificationPreference, NotificationPreferenceList
 11
 12
 13class NotificationPreferenceReplaceInput(TypedDict, total=False):
 14    "Create or update a notification preference"
 15
 16    app_id: str | None
 17    "App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other."
 18    channel: Required[str]
 19    'Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.'
 20    enabled: Required[bool]
 21    "Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel."
 22    type: Required[str]
 23    'Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app\'s bundle. Unknown type identifiers are rejected with a validation error.'
 24
 25
 26class AsyncNotificationPreferenceResource:
 27    def __init__(self, http: HttpClient):
 28        self._http = http
 29
 30    async def remove(self) -> None:
 31        """
 32        Delete a notification preference
 33        Removes the authenticated user's explicit notification preference for a
 34        given `(type, channel)` combination, reverting that slot to the type's
 35        default channel set.
 36        The `app_id` param scopes the deletion to a specific app's preference
 37        row. Omit `app_id` to target the system-level (no-app) slot. Because
 38        the two slots are stored independently, omitting `app_id` will not
 39        match a row that has one set, and vice versa.
 40        Returns `204 No Content` on success. Returns `404` if no preference
 41        exists for the given composite key.
 42
 43        Returns:
 44            Empty response body. A `204 No Content` status indicates the preference was deleted successfully.
 45        """
 46        await self._http.request("/api/v1/notification_preferences", method="DELETE")
 47
 48    async def list(self) -> NotificationPreferenceList:
 49        """
 50        List notification preferences
 51        Returns all explicit notification preferences belonging to the authenticated
 52        user. Preferences are returned for every `(type, channel)` combination the
 53        user has explicitly configured; slots that have not been overridden are not
 54        included and fall back to the type's defaults.
 55        The recipient is derived from the authenticated viewer. You cannot retrieve
 56        preferences for any other user through this endpoint. All configured
 57        preferences system-level and app-scoped are returned together in the
 58        `data` array.
 59
 60        Returns:
 61            An object with a `data` array containing all explicit notification preferences for the authenticated user.
 62        """
 63        return await self._http.request(
 64            "/api/v1/notification_preferences",
 65            response_type=NotificationPreferenceList,
 66        )
 67
 68    async def replace(self, input: NotificationPreferenceReplaceInput) -> NotificationPreference:
 69        """
 70        Create or update a notification preference
 71        Creates or replaces the authenticated user's notification preference for a
 72        given `(type, channel)` combination. This is an idempotent PUT: if no
 73        preference exists for the composite key, a new row is created; if one
 74        already exists, its `enabled` flag is updated to the value you provide.
 75        The recipient is derived from the authenticated viewer. You cannot set
 76        preferences for another user through this endpoint.
 77        Pass `app_id` to scope the preference to a specific app's notifications
 78        most useful for the `app_*` notification type family. Omit `app_id` to
 79        configure the system-level (no-app) slot. System-level and app-scoped
 80        preferences are stored independently and do not overwrite each other.
 81        The `in_app` channel is not configurable and will be rejected with a
 82        validation error if supplied.
 83
 84        Args:
 85            input: Request body.
 86            input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
 87            input.channel: Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.
 88            input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel.
 89            input.type: Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
 90
 91        Returns:
 92            The created or updated notification preference reflecting the new `enabled` state.
 93        """
 94        return await self._http.request(
 95            "/api/v1/notification_preferences",
 96            method="PUT",
 97            body=input,
 98            response_type=NotificationPreference,
 99        )
100
101
102class NotificationPreferenceResource:
103    def __init__(self, http: SyncHttpClient):
104        self._http = http
105
106    def remove(self) -> None:
107        """
108        Delete a notification preference
109        Removes the authenticated user's explicit notification preference for a
110        given `(type, channel)` combination, reverting that slot to the type's
111        default channel set.
112        The `app_id` param scopes the deletion to a specific app's preference
113        row. Omit `app_id` to target the system-level (no-app) slot. Because
114        the two slots are stored independently, omitting `app_id` will not
115        match a row that has one set, and vice versa.
116        Returns `204 No Content` on success. Returns `404` if no preference
117        exists for the given composite key.
118
119        Returns:
120            Empty response body. A `204 No Content` status indicates the preference was deleted successfully.
121        """
122        self._http.request("/api/v1/notification_preferences", method="DELETE")
123
124    def list(self) -> NotificationPreferenceList:
125        """
126        List notification preferences
127        Returns all explicit notification preferences belonging to the authenticated
128        user. Preferences are returned for every `(type, channel)` combination the
129        user has explicitly configured; slots that have not been overridden are not
130        included and fall back to the type's defaults.
131        The recipient is derived from the authenticated viewer. You cannot retrieve
132        preferences for any other user through this endpoint. All configured
133        preferences system-level and app-scoped are returned together in the
134        `data` array.
135
136        Returns:
137            An object with a `data` array containing all explicit notification preferences for the authenticated user.
138        """
139        return self._http.request(
140            "/api/v1/notification_preferences",
141            response_type=NotificationPreferenceList,
142        )
143
144    def replace(self, input: NotificationPreferenceReplaceInput) -> NotificationPreference:
145        """
146        Create or update a notification preference
147        Creates or replaces the authenticated user's notification preference for a
148        given `(type, channel)` combination. This is an idempotent PUT: if no
149        preference exists for the composite key, a new row is created; if one
150        already exists, its `enabled` flag is updated to the value you provide.
151        The recipient is derived from the authenticated viewer. You cannot set
152        preferences for another user through this endpoint.
153        Pass `app_id` to scope the preference to a specific app's notifications
154        most useful for the `app_*` notification type family. Omit `app_id` to
155        configure the system-level (no-app) slot. System-level and app-scoped
156        preferences are stored independently and do not overwrite each other.
157        The `in_app` channel is not configurable and will be rejected with a
158        validation error if supplied.
159
160        Args:
161            input: Request body.
162            input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
163            input.channel: Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.
164            input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel.
165            input.type: Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
166
167        Returns:
168            The created or updated notification preference reflecting the new `enabled` state.
169        """
170        return self._http.request(
171            "/api/v1/notification_preferences",
172            method="PUT",
173            body=input,
174            response_type=NotificationPreference,
175        )
class NotificationPreferenceReplaceInput(typing.TypedDict):
14class NotificationPreferenceReplaceInput(TypedDict, total=False):
15    "Create or update a notification preference"
16
17    app_id: str | None
18    "App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other."
19    channel: Required[str]
20    'Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.'
21    enabled: Required[bool]
22    "Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel."
23    type: Required[str]
24    'Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app\'s bundle. Unknown type identifiers are rejected with a validation error.'

Create or update a notification preference

app_id: str | None

App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.

channel: Required[str]

Delivery channel to configure (e.g., "email", "sms"). The in_app channel is not configurable and will be rejected with a validation error.

enabled: Required[bool]

Whether the specified channel should be enabled for this notification type and scope. Set to false to suppress delivery on this channel.

type: Required[str]

Notification type to configure. Use a builtin name (e.g., "app_info", "billing_alert") or a "custom:<lookup_key>" identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.

class AsyncNotificationPreferenceResource:
 27class AsyncNotificationPreferenceResource:
 28    def __init__(self, http: HttpClient):
 29        self._http = http
 30
 31    async def remove(self) -> None:
 32        """
 33        Delete a notification preference
 34        Removes the authenticated user's explicit notification preference for a
 35        given `(type, channel)` combination, reverting that slot to the type's
 36        default channel set.
 37        The `app_id` param scopes the deletion to a specific app's preference
 38        row. Omit `app_id` to target the system-level (no-app) slot. Because
 39        the two slots are stored independently, omitting `app_id` will not
 40        match a row that has one set, and vice versa.
 41        Returns `204 No Content` on success. Returns `404` if no preference
 42        exists for the given composite key.
 43
 44        Returns:
 45            Empty response body. A `204 No Content` status indicates the preference was deleted successfully.
 46        """
 47        await self._http.request("/api/v1/notification_preferences", method="DELETE")
 48
 49    async def list(self) -> NotificationPreferenceList:
 50        """
 51        List notification preferences
 52        Returns all explicit notification preferences belonging to the authenticated
 53        user. Preferences are returned for every `(type, channel)` combination the
 54        user has explicitly configured; slots that have not been overridden are not
 55        included and fall back to the type's defaults.
 56        The recipient is derived from the authenticated viewer. You cannot retrieve
 57        preferences for any other user through this endpoint. All configured
 58        preferences system-level and app-scoped are returned together in the
 59        `data` array.
 60
 61        Returns:
 62            An object with a `data` array containing all explicit notification preferences for the authenticated user.
 63        """
 64        return await self._http.request(
 65            "/api/v1/notification_preferences",
 66            response_type=NotificationPreferenceList,
 67        )
 68
 69    async def replace(self, input: NotificationPreferenceReplaceInput) -> NotificationPreference:
 70        """
 71        Create or update a notification preference
 72        Creates or replaces the authenticated user's notification preference for a
 73        given `(type, channel)` combination. This is an idempotent PUT: if no
 74        preference exists for the composite key, a new row is created; if one
 75        already exists, its `enabled` flag is updated to the value you provide.
 76        The recipient is derived from the authenticated viewer. You cannot set
 77        preferences for another user through this endpoint.
 78        Pass `app_id` to scope the preference to a specific app's notifications
 79        most useful for the `app_*` notification type family. Omit `app_id` to
 80        configure the system-level (no-app) slot. System-level and app-scoped
 81        preferences are stored independently and do not overwrite each other.
 82        The `in_app` channel is not configurable and will be rejected with a
 83        validation error if supplied.
 84
 85        Args:
 86            input: Request body.
 87            input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
 88            input.channel: Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.
 89            input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel.
 90            input.type: Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
 91
 92        Returns:
 93            The created or updated notification preference reflecting the new `enabled` state.
 94        """
 95        return await self._http.request(
 96            "/api/v1/notification_preferences",
 97            method="PUT",
 98            body=input,
 99            response_type=NotificationPreference,
100        )
AsyncNotificationPreferenceResource(http: archastro.platform.runtime.http_client.HttpClient)
28    def __init__(self, http: HttpClient):
29        self._http = http
async def remove(self) -> None:
31    async def remove(self) -> None:
32        """
33        Delete a notification preference
34        Removes the authenticated user's explicit notification preference for a
35        given `(type, channel)` combination, reverting that slot to the type's
36        default channel set.
37        The `app_id` param scopes the deletion to a specific app's preference
38        row. Omit `app_id` to target the system-level (no-app) slot. Because
39        the two slots are stored independently, omitting `app_id` will not
40        match a row that has one set, and vice versa.
41        Returns `204 No Content` on success. Returns `404` if no preference
42        exists for the given composite key.
43
44        Returns:
45            Empty response body. A `204 No Content` status indicates the preference was deleted successfully.
46        """
47        await self._http.request("/api/v1/notification_preferences", method="DELETE")

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.

Returns:

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

49    async def list(self) -> NotificationPreferenceList:
50        """
51        List notification preferences
52        Returns all explicit notification preferences belonging to the authenticated
53        user. Preferences are returned for every `(type, channel)` combination the
54        user has explicitly configured; slots that have not been overridden are not
55        included and fall back to the type's defaults.
56        The recipient is derived from the authenticated viewer. You cannot retrieve
57        preferences for any other user through this endpoint. All configured
58        preferences system-level and app-scoped are returned together in the
59        `data` array.
60
61        Returns:
62            An object with a `data` array containing all explicit notification preferences for the authenticated user.
63        """
64        return await self._http.request(
65            "/api/v1/notification_preferences",
66            response_type=NotificationPreferenceList,
67        )

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.

Returns:

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

 69    async def replace(self, input: NotificationPreferenceReplaceInput) -> NotificationPreference:
 70        """
 71        Create or update a notification preference
 72        Creates or replaces the authenticated user's notification preference for a
 73        given `(type, channel)` combination. This is an idempotent PUT: if no
 74        preference exists for the composite key, a new row is created; if one
 75        already exists, its `enabled` flag is updated to the value you provide.
 76        The recipient is derived from the authenticated viewer. You cannot set
 77        preferences for another user through this endpoint.
 78        Pass `app_id` to scope the preference to a specific app's notifications
 79        most useful for the `app_*` notification type family. Omit `app_id` to
 80        configure the system-level (no-app) slot. System-level and app-scoped
 81        preferences are stored independently and do not overwrite each other.
 82        The `in_app` channel is not configurable and will be rejected with a
 83        validation error if supplied.
 84
 85        Args:
 86            input: Request body.
 87            input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
 88            input.channel: Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.
 89            input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel.
 90            input.type: Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
 91
 92        Returns:
 93            The created or updated notification preference reflecting the new `enabled` state.
 94        """
 95        return await self._http.request(
 96            "/api/v1/notification_preferences",
 97            method="PUT",
 98            body=input,
 99            response_type=NotificationPreference,
100        )

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.

Arguments:
  • input: Request body.
  • input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
  • input.channel: Delivery channel to configure (e.g., "email", "sms"). The in_app channel is not configurable and will be rejected with a validation error.
  • input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to false to suppress delivery on this channel.
  • input.type: Notification type to configure. Use a builtin name (e.g., "app_info", "billing_alert") or a "custom:<lookup_key>" identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
Returns:

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

class NotificationPreferenceResource:
103class NotificationPreferenceResource:
104    def __init__(self, http: SyncHttpClient):
105        self._http = http
106
107    def remove(self) -> None:
108        """
109        Delete a notification preference
110        Removes the authenticated user's explicit notification preference for a
111        given `(type, channel)` combination, reverting that slot to the type's
112        default channel set.
113        The `app_id` param scopes the deletion to a specific app's preference
114        row. Omit `app_id` to target the system-level (no-app) slot. Because
115        the two slots are stored independently, omitting `app_id` will not
116        match a row that has one set, and vice versa.
117        Returns `204 No Content` on success. Returns `404` if no preference
118        exists for the given composite key.
119
120        Returns:
121            Empty response body. A `204 No Content` status indicates the preference was deleted successfully.
122        """
123        self._http.request("/api/v1/notification_preferences", method="DELETE")
124
125    def list(self) -> NotificationPreferenceList:
126        """
127        List notification preferences
128        Returns all explicit notification preferences belonging to the authenticated
129        user. Preferences are returned for every `(type, channel)` combination the
130        user has explicitly configured; slots that have not been overridden are not
131        included and fall back to the type's defaults.
132        The recipient is derived from the authenticated viewer. You cannot retrieve
133        preferences for any other user through this endpoint. All configured
134        preferences system-level and app-scoped are returned together in the
135        `data` array.
136
137        Returns:
138            An object with a `data` array containing all explicit notification preferences for the authenticated user.
139        """
140        return self._http.request(
141            "/api/v1/notification_preferences",
142            response_type=NotificationPreferenceList,
143        )
144
145    def replace(self, input: NotificationPreferenceReplaceInput) -> NotificationPreference:
146        """
147        Create or update a notification preference
148        Creates or replaces the authenticated user's notification preference for a
149        given `(type, channel)` combination. This is an idempotent PUT: if no
150        preference exists for the composite key, a new row is created; if one
151        already exists, its `enabled` flag is updated to the value you provide.
152        The recipient is derived from the authenticated viewer. You cannot set
153        preferences for another user through this endpoint.
154        Pass `app_id` to scope the preference to a specific app's notifications
155        most useful for the `app_*` notification type family. Omit `app_id` to
156        configure the system-level (no-app) slot. System-level and app-scoped
157        preferences are stored independently and do not overwrite each other.
158        The `in_app` channel is not configurable and will be rejected with a
159        validation error if supplied.
160
161        Args:
162            input: Request body.
163            input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
164            input.channel: Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.
165            input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel.
166            input.type: Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
167
168        Returns:
169            The created or updated notification preference reflecting the new `enabled` state.
170        """
171        return self._http.request(
172            "/api/v1/notification_preferences",
173            method="PUT",
174            body=input,
175            response_type=NotificationPreference,
176        )
NotificationPreferenceResource(http: archastro.platform.runtime.http_client.SyncHttpClient)
104    def __init__(self, http: SyncHttpClient):
105        self._http = http
def remove(self) -> None:
107    def remove(self) -> None:
108        """
109        Delete a notification preference
110        Removes the authenticated user's explicit notification preference for a
111        given `(type, channel)` combination, reverting that slot to the type's
112        default channel set.
113        The `app_id` param scopes the deletion to a specific app's preference
114        row. Omit `app_id` to target the system-level (no-app) slot. Because
115        the two slots are stored independently, omitting `app_id` will not
116        match a row that has one set, and vice versa.
117        Returns `204 No Content` on success. Returns `404` if no preference
118        exists for the given composite key.
119
120        Returns:
121            Empty response body. A `204 No Content` status indicates the preference was deleted successfully.
122        """
123        self._http.request("/api/v1/notification_preferences", method="DELETE")

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.

Returns:

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

125    def list(self) -> NotificationPreferenceList:
126        """
127        List notification preferences
128        Returns all explicit notification preferences belonging to the authenticated
129        user. Preferences are returned for every `(type, channel)` combination the
130        user has explicitly configured; slots that have not been overridden are not
131        included and fall back to the type's defaults.
132        The recipient is derived from the authenticated viewer. You cannot retrieve
133        preferences for any other user through this endpoint. All configured
134        preferences system-level and app-scoped are returned together in the
135        `data` array.
136
137        Returns:
138            An object with a `data` array containing all explicit notification preferences for the authenticated user.
139        """
140        return self._http.request(
141            "/api/v1/notification_preferences",
142            response_type=NotificationPreferenceList,
143        )

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.

Returns:

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

145    def replace(self, input: NotificationPreferenceReplaceInput) -> NotificationPreference:
146        """
147        Create or update a notification preference
148        Creates or replaces the authenticated user's notification preference for a
149        given `(type, channel)` combination. This is an idempotent PUT: if no
150        preference exists for the composite key, a new row is created; if one
151        already exists, its `enabled` flag is updated to the value you provide.
152        The recipient is derived from the authenticated viewer. You cannot set
153        preferences for another user through this endpoint.
154        Pass `app_id` to scope the preference to a specific app's notifications
155        most useful for the `app_*` notification type family. Omit `app_id` to
156        configure the system-level (no-app) slot. System-level and app-scoped
157        preferences are stored independently and do not overwrite each other.
158        The `in_app` channel is not configurable and will be rejected with a
159        validation error if supplied.
160
161        Args:
162            input: Request body.
163            input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
164            input.channel: Delivery channel to configure (e.g., `"email"`, `"sms"`). The `in_app` channel is not configurable and will be rejected with a validation error.
165            input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to `false` to suppress delivery on this channel.
166            input.type: Notification type to configure. Use a builtin name (e.g., `"app_info"`, `"billing_alert"`) or a `"custom:<lookup_key>"` identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
167
168        Returns:
169            The created or updated notification preference reflecting the new `enabled` state.
170        """
171        return self._http.request(
172            "/api/v1/notification_preferences",
173            method="PUT",
174            body=input,
175            response_type=NotificationPreference,
176        )

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.

Arguments:
  • input: Request body.
  • input.app_id: App to scope this preference to. Omit to configure the system-level (no-app) slot. App-scoped and system-level preferences are stored separately and do not affect each other.
  • input.channel: Delivery channel to configure (e.g., "email", "sms"). The in_app channel is not configurable and will be rejected with a validation error.
  • input.enabled: Whether the specified channel should be enabled for this notification type and scope. Set to false to suppress delivery on this channel.
  • input.type: Notification type to configure. Use a builtin name (e.g., "app_info", "billing_alert") or a "custom:<lookup_key>" identifier matching a NotificationType config registered in your app's bundle. Unknown type identifiers are rejected with a validation error.
Returns:

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