@nizam-os/dashboard-sdk 9.0.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.
Files changed (32) hide show
  1. package/dist/api/resources/assets/client/Client.d.ts +5 -0
  2. package/dist/api/resources/assets/client/Client.js +10 -2
  3. package/dist/api/resources/assets/client/requests/CreateAssetRequest.d.ts +6 -0
  4. package/dist/api/resources/assignments/client/Client.d.ts +2 -0
  5. package/dist/api/resources/assignments/client/Client.js +5 -2
  6. package/dist/api/resources/assignments/client/requests/OpenAssignmentRequest.d.ts +4 -0
  7. package/dist/api/resources/files/client/Client.d.ts +2 -0
  8. package/dist/api/resources/files/client/Client.js +7 -2
  9. package/dist/api/resources/files/client/requests/InitiateFileUploadRequest.d.ts +3 -0
  10. package/dist/api/resources/imports/client/Client.d.ts +2 -0
  11. package/dist/api/resources/imports/client/Client.js +7 -2
  12. package/dist/api/resources/imports/client/requests/CreateImportRequest.d.ts +3 -0
  13. package/dist/api/resources/invites/client/Client.d.ts +5 -0
  14. package/dist/api/resources/invites/client/Client.js +12 -2
  15. package/dist/api/resources/invites/client/requests/CreateInviteRequest.d.ts +5 -0
  16. package/dist/api/resources/operators/client/Client.d.ts +21 -11
  17. package/dist/api/resources/operators/client/Client.js +25 -12
  18. package/dist/api/resources/operators/client/requests/CreateOperatorBody.d.ts +37 -0
  19. package/dist/api/resources/operators/client/requests/CreateOperatorBody.js +3 -0
  20. package/dist/api/resources/operators/client/requests/index.d.ts +1 -0
  21. package/dist/api/resources/organizations/client/Client.d.ts +2 -2
  22. package/dist/api/resources/organizations/client/Client.js +5 -4
  23. package/dist/api/resources/organizations/client/requests/CreateOrganizationRequest.d.ts +4 -0
  24. package/dist/api/resources/taskAttempts/client/Client.d.ts +2 -0
  25. package/dist/api/resources/taskAttempts/client/Client.js +6 -2
  26. package/dist/api/resources/taskAttempts/client/requests/CaptureTaskAttemptPhotoRequest.d.ts +3 -0
  27. package/dist/api/resources/users/client/Client.d.ts +3 -0
  28. package/dist/api/resources/users/client/Client.js +8 -2
  29. package/dist/api/resources/users/client/requests/InviteUserRequest.d.ts +4 -0
  30. package/dist/api/types/Device.d.ts +17 -2
  31. package/dist/api/types/Device.js +13 -0
  32. package/package.json +1 -1
