@nizam-os/dashboard-sdk 8.1.0 → 10.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/dist/api/resources/assets/client/Client.d.ts +5 -0
- package/dist/api/resources/assets/client/Client.js +10 -2
- package/dist/api/resources/assets/client/requests/CreateAssetRequest.d.ts +6 -0
- package/dist/api/resources/assignments/client/Client.d.ts +2 -0
- package/dist/api/resources/assignments/client/Client.js +5 -2
- package/dist/api/resources/assignments/client/requests/OpenAssignmentRequest.d.ts +4 -0
- package/dist/api/resources/files/client/Client.d.ts +2 -0
- package/dist/api/resources/files/client/Client.js +7 -2
- package/dist/api/resources/files/client/requests/InitiateFileUploadRequest.d.ts +3 -0
- package/dist/api/resources/imports/client/Client.d.ts +2 -0
- package/dist/api/resources/imports/client/Client.js +7 -2
- package/dist/api/resources/imports/client/requests/CreateImportRequest.d.ts +3 -0
- package/dist/api/resources/invites/client/Client.d.ts +5 -0
- package/dist/api/resources/invites/client/Client.js +12 -2
- package/dist/api/resources/invites/client/requests/CreateInviteRequest.d.ts +5 -0
- package/dist/api/resources/notifications/client/Client.d.ts +93 -2
- package/dist/api/resources/notifications/client/Client.js +311 -4
- package/dist/api/resources/notifications/client/requests/ArchiveNotificationRequest.d.ts +9 -0
- package/dist/api/resources/notifications/client/requests/ArchiveNotificationRequest.js +3 -0
- package/dist/api/resources/notifications/client/requests/ListNotificationsRequest.d.ts +10 -2
- package/dist/api/resources/notifications/client/requests/MarkNotificationUnreadRequest.d.ts +9 -0
- package/dist/api/resources/notifications/client/requests/MarkNotificationUnreadRequest.js +3 -0
- package/dist/api/resources/notifications/client/requests/UnarchiveNotificationRequest.d.ts +9 -0
- package/dist/api/resources/notifications/client/requests/UnarchiveNotificationRequest.js +3 -0
- package/dist/api/resources/notifications/client/requests/index.d.ts +3 -0
- package/dist/api/resources/operators/client/Client.d.ts +21 -11
- package/dist/api/resources/operators/client/Client.js +25 -12
- package/dist/api/resources/operators/client/requests/CreateOperatorBody.d.ts +37 -0
- package/dist/api/resources/operators/client/requests/CreateOperatorBody.js +3 -0
- package/dist/api/resources/operators/client/requests/index.d.ts +1 -0
- package/dist/api/resources/organizations/client/Client.d.ts +2 -2
- package/dist/api/resources/organizations/client/Client.js +5 -4
- package/dist/api/resources/organizations/client/requests/CreateOrganizationRequest.d.ts +4 -0
- package/dist/api/resources/taskAttempts/client/Client.d.ts +2 -0
- package/dist/api/resources/taskAttempts/client/Client.js +6 -2
- package/dist/api/resources/taskAttempts/client/requests/CaptureTaskAttemptPhotoRequest.d.ts +3 -0
- package/dist/api/resources/users/client/Client.d.ts +3 -0
- package/dist/api/resources/users/client/Client.js +8 -2
- package/dist/api/resources/users/client/requests/InviteUserRequest.d.ts +4 -0
- package/dist/api/types/Device.d.ts +17 -2
- package/dist/api/types/Device.js +13 -0
- package/dist/api/types/Notification.d.ts +4 -0
- package/dist/api/types/NotificationCategoryCount.d.ts +23 -0
- package/dist/api/types/NotificationCategoryCount.js +16 -0
- package/dist/api/types/NotificationCounts.d.ts +23 -0
- package/dist/api/types/NotificationCounts.js +11 -0
- package/dist/api/types/NotificationsArchived.d.ts +16 -0
- package/dist/api/types/NotificationsArchived.js +11 -0
- package/dist/api/types/NotificationsMarkedRead.d.ts +1 -1
- package/dist/api/types/index.d.ts +3 -0
- package/dist/api/types/index.js +3 -0
- package/package.json +1 -1
|
@@ -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
|
|
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 {NizamDashboard.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 {
|
|
77
|
+
const { status, category, kind, q, since, sort, limit, starting_after: startingAfter, ending_before: endingBefore, } = request;
|
|
76
78
|
const _queryParams = {
|
|
77
|
-
|
|
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 NizamDashboard.BadRequestError}
|
|
142
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
143
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
144
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
145
|
+
* @throws {@link NizamDashboard.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.NizamDashboardEnvironment.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 NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
|
|
176
|
+
case 401:
|
|
177
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
178
|
+
case 403:
|
|
179
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
180
|
+
case 429:
|
|
181
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
182
|
+
case 500:
|
|
183
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
184
|
+
default:
|
|
185
|
+
throw new errors.NizamDashboardError({
|
|
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 NizamDashboard.BadRequestError}
|
|
200
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
201
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
202
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
203
|
+
* @throws {@link NizamDashboard.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.NizamDashboardEnvironment.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 NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
|
|
234
|
+
case 401:
|
|
235
|
+
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
236
|
+
case 403:
|
|
237
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
238
|
+
case 429:
|
|
239
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
240
|
+
case 500:
|
|
241
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
242
|
+
default:
|
|
243
|
+
throw new errors.NizamDashboardError({
|
|
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.
|
|
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 {NizamDashboard.ArchiveNotificationRequest} request
|
|
378
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
379
|
+
*
|
|
380
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
381
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
382
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
383
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
384
|
+
* @throws {@link NizamDashboard.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.NizamDashboardEnvironment.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 NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
418
|
+
case 403:
|
|
419
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
420
|
+
case 404:
|
|
421
|
+
throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
|
|
422
|
+
case 429:
|
|
423
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
424
|
+
case 500:
|
|
425
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
426
|
+
default:
|
|
427
|
+
throw new errors.NizamDashboardError({
|
|
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 {NizamDashboard.UnarchiveNotificationRequest} request
|
|
502
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
503
|
+
*
|
|
504
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
505
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
506
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
507
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
508
|
+
* @throws {@link NizamDashboard.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.NizamDashboardEnvironment.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 NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
542
|
+
case 403:
|
|
543
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
544
|
+
case 404:
|
|
545
|
+
throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
|
|
546
|
+
case 429:
|
|
547
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
548
|
+
case 500:
|
|
549
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
550
|
+
default:
|
|
551
|
+
throw new errors.NizamDashboardError({
|
|
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 {NizamDashboard.MarkNotificationUnreadRequest} request
|
|
564
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
565
|
+
*
|
|
566
|
+
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
567
|
+
* @throws {@link NizamDashboard.ForbiddenError}
|
|
568
|
+
* @throws {@link NizamDashboard.NotFoundError}
|
|
569
|
+
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
570
|
+
* @throws {@link NizamDashboard.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.NizamDashboardEnvironment.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 NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
604
|
+
case 403:
|
|
605
|
+
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
606
|
+
case 404:
|
|
607
|
+
throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
|
|
608
|
+
case 429:
|
|
609
|
+
throw new NizamDashboard.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
610
|
+
case 500:
|
|
611
|
+
throw new NizamDashboard.InternalServerError(_response.error.body, _response.rawResponse);
|
|
612
|
+
default:
|
|
613
|
+
throw new errors.NizamDashboardError({
|
|
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;
|
|
@@ -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
|
-
/**
|
|
11
|
-
|
|
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`. */
|
|
@@ -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";
|
|
@@ -16,38 +16,48 @@ export declare class OperatorsClient {
|
|
|
16
16
|
/**
|
|
17
17
|
* Creates a new operator (human, autonomous software, or teleoperated). The `kind` discriminator selects the variant.
|
|
18
18
|
*
|
|
19
|
-
* @param {NizamDashboard.
|
|
19
|
+
* @param {NizamDashboard.CreateOperatorBody} request
|
|
20
20
|
* @param {OperatorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
21
21
|
*
|
|
22
22
|
* @throws {@link NizamDashboard.BadRequestError}
|
|
23
23
|
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
24
24
|
* @throws {@link NizamDashboard.ForbiddenError}
|
|
25
|
+
* @throws {@link NizamDashboard.ConflictError}
|
|
25
26
|
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
26
27
|
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
27
28
|
* @throws {@link NizamDashboard.InternalServerError}
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* await client.operators.createOperator({
|
|
31
|
-
*
|
|
32
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
33
|
+
* body: {
|
|
34
|
+
* kind: "human"
|
|
35
|
+
* }
|
|
32
36
|
* })
|
|
33
37
|
*
|
|
34
38
|
* @example
|
|
35
39
|
* await client.operators.createOperator({
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
40
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
41
|
+
* body: {
|
|
42
|
+
* kind: "autonomous",
|
|
43
|
+
* vendor: "Waymo",
|
|
44
|
+
* product: "Waymo Driver",
|
|
45
|
+
* version: "7.3",
|
|
46
|
+
* responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
|
|
47
|
+
* }
|
|
41
48
|
* })
|
|
42
49
|
*
|
|
43
50
|
* @example
|
|
44
51
|
* await client.operators.createOperator({
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
52
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
53
|
+
* body: {
|
|
54
|
+
* kind: "teleoperated",
|
|
55
|
+
* controller_user_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
|
|
56
|
+
* responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
|
|
57
|
+
* }
|
|
48
58
|
* })
|
|
49
59
|
*/
|
|
50
|
-
createOperator(request: NizamDashboard.
|
|
60
|
+
createOperator(request: NizamDashboard.CreateOperatorBody, requestOptions?: OperatorsClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Operator>;
|
|
51
61
|
private __createOperator;
|
|
52
62
|
/**
|
|
53
63
|
* @param {NizamDashboard.GetOperatorRequest} request
|
|
@@ -52,43 +52,54 @@ class OperatorsClient {
|
|
|
52
52
|
/**
|
|
53
53
|
* Creates a new operator (human, autonomous software, or teleoperated). The `kind` discriminator selects the variant.
|
|
54
54
|
*
|
|
55
|
-
* @param {NizamDashboard.
|
|
55
|
+
* @param {NizamDashboard.CreateOperatorBody} request
|
|
56
56
|
* @param {OperatorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
57
57
|
*
|
|
58
58
|
* @throws {@link NizamDashboard.BadRequestError}
|
|
59
59
|
* @throws {@link NizamDashboard.UnauthorizedError}
|
|
60
60
|
* @throws {@link NizamDashboard.ForbiddenError}
|
|
61
|
+
* @throws {@link NizamDashboard.ConflictError}
|
|
61
62
|
* @throws {@link NizamDashboard.UnprocessableEntityError}
|
|
62
63
|
* @throws {@link NizamDashboard.TooManyRequestsError}
|
|
63
64
|
* @throws {@link NizamDashboard.InternalServerError}
|
|
64
65
|
*
|
|
65
66
|
* @example
|
|
66
67
|
* await client.operators.createOperator({
|
|
67
|
-
*
|
|
68
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
69
|
+
* body: {
|
|
70
|
+
* kind: "human"
|
|
71
|
+
* }
|
|
68
72
|
* })
|
|
69
73
|
*
|
|
70
74
|
* @example
|
|
71
75
|
* await client.operators.createOperator({
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
76
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
77
|
+
* body: {
|
|
78
|
+
* kind: "autonomous",
|
|
79
|
+
* vendor: "Waymo",
|
|
80
|
+
* product: "Waymo Driver",
|
|
81
|
+
* version: "7.3",
|
|
82
|
+
* responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
|
|
83
|
+
* }
|
|
77
84
|
* })
|
|
78
85
|
*
|
|
79
86
|
* @example
|
|
80
87
|
* await client.operators.createOperator({
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
88
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
89
|
+
* body: {
|
|
90
|
+
* kind: "teleoperated",
|
|
91
|
+
* controller_user_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
|
|
92
|
+
* responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
|
|
93
|
+
* }
|
|
84
94
|
* })
|
|
85
95
|
*/
|
|
86
96
|
createOperator(request, requestOptions) {
|
|
87
97
|
return core.HttpResponsePromise.fromPromise(this.__createOperator(request, requestOptions));
|
|
88
98
|
}
|
|
89
99
|
async __createOperator(request, requestOptions) {
|
|
100
|
+
const { "Idempotency-Key": idempotencyKey, body: _body } = request;
|
|
90
101
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
91
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
102
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
|
|
92
103
|
const _response = await core.fetcher({
|
|
93
104
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
94
105
|
(await core.Supplier.get(this._options.environment)) ??
|
|
@@ -98,7 +109,7 @@ class OperatorsClient {
|
|
|
98
109
|
contentType: "application/json",
|
|
99
110
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
100
111
|
requestType: "json",
|
|
101
|
-
body:
|
|
112
|
+
body: _body,
|
|
102
113
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
103
114
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
104
115
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -116,6 +127,8 @@ class OperatorsClient {
|
|
|
116
127
|
throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
117
128
|
case 403:
|
|
118
129
|
throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
130
|
+
case 409:
|
|
131
|
+
throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
|
|
119
132
|
case 422:
|
|
120
133
|
throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
121
134
|
case 429:
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type * as NizamDashboard from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
6
|
+
* body: {
|
|
7
|
+
* kind: "human"
|
|
8
|
+
* }
|
|
9
|
+
* }
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* {
|
|
13
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
14
|
+
* body: {
|
|
15
|
+
* kind: "autonomous",
|
|
16
|
+
* vendor: "Waymo",
|
|
17
|
+
* product: "Waymo Driver",
|
|
18
|
+
* version: "7.3",
|
|
19
|
+
* responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
|
|
20
|
+
* }
|
|
21
|
+
* }
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* {
|
|
25
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
26
|
+
* body: {
|
|
27
|
+
* kind: "teleoperated",
|
|
28
|
+
* controller_user_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
|
|
29
|
+
* responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
|
|
30
|
+
* }
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
export interface CreateOperatorBody {
|
|
34
|
+
/** Optional. Supply a UUID (canonical 8-4-4-4-12 form; lowercase v4 recommended) to make this operation idempotent: the same key on a retry replays the original outcome instead of creating a second resource. 2xx successes and deliberate 4xx domain rejections are cached and replayed for 24h when the request body matches; transient 5xx responses are never cached, so a retry with the same key re-executes. A malformed key is rejected with 400 `idempotency.invalid_key`; reusing a key with a different request body is 409 `idempotency.key_conflict`; a key still in flight is 409 `idempotency.in_progress`. Omit the header and the operation behaves like any other write. */
|
|
35
|
+
"Idempotency-Key"?: string;
|
|
36
|
+
body: NizamDashboard.CreateOperatorRequest;
|
|
37
|
+
}
|