pushy 4.0.0 → 4.0.2

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.
Files changed (2) hide show
  1. package/index.d.ts +58 -10
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -45,25 +45,25 @@ declare module 'pushy' {
45
45
  * The main alert message, visible on the lock screen and in other areas on iOS.
46
46
  * Supports Apple Emojis via their unicode representation.
47
47
  */
48
- body: string;
48
+ body?: string;
49
49
 
50
50
  /** The number to display as the badge of the app icon. */
51
- badge: number;
51
+ badge?: number;
52
52
 
53
53
  /**
54
54
  * The filename of a sound in the app bundle or in the Library/Sounds folder of your app's data
55
55
  * container, or a sound dictionary object for critical alerts (iOS 12, more info) .
56
56
  */
57
- sound: unknown;
57
+ sound?: unknown;
58
58
 
59
59
  /** A short string describing the purpose of the notification, visible on Apple Watch and iOS 8.2+. */
60
- title: string;
60
+ title?: string;
61
61
 
62
62
  /**
63
63
  * Your app's Notification Content Extension with the matching category will be invoked in order to
64
64
  * display custom notification UI.
65
65
  */
66
- category: string;
66
+ category?: string;
67
67
 
68
68
  /**
69
69
  * The localization key of a string present in your app's Localizable.strings file.
@@ -71,7 +71,7 @@ declare module 'pushy' {
71
71
  * Use this parameter to localize the notification body. Refer to the APNs documentation for more
72
72
  * information.
73
73
  */
74
- loc_key: string;
74
+ loc_key?: string;
75
75
 
76
76
  /**
77
77
  * The replacement strings to substitute in place of the %@ placeholders of the localization string
@@ -80,7 +80,7 @@ declare module 'pushy' {
80
80
  * Use this parameter to localize the notification body. Refer to the APNs documentation for more
81
81
  * information.
82
82
  */
83
- loc_args: Array<string>;
83
+ loc_args?: Array<string>;
84
84
 
85
85
  /**
86
86
  * The localization key of a string present in your app's Localizable.strings file.
@@ -88,7 +88,7 @@ declare module 'pushy' {
88
88
  * Use this parameter to localize the notification title. Refer to the APNs documentation for more
89
89
  * information.
90
90
  */
91
- title_loc_key: string;
91
+ title_loc_key?: string;
92
92
 
93
93
  /**
94
94
  * The replacement strings to substitute in place of the %@ placeholders of the localization string
@@ -97,7 +97,7 @@ declare module 'pushy' {
97
97
  * Use this parameter to localize the notification title. Refer to the APNs documentation for more
98
98
  * information.
99
99
  */
100
- title_loc_args: Array<string>;
100
+ title_loc_args?: Array<string>;
101
101
 
102
102
  /**
103
103
  * Indicate the importance and delivery timing of a notification on iOS 15+, with possible values
@@ -106,7 +106,7 @@ declare module 'pushy' {
106
106
  * Defaults to active. Anything above active requires capabilities to be enabled in your Xcode
107
107
  * project. Refer to the APNs documentation for more information.
108
108
  */
109
- interruption_level: string;
109
+ interruption_level?: string;
110
110
  };
111
111
  }
112
112
 
@@ -137,6 +137,7 @@ declare module 'pushy' {
137
137
  failed: Array<string>;
138
138
  };
139
139
  }
140
+
140
141
  interface NotificationStatus {
141
142
  /** The creation date of the push notification (unix timestamp). */
142
143
  date: number;
@@ -214,6 +215,26 @@ declare module 'pushy' {
214
215
  subscriptions: Array<string>;
215
216
  }
216
217
 
218
+ /**
219
+ * Options for extra request library parameters.
220
+ */
221
+ interface ExtraRequestOptions {
222
+ /**
223
+ * Custom headers for the request, represented as key-value pairs.
224
+ */
225
+ headers?: Record<string, string>;
226
+
227
+ /**
228
+ * Timeout for the request in milliseconds.
229
+ */
230
+ timeout?: number;
231
+
232
+ /**
233
+ * Allow any additional options to be specified.
234
+ */
235
+ [key: string]: any;
236
+ }
237
+
217
238
  interface DevicePresenceInfo {
218
239
  /** The device token linked to this presence object. */
219
240
  id: string;
@@ -254,6 +275,12 @@ declare module 'pushy' {
254
275
  }
255
276
 
256
277
  export default class Pushy {
278
+ /**
279
+ * Constructor
280
+ * @see {@link https://pushy.me/docs/api}
281
+ *
282
+ * @param apiKey Pushy Secret API Key, available in the Pushy Dashboard (Click your app -> API Authentication tab).
283
+ */
257
284
  constructor(apiKey: string);
258
285
 
259
286
  /**
@@ -357,5 +384,26 @@ declare module 'pushy' {
357
384
  topic: string,
358
385
  callback?: (error: Error | null, subscribers: TopicSuscribers) => void
359
386
  ): Promise<TopicSuscribers>;
387
+
388
+ /**
389
+ * Set extra request library options to customize requests sent to the Pushy API.
390
+ *
391
+ * @param options An object containing additional request options.
392
+ */
393
+ setExtraRequestOptions(options: ExtraRequestOptions): void;
394
+
395
+ /**
396
+ * Set the Pushy Enterprise API endpoint hostname.
397
+ *
398
+ * @param endpoint The Pushy Enterprise API endpoint along with protocol (no trailing slash).
399
+ */
400
+ setEnterpriseConfig(endpoint: string): void;
401
+
402
+ /**
403
+ * Get the API endpoint being used by the Pushy instance.
404
+ *
405
+ * @returns The API endpoint URL as a string.
406
+ */
407
+ getApiEndpoint(): string;
360
408
  }
361
409
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pushy",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "The official Node.js package for sending push notifications with Pushy.",
5
5
  "main": "index.js",
6
6
  "scripts": {