@@ -43,12 +43,14 @@ export declare class AssetsClient {
43
43
  * @throws {@link NizamDashboard.BadRequestError}
44
44
  * @throws {@link NizamDashboard.UnauthorizedError}
45
45
  * @throws {@link NizamDashboard.ForbiddenError}
46
+ * @throws {@link NizamDashboard.ConflictError}
46
47
  * @throws {@link NizamDashboard.UnprocessableEntityError}
47
48
  * @throws {@link NizamDashboard.TooManyRequestsError}
48
49
  * @throws {@link NizamDashboard.InternalServerError}
49
50
  *
50
51
  * @example
51
52
  * await client.assets.createAsset({
53
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
52
54
  * kind: "ground_vehicle",
53
55
  * name: "Truck 7",
54
56
  * autonomy_level: 0
@@ -56,6 +58,7 @@ export declare class AssetsClient {
56
58
  *
57
59
  * @example
58
60
  * await client.assets.createAsset({
61
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
59
62
  * kind: "aerial_vehicle",
60
63
  * name: "Delivery Drone D-12",
61
64
  * autonomy_level: 4
@@ -63,6 +66,7 @@ export declare class AssetsClient {
63
66
  *
64
67
  * @example
65
68
  * await client.assets.createAsset({
69
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
66
70
  * kind: "robot",
67
71
  * name: "Picker Bot 3",
68
72
  * autonomy_level: 5
@@ -70,6 +74,7 @@ export declare class AssetsClient {
70
74
  *
71
75
  * @example
72
76
  * await client.assets.createAsset({
77
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
73
78
  * kind: "container"
74
79
  * })
75
80
  */
@@ -139,12 +139,14 @@ class AssetsClient {
139
139
  * @throws {@link NizamDashboard.BadRequestError}
140
140
  * @throws {@link NizamDashboard.UnauthorizedError}
141
141
  * @throws {@link NizamDashboard.ForbiddenError}
142
+ * @throws {@link NizamDashboard.ConflictError}
142
143
  * @throws {@link NizamDashboard.UnprocessableEntityError}
143
144
  * @throws {@link NizamDashboard.TooManyRequestsError}
144
145
  * @throws {@link NizamDashboard.InternalServerError}
145
146
  *
146
147
  * @example
147
148
  * await client.assets.createAsset({
149
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
148
150
  * kind: "ground_vehicle",
149
151
  * name: "Truck 7",
150
152
  * autonomy_level: 0
@@ -152,6 +154,7 @@ class AssetsClient {
152
154
  *
153
155
  * @example
154
156
  * await client.assets.createAsset({
157
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
155
158
  * kind: "aerial_vehicle",
156
159
  * name: "Delivery Drone D-12",
157
160
  * autonomy_level: 4
@@ -159,6 +162,7 @@ class AssetsClient {
159
162
  *
160
163
  * @example
161
164
  * await client.assets.createAsset({
165
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
162
166
  * kind: "robot",
163
167
  * name: "Picker Bot 3",
164
168
  * autonomy_level: 5
@@ -166,6 +170,7 @@ class AssetsClient {
166
170
  *
167
171
  * @example
168
172
  * await client.assets.createAsset({
173
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
169
174
  * kind: "container"
170
175
  * })
171
176
  */
@@ -173,8 +178,9 @@ class AssetsClient {
173
178
  return core.HttpResponsePromise.fromPromise(this.__createAsset(request, requestOptions));
174
179
  }
175
180
  async __createAsset(request, requestOptions) {
181
+ const { "Idempotency-Key": idempotencyKey, ..._body } = request;
176
182
  const _authRequest = await this._options.authProvider.getAuthRequest();
177
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
183
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
178
184
  const _response = await core.fetcher({
179
185
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
180
186
  (await core.Supplier.get(this._options.environment)) ??
@@ -184,7 +190,7 @@ class AssetsClient {
184
190
  contentType: "application/json",
185
191
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
186
192
  requestType: "json",
187
- body: request,
193
+ body: _body,
188
194
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
189
195
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
190
196
  abortSignal: requestOptions?.abortSignal,
@@ -202,6 +208,8 @@ class AssetsClient {
202
208
  throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
203
209
  case 403:
204
210
  throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
211
+ case 409:
212
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
205
213
  case 422:
206
214
  throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
207
215
  case 429:
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
4
5
  * kind: "ground_vehicle",
5
6
  * name: "Truck 7",
6
7
  * autonomy_level: 0
@@ -8,6 +9,7 @@
8
9
  *
9
10
  * @example
10
11
  * {
12
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
11
13
  * kind: "aerial_vehicle",
12
14
  * name: "Delivery Drone D-12",
13
15
  * autonomy_level: 4
@@ -15,6 +17,7 @@
15
17
  *
16
18
  * @example
17
19
  * {
20
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
18
21
  * kind: "robot",
19
22
  * name: "Picker Bot 3",
20
23
  * autonomy_level: 5
@@ -22,10 +25,13 @@
22
25
  *
23
26
  * @example
24
27
  * {
28
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
25
29
  * kind: "container"
26
30
  * }
27
31
  */
28
32
  export interface CreateAssetRequest {
33
+ /** 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. */
34
+ "Idempotency-Key"?: string;
29
35
  /** Top-level kind. */
30
36
  kind: CreateAssetRequest.Kind;
31
37
  /** Display name. */
@@ -29,6 +29,7 @@ export declare class AssignmentsClient {
29
29
  *
30
30
  * @example
31
31
  * await client.assignments.openAssignment({
32
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
32
33
  * asset_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
33
34
  * operator_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
34
35
  * role: "primary"
@@ -36,6 +37,7 @@ export declare class AssignmentsClient {
36
37
  *
37
38
  * @example
38
39
  * await client.assignments.openAssignment({
40
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
39
41
  * asset_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
40
42
  * operator_id: "d2e3f4a5-6b7c-8d9e-0f1a-2b3c4d5e6f7a",
41
43
  * role: "safety_monitor"
@@ -65,6 +65,7 @@ class AssignmentsClient {
65
65
  *
66
66
  * @example
67
67
  * await client.assignments.openAssignment({
68
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
68
69
  * asset_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
69
70
  * operator_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
70
71
  * role: "primary"
@@ -72,6 +73,7 @@ class AssignmentsClient {
72
73
  *
73
74
  * @example
74
75
  * await client.assignments.openAssignment({
76
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
75
77
  * asset_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
76
78
  * operator_id: "d2e3f4a5-6b7c-8d9e-0f1a-2b3c4d5e6f7a",
77
79
  * role: "safety_monitor"
@@ -81,8 +83,9 @@ class AssignmentsClient {
81
83
  return core.HttpResponsePromise.fromPromise(this.__openAssignment(request, requestOptions));
82
84
  }
83
85
  async __openAssignment(request, requestOptions) {
86
+ const { "Idempotency-Key": idempotencyKey, ..._body } = request;
84
87
  const _authRequest = await this._options.authProvider.getAuthRequest();
85
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
88
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
86
89
  const _response = await core.fetcher({
87
90
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
88
91
  (await core.Supplier.get(this._options.environment)) ??
@@ -92,7 +95,7 @@ class AssignmentsClient {
92
95
  contentType: "application/json",
93
96
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
94
97
  requestType: "json",
95
- body: request,
98
+ body: _body,
96
99
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
97
100
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
98
101
  abortSignal: requestOptions?.abortSignal,
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
4
5
  * asset_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
5
6
  * operator_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
6
7
  * role: "primary"
@@ -8,12 +9,15 @@
8
9
  *
9
10
  * @example
10
11
  * {
12
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
11
13
  * asset_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
12
14
  * operator_id: "d2e3f4a5-6b7c-8d9e-0f1a-2b3c4d5e6f7a",
13
15
  * role: "safety_monitor"
14
16
  * }
15
17
  */
16
18
  export interface OpenAssignmentRequest {
19
+ /** 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. */
20
+ "Idempotency-Key"?: string;
17
21
  /** Asset id. */
18
22
  asset_id: string;
19
23
  /** Operator id. */
@@ -41,6 +41,7 @@ export declare class FilesClient {
41
41
  * @throws {@link NizamDashboard.BadRequestError}
42
42
  * @throws {@link NizamDashboard.UnauthorizedError}
43
43
  * @throws {@link NizamDashboard.ForbiddenError}
44
+ * @throws {@link NizamDashboard.ConflictError}
44
45
  * @throws {@link NizamDashboard.ContentTooLargeError}
45
46
  * @throws {@link NizamDashboard.UnprocessableEntityError}
46
47
  * @throws {@link NizamDashboard.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",
@@ -134,6 +134,7 @@ class FilesClient {
134
134
  * @throws {@link NizamDashboard.BadRequestError}
135
135
  * @throws {@link NizamDashboard.UnauthorizedError}
136
136
  * @throws {@link NizamDashboard.ForbiddenError}
137
+ * @throws {@link NizamDashboard.ConflictError}
137
138
  * @throws {@link NizamDashboard.ContentTooLargeError}
138
139
  * @throws {@link NizamDashboard.UnprocessableEntityError}
139
140
  * @throws {@link NizamDashboard.TooManyRequestsError}
@@ -141,6 +142,7 @@ class FilesClient {
141
142
  *
142
143
  * @example
143
144
  * await client.files.initiateFileUpload({
145
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
144
146
  * kind: "profile_picture",
145
147
  * subject_type: "task_attempt",
146
148
  * subject_id: "b3c4d5e6-7f8a-9b0c-1d2e-3f4a5b6c7d8e",
@@ -154,8 +156,9 @@ class FilesClient {
154
156
  return core.HttpResponsePromise.fromPromise(this.__initiateFileUpload(request, requestOptions));
155
157
  }
156
158
  async __initiateFileUpload(request, requestOptions) {
159
+ const { "Idempotency-Key": idempotencyKey, ..._body } = request;
157
160
  const _authRequest = await this._options.authProvider.getAuthRequest();
158
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
161
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
159
162
  const _response = await core.fetcher({
160
163
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
161
164
  (await core.Supplier.get(this._options.environment)) ??
@@ -165,7 +168,7 @@ class FilesClient {
165
168
  contentType: "application/json",
166
169
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
167
170
  requestType: "json",
168
- body: request,
171
+ body: _body,
169
172
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
170
173
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
171
174
  abortSignal: requestOptions?.abortSignal,
@@ -183,6 +186,8 @@ class FilesClient {
183
186
  throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
184
187
  case 403:
185
188
  throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
189
+ case 409:
190
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
186
191
  case 413:
187
192
  throw new NizamDashboard.ContentTooLargeError(_response.error.body, _response.rawResponse);
188
193
  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). */
@@ -19,6 +19,7 @@ export declare class ImportsClient {
19
19
  * @throws {@link NizamDashboard.BadRequestError}
20
20
  * @throws {@link NizamDashboard.UnauthorizedError}
21
21
  * @throws {@link NizamDashboard.ForbiddenError}
22
+ * @throws {@link NizamDashboard.ConflictError}
22
23
  * @throws {@link NizamDashboard.ContentTooLargeError}
23
24
  * @throws {@link NizamDashboard.UnprocessableEntityError}
24
25
  * @throws {@link NizamDashboard.TooManyRequestsError}
@@ -26,6 +27,7 @@ export declare class ImportsClient {
26
27
  *
27
28
  * @example
28
29
  * await client.imports.createImport({
30
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
29
31
  * kind: "import_fleet_assets_xlsx",
30
32
  * filename: "fleet-assets.xlsx",
31
33
  * content_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
@@ -55,6 +55,7 @@ class ImportsClient {
55
55
  * @throws {@link NizamDashboard.BadRequestError}
56
56
  * @throws {@link NizamDashboard.UnauthorizedError}
57
57
  * @throws {@link NizamDashboard.ForbiddenError}
58
+ * @throws {@link NizamDashboard.ConflictError}
58
59
  * @throws {@link NizamDashboard.ContentTooLargeError}
59
60
  * @throws {@link NizamDashboard.UnprocessableEntityError}
60
61
  * @throws {@link NizamDashboard.TooManyRequestsError}
@@ -62,6 +63,7 @@ class ImportsClient {
62
63
  *
63
64
  * @example
64
65
  * await client.imports.createImport({
66
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
65
67
  * kind: "import_fleet_assets_xlsx",
66
68
  * filename: "fleet-assets.xlsx",
67
69
  * content_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
@@ -73,8 +75,9 @@ class ImportsClient {
73
75
  return core.HttpResponsePromise.fromPromise(this.__createImport(request, requestOptions));
74
76
  }
75
77
  async __createImport(request, requestOptions) {
78
+ const { "Idempotency-Key": idempotencyKey, ..._body } = request;
76
79
  const _authRequest = await this._options.authProvider.getAuthRequest();
77
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
80
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
78
81
  const _response = await core.fetcher({
79
82
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
80
83
  (await core.Supplier.get(this._options.environment)) ??
@@ -84,7 +87,7 @@ class ImportsClient {
84
87
  contentType: "application/json",
85
88
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
86
89
  requestType: "json",
87
- body: request,
90
+ body: _body,
88
91
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
89
92
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
90
93
  abortSignal: requestOptions?.abortSignal,
@@ -102,6 +105,8 @@ class ImportsClient {
102
105
  throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
103
106
  case 403:
104
107
  throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
108
+ case 409:
109
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
105
110
  case 413:
106
111
  throw new NizamDashboard.ContentTooLargeError(_response.error.body, _response.rawResponse);
107
112
  case 422:
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
4
5
  * kind: "import_fleet_assets_xlsx",
5
6
  * filename: "fleet-assets.xlsx",
6
7
  * content_type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
@@ -9,6 +10,8 @@
9
10
  * }
10
11
  */
11
12
  export interface CreateImportRequest {
13
+ /** 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. */
14
+ "Idempotency-Key"?: string;
12
15
  /** The import kind to run (lowercase). */
13
16
  kind: string;
14
17
  /** Original filename of the source file. */
@@ -19,14 +19,17 @@ export declare class InvitesClient {
19
19
  * @param {NizamDashboard.CreateInviteRequest} request
20
20
  * @param {InvitesClient.RequestOptions} requestOptions - Request-specific configuration.
21
21
  *
22
+ * @throws {@link NizamDashboard.BadRequestError}
22
23
  * @throws {@link NizamDashboard.UnauthorizedError}
23
24
  * @throws {@link NizamDashboard.ForbiddenError}
25
+ * @throws {@link NizamDashboard.ConflictError}
24
26
  * @throws {@link NizamDashboard.UnprocessableEntityError}
25
27
  * @throws {@link NizamDashboard.TooManyRequestsError}
26
28
  * @throws {@link NizamDashboard.InternalServerError}
27
29
  *
28
30
  * @example
29
31
  * await client.invites.createInvite({
32
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
30
33
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
31
34
  * email: "ali@nizam.ai",
32
35
  * role: "admin"
@@ -34,6 +37,7 @@ export declare class InvitesClient {
34
37
  *
35
38
  * @example
36
39
  * await client.invites.createInvite({
40
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
37
41
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
38
42
  * email: "jordan@example.com",
39
43
  * role: "dispatcher",
@@ -42,6 +46,7 @@ export declare class InvitesClient {
42
46
  *
43
47
  * @example
44
48
  * await client.invites.createInvite({
49
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
45
50
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
46
51
  * email: "auditor@partner.example",
47
52
  * role: "viewer",
@@ -55,14 +55,17 @@ class InvitesClient {
55
55
  * @param {NizamDashboard.CreateInviteRequest} request
56
56
  * @param {InvitesClient.RequestOptions} requestOptions - Request-specific configuration.
57
57
  *
58
+ * @throws {@link NizamDashboard.BadRequestError}
58
59
  * @throws {@link NizamDashboard.UnauthorizedError}
59
60
  * @throws {@link NizamDashboard.ForbiddenError}
61
+ * @throws {@link NizamDashboard.ConflictError}
60
62
  * @throws {@link NizamDashboard.UnprocessableEntityError}
61
63
  * @throws {@link NizamDashboard.TooManyRequestsError}
62
64
  * @throws {@link NizamDashboard.InternalServerError}
63
65
  *
64
66
  * @example
65
67
  * await client.invites.createInvite({
68
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
66
69
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
67
70
  * email: "ali@nizam.ai",
68
71
  * role: "admin"
@@ -70,6 +73,7 @@ class InvitesClient {
70
73
  *
71
74
  * @example
72
75
  * await client.invites.createInvite({
76
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
73
77
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
74
78
  * email: "jordan@example.com",
75
79
  * role: "dispatcher",
@@ -78,6 +82,7 @@ class InvitesClient {
78
82
  *
79
83
  * @example
80
84
  * await client.invites.createInvite({
85
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
81
86
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
82
87
  * email: "auditor@partner.example",
83
88
  * role: "viewer",
@@ -88,8 +93,9 @@ class InvitesClient {
88
93
  return core.HttpResponsePromise.fromPromise(this.__createInvite(request, requestOptions));
89
94
  }
90
95
  async __createInvite(request, requestOptions) {
96
+ const { "Idempotency-Key": idempotencyKey, ..._body } = request;
91
97
  const _authRequest = await this._options.authProvider.getAuthRequest();
92
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
98
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
93
99
  const _response = await core.fetcher({
94
100
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
95
101
  (await core.Supplier.get(this._options.environment)) ??
@@ -99,7 +105,7 @@ class InvitesClient {
99
105
  contentType: "application/json",
100
106
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
101
107
  requestType: "json",
102
- body: request,
108
+ body: _body,
103
109
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
104
110
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
105
111
  abortSignal: requestOptions?.abortSignal,
@@ -111,10 +117,14 @@ class InvitesClient {
111
117
  }
112
118
  if (_response.error.reason === "status-code") {
113
119
  switch (_response.error.statusCode) {
120
+ case 400:
121
+ throw new NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
114
122
  case 401:
115
123
  throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
116
124
  case 403:
117
125
  throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
126
+ case 409:
127
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
118
128
  case 422:
119
129
  throw new NizamDashboard.UnprocessableEntityError(_response.error.body, _response.rawResponse);
120
130
  case 429:
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
4
5
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
5
6
  * email: "ali@nizam.ai",
6
7
  * role: "admin"
@@ -8,6 +9,7 @@
8
9
  *
9
10
  * @example
10
11
  * {
12
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
11
13
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
12
14
  * email: "jordan@example.com",
13
15
  * role: "dispatcher",
@@ -16,6 +18,7 @@
16
18
  *
17
19
  * @example
18
20
  * {
21
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
19
22
  * organization_id: "8f55f0eb-7d3a-4f2c-9c8d-a1b2c3d4e5f6",
20
23
  * email: "auditor@partner.example",
21
24
  * role: "viewer",
@@ -23,6 +26,8 @@
23
26
  * }
24
27
  */
25
28
  export interface CreateInviteRequest {
29
+ /** 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. */
30
+ "Idempotency-Key"?: string;
26
31
  /** Organization the invite is for. */
27
32
  organization_id: string;
28
33
  /** Recipient email. */
@@ -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.CreateOperatorRequest} request
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
- * kind: "human"
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
- * kind: "autonomous",
37
- * vendor: "Waymo",
38
- * product: "Waymo Driver",
39
- * version: "7.3",
40
- * responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
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
- * kind: "teleoperated",
46
- * controller_user_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
47
- * responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
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.CreateOperatorRequest, requestOptions?: OperatorsClient.RequestOptions): core.HttpResponsePromise<NizamDashboard.Operator>;
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.CreateOperatorRequest} request
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
- * kind: "human"
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
- * kind: "autonomous",
73
- * vendor: "Waymo",
74
- * product: "Waymo Driver",
75
- * version: "7.3",
76
- * responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
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
- * kind: "teleoperated",
82
- * controller_user_id: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f",
83
- * responsible_party: "c1d2e3f4-5a6b-7c8d-9e0f-1a2b3c4d5e6f"
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: request,
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
+ }
@@ -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 +1,2 @@
1
+ export type { CreateOperatorBody } from "./CreateOperatorBody.js";
1
2
  export type { GetOperatorRequest } from "./GetOperatorRequest.js";
@@ -35,8 +35,6 @@ export declare class OrganizationsClient {
35
35
  /**
36
36
  * Creates a brand-new tenant with the calling user as the founding admin. The id is assigned by Keycloak so the same value identifies the organization in both systems. Slug is derived from the name when not supplied.
37
37
  *
38
- * Supports the standard `Idempotency-Key` header — submit a UUID (v4 recommended) per logical attempt (same value on retry); malformed keys are rejected with 400 `idempotency.invalid_key`. Successful responses and 4xx domain rejections replay for matching request bodies; transient 5xx responses are never cached, so retrying with the same key re-executes. Mismatching fingerprints surface as 409 `idempotency.key_conflict`.
39
- *
40
38
  * @param {NizamDashboard.CreateOrganizationRequest} request
41
39
  * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
42
40
  *
@@ -50,11 +48,13 @@ export declare class OrganizationsClient {
50
48
  *
51
49
  * @example
52
50
  * await client.organizations.createOrganization({
51
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
53
52
  * name: "Acme Logistics"
54
53
  * })
55
54
  *
56
55
  * @example
57
56
  * await client.organizations.createOrganization({
57
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
58
58
  * name: "Acme Logistics",
59
59
  * slug: "acme-logistics",
60
60
  * primary_domain: "acme.com",
@@ -125,8 +125,6 @@ class OrganizationsClient {
125
125
  /**
126
126
  * Creates a brand-new tenant with the calling user as the founding admin. The id is assigned by Keycloak so the same value identifies the organization in both systems. Slug is derived from the name when not supplied.
127
127
  *
128
- * Supports the standard `Idempotency-Key` header — submit a UUID (v4 recommended) per logical attempt (same value on retry); malformed keys are rejected with 400 `idempotency.invalid_key`. Successful responses and 4xx domain rejections replay for matching request bodies; transient 5xx responses are never cached, so retrying with the same key re-executes. Mismatching fingerprints surface as 409 `idempotency.key_conflict`.
129
- *
130
128
  * @param {NizamDashboard.CreateOrganizationRequest} request
131
129
  * @param {OrganizationsClient.RequestOptions} requestOptions - Request-specific configuration.
132
130
  *
@@ -140,11 +138,13 @@ class OrganizationsClient {
140
138
  *
141
139
  * @example
142
140
  * await client.organizations.createOrganization({
141
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
143
142
  * name: "Acme Logistics"
144
143
  * })
145
144
  *
146
145
  * @example
147
146
  * await client.organizations.createOrganization({
147
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
148
148
  * name: "Acme Logistics",
149
149
  * slug: "acme-logistics",
150
150
  * primary_domain: "acme.com",
@@ -158,8 +158,9 @@ class OrganizationsClient {
158
158
  return core.HttpResponsePromise.fromPromise(this.__createOrganization(request, requestOptions));
159
159
  }
160
160
  async __createOrganization(request, requestOptions) {
161
+ const { "Idempotency-Key": idempotencyKey, ..._body } = request;
161
162
  const _authRequest = await this._options.authProvider.getAuthRequest();
162
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
163
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
163
164
  const _response = await core.fetcher({
164
165
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
165
166
  (await core.Supplier.get(this._options.environment)) ??
@@ -169,7 +170,7 @@ class OrganizationsClient {
169
170
  contentType: "application/json",
170
171
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
171
172
  requestType: "json",
172
- body: request,
173
+ body: _body,
173
174
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
174
175
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
175
176
  abortSignal: requestOptions?.abortSignal,
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
4
5
  * name: "Acme Logistics"
5
6
  * }
6
7
  *
7
8
  * @example
8
9
  * {
10
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
9
11
  * name: "Acme Logistics",
10
12
  * slug: "acme-logistics",
11
13
  * primary_domain: "acme.com",
@@ -16,6 +18,8 @@
16
18
  * }
17
19
  */
18
20
  export interface CreateOrganizationRequest {
21
+ /** 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. */
22
+ "Idempotency-Key"?: string;
19
23
  /** Display name of the organization. */
20
24
  name: string;
21
25
  /** Optional URL-safe slug. When omitted, the server derives one from the name. */
@@ -42,6 +42,7 @@ export declare class TaskAttemptsClient {
42
42
  * @throws {@link NizamDashboard.UnauthorizedError}
43
43
  * @throws {@link NizamDashboard.ForbiddenError}
44
44
  * @throws {@link NizamDashboard.NotFoundError}
45
+ * @throws {@link NizamDashboard.ConflictError}
45
46
  * @throws {@link NizamDashboard.ContentTooLargeError}
46
47
  * @throws {@link NizamDashboard.UnprocessableEntityError}
47
48
  * @throws {@link NizamDashboard.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",
@@ -132,6 +132,7 @@ class TaskAttemptsClient {
132
132
  * @throws {@link NizamDashboard.UnauthorizedError}
133
133
  * @throws {@link NizamDashboard.ForbiddenError}
134
134
  * @throws {@link NizamDashboard.NotFoundError}
135
+ * @throws {@link NizamDashboard.ConflictError}
135
136
  * @throws {@link NizamDashboard.ContentTooLargeError}
136
137
  * @throws {@link NizamDashboard.UnprocessableEntityError}
137
138
  * @throws {@link NizamDashboard.TooManyRequestsError}
@@ -139,6 +140,7 @@ class TaskAttemptsClient {
139
140
  *
140
141
  * @example
141
142
  * await client.taskAttempts.captureTaskAttemptPhoto({
143
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
142
144
  * attemptId: "00000000-0000-0000-0000-000000000000",
143
145
  * filename: "delivery-door.jpg",
144
146
  * content_type: "image/jpeg",
@@ -154,9 +156,9 @@ class TaskAttemptsClient {
154
156
  return core.HttpResponsePromise.fromPromise(this.__captureTaskAttemptPhoto(request, requestOptions));
155
157
  }
156
158
  async __captureTaskAttemptPhoto(request, requestOptions) {
157
- const { attemptId, ..._body } = request;
159
+ const { attemptId, "Idempotency-Key": idempotencyKey, ..._body } = request;
158
160
  const _authRequest = await this._options.authProvider.getAuthRequest();
159
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
161
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
160
162
  const _response = await core.fetcher({
161
163
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
162
164
  (await core.Supplier.get(this._options.environment)) ??
@@ -186,6 +188,8 @@ class TaskAttemptsClient {
186
188
  throw new NizamDashboard.ForbiddenError(_response.error.body, _response.rawResponse);
187
189
  case 404:
188
190
  throw new NizamDashboard.NotFoundError(_response.error.body, _response.rawResponse);
191
+ case 409:
192
+ throw new NizamDashboard.ConflictError(_response.error.body, _response.rawResponse);
189
193
  case 413:
190
194
  throw new NizamDashboard.ContentTooLargeError(_response.error.body, _response.rawResponse);
191
195
  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. */
@@ -88,6 +88,7 @@ export declare class UsersClient {
88
88
  * @param {NizamDashboard.InviteUserRequest} request
89
89
  * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
90
90
  *
91
+ * @throws {@link NizamDashboard.BadRequestError}
91
92
  * @throws {@link NizamDashboard.UnauthorizedError}
92
93
  * @throws {@link NizamDashboard.ForbiddenError}
93
94
  * @throws {@link NizamDashboard.ConflictError}
@@ -97,12 +98,14 @@ export declare class UsersClient {
97
98
  *
98
99
  * @example
99
100
  * await client.users.inviteUser({
101
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
100
102
  * email: "newhire@acme.example",
101
103
  * name: "New Hire"
102
104
  * })
103
105
  *
104
106
  * @example
105
107
  * await client.users.inviteUser({
108
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
106
109
  * email: "newhire@acme.example"
107
110
  * })
108
111
  */
@@ -271,6 +271,7 @@ class UsersClient {
271
271
  * @param {NizamDashboard.InviteUserRequest} request
272
272
  * @param {UsersClient.RequestOptions} requestOptions - Request-specific configuration.
273
273
  *
274
+ * @throws {@link NizamDashboard.BadRequestError}
274
275
  * @throws {@link NizamDashboard.UnauthorizedError}
275
276
  * @throws {@link NizamDashboard.ForbiddenError}
276
277
  * @throws {@link NizamDashboard.ConflictError}
@@ -280,12 +281,14 @@ class UsersClient {
280
281
  *
281
282
  * @example
282
283
  * await client.users.inviteUser({
284
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
283
285
  * email: "newhire@acme.example",
284
286
  * name: "New Hire"
285
287
  * })
286
288
  *
287
289
  * @example
288
290
  * await client.users.inviteUser({
291
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
289
292
  * email: "newhire@acme.example"
290
293
  * })
291
294
  */
@@ -293,8 +296,9 @@ class UsersClient {
293
296
  return core.HttpResponsePromise.fromPromise(this.__inviteUser(request, requestOptions));
294
297
  }
295
298
  async __inviteUser(request, requestOptions) {
299
+ const { "Idempotency-Key": idempotencyKey, ..._body } = request;
296
300
  const _authRequest = await this._options.authProvider.getAuthRequest();
297
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, requestOptions?.headers);
301
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey }), requestOptions?.headers);
298
302
  const _response = await core.fetcher({
299
303
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
300
304
  (await core.Supplier.get(this._options.environment)) ??
@@ -304,7 +308,7 @@ class UsersClient {
304
308
  contentType: "application/json",
305
309
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
306
310
  requestType: "json",
307
- body: request,
311
+ body: _body,
308
312
  timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
309
313
  maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
310
314
  abortSignal: requestOptions?.abortSignal,
@@ -316,6 +320,8 @@ class UsersClient {
316
320
  }
317
321
  if (_response.error.reason === "status-code") {
318
322
  switch (_response.error.statusCode) {
323
+ case 400:
324
+ throw new NizamDashboard.BadRequestError(_response.error.body, _response.rawResponse);
319
325
  case 401:
320
326
  throw new NizamDashboard.UnauthorizedError(_response.error.body, _response.rawResponse);
321
327
  case 403:
@@ -1,16 +1,20 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
4
5
  * email: "newhire@acme.example",
5
6
  * name: "New Hire"
6
7
  * }
7
8
  *
8
9
  * @example
9
10
  * {
11
+ * "Idempotency-Key": "9f1e6d2a-7c3b-4e5f-8a91-0b2c3d4e5f60",
10
12
  * email: "newhire@acme.example"
11
13
  * }
12
14
  */
13
15
  export interface InviteUserRequest {
16
+ /** 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. */
17
+ "Idempotency-Key"?: string;
14
18
  /** Recipient email. */
15
19
  email: string;
16
20
  /** Display name (optional). */
@@ -5,9 +5,9 @@ export interface Device {
5
5
  /** Device id. */
6
6
  id?: string | undefined;
7
7
  /** Push transport. */
8
- platform?: string | undefined;
8
+ platform?: Device.Platform | undefined;
9
9
  /** Registration lifecycle. */
10
- status?: string | undefined;
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";
@@ -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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nizam-os/dashboard-sdk",
3
- "version": "9.0.0",
3
+ "version": "10.0.0",
4
4
  "description": "Nizam Dashboard API SDK for TypeScript / JavaScript.",
5
5
  "license": "MIT",
6
6
  "private": false,