@sudoplatform/sudo-notification 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/gen/graphqlTypes.js +3 -1
- package/cjs/gen/graphqlTypes.js.map +1 -1
- package/cjs/private/apiClient.js +33 -29
- package/cjs/private/apiClient.js.map +1 -1
- package/cjs/private/transformers/errorTransformer.js +6 -1
- package/cjs/private/transformers/errorTransformer.js.map +1 -1
- package/cjs/public/errors.js +19 -1
- package/cjs/public/errors.js.map +1 -1
- package/cjs/public/sudoNotificationClient.js +36 -3
- package/cjs/public/sudoNotificationClient.js.map +1 -1
- package/cjs/public/types/index.js +1 -0
- package/cjs/public/types/index.js.map +1 -1
- package/cjs/public/types/userAndDeviceNotificationConfiguration.js +8 -0
- package/cjs/public/types/userAndDeviceNotificationConfiguration.js.map +1 -0
- package/lib/gen/graphqlTypes.js +2 -0
- package/lib/gen/graphqlTypes.js.map +1 -1
- package/lib/private/apiClient.js +35 -31
- package/lib/private/apiClient.js.map +1 -1
- package/lib/private/transformers/errorTransformer.js +8 -3
- package/lib/private/transformers/errorTransformer.js.map +1 -1
- package/lib/public/errors.js +16 -0
- package/lib/public/errors.js.map +1 -1
- package/lib/public/sudoNotificationClient.js +36 -3
- package/lib/public/sudoNotificationClient.js.map +1 -1
- package/lib/public/types/index.js +1 -0
- package/lib/public/types/index.js.map +1 -1
- package/lib/public/types/userAndDeviceNotificationConfiguration.js +7 -0
- package/lib/public/types/userAndDeviceNotificationConfiguration.js.map +1 -0
- package/package.json +46 -45
- package/types/gen/graphqlTypes.d.ts +68 -1
- package/types/private/apiClient.d.ts +7 -4
- package/types/private/transformers/errorTransformer.d.ts +5 -2
- package/types/public/errors.d.ts +12 -0
- package/types/public/sudoNotificationClient.d.ts +47 -1
- package/types/public/types/index.d.ts +1 -0
- package/types/public/types/userAndDeviceNotificationConfiguration.d.ts +18 -0
|
@@ -3,6 +3,7 @@ import { CanonicalPushSubscriptionJSON } from '../private/types/canonicalPushSub
|
|
|
3
3
|
import { NotificationConfiguration } from './types/notificationConfiguration';
|
|
4
4
|
import { NotificationDeviceInfo } from './types/notificationDeviceInfo';
|
|
5
5
|
import { SudoNotificationClientOptions } from './types/sudoNotificationClientOptions';
|
|
6
|
+
import { UserAndDeviceNotificationConfiguration } from './types/userAndDeviceNotificationConfiguration';
|
|
6
7
|
/**
|
|
7
8
|
* Client used to interface with the Sudo Notification Platform service.
|
|
8
9
|
*
|
|
@@ -55,7 +56,34 @@ export interface SudoNotificationClient {
|
|
|
55
56
|
*/
|
|
56
57
|
getNotificationConfiguration(deviceInfo: NotificationDeviceInfo): Promise<NotificationConfiguration>;
|
|
57
58
|
/**
|
|
58
|
-
*
|
|
59
|
+
* Get the user's current set of notification configurations for a push
|
|
60
|
+
* subscription at user level.
|
|
61
|
+
*
|
|
62
|
+
* Returns undefined if no user level notification configuration has been set.
|
|
63
|
+
*
|
|
64
|
+
* @param bundleId
|
|
65
|
+
* Reverse DNS name idenfifying the application. For example
|
|
66
|
+
* com.sudoplatform.examples.notification.
|
|
67
|
+
*
|
|
68
|
+
* @throws {@link UserInfoReadError} if the retrieval of user level information fails for some reason
|
|
69
|
+
*/
|
|
70
|
+
getUserNotificationConfiguration(bundleId: string): Promise<NotificationConfiguration | undefined>;
|
|
71
|
+
/**
|
|
72
|
+
* Get the user's current set of notification configurations for a push
|
|
73
|
+
* subscription at user level and device level.
|
|
74
|
+
*
|
|
75
|
+
* @param deviceInfo Information that identifies the user's device and application
|
|
76
|
+
*
|
|
77
|
+
* @throws {@link DeviceReadError} if the retrieval of device information fails for some reason
|
|
78
|
+
* @throws {@link UserInfoReadError} if the retrieval of user level information fails for some reason
|
|
79
|
+
*/
|
|
80
|
+
getUserAndDeviceNotificationConfiguration(deviceInfo: NotificationDeviceInfo): Promise<UserAndDeviceNotificationConfiguration>;
|
|
81
|
+
/**
|
|
82
|
+
* Set the notification configuration for the user's device.
|
|
83
|
+
*
|
|
84
|
+
* Any device specific configuration is evaluated first. Evaluation of
|
|
85
|
+
* rules will fall back to user level settings if there is no matching
|
|
86
|
+
* device rule or it is just a catch-all rule that matches.
|
|
59
87
|
*
|
|
60
88
|
* @param deviceInfo Information that identifies the user's device and application
|
|
61
89
|
*
|
|
@@ -63,6 +91,20 @@ export interface SudoNotificationClient {
|
|
|
63
91
|
* @throws {@link SchemaValidationError} if the retrieval fails for some other reason
|
|
64
92
|
*/
|
|
65
93
|
setNotificationConfiguration(deviceInfo: NotificationDeviceInfo, config: NotificationConfiguration): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Set the notification configuration for the user across all devices.
|
|
96
|
+
*
|
|
97
|
+
* Any device specific configuration is evaluated first. Evaluation of
|
|
98
|
+
* rules will fall back to user level settings if there is no matching
|
|
99
|
+
* device rule or it is just a catch-all rule that matches.
|
|
100
|
+
*
|
|
101
|
+
* @param bundleId
|
|
102
|
+
* Reverse DNS name idenfifying the application. For example
|
|
103
|
+
* com.sudoplatform.examples.notification.
|
|
104
|
+
*
|
|
105
|
+
* @throws {@link SchemaValidationError} if the retrieval fails for some other reason
|
|
106
|
+
*/
|
|
107
|
+
setUserNotificationConfiguration(bundleId: string, config: NotificationConfiguration): Promise<void>;
|
|
66
108
|
/** @ignore */
|
|
67
109
|
sendTestNotification(input: SendTestNotificationInput): Promise<boolean>;
|
|
68
110
|
}
|
|
@@ -96,7 +138,11 @@ export declare class DefaultSudoNotificationClient implements SudoNotificationCl
|
|
|
96
138
|
updatePushSubscription(deviceInfo: NotificationDeviceInfo, pushSubscription: PushSubscription): Promise<void>;
|
|
97
139
|
deregisterPushSubscription(deviceInfo: NotificationDeviceInfo): Promise<void>;
|
|
98
140
|
getNotificationConfiguration(deviceInfo: NotificationDeviceInfo): Promise<NotificationConfiguration>;
|
|
141
|
+
getUserNotificationConfiguration(bundleId: string): Promise<NotificationConfiguration | undefined>;
|
|
142
|
+
getUserAndDeviceNotificationConfiguration(deviceInfo: NotificationDeviceInfo): Promise<UserAndDeviceNotificationConfiguration>;
|
|
99
143
|
setNotificationConfiguration(deviceInfo: NotificationDeviceInfo, config: NotificationConfiguration): Promise<void>;
|
|
144
|
+
setUserNotificationConfiguration(bundleId: string, config: NotificationConfiguration): Promise<void>;
|
|
145
|
+
private setUserOrDeviceNotificationConfiguration;
|
|
100
146
|
/** @ignore */
|
|
101
147
|
sendTestNotification(input: SendTestNotificationInput): Promise<boolean>;
|
|
102
148
|
/**
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { NotificationConfiguration } from './notificationConfiguration';
|
|
2
|
+
/**
|
|
3
|
+
* Result of call to getUserAndDeviceNotificationConfiguration
|
|
4
|
+
*/
|
|
5
|
+
export interface UserAndDeviceNotificationConfiguration {
|
|
6
|
+
/**
|
|
7
|
+
* User level notification configuration or undefined if no
|
|
8
|
+
* user level notification configuration has been set.
|
|
9
|
+
*/
|
|
10
|
+
user?: NotificationConfiguration;
|
|
11
|
+
/**
|
|
12
|
+
* Device level notification configuration or undefined if no
|
|
13
|
+
* device level notification configuration has been set, or
|
|
14
|
+
* no device information was provided when calling
|
|
15
|
+
* getUserAndDeviceNotificationConfiguration.
|
|
16
|
+
*/
|
|
17
|
+
device?: NotificationConfiguration;
|
|
18
|
+
}
|