@nizam-os/operator-sdk 2.9.0 → 4.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/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/notifications/client/Client.d.ts +93 -2
- package/dist/api/resources/notifications/client/Client.js +317 -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/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/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
|
@@ -41,6 +41,7 @@ export declare class FilesClient {
|
|
|
41
41
|
* @throws {@link NizamOperatorRuntime.BadRequestError}
|
|
42
42
|
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
43
43
|
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
44
|
+
* @throws {@link NizamOperatorRuntime.ConflictError}
|
|
44
45
|
* @throws {@link NizamOperatorRuntime.ContentTooLargeError}
|
|
45
46
|
* @throws {@link NizamOperatorRuntime.UnprocessableEntityError}
|
|
46
47
|
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
@@ -48,6 +49,7 @@ export declare class FilesClient {
|
|
|
48
49
|
*
|
|
49
50
|
* @example
|
|
50
51
|
* await client.files.initiateFileUpload({
|
|
52
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
51
53
|
* kind: "profile_picture",
|
|
52
54
|
* subject_type: "task_attempt",
|
|
53
55
|
* subject_id: "b3c4d5e6-7f8a-9b0c-1d2e-3f4a5b6c7d8e",
|
|
@@ -137,6 +137,7 @@ class FilesClient {
|
|
|
137
137
|
* @throws {@link NizamOperatorRuntime.BadRequestError}
|
|
138
138
|
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
139
139
|
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
140
|
+
* @throws {@link NizamOperatorRuntime.ConflictError}
|
|
140
141
|
* @throws {@link NizamOperatorRuntime.ContentTooLargeError}
|
|
141
142
|
* @throws {@link NizamOperatorRuntime.UnprocessableEntityError}
|
|
142
143
|
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
@@ -144,6 +145,7 @@ class FilesClient {
|
|
|
144
145
|
*
|
|
145
146
|
* @example
|
|
146
147
|
* await client.files.initiateFileUpload({
|
|
148
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
147
149
|
* kind: "profile_picture",
|
|
148
150
|
* subject_type: "task_attempt",
|
|
149
151
|
* subject_id: "b3c4d5e6-7f8a-9b0c-1d2e-3f4a5b6c7d8e",
|
|
@@ -157,8 +159,9 @@ class FilesClient {
|
|
|
157
159
|
return core.HttpResponsePromise.fromPromise(this.__initiateFileUpload(request, requestOptions));
|
|
158
160
|
}
|
|
159
161
|
async __initiateFileUpload(request, requestOptions) {
|
|
162
|
+
const { "Idempotency-Key": idempotencyKey, ..._body } = request;
|
|
160
163
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
161
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
164
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
|
|
162
165
|
const _response = await core.fetcher({
|
|
163
166
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
164
167
|
(await core.Supplier.get(this._options.environment)) ??
|
|
@@ -168,7 +171,7 @@ class FilesClient {
|
|
|
168
171
|
contentType: "application/json",
|
|
169
172
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
170
173
|
requestType: "json",
|
|
171
|
-
body:
|
|
174
|
+
body: _body,
|
|
172
175
|
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
173
176
|
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
174
177
|
abortSignal: requestOptions?.abortSignal,
|
|
@@ -189,6 +192,8 @@ class FilesClient {
|
|
|
189
192
|
throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
190
193
|
case 403:
|
|
191
194
|
throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
195
|
+
case 409:
|
|
196
|
+
throw new NizamOperatorRuntime.ConflictError(_response.error.body, _response.rawResponse);
|
|
192
197
|
case 413:
|
|
193
198
|
throw new NizamOperatorRuntime.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
194
199
|
case 422:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
4
5
|
* kind: "profile_picture",
|
|
5
6
|
* subject_type: "task_attempt",
|
|
6
7
|
* subject_id: "b3c4d5e6-7f8a-9b0c-1d2e-3f4a5b6c7d8e",
|
|
@@ -11,6 +12,8 @@
|
|
|
11
12
|
* }
|
|
12
13
|
*/
|
|
13
14
|
export interface InitiateFileUploadRequest {
|
|
15
|
+
/** 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. */
|
|
16
|
+
"Idempotency-Key"?: string;
|
|
14
17
|
/** What the bytes are for the platform — fixes the policy applied to them. */
|
|
15
18
|
kind: InitiateFileUploadRequest.Kind;
|
|
16
19
|
/** Type of the business entity this file documents (optional at upload time; can also be attached later). */
|
|
@@ -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
|
|
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 {NizamOperatorRuntime.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?: NizamOperatorRuntime.ListNotificationsRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.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 NizamOperatorRuntime.BadRequestError}
|
|
45
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
46
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
47
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
48
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* await client.notifications.archiveAllNotifications()
|
|
52
|
+
*/
|
|
53
|
+
archiveAllNotifications(requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.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 NizamOperatorRuntime.BadRequestError}
|
|
61
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
62
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
63
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
64
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* await client.notifications.getNotificationCounts()
|
|
68
|
+
*/
|
|
69
|
+
getNotificationCounts(requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.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<NizamOperatorRuntime.NotificationsMarkedRead>;
|
|
52
86
|
private __markAllNotificationsRead;
|
|
53
87
|
/**
|
|
54
|
-
* The unread badge count for the active organization.
|
|
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<NizamOperatorRuntime.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 {NizamOperatorRuntime.ArchiveNotificationRequest} request
|
|
107
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
|
+
*
|
|
109
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
110
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
111
|
+
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
112
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
113
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* await client.notifications.archiveNotification({
|
|
117
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
118
|
+
* })
|
|
119
|
+
*/
|
|
120
|
+
archiveNotification(request: NizamOperatorRuntime.ArchiveNotificationRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.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: NizamOperatorRuntime.MarkNotificationReadRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.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 {NizamOperatorRuntime.UnarchiveNotificationRequest} request
|
|
145
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
146
|
+
*
|
|
147
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
148
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
149
|
+
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
150
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
151
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* await client.notifications.unarchiveNotification({
|
|
155
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
156
|
+
* })
|
|
157
|
+
*/
|
|
158
|
+
unarchiveNotification(request: NizamOperatorRuntime.UnarchiveNotificationRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.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 {NizamOperatorRuntime.MarkNotificationUnreadRequest} request
|
|
164
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
165
|
+
*
|
|
166
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
167
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
168
|
+
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
169
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
170
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* await client.notifications.markNotificationUnread({
|
|
174
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
175
|
+
* })
|
|
176
|
+
*/
|
|
177
|
+
markNotificationUnread(request: NizamOperatorRuntime.MarkNotificationUnreadRequest, requestOptions?: NotificationsClient.RequestOptions): core.HttpResponsePromise<NizamOperatorRuntime.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
|
|
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 {NizamOperatorRuntime.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,128 @@ 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 NizamOperatorRuntime.BadRequestError}
|
|
142
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
143
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
144
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
145
|
+
* @throws {@link NizamOperatorRuntime.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.NizamOperatorRuntimeEnvironment.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 {
|
|
171
|
+
data: _response.body,
|
|
172
|
+
rawResponse: _response.rawResponse,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (_response.error.reason === "status-code") {
|
|
176
|
+
switch (_response.error.statusCode) {
|
|
177
|
+
case 400:
|
|
178
|
+
throw new NizamOperatorRuntime.BadRequestError(_response.error.body, _response.rawResponse);
|
|
179
|
+
case 401:
|
|
180
|
+
throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
181
|
+
case 403:
|
|
182
|
+
throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
183
|
+
case 429:
|
|
184
|
+
throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
185
|
+
case 500:
|
|
186
|
+
throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
|
|
187
|
+
default:
|
|
188
|
+
throw new errors.NizamOperatorRuntimeError({
|
|
189
|
+
statusCode: _response.error.statusCode,
|
|
190
|
+
body: _response.error.body,
|
|
191
|
+
rawResponse: _response.rawResponse,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/archive_all");
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* 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.
|
|
199
|
+
*
|
|
200
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
201
|
+
*
|
|
202
|
+
* @throws {@link NizamOperatorRuntime.BadRequestError}
|
|
203
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
204
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
205
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
206
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* await client.notifications.getNotificationCounts()
|
|
210
|
+
*/
|
|
211
|
+
getNotificationCounts(requestOptions) {
|
|
212
|
+
return core.HttpResponsePromise.fromPromise(this.__getNotificationCounts(requestOptions));
|
|
213
|
+
}
|
|
214
|
+
async __getNotificationCounts(requestOptions) {
|
|
215
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
216
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
217
|
+
const _response = await core.fetcher({
|
|
218
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
219
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
220
|
+
environments.NizamOperatorRuntimeEnvironment.Production, "v1/notifications/counts"),
|
|
221
|
+
method: "GET",
|
|
222
|
+
headers: _headers,
|
|
223
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
224
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
225
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
226
|
+
abortSignal: requestOptions?.abortSignal,
|
|
227
|
+
fetchFn: this._options?.fetch,
|
|
228
|
+
logging: this._options.logging,
|
|
229
|
+
});
|
|
230
|
+
if (_response.ok) {
|
|
231
|
+
return {
|
|
232
|
+
data: _response.body,
|
|
233
|
+
rawResponse: _response.rawResponse,
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
if (_response.error.reason === "status-code") {
|
|
237
|
+
switch (_response.error.statusCode) {
|
|
238
|
+
case 400:
|
|
239
|
+
throw new NizamOperatorRuntime.BadRequestError(_response.error.body, _response.rawResponse);
|
|
240
|
+
case 401:
|
|
241
|
+
throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
242
|
+
case 403:
|
|
243
|
+
throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
244
|
+
case 429:
|
|
245
|
+
throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
246
|
+
case 500:
|
|
247
|
+
throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
|
|
248
|
+
default:
|
|
249
|
+
throw new errors.NizamOperatorRuntimeError({
|
|
250
|
+
statusCode: _response.error.statusCode,
|
|
251
|
+
body: _response.error.body,
|
|
252
|
+
rawResponse: _response.rawResponse,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/notifications/counts");
|
|
257
|
+
}
|
|
131
258
|
/**
|
|
132
259
|
* 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
260
|
*
|
|
@@ -190,7 +317,7 @@ class NotificationsClient {
|
|
|
190
317
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/read_all");
|
|
191
318
|
}
|
|
192
319
|
/**
|
|
193
|
-
* The unread badge count for the active organization.
|
|
320
|
+
* The unread badge count for the active organization. Counts active (non-archived) unread notifications; excludes dismissed (soft-deleted) and archived ones.
|
|
194
321
|
*
|
|
195
322
|
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
196
323
|
*
|
|
@@ -250,6 +377,68 @@ class NotificationsClient {
|
|
|
250
377
|
}
|
|
251
378
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v1/notifications/unread_count");
|
|
252
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* 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.
|
|
382
|
+
*
|
|
383
|
+
* @param {NizamOperatorRuntime.ArchiveNotificationRequest} request
|
|
384
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
385
|
+
*
|
|
386
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
387
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
388
|
+
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
389
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
390
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* await client.notifications.archiveNotification({
|
|
394
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
395
|
+
* })
|
|
396
|
+
*/
|
|
397
|
+
archiveNotification(request, requestOptions) {
|
|
398
|
+
return core.HttpResponsePromise.fromPromise(this.__archiveNotification(request, requestOptions));
|
|
399
|
+
}
|
|
400
|
+
async __archiveNotification(request, requestOptions) {
|
|
401
|
+
const { id } = request;
|
|
402
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
403
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
404
|
+
const _response = await core.fetcher({
|
|
405
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
406
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
407
|
+
environments.NizamOperatorRuntimeEnvironment.Production, `v1/notifications/${core.url.encodePathParam(id)}/archive`),
|
|
408
|
+
method: "POST",
|
|
409
|
+
headers: _headers,
|
|
410
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
411
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
412
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
413
|
+
abortSignal: requestOptions?.abortSignal,
|
|
414
|
+
fetchFn: this._options?.fetch,
|
|
415
|
+
logging: this._options.logging,
|
|
416
|
+
});
|
|
417
|
+
if (_response.ok) {
|
|
418
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
419
|
+
}
|
|
420
|
+
if (_response.error.reason === "status-code") {
|
|
421
|
+
switch (_response.error.statusCode) {
|
|
422
|
+
case 401:
|
|
423
|
+
throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
424
|
+
case 403:
|
|
425
|
+
throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
426
|
+
case 404:
|
|
427
|
+
throw new NizamOperatorRuntime.NotFoundError(_response.error.body, _response.rawResponse);
|
|
428
|
+
case 429:
|
|
429
|
+
throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
430
|
+
case 500:
|
|
431
|
+
throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
|
|
432
|
+
default:
|
|
433
|
+
throw new errors.NizamOperatorRuntimeError({
|
|
434
|
+
statusCode: _response.error.statusCode,
|
|
435
|
+
body: _response.error.body,
|
|
436
|
+
rawResponse: _response.rawResponse,
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/archive");
|
|
441
|
+
}
|
|
253
442
|
/**
|
|
254
443
|
* 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
444
|
*
|
|
@@ -312,5 +501,129 @@ class NotificationsClient {
|
|
|
312
501
|
}
|
|
313
502
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/read");
|
|
314
503
|
}
|
|
504
|
+
/**
|
|
505
|
+
* Restores an archived notification to the active inbox — the inverse of archive. Idempotent. 404 if the notification is not the caller's.
|
|
506
|
+
*
|
|
507
|
+
* @param {NizamOperatorRuntime.UnarchiveNotificationRequest} request
|
|
508
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
509
|
+
*
|
|
510
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
511
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
512
|
+
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
513
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
514
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
515
|
+
*
|
|
516
|
+
* @example
|
|
517
|
+
* await client.notifications.unarchiveNotification({
|
|
518
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
519
|
+
* })
|
|
520
|
+
*/
|
|
521
|
+
unarchiveNotification(request, requestOptions) {
|
|
522
|
+
return core.HttpResponsePromise.fromPromise(this.__unarchiveNotification(request, requestOptions));
|
|
523
|
+
}
|
|
524
|
+
async __unarchiveNotification(request, requestOptions) {
|
|
525
|
+
const { id } = request;
|
|
526
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
527
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
528
|
+
const _response = await core.fetcher({
|
|
529
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
530
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
531
|
+
environments.NizamOperatorRuntimeEnvironment.Production, `v1/notifications/${core.url.encodePathParam(id)}/unarchive`),
|
|
532
|
+
method: "POST",
|
|
533
|
+
headers: _headers,
|
|
534
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
535
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
536
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
537
|
+
abortSignal: requestOptions?.abortSignal,
|
|
538
|
+
fetchFn: this._options?.fetch,
|
|
539
|
+
logging: this._options.logging,
|
|
540
|
+
});
|
|
541
|
+
if (_response.ok) {
|
|
542
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
543
|
+
}
|
|
544
|
+
if (_response.error.reason === "status-code") {
|
|
545
|
+
switch (_response.error.statusCode) {
|
|
546
|
+
case 401:
|
|
547
|
+
throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
548
|
+
case 403:
|
|
549
|
+
throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
550
|
+
case 404:
|
|
551
|
+
throw new NizamOperatorRuntime.NotFoundError(_response.error.body, _response.rawResponse);
|
|
552
|
+
case 429:
|
|
553
|
+
throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
554
|
+
case 500:
|
|
555
|
+
throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
|
|
556
|
+
default:
|
|
557
|
+
throw new errors.NizamOperatorRuntimeError({
|
|
558
|
+
statusCode: _response.error.statusCode,
|
|
559
|
+
body: _response.error.body,
|
|
560
|
+
rawResponse: _response.rawResponse,
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/unarchive");
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Flips a single notification back to unread — the inverse of mark-read. Idempotent. 404 if the notification is not the caller's.
|
|
568
|
+
*
|
|
569
|
+
* @param {NizamOperatorRuntime.MarkNotificationUnreadRequest} request
|
|
570
|
+
* @param {NotificationsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
571
|
+
*
|
|
572
|
+
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
573
|
+
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
574
|
+
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
575
|
+
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
576
|
+
* @throws {@link NizamOperatorRuntime.InternalServerError}
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* await client.notifications.markNotificationUnread({
|
|
580
|
+
* id: "00000000-0000-0000-0000-000000000000"
|
|
581
|
+
* })
|
|
582
|
+
*/
|
|
583
|
+
markNotificationUnread(request, requestOptions) {
|
|
584
|
+
return core.HttpResponsePromise.fromPromise(this.__markNotificationUnread(request, requestOptions));
|
|
585
|
+
}
|
|
586
|
+
async __markNotificationUnread(request, requestOptions) {
|
|
587
|
+
const { id } = request;
|
|
588
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
589
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
590
|
+
const _response = await core.fetcher({
|
|
591
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
592
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
593
|
+
environments.NizamOperatorRuntimeEnvironment.Production, `v1/notifications/${core.url.encodePathParam(id)}/unread`),
|
|
594
|
+
method: "POST",
|
|
595
|
+
headers: _headers,
|
|
596
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
597
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
598
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
599
|
+
abortSignal: requestOptions?.abortSignal,
|
|
600
|
+
fetchFn: this._options?.fetch,
|
|
601
|
+
logging: this._options.logging,
|
|
602
|
+
});
|
|
603
|
+
if (_response.ok) {
|
|
604
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
605
|
+
}
|
|
606
|
+
if (_response.error.reason === "status-code") {
|
|
607
|
+
switch (_response.error.statusCode) {
|
|
608
|
+
case 401:
|
|
609
|
+
throw new NizamOperatorRuntime.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
610
|
+
case 403:
|
|
611
|
+
throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
612
|
+
case 404:
|
|
613
|
+
throw new NizamOperatorRuntime.NotFoundError(_response.error.body, _response.rawResponse);
|
|
614
|
+
case 429:
|
|
615
|
+
throw new NizamOperatorRuntime.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
616
|
+
case 500:
|
|
617
|
+
throw new NizamOperatorRuntime.InternalServerError(_response.error.body, _response.rawResponse);
|
|
618
|
+
default:
|
|
619
|
+
throw new errors.NizamOperatorRuntimeError({
|
|
620
|
+
statusCode: _response.error.statusCode,
|
|
621
|
+
body: _response.error.body,
|
|
622
|
+
rawResponse: _response.rawResponse,
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v1/notifications/{id}/unread");
|
|
627
|
+
}
|
|
315
628
|
}
|
|
316
629
|
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";
|
|
@@ -42,6 +42,7 @@ export declare class TaskAttemptsClient {
|
|
|
42
42
|
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
43
43
|
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
44
44
|
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
45
|
+
* @throws {@link NizamOperatorRuntime.ConflictError}
|
|
45
46
|
* @throws {@link NizamOperatorRuntime.ContentTooLargeError}
|
|
46
47
|
* @throws {@link NizamOperatorRuntime.UnprocessableEntityError}
|
|
47
48
|
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
@@ -49,6 +50,7 @@ export declare class TaskAttemptsClient {
|
|
|
49
50
|
*
|
|
50
51
|
* @example
|
|
51
52
|
* await client.taskAttempts.captureTaskAttemptPhoto({
|
|
53
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
52
54
|
* attemptId: "00000000-0000-0000-0000-000000000000",
|
|
53
55
|
* filename: "delivery-door.jpg",
|
|
54
56
|
* content_type: "image/jpeg",
|
|
@@ -135,6 +135,7 @@ class TaskAttemptsClient {
|
|
|
135
135
|
* @throws {@link NizamOperatorRuntime.UnauthorizedError}
|
|
136
136
|
* @throws {@link NizamOperatorRuntime.ForbiddenError}
|
|
137
137
|
* @throws {@link NizamOperatorRuntime.NotFoundError}
|
|
138
|
+
* @throws {@link NizamOperatorRuntime.ConflictError}
|
|
138
139
|
* @throws {@link NizamOperatorRuntime.ContentTooLargeError}
|
|
139
140
|
* @throws {@link NizamOperatorRuntime.UnprocessableEntityError}
|
|
140
141
|
* @throws {@link NizamOperatorRuntime.TooManyRequestsError}
|
|
@@ -142,6 +143,7 @@ class TaskAttemptsClient {
|
|
|
142
143
|
*
|
|
143
144
|
* @example
|
|
144
145
|
* await client.taskAttempts.captureTaskAttemptPhoto({
|
|
146
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
145
147
|
* attemptId: "00000000-0000-0000-0000-000000000000",
|
|
146
148
|
* filename: "delivery-door.jpg",
|
|
147
149
|
* content_type: "image/jpeg",
|
|
@@ -157,9 +159,9 @@ class TaskAttemptsClient {
|
|
|
157
159
|
return core.HttpResponsePromise.fromPromise(this.__captureTaskAttemptPhoto(request, requestOptions));
|
|
158
160
|
}
|
|
159
161
|
async __captureTaskAttemptPhoto(request, requestOptions) {
|
|
160
|
-
const { attemptId, ..._body } = request;
|
|
162
|
+
const { attemptId, "Idempotency-Key": idempotencyKey, ..._body } = request;
|
|
161
163
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
162
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
164
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
|
|
163
165
|
const _response = await core.fetcher({
|
|
164
166
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
165
167
|
(await core.Supplier.get(this._options.environment)) ??
|
|
@@ -192,6 +194,8 @@ class TaskAttemptsClient {
|
|
|
192
194
|
throw new NizamOperatorRuntime.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
193
195
|
case 404:
|
|
194
196
|
throw new NizamOperatorRuntime.NotFoundError(_response.error.body, _response.rawResponse);
|
|
197
|
+
case 409:
|
|
198
|
+
throw new NizamOperatorRuntime.ConflictError(_response.error.body, _response.rawResponse);
|
|
195
199
|
case 413:
|
|
196
200
|
throw new NizamOperatorRuntime.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
197
201
|
case 422:
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
+
* "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
|
|
4
5
|
* attemptId: "00000000-0000-0000-0000-000000000000",
|
|
5
6
|
* filename: "delivery-door.jpg",
|
|
6
7
|
* content_type: "image/jpeg",
|
|
@@ -14,6 +15,8 @@
|
|
|
14
15
|
*/
|
|
15
16
|
export interface CaptureTaskAttemptPhotoRequest {
|
|
16
17
|
attemptId: string;
|
|
18
|
+
/** 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. */
|
|
19
|
+
"Idempotency-Key"?: string;
|
|
17
20
|
/** Original filename. */
|
|
18
21
|
filename: string;
|
|
19
22
|
/** Declared MIME type — POD photos accept image/jpeg, image/png, image/webp, image/heic, image/heif. */
|
|
@@ -5,9 +5,9 @@ export interface Device {
|
|
|
5
5
|
/** Device id. */
|
|
6
6
|
id?: string | undefined;
|
|
7
7
|
/** Push transport. */
|
|
8
|
-
platform?:
|
|
8
|
+
platform?: Device.Platform | undefined;
|
|
9
9
|
/** Registration lifecycle. */
|
|
10
|
-
status?:
|
|
10
|
+
status?: Device.Status | undefined;
|
|
11
11
|
/** When the device was first registered. */
|
|
12
12
|
registered_at?: string | undefined;
|
|
13
13
|
/** When the registration was last refreshed (last seen). */
|
|
@@ -16,6 +16,21 @@ export interface Device {
|
|
|
16
16
|
object?: Device.Object_ | undefined;
|
|
17
17
|
}
|
|
18
18
|
export declare namespace Device {
|
|
19
|
+
/** Push transport. */
|
|
20
|
+
const Platform: {
|
|
21
|
+
readonly Ios: "ios";
|
|
22
|
+
readonly Android: "android";
|
|
23
|
+
readonly Web: "web";
|
|
24
|
+
};
|
|
25
|
+
type Platform = (typeof Platform)[keyof typeof Platform];
|
|
26
|
+
/** Registration lifecycle. */
|
|
27
|
+
const Status: {
|
|
28
|
+
readonly Active: "active";
|
|
29
|
+
readonly Suspended: "suspended";
|
|
30
|
+
readonly Inactive: "inactive";
|
|
31
|
+
readonly Expired: "expired";
|
|
32
|
+
};
|
|
33
|
+
type Status = (typeof Status)[keyof typeof Status];
|
|
19
34
|
/** Object type discriminator. */
|
|
20
35
|
const Object_: {
|
|
21
36
|
readonly Device: "device";
|
package/dist/api/types/Device.js
CHANGED
|
@@ -4,6 +4,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.Device = void 0;
|
|
5
5
|
var Device;
|
|
6
6
|
(function (Device) {
|
|
7
|
+
/** Push transport. */
|
|
8
|
+
Device.Platform = {
|
|
9
|
+
Ios: "ios",
|
|
10
|
+
Android: "android",
|
|
11
|
+
Web: "web",
|
|
12
|
+
};
|
|
13
|
+
/** Registration lifecycle. */
|
|
14
|
+
Device.Status = {
|
|
15
|
+
Active: "active",
|
|
16
|
+
Suspended: "suspended",
|
|
17
|
+
Inactive: "inactive",
|
|
18
|
+
Expired: "expired",
|
|
19
|
+
};
|
|
7
20
|
/** Object type discriminator. */
|
|
8
21
|
Device.Object_ = {
|
|
9
22
|
Device: "device",
|
|
@@ -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 NizamOperatorRuntime 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?: NizamOperatorRuntime.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 = {}));
|
|
@@ -55,10 +55,13 @@ export * from "./MembershipChoice.js";
|
|
|
55
55
|
export * from "./MembershipDriftResponse.js";
|
|
56
56
|
export * from "./MqttToken.js";
|
|
57
57
|
export * from "./Notification.js";
|
|
58
|
+
export * from "./NotificationCategoryCount.js";
|
|
59
|
+
export * from "./NotificationCounts.js";
|
|
58
60
|
export * from "./NotificationDeadLetter.js";
|
|
59
61
|
export * from "./NotificationPreference.js";
|
|
60
62
|
export * from "./NotificationPreferenceItem.js";
|
|
61
63
|
export * from "./NotificationPreferences.js";
|
|
64
|
+
export * from "./NotificationsArchived.js";
|
|
62
65
|
export * from "./NotificationsMarkedRead.js";
|
|
63
66
|
export * from "./NotificationUnreadCount.js";
|
|
64
67
|
export * from "./OpenAssignmentRequest.js";
|
package/dist/api/types/index.js
CHANGED
|
@@ -71,10 +71,13 @@ __exportStar(require("./MembershipChoice.js"), exports);
|
|
|
71
71
|
__exportStar(require("./MembershipDriftResponse.js"), exports);
|
|
72
72
|
__exportStar(require("./MqttToken.js"), exports);
|
|
73
73
|
__exportStar(require("./Notification.js"), exports);
|
|
74
|
+
__exportStar(require("./NotificationCategoryCount.js"), exports);
|
|
75
|
+
__exportStar(require("./NotificationCounts.js"), exports);
|
|
74
76
|
__exportStar(require("./NotificationDeadLetter.js"), exports);
|
|
75
77
|
__exportStar(require("./NotificationPreference.js"), exports);
|
|
76
78
|
__exportStar(require("./NotificationPreferenceItem.js"), exports);
|
|
77
79
|
__exportStar(require("./NotificationPreferences.js"), exports);
|
|
80
|
+
__exportStar(require("./NotificationsArchived.js"), exports);
|
|
78
81
|
__exportStar(require("./NotificationsMarkedRead.js"), exports);
|
|
79
82
|
__exportStar(require("./NotificationUnreadCount.js"), exports);
|
|
80
83
|
__exportStar(require("./OpenAssignmentRequest.js"), exports);
|