@nizam-os/merchant-sdk 2.8.0 → 3.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.
@@ -14,7 +14,7 @@ export declare class NotificationsClient {
14
14
  protected readonly _options: NormalizedClientOptionsWithAuth<NotificationsClient.Options>;
15
15
  constructor(options: NotificationsClient.Options);
16
16
  /**
17
- * The caller's own notifications ordered by `created_at` descending (pass `sort=created_at` for ascending). `unread=true` restricts to unread; `since=` (RFC 3339) returns only items at/after the instant for incremental catch-up after a reconnect. Pagination is bidirectional (`starting_after` / `ending_before`); cursors are bound to the sort direction that minted them.
17
+ * The caller's own notifications ordered by `created_at` descending (pass `sort=created_at` for ascending). `status` selects the segment — `all` (default; the active inbox, non-archived), `unread`, `read`, or `archived`. `category` and `kind` accept comma-separated values and AND on top of the segment; `q` matches the notification title/body. `since=` (RFC 3339) returns only items at/after the instant for incremental catch-up after a reconnect. Pagination is bidirectional (`starting_after` / `ending_before`); cursors are bound to the sort direction that minted them.
18
18
  *
19
19
  * @param {NizamMerchant.ListNotificationsRequest} request
20
20
  * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -27,6 +27,8 @@ export declare class NotificationsClient {
27
27
  *
28
28
  * @example
29
29
  * await client.notifications.listNotifications({
30
+ * status: "<string>",
31
+ * q: "<string>",
30
32
  * since: "2026-05-20T14:00:00Z",
31
33
  * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
32
34
  * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
@@ -34,6 +36,38 @@ export declare class NotificationsClient {
34
36
  */
35
37
  listNotifications(request?: NizamMerchant.ListNotificationsRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.ListResponseNotification>;
36
38
  private __listNotifications;
39
+ /**
40
+ * Archives every active notification of the caller in one operation. Returns the number archived (zero when the active inbox was already empty).
41
+ *
42
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
43
+ *
44
+ * @throws {@link NizamMerchant.BadRequestError}
45
+ * @throws {@link NizamMerchant.UnauthorizedError}
46
+ * @throws {@link NizamMerchant.ForbiddenError}
47
+ * @throws {@link NizamMerchant.TooManyRequestsError}
48
+ * @throws {@link NizamMerchant.InternalServerError}
49
+ *
50
+ * @example
51
+ * await client.notifications.archiveAllNotifications()
52
+ */
53
+ archiveAllNotifications(requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.NotificationsArchived>;
54
+ private __archiveAllNotifications;
55
+ /**
56
+ * The segment-badge roll-up for the active organization: total + unread (active, non-archived), archived, and per-category active total/unread. Computed server-side in one pass so segment badges stay accurate across cursor pages (never inferred from the loaded page). Excludes dismissed (soft-deleted) notifications.
57
+ *
58
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
59
+ *
60
+ * @throws {@link NizamMerchant.BadRequestError}
61
+ * @throws {@link NizamMerchant.UnauthorizedError}
62
+ * @throws {@link NizamMerchant.ForbiddenError}
63
+ * @throws {@link NizamMerchant.TooManyRequestsError}
64
+ * @throws {@link NizamMerchant.InternalServerError}
65
+ *
66
+ * @example
67
+ * await client.notifications.getNotificationCounts()
68
+ */
69
+ getNotificationCounts(requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.NotificationCounts>;
70
+ private __getNotificationCounts;
37
71
  /**
38
72
  * Flips every unread notification of the caller to read in one operation. Returns the number of notifications that were flipped (zero when the inbox was already clear).
39
73
  *
@@ -51,7 +85,7 @@ export declare class NotificationsClient {
51
85
  markAllNotificationsRead(requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.NotificationsMarkedRead>;
52
86
  private __markAllNotificationsRead;
53
87
  /**
54
- * The unread badge count for the active organization. Excludes dismissed (soft-deleted) notifications.
88
+ * The unread badge count for the active organization. Counts active (non-archived) unread notifications; excludes dismissed (soft-deleted) and archived ones.
55
89
  *
56
90
  * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
57
91
  *
@@ -66,6 +100,25 @@ export declare class NotificationsClient {
66
100
  */
67
101
  getUnreadNotificationCount(requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.NotificationUnreadCount>;
68
102
  private __getUnreadNotificationCount;
103
+ /**
104
+ * Moves a single notification to the archive ("Done") — reversible, not a delete: it leaves the active inbox but stays listable under `status=archived`. Idempotent. 404 if the notification is not the caller's.
105
+ *
106
+ * @param {NizamMerchant.ArchiveNotificationRequest} request
107
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
108
+ *
109
+ * @throws {@link NizamMerchant.UnauthorizedError}
110
+ * @throws {@link NizamMerchant.ForbiddenError}
111
+ * @throws {@link NizamMerchant.NotFoundError}
112
+ * @throws {@link NizamMerchant.TooManyRequestsError}
113
+ * @throws {@link NizamMerchant.InternalServerError}
114
+ *
115
+ * @example
116
+ * await client.notifications.archiveNotification({
117
+ * id: "00000000-0000-0000-0000-000000000000"
118
+ * })
119
+ */
120
+ archiveNotification(request: NizamMerchant.ArchiveNotificationRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.Notification>;
121
+ private __archiveNotification;
69
122
  /**
70
123
  * Flips a single notification to read. Idempotent — a second call is a no-op that preserves the original read timestamp. 404 if the notification is not the caller's.
71
124
  *
@@ -85,4 +138,42 @@ export declare class NotificationsClient {
85
138
  */
86
139
  markNotificationRead(request: NizamMerchant.MarkNotificationReadRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.Notification>;
87
140
  private __markNotificationRead;
141
+ /**
142
+ * Restores an archived notification to the active inbox — the inverse of archive. Idempotent. 404 if the notification is not the caller's.
143
+ *
144
+ * @param {NizamMerchant.UnarchiveNotificationRequest} request
145
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
146
+ *
147
+ * @throws {@link NizamMerchant.UnauthorizedError}
148
+ * @throws {@link NizamMerchant.ForbiddenError}
149
+ * @throws {@link NizamMerchant.NotFoundError}
150
+ * @throws {@link NizamMerchant.TooManyRequestsError}
151
+ * @throws {@link NizamMerchant.InternalServerError}
152
+ *
153
+ * @example
154
+ * await client.notifications.unarchiveNotification({
155
+ * id: "00000000-0000-0000-0000-000000000000"
156
+ * })
157
+ */
158
+ unarchiveNotification(request: NizamMerchant.UnarchiveNotificationRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.Notification>;
159
+ private __unarchiveNotification;
160
+ /**
161
+ * Flips a single notification back to unread — the inverse of mark-read. Idempotent. 404 if the notification is not the caller's.
162
+ *
163
+ * @param {NizamMerchant.MarkNotificationUnreadRequest} request
164
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
165
+ *
166
+ * @throws {@link NizamMerchant.UnauthorizedError}
167
+ * @throws {@link NizamMerchant.ForbiddenError}
168
+ * @throws {@link NizamMerchant.NotFoundError}
169
+ * @throws {@link NizamMerchant.TooManyRequestsError}
170
+ * @throws {@link NizamMerchant.InternalServerError}
171
+ *
172
+ * @example
173
+ * await client.notifications.markNotificationUnread({
174
+ * id: "00000000-0000-0000-0000-000000000000"
175
+ * })
176
+ */
177
+ markNotificationUnread(request: NizamMerchant.MarkNotificationUnreadRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamMerchant.Notification>;
178
+ private __markNotificationUnread;
88
179
  }
@@ -50,7 +50,7 @@ class NotificationsClient {
50
50
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
51
51
  }
52
52
  /**
53
- * The caller's own notifications ordered by `created_at` descending (pass `sort=created_at` for ascending). `unread=true` restricts to unread; `since=` (RFC 3339) returns only items at/after the instant for incremental catch-up after a reconnect. Pagination is bidirectional (`starting_after` / `ending_before`); cursors are bound to the sort direction that minted them.
53
+ * The caller's own notifications ordered by `created_at` descending (pass `sort=created_at` for ascending). `status` selects the segment — `all` (default; the active inbox, non-archived), `unread`, `read`, or `archived`. `category` and `kind` accept comma-separated values and AND on top of the segment; `q` matches the notification title/body. `since=` (RFC 3339) returns only items at/after the instant for incremental catch-up after a reconnect. Pagination is bidirectional (`starting_after` / `ending_before`); cursors are bound to the sort direction that minted them.
54
54
  *
55
55
  * @param {NizamMerchant.ListNotificationsRequest} request
56
56
  * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -63,6 +63,8 @@ class NotificationsClient {
63
63
  *
64
64
  * @example
65
65
  * await client.notifications.listNotifications({
66
+ * status: "<string>",
67
+ * q: "<string>",
66
68
  * since: "2026-05-20T14:00:00Z",
67
69
  * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
68
70
  * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
@@ -72,9 +74,12 @@ class NotificationsClient {
72
74
  return core.HttpResponsePromise.fromPromise(this.__listNotifications(request, requestOptions));
73
75
  }
74
76
  async __listNotifications(request = {}, requestOptions) {
75
- const { unread, since, sort, limit, starting_after: startingAfter, ending_before: endingBefore } = request;
77
+ const { status, category, kind, q, since, sort, limit, starting_after: startingAfter, ending_before: endingBefore, } = request;
76
78
  const _queryParams = {
77
- unread,
79
+ status,
80
+ category,
81
+ kind,
82
+ q,
78
83
  since: since != null ? since : undefined,
79
84
  sort,
80
85
  limit,
@@ -128,6 +133,122 @@ class NotificationsClient {
128
133
  }
129
134
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/notifications");
130
135
  }
136
+ /**
137
+ * Archives every active notification of the caller in one operation. Returns the number archived (zero when the active inbox was already empty).
138
+ *
139
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
140
+ *
141
+ * @throws {@link NizamMerchant.BadRequestError}
142
+ * @throws {@link NizamMerchant.UnauthorizedError}
143
+ * @throws {@link NizamMerchant.ForbiddenError}
144
+ * @throws {@link NizamMerchant.TooManyRequestsError}
145
+ * @throws {@link NizamMerchant.InternalServerError}
146
+ *
147
+ * @example
148
+ * await client.notifications.archiveAllNotifications()
149
+ */
150
+ archiveAllNotifications(requestOptions) {
151
+ return core.HttpResponsePromise.fromPromise(this.__archiveAllNotifications(requestOptions));
152
+ }
153
+ async __archiveAllNotifications(requestOptions) {
154
+ const _authRequest = await this._options.authProvider.getAuthRequest();
155
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
156
+ const _response = await core.fetcher({
157
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
158
+ (await core.Supplier.get(this._options.environment)) ??
159
+ environments.NizamMerchantEnvironment.Production, "v1/notifications/archive_all"),
160
+ method: "POST",
161
+ headers: _headers,
162
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
163
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
164
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
165
+ abortSignal: requestOptions?.abortSignal,
166
+ fetchFn: this._options?.fetch,
167
+ logging: this._options.logging,
168
+ });
169
+ if (_response.ok) {
170
+ return { data: _response.body, rawResponse: _response.rawResponse };
171
+ }
172
+ if (_response.error.reason === "status-code") {
173
+ switch (_response.error.statusCode) {
174
+ case 400:
175
+ throw new NizamMerchant.BadRequestError(_response.error.body, _response.rawResponse);
176
+ case 401:
177
+ throw new NizamMerchant.UnauthorizedError(_response.error.body, _response.rawResponse);
178
+ case 403:
179
+ throw new NizamMerchant.ForbiddenError(_response.error.body, _response.rawResponse);
180
+ case 429:
181
+ throw new NizamMerchant.TooManyRequestsError(_response.error.body, _response.rawResponse);
182
+ case 500:
183
+ throw new NizamMerchant.InternalServerError(_response.error.body, _response.rawResponse);
184
+ default:
185
+ throw new errors.NizamMerchantError({
186
+ statusCode: _response.error.statusCode,
187
+ body: _response.error.body,
188
+ rawResponse: _response.rawResponse,
189
+ });
190
+ }
191
+ }
192
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/archive_all");
193
+ }
194
+ /**
195
+ * The segment-badge roll-up for the active organization: total + unread (active, non-archived), archived, and per-category active total/unread. Computed server-side in one pass so segment badges stay accurate across cursor pages (never inferred from the loaded page). Excludes dismissed (soft-deleted) notifications.
196
+ *
197
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
198
+ *
199
+ * @throws {@link NizamMerchant.BadRequestError}
200
+ * @throws {@link NizamMerchant.UnauthorizedError}
201
+ * @throws {@link NizamMerchant.ForbiddenError}
202
+ * @throws {@link NizamMerchant.TooManyRequestsError}
203
+ * @throws {@link NizamMerchant.InternalServerError}
204
+ *
205
+ * @example
206
+ * await client.notifications.getNotificationCounts()
207
+ */
208
+ getNotificationCounts(requestOptions) {
209
+ return core.HttpResponsePromise.fromPromise(this.__getNotificationCounts(requestOptions));
210
+ }
211
+ async __getNotificationCounts(requestOptions) {
212
+ const _authRequest = await this._options.authProvider.getAuthRequest();
213
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
214
+ const _response = await core.fetcher({
215
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
216
+ (await core.Supplier.get(this._options.environment)) ??
217
+ environments.NizamMerchantEnvironment.Production, "v1/notifications/counts"),
218
+ method: "GET",
219
+ headers: _headers,
220
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
221
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
222
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
223
+ abortSignal: requestOptions?.abortSignal,
224
+ fetchFn: this._options?.fetch,
225
+ logging: this._options.logging,
226
+ });
227
+ if (_response.ok) {
228
+ return { data: _response.body, rawResponse: _response.rawResponse };
229
+ }
230
+ if (_response.error.reason === "status-code") {
231
+ switch (_response.error.statusCode) {
232
+ case 400:
233
+ throw new NizamMerchant.BadRequestError(_response.error.body, _response.rawResponse);
234
+ case 401:
235
+ throw new NizamMerchant.UnauthorizedError(_response.error.body, _response.rawResponse);
236
+ case 403:
237
+ throw new NizamMerchant.ForbiddenError(_response.error.body, _response.rawResponse);
238
+ case 429:
239
+ throw new NizamMerchant.TooManyRequestsError(_response.error.body, _response.rawResponse);
240
+ case 500:
241
+ throw new NizamMerchant.InternalServerError(_response.error.body, _response.rawResponse);
242
+ default:
243
+ throw new errors.NizamMerchantError({
244
+ statusCode: _response.error.statusCode,
245
+ body: _response.error.body,
246
+ rawResponse: _response.rawResponse,
247
+ });
248
+ }
249
+ }
250
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/notifications/counts");
251
+ }
131
252
  /**
132
253
  * Flips every unread notification of the caller to read in one operation. Returns the number of notifications that were flipped (zero when the inbox was already clear).
133
254
  *
@@ -190,7 +311,7 @@ class NotificationsClient {
190
311
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/read_all");
191
312
  }
192
313
  /**
193
- * The unread badge count for the active organization. Excludes dismissed (soft-deleted) notifications.
314
+ * The unread badge count for the active organization. Counts active (non-archived) unread notifications; excludes dismissed (soft-deleted) and archived ones.
194
315
  *
195
316
  * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
196
317
  *
@@ -250,6 +371,68 @@ class NotificationsClient {
250
371
  }
251
372
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/notifications/unread_count");
252
373
  }
374
+ /**
375
+ * Moves a single notification to the archive ("Done") — reversible, not a delete: it leaves the active inbox but stays listable under `status=archived`. Idempotent. 404 if the notification is not the caller's.
376
+ *
377
+ * @param {NizamMerchant.ArchiveNotificationRequest} request
378
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
379
+ *
380
+ * @throws {@link NizamMerchant.UnauthorizedError}
381
+ * @throws {@link NizamMerchant.ForbiddenError}
382
+ * @throws {@link NizamMerchant.NotFoundError}
383
+ * @throws {@link NizamMerchant.TooManyRequestsError}
384
+ * @throws {@link NizamMerchant.InternalServerError}
385
+ *
386
+ * @example
387
+ * await client.notifications.archiveNotification({
388
+ * id: "00000000-0000-0000-0000-000000000000"
389
+ * })
390
+ */
391
+ archiveNotification(request, requestOptions) {
392
+ return core.HttpResponsePromise.fromPromise(this.__archiveNotification(request, requestOptions));
393
+ }
394
+ async __archiveNotification(request, requestOptions) {
395
+ const { id } = request;
396
+ const _authRequest = await this._options.authProvider.getAuthRequest();
397
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
398
+ const _response = await core.fetcher({
399
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
400
+ (await core.Supplier.get(this._options.environment)) ??
401
+ environments.NizamMerchantEnvironment.Production, `v1/notifications/${core.url.encodePathParam(id)}/archive`),
402
+ method: "POST",
403
+ headers: _headers,
404
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
405
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
406
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
407
+ abortSignal: requestOptions?.abortSignal,
408
+ fetchFn: this._options?.fetch,
409
+ logging: this._options.logging,
410
+ });
411
+ if (_response.ok) {
412
+ return { data: _response.body, rawResponse: _response.rawResponse };
413
+ }
414
+ if (_response.error.reason === "status-code") {
415
+ switch (_response.error.statusCode) {
416
+ case 401:
417
+ throw new NizamMerchant.UnauthorizedError(_response.error.body, _response.rawResponse);
418
+ case 403:
419
+ throw new NizamMerchant.ForbiddenError(_response.error.body, _response.rawResponse);
420
+ case 404:
421
+ throw new NizamMerchant.NotFoundError(_response.error.body, _response.rawResponse);
422
+ case 429:
423
+ throw new NizamMerchant.TooManyRequestsError(_response.error.body, _response.rawResponse);
424
+ case 500:
425
+ throw new NizamMerchant.InternalServerError(_response.error.body, _response.rawResponse);
426
+ default:
427
+ throw new errors.NizamMerchantError({
428
+ statusCode: _response.error.statusCode,
429
+ body: _response.error.body,
430
+ rawResponse: _response.rawResponse,
431
+ });
432
+ }
433
+ }
434
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/archive");
435
+ }
253
436
  /**
254
437
  * Flips a single notification to read. Idempotent — a second call is a no-op that preserves the original read timestamp. 404 if the notification is not the caller's.
255
438
  *
@@ -312,5 +495,129 @@ class NotificationsClient {
312
495
  }
313
496
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/read");
314
497
  }
498
+ /**
499
+ * Restores an archived notification to the active inbox — the inverse of archive. Idempotent. 404 if the notification is not the caller's.
500
+ *
501
+ * @param {NizamMerchant.UnarchiveNotificationRequest} request
502
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
503
+ *
504
+ * @throws {@link NizamMerchant.UnauthorizedError}
505
+ * @throws {@link NizamMerchant.ForbiddenError}
506
+ * @throws {@link NizamMerchant.NotFoundError}
507
+ * @throws {@link NizamMerchant.TooManyRequestsError}
508
+ * @throws {@link NizamMerchant.InternalServerError}
509
+ *
510
+ * @example
511
+ * await client.notifications.unarchiveNotification({
512
+ * id: "00000000-0000-0000-0000-000000000000"
513
+ * })
514
+ */
515
+ unarchiveNotification(request, requestOptions) {
516
+ return core.HttpResponsePromise.fromPromise(this.__unarchiveNotification(request, requestOptions));
517
+ }
518
+ async __unarchiveNotification(request, requestOptions) {
519
+ const { id } = request;
520
+ const _authRequest = await this._options.authProvider.getAuthRequest();
521
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
522
+ const _response = await core.fetcher({
523
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
524
+ (await core.Supplier.get(this._options.environment)) ??
525
+ environments.NizamMerchantEnvironment.Production, `v1/notifications/${core.url.encodePathParam(id)}/unarchive`),
526
+ method: "POST",
527
+ headers: _headers,
528
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
529
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
530
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
531
+ abortSignal: requestOptions?.abortSignal,
532
+ fetchFn: this._options?.fetch,
533
+ logging: this._options.logging,
534
+ });
535
+ if (_response.ok) {
536
+ return { data: _response.body, rawResponse: _response.rawResponse };
537
+ }
538
+ if (_response.error.reason === "status-code") {
539
+ switch (_response.error.statusCode) {
540
+ case 401:
541
+ throw new NizamMerchant.UnauthorizedError(_response.error.body, _response.rawResponse);
542
+ case 403:
543
+ throw new NizamMerchant.ForbiddenError(_response.error.body, _response.rawResponse);
544
+ case 404:
545
+ throw new NizamMerchant.NotFoundError(_response.error.body, _response.rawResponse);
546
+ case 429:
547
+ throw new NizamMerchant.TooManyRequestsError(_response.error.body, _response.rawResponse);
548
+ case 500:
549
+ throw new NizamMerchant.InternalServerError(_response.error.body, _response.rawResponse);
550
+ default:
551
+ throw new errors.NizamMerchantError({
552
+ statusCode: _response.error.statusCode,
553
+ body: _response.error.body,
554
+ rawResponse: _response.rawResponse,
555
+ });
556
+ }
557
+ }
558
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/unarchive");
559
+ }
560
+ /**
561
+ * Flips a single notification back to unread — the inverse of mark-read. Idempotent. 404 if the notification is not the caller's.
562
+ *
563
+ * @param {NizamMerchant.MarkNotificationUnreadRequest} request
564
+ * @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
565
+ *
566
+ * @throws {@link NizamMerchant.UnauthorizedError}
567
+ * @throws {@link NizamMerchant.ForbiddenError}
568
+ * @throws {@link NizamMerchant.NotFoundError}
569
+ * @throws {@link NizamMerchant.TooManyRequestsError}
570
+ * @throws {@link NizamMerchant.InternalServerError}
571
+ *
572
+ * @example
573
+ * await client.notifications.markNotificationUnread({
574
+ * id: "00000000-0000-0000-0000-000000000000"
575
+ * })
576
+ */
577
+ markNotificationUnread(request, requestOptions) {
578
+ return core.HttpResponsePromise.fromPromise(this.__markNotificationUnread(request, requestOptions));
579
+ }
580
+ async __markNotificationUnread(request, requestOptions) {
581
+ const { id } = request;
582
+ const _authRequest = await this._options.authProvider.getAuthRequest();
583
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
584
+ const _response = await core.fetcher({
585
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
586
+ (await core.Supplier.get(this._options.environment)) ??
587
+ environments.NizamMerchantEnvironment.Production, `v1/notifications/${core.url.encodePathParam(id)}/unread`),
588
+ method: "POST",
589
+ headers: _headers,
590
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
591
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
592
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
593
+ abortSignal: requestOptions?.abortSignal,
594
+ fetchFn: this._options?.fetch,
595
+ logging: this._options.logging,
596
+ });
597
+ if (_response.ok) {
598
+ return { data: _response.body, rawResponse: _response.rawResponse };
599
+ }
600
+ if (_response.error.reason === "status-code") {
601
+ switch (_response.error.statusCode) {
602
+ case 401:
603
+ throw new NizamMerchant.UnauthorizedError(_response.error.body, _response.rawResponse);
604
+ case 403:
605
+ throw new NizamMerchant.ForbiddenError(_response.error.body, _response.rawResponse);
606
+ case 404:
607
+ throw new NizamMerchant.NotFoundError(_response.error.body, _response.rawResponse);
608
+ case 429:
609
+ throw new NizamMerchant.TooManyRequestsError(_response.error.body, _response.rawResponse);
610
+ case 500:
611
+ throw new NizamMerchant.InternalServerError(_response.error.body, _response.rawResponse);
612
+ default:
613
+ throw new errors.NizamMerchantError({
614
+ statusCode: _response.error.statusCode,
615
+ body: _response.error.body,
616
+ rawResponse: _response.rawResponse,
617
+ });
618
+ }
619
+ }
620
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/unread");
621
+ }
315
622
  }
316
623
  exports.NotificationsClient = NotificationsClient;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface ArchiveNotificationRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +1,22 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * status: "<string>",
5
+ * q: "<string>",
4
6
  * since: "2026-05-20T14:00:00Z",
5
7
  * starting_after: "Y3Vyc29yX25leHRfMDFKNVE=",
6
8
  * ending_before: "Y3Vyc29yX25leHRfMDFKNVE="
7
9
  * }
8
10
  */
9
11
  export interface ListNotificationsRequest {
10
- /** Restrict to unread notifications. */
11
- unread?: boolean;
12
+ /** Inbox segment. One of: `all` (default — active, non-archived), `unread`, `read`, `archived`. */
13
+ status?: string;
14
+ /** Filter by category. Comma-separated; values: `transactional`, `operational`, `alert`, `marketing`, `security`, `system`. */
15
+ category?: string | string[];
16
+ /** Filter by notification kind (wire key). Comma-separated; e.g. `membership.joined`. */
17
+ kind?: string | string[];
18
+ /** Free-text search over the notification title/body (max 200 chars). */
19
+ q?: string;
12
20
  /** Only notifications created at/after this RFC 3339 instant. */
13
21
  since?: string;
14
22
  /** Sort order. Allowed fields: `created_at`. Prefix a field with `-` for descending (e.g. `-created_at`); unknown fields are rejected with `400 validation_failed`. */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface MarkNotificationUnreadRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "00000000-0000-0000-0000-000000000000"
5
+ * }
6
+ */
7
+ export interface UnarchiveNotificationRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,5 @@
1
+ export type { ArchiveNotificationRequest } from "./ArchiveNotificationRequest.js";
1
2
  export type { ListNotificationsRequest } from "./ListNotificationsRequest.js";
2
3
  export type { MarkNotificationReadRequest } from "./MarkNotificationReadRequest.js";
4
+ export type { MarkNotificationUnreadRequest } from "./MarkNotificationUnreadRequest.js";
5
+ export type { UnarchiveNotificationRequest } from "./UnarchiveNotificationRequest.js";
@@ -18,6 +18,10 @@ export interface Notification {
18
18
  read?: boolean | undefined;
19
19
  /** When it was read (RFC 3339); null while unread. */
20
20
  read_at?: string | undefined;
21
+ /** Whether the recipient has archived ("Done") it. */
22
+ archived?: boolean | undefined;
23
+ /** When it was archived (RFC 3339); null while in the active inbox. */
24
+ archived_at?: string | undefined;
21
25
  /** When it was raised (RFC 3339). */
22
26
  created_at?: string | undefined;
23
27
  }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Active total/unread for one category.
3
+ */
4
+ export interface NotificationCategoryCount {
5
+ /** Category. */
6
+ category?: NotificationCategoryCount.Category | undefined;
7
+ /** Active notifications in this category. */
8
+ total?: number | undefined;
9
+ /** Active unread notifications in this category. */
10
+ unread?: number | undefined;
11
+ }
12
+ export declare namespace NotificationCategoryCount {
13
+ /** Category. */
14
+ const Category: {
15
+ readonly Transactional: "transactional";
16
+ readonly Operational: "operational";
17
+ readonly Alert: "alert";
18
+ readonly Marketing: "marketing";
19
+ readonly Security: "security";
20
+ readonly System: "system";
21
+ };
22
+ type Category = (typeof Category)[keyof typeof Category];
23
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.NotificationCategoryCount = void 0;
5
+ var NotificationCategoryCount;
6
+ (function (NotificationCategoryCount) {
7
+ /** Category. */
8
+ NotificationCategoryCount.Category = {
9
+ Transactional: "transactional",
10
+ Operational: "operational",
11
+ Alert: "alert",
12
+ Marketing: "marketing",
13
+ Security: "security",
14
+ System: "system",
15
+ };
16
+ })(NotificationCategoryCount || (exports.NotificationCategoryCount = NotificationCategoryCount = {}));
@@ -0,0 +1,23 @@
1
+ import type * as NizamMerchant from "../index.js";
2
+ /**
3
+ * Inbox segment-badge counts (server-derived).
4
+ */
5
+ export interface NotificationCounts {
6
+ /** Active (non-archived) notifications. */
7
+ total?: number | undefined;
8
+ /** Active unread notifications. */
9
+ unread?: number | undefined;
10
+ /** Archived ("Done") notifications. */
11
+ archived?: number | undefined;
12
+ /** Per-category active counts; categories with no active row are omitted. */
13
+ categories?: NizamMerchant.NotificationCategoryCount[] | undefined;
14
+ /** Object type discriminator. */
15
+ object?: NotificationCounts.Object_ | undefined;
16
+ }
17
+ export declare namespace NotificationCounts {
18
+ /** Object type discriminator. */
19
+ const Object_: {
20
+ readonly NotificationCounts: "notification_counts";
21
+ };
22
+ type Object_ = (typeof Object_)[keyof typeof Object_];
23
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.NotificationCounts = void 0;
5
+ var NotificationCounts;
6
+ (function (NotificationCounts) {
7
+ /** Object type discriminator. */
8
+ NotificationCounts.Object_ = {
9
+ NotificationCounts: "notification_counts",
10
+ };
11
+ })(NotificationCounts || (exports.NotificationCounts = NotificationCounts = {}));
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Result of an archive-all operation.
3
+ */
4
+ export interface NotificationsArchived {
5
+ /** Number of notifications archived. */
6
+ archived?: number | undefined;
7
+ /** Object type discriminator. */
8
+ object?: NotificationsArchived.Object_ | undefined;
9
+ }
10
+ export declare namespace NotificationsArchived {
11
+ /** Object type discriminator. */
12
+ const Object_: {
13
+ readonly NotificationsArchived: "notifications_archived";
14
+ };
15
+ type Object_ = (typeof Object_)[keyof typeof Object_];
16
+ }
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.NotificationsArchived = void 0;
5
+ var NotificationsArchived;
6
+ (function (NotificationsArchived) {
7
+ /** Object type discriminator. */
8
+ NotificationsArchived.Object_ = {
9
+ NotificationsArchived: "notifications_archived",
10
+ };
11
+ })(NotificationsArchived || (exports.NotificationsArchived = NotificationsArchived = {}));
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Result of a mark-all-read operation.
2
+ * Result of a mark-read operation.
3
3
  */
4
4
  export interface NotificationsMarkedRead {
5
5
  /** Number of notifications flipped to read. */
@@ -56,10 +56,13 @@ export * from "./MembershipChoice.js";
56
56
  export * from "./MembershipDriftResponse.js";
57
57
  export * from "./MqttToken.js";
58
58
  export * from "./Notification.js";
59
+ export * from "./NotificationCategoryCount.js";
60
+ export * from "./NotificationCounts.js";
59
61
  export * from "./NotificationDeadLetter.js";
60
62
  export * from "./NotificationPreference.js";
61
63
  export * from "./NotificationPreferenceItem.js";
62
64
  export * from "./NotificationPreferences.js";
65
+ export * from "./NotificationsArchived.js";
63
66
  export * from "./NotificationsMarkedRead.js";
64
67
  export * from "./NotificationUnreadCount.js";
65
68
  export * from "./OpenAssignmentRequest.js";
@@ -72,10 +72,13 @@ __exportStar(require("./MembershipChoice.js"), exports);
72
72
  __exportStar(require("./MembershipDriftResponse.js"), exports);
73
73
  __exportStar(require("./MqttToken.js"), exports);
74
74
  __exportStar(require("./Notification.js"), exports);
75
+ __exportStar(require("./NotificationCategoryCount.js"), exports);
76
+ __exportStar(require("./NotificationCounts.js"), exports);
75
77
  __exportStar(require("./NotificationDeadLetter.js"), exports);
76
78
  __exportStar(require("./NotificationPreference.js"), exports);
77
79
  __exportStar(require("./NotificationPreferenceItem.js"), exports);
78
80
  __exportStar(require("./NotificationPreferences.js"), exports);
81
+ __exportStar(require("./NotificationsArchived.js"), exports);
79
82
  __exportStar(require("./NotificationsMarkedRead.js"), exports);
80
83
  __exportStar(require("./NotificationUnreadCount.js"), exports);
81
84
  __exportStar(require("./OpenAssignmentRequest.js"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizam-os/merchant-sdk",
3
- "version": "2.8.0",
3
+ "version": "3.0.0",
4
4
  "description": "Nizam Merchant API SDK for TypeScript / JavaScript.",
5
5
  "license": "MIT",
6
6
  "private": false,