basyx-typescript-sdk 2.2.5 → 2.3.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.
@@ -2,6 +2,7 @@ import { SubmodelRepositoryService } from '../generated'; // Updated import
2
2
  import { RequiredError } from '../generated/runtime';
3
3
  import { applyDefaults } from '../lib/apiConfig';
4
4
  import { base64Encode } from '../lib/base64Url';
5
+ import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
5
6
  import { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from '../lib/convertSubmodelTypes';
6
7
  import { handleApiError } from '../lib/errorHandler';
7
8
  //import { SubmodelElement } from 'src/generated/SubmodelRepositoryService';
@@ -60,6 +61,7 @@ export class SubmodelRepositoryClient {
60
61
  success: true,
61
62
  data: { pagedResult: result.paging_metadata, result: submodels },
62
63
  statusCode: response.raw.status,
64
+ etag: getEtag(response.raw),
63
65
  };
64
66
  }
65
67
  catch (err) {
@@ -68,6 +70,7 @@ export class SubmodelRepositoryClient {
68
70
  success: false,
69
71
  error: customError,
70
72
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
73
+ ...getConditionalErrorFields(err),
71
74
  };
72
75
  }
73
76
  }
@@ -95,7 +98,7 @@ export class SubmodelRepositoryClient {
95
98
  cursor: cursor,
96
99
  });
97
100
  const result = await response.value();
98
- return { success: true, data: result, statusCode: response.raw.status };
101
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
99
102
  }
100
103
  catch (err) {
101
104
  const customError = await handleApiError(err);
@@ -103,6 +106,7 @@ export class SubmodelRepositoryClient {
103
106
  success: false,
104
107
  error: customError,
105
108
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
109
+ ...getConditionalErrorFields(err),
106
110
  };
107
111
  }
108
112
  }
@@ -134,7 +138,7 @@ export class SubmodelRepositoryClient {
134
138
  extent: extent,
135
139
  });
136
140
  const result = await response.value();
137
- return { success: true, data: result, statusCode: response.raw.status };
141
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
138
142
  }
139
143
  catch (err) {
140
144
  const customError = await handleApiError(err);
@@ -142,6 +146,7 @@ export class SubmodelRepositoryClient {
142
146
  success: false,
143
147
  error: customError,
144
148
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
149
+ ...getConditionalErrorFields(err),
145
150
  };
146
151
  }
147
152
  }
@@ -171,7 +176,7 @@ export class SubmodelRepositoryClient {
171
176
  level: level,
172
177
  });
173
178
  const result = await response.value();
174
- return { success: true, data: result, statusCode: response.raw.status };
179
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
175
180
  }
176
181
  catch (err) {
177
182
  const customError = await handleApiError(err);
@@ -179,6 +184,7 @@ export class SubmodelRepositoryClient {
179
184
  success: false,
180
185
  error: customError,
181
186
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
187
+ ...getConditionalErrorFields(err),
182
188
  };
183
189
  }
184
190
  }
@@ -208,7 +214,7 @@ export class SubmodelRepositoryClient {
208
214
  level: level,
209
215
  });
210
216
  const result = await response.value();
211
- return { success: true, data: result, statusCode: response.raw.status };
217
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
212
218
  }
213
219
  catch (err) {
214
220
  const customError = await handleApiError(err);
@@ -216,6 +222,7 @@ export class SubmodelRepositoryClient {
216
222
  success: false,
217
223
  error: customError,
218
224
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
225
+ ...getConditionalErrorFields(err),
219
226
  };
220
227
  }
221
228
  }
@@ -240,6 +247,7 @@ export class SubmodelRepositoryClient {
240
247
  success: true,
241
248
  data: convertApiSubmodelToCoreSubmodel(result),
242
249
  statusCode: response.raw.status,
250
+ etag: getEtag(response.raw),
243
251
  };
244
252
  }
245
253
  catch (err) {
@@ -248,6 +256,7 @@ export class SubmodelRepositoryClient {
248
256
  success: false,
249
257
  error: customError,
250
258
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
259
+ ...getConditionalErrorFields(err),
251
260
  };
252
261
  }
253
262
  }
@@ -257,19 +266,20 @@ export class SubmodelRepositoryClient {
257
266
  * @param options Object containing:
258
267
  * - configuration: The http request options
259
268
  * - submodelIdentifier: The Submodel’s unique id
269
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
260
270
  *
261
271
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
262
272
  */
263
273
  async deleteSubmodelById(options) {
264
- const { configuration, submodelIdentifier } = options;
274
+ const { configuration, submodelIdentifier, ifMatch } = options;
265
275
  try {
266
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
276
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
267
277
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
268
278
  const response = await apiInstance.deleteSubmodelByIdRaw({
269
279
  submodelIdentifier: encodedSubmodelIdentifier,
270
280
  });
271
281
  const result = await response.value();
272
- return { success: true, data: result, statusCode: response.raw.status };
282
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
273
283
  }
274
284
  catch (err) {
275
285
  const customError = await handleApiError(err);
@@ -277,6 +287,7 @@ export class SubmodelRepositoryClient {
277
287
  success: false,
278
288
  error: customError,
279
289
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
290
+ ...getConditionalErrorFields(err),
280
291
  };
281
292
  }
282
293
  }
@@ -288,13 +299,14 @@ export class SubmodelRepositoryClient {
288
299
  * - submodelIdentifier: The Submodel’s unique id
289
300
  * - level?: Determines the structural depth of the respective resource content
290
301
  * - extent?: Determines to which extent the resource is being serialized
302
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
291
303
  *
292
304
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
293
305
  */
294
306
  async getSubmodelById(options) {
295
- const { configuration, submodelIdentifier, level, extent } = options;
307
+ const { configuration, submodelIdentifier, level, extent, ifNoneMatch } = options;
296
308
  try {
297
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
309
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
298
310
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
299
311
  const response = await apiInstance.getSubmodelByIdRaw({
300
312
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -306,14 +318,20 @@ export class SubmodelRepositoryClient {
306
318
  success: true,
307
319
  data: convertApiSubmodelToCoreSubmodel(result),
308
320
  statusCode: response.raw.status,
321
+ etag: getEtag(response.raw),
309
322
  };
310
323
  }
311
324
  catch (err) {
325
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
326
+ if (notModified) {
327
+ return notModified;
328
+ }
312
329
  const customError = await handleApiError(err);
313
330
  return {
314
331
  success: false,
315
332
  error: customError,
316
333
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
334
+ ...getConditionalErrorFields(err),
317
335
  };
318
336
  }
319
337
  }
@@ -323,26 +341,32 @@ export class SubmodelRepositoryClient {
323
341
  * @param options Object containing:
324
342
  * - configuration: The http request options
325
343
  * - submodelIdentifier: The Submodel's unique id
344
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
326
345
  *
327
346
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
328
347
  */
329
348
  async getSubmodelByIdReference(options) {
330
- const { configuration, submodelIdentifier } = options;
349
+ const { configuration, submodelIdentifier, ifNoneMatch } = options;
331
350
  try {
332
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
351
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
333
352
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
334
353
  const response = await apiInstance.getSubmodelByIdReferenceRaw({
335
354
  submodelIdentifier: encodedSubmodelIdentifier,
336
355
  });
337
356
  const result = await response.value();
338
- return { success: true, data: result, statusCode: response.raw.status };
357
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
339
358
  }
340
359
  catch (err) {
360
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
361
+ if (notModified) {
362
+ return notModified;
363
+ }
341
364
  const customError = await handleApiError(err);
342
365
  return {
343
366
  success: false,
344
367
  error: customError,
345
368
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
369
+ ...getConditionalErrorFields(err),
346
370
  };
347
371
  }
348
372
  }
@@ -353,27 +377,33 @@ export class SubmodelRepositoryClient {
353
377
  * - configuration: The http request options
354
378
  * - submodelIdentifier: The Submodel's unique id
355
379
  * - level?: Determines the structural depth of the respective resource content
380
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
356
381
  *
357
382
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
358
383
  */
359
384
  async getSubmodelByIdPath(options) {
360
- const { configuration, submodelIdentifier, level } = options;
385
+ const { configuration, submodelIdentifier, level, ifNoneMatch } = options;
361
386
  try {
362
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
387
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
363
388
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
364
389
  const response = await apiInstance.getSubmodelByIdPathRaw({
365
390
  submodelIdentifier: encodedSubmodelIdentifier,
366
391
  level: level,
367
392
  });
368
393
  const result = await response.value();
369
- return { success: true, data: result, statusCode: response.raw.status };
394
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
370
395
  }
371
396
  catch (err) {
397
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
398
+ if (notModified) {
399
+ return notModified;
400
+ }
372
401
  const customError = await handleApiError(err);
373
402
  return {
374
403
  success: false,
375
404
  error: customError,
376
405
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
406
+ ...getConditionalErrorFields(err),
377
407
  };
378
408
  }
379
409
  }
@@ -384,26 +414,29 @@ export class SubmodelRepositoryClient {
384
414
  * - configuration: The http request options
385
415
  * - submodelIdentifier: The Submodel’s unique id
386
416
  * - submodel: Submodel object
417
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
418
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
387
419
  *
388
420
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
389
421
  */
390
422
  async putSubmodelById(options) {
391
- const { configuration, submodelIdentifier, submodel } = options;
423
+ const { configuration, submodelIdentifier, submodel, ifMatch, ifNoneMatch } = options;
392
424
  try {
393
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
425
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
394
426
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
395
427
  const response = await apiInstance.putSubmodelByIdRaw({
396
428
  submodelIdentifier: encodedSubmodelIdentifier,
397
429
  submodel: convertCoreSubmodelToApiSubmodel(submodel),
398
430
  });
399
431
  if (response.raw.status === 204) {
400
- return { success: true, data: undefined, statusCode: response.raw.status };
432
+ return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
401
433
  }
402
434
  const result = await response.value();
403
435
  return {
404
436
  success: true,
405
437
  data: result ? convertApiSubmodelToCoreSubmodel(result) : undefined,
406
438
  statusCode: response.raw.status,
439
+ etag: getEtag(response.raw),
407
440
  };
408
441
  }
409
442
  catch (err) {
@@ -412,6 +445,7 @@ export class SubmodelRepositoryClient {
412
445
  success: false,
413
446
  error: customError,
414
447
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
448
+ ...getConditionalErrorFields(err),
415
449
  };
416
450
  }
417
451
  }
@@ -423,13 +457,14 @@ export class SubmodelRepositoryClient {
423
457
  * - submodelIdentifier: The Submodel's unique id
424
458
  * - submodel: Submodel object
425
459
  * - level?: Determines the structural depth of the respective resource content
460
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
426
461
  *
427
462
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
428
463
  */
429
464
  async patchSubmodelById(options) {
430
- const { configuration, submodelIdentifier, submodel, level } = options;
465
+ const { configuration, submodelIdentifier, submodel, level, ifMatch } = options;
431
466
  try {
432
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
467
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
433
468
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
434
469
  const response = await apiInstance.patchSubmodelByIdRaw({
435
470
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -437,7 +472,7 @@ export class SubmodelRepositoryClient {
437
472
  level: level,
438
473
  });
439
474
  const result = await response.value();
440
- return { success: true, data: result, statusCode: response.raw.status };
475
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
441
476
  }
442
477
  catch (err) {
443
478
  const customError = await handleApiError(err);
@@ -445,6 +480,7 @@ export class SubmodelRepositoryClient {
445
480
  success: false,
446
481
  error: customError,
447
482
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
483
+ ...getConditionalErrorFields(err),
448
484
  };
449
485
  }
450
486
  }
@@ -458,13 +494,14 @@ export class SubmodelRepositoryClient {
458
494
  * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
459
495
  * - level?: Determines the structural depth of the respective resource content
460
496
  * - extent?: Determines to which extent the resource is being serialized
497
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
461
498
  *
462
499
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
463
500
  */
464
501
  async getAllSubmodelElements(options) {
465
- const { configuration, submodelIdentifier, limit, cursor, level, extent } = options;
502
+ const { configuration, submodelIdentifier, limit, cursor, level, extent, ifNoneMatch } = options;
466
503
  try {
467
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
504
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
468
505
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
469
506
  const response = await apiInstance.getAllSubmodelElementsRaw({
470
507
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -479,14 +516,20 @@ export class SubmodelRepositoryClient {
479
516
  success: true,
480
517
  data: { pagedResult: result.paging_metadata, result: submodelElements },
481
518
  statusCode: response.raw.status,
519
+ etag: getEtag(response.raw),
482
520
  };
483
521
  }
484
522
  catch (err) {
523
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
524
+ if (notModified) {
525
+ return notModified;
526
+ }
485
527
  const customError = await handleApiError(err);
486
528
  return {
487
529
  success: false,
488
530
  error: customError,
489
531
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
532
+ ...getConditionalErrorFields(err),
490
533
  };
491
534
  }
492
535
  }
@@ -498,13 +541,14 @@ export class SubmodelRepositoryClient {
498
541
  * - submodelIdentifier: The Submodel's unique id
499
542
  * - limit?: The maximum number of elements in the response array
500
543
  * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
544
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
501
545
  *
502
546
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
503
547
  */
504
548
  async getAllSubmodelElementsMetadata(options) {
505
- const { configuration, submodelIdentifier, limit, cursor } = options;
549
+ const { configuration, submodelIdentifier, limit, cursor, ifNoneMatch } = options;
506
550
  try {
507
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
551
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
508
552
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
509
553
  const response = await apiInstance.getAllSubmodelElementsMetadataSubmodelRepoRaw({
510
554
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -512,14 +556,19 @@ export class SubmodelRepositoryClient {
512
556
  cursor: cursor,
513
557
  });
514
558
  const result = await response.value();
515
- return { success: true, data: result, statusCode: response.raw.status };
559
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
516
560
  }
517
561
  catch (err) {
562
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
563
+ if (notModified) {
564
+ return notModified;
565
+ }
518
566
  const customError = await handleApiError(err);
519
567
  return {
520
568
  success: false,
521
569
  error: customError,
522
570
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
571
+ ...getConditionalErrorFields(err),
523
572
  };
524
573
  }
525
574
  }
@@ -533,13 +582,14 @@ export class SubmodelRepositoryClient {
533
582
  * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
534
583
  * - level?: Determines the structural depth of the respective resource content
535
584
  * - extent?: Determines to which extent the resource is being serialized
585
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
536
586
  *
537
587
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
538
588
  */
539
589
  async getAllSubmodelElementsValueOnly(options) {
540
- const { configuration, submodelIdentifier, limit, cursor, level, extent } = options;
590
+ const { configuration, submodelIdentifier, limit, cursor, level, extent, ifNoneMatch } = options;
541
591
  try {
542
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
592
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
543
593
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
544
594
  const response = await apiInstance.getAllSubmodelElementsValueOnlySubmodelRepoRaw({
545
595
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -549,14 +599,19 @@ export class SubmodelRepositoryClient {
549
599
  extent: extent,
550
600
  });
551
601
  const result = await response.value();
552
- return { success: true, data: result, statusCode: response.raw.status };
602
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
553
603
  }
554
604
  catch (err) {
605
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
606
+ if (notModified) {
607
+ return notModified;
608
+ }
555
609
  const customError = await handleApiError(err);
556
610
  return {
557
611
  success: false,
558
612
  error: customError,
559
613
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
614
+ ...getConditionalErrorFields(err),
560
615
  };
561
616
  }
562
617
  }
@@ -569,13 +624,14 @@ export class SubmodelRepositoryClient {
569
624
  * - limit?: The maximum number of elements in the response array
570
625
  * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
571
626
  * - level?: Determines the structural depth of the respective resource content
627
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
572
628
  *
573
629
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
574
630
  */
575
631
  async getAllSubmodelElementsReference(options) {
576
- const { configuration, submodelIdentifier, limit, cursor, level } = options;
632
+ const { configuration, submodelIdentifier, limit, cursor, level, ifNoneMatch } = options;
577
633
  try {
578
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
634
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
579
635
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
580
636
  const response = await apiInstance.getAllSubmodelElementsReferenceSubmodelRepoRaw({
581
637
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -584,14 +640,19 @@ export class SubmodelRepositoryClient {
584
640
  level: level,
585
641
  });
586
642
  const result = await response.value();
587
- return { success: true, data: result, statusCode: response.raw.status };
643
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
588
644
  }
589
645
  catch (err) {
646
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
647
+ if (notModified) {
648
+ return notModified;
649
+ }
590
650
  const customError = await handleApiError(err);
591
651
  return {
592
652
  success: false,
593
653
  error: customError,
594
654
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
655
+ ...getConditionalErrorFields(err),
595
656
  };
596
657
  }
597
658
  }
@@ -604,13 +665,14 @@ export class SubmodelRepositoryClient {
604
665
  * - limit?: The maximum number of elements in the response array
605
666
  * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
606
667
  * - level?: Determines the structural depth of the respective resource content
668
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
607
669
  *
608
670
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
609
671
  */
610
672
  async getAllSubmodelElementsPath(options) {
611
- const { configuration, submodelIdentifier, limit, cursor, level } = options;
673
+ const { configuration, submodelIdentifier, limit, cursor, level, ifNoneMatch } = options;
612
674
  try {
613
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
675
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
614
676
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
615
677
  const response = await apiInstance.getAllSubmodelElementsPathSubmodelRepoRaw({
616
678
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -619,14 +681,19 @@ export class SubmodelRepositoryClient {
619
681
  level: level,
620
682
  });
621
683
  const result = await response.value();
622
- return { success: true, data: result, statusCode: response.raw.status };
684
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
623
685
  }
624
686
  catch (err) {
687
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
688
+ if (notModified) {
689
+ return notModified;
690
+ }
625
691
  const customError = await handleApiError(err);
626
692
  return {
627
693
  success: false,
628
694
  error: customError,
629
695
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
696
+ ...getConditionalErrorFields(err),
630
697
  };
631
698
  }
632
699
  }
@@ -636,13 +703,14 @@ export class SubmodelRepositoryClient {
636
703
  * @param options Object containing:
637
704
  * - configuration: The http request options
638
705
  * - submodelIdentifier: The Submodel’s unique id
706
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
639
707
  *
640
708
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
641
709
  */
642
710
  async postSubmodelElement(options) {
643
- const { configuration, submodelIdentifier, submodelElement } = options;
711
+ const { configuration, submodelIdentifier, submodelElement, ifMatch } = options;
644
712
  try {
645
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
713
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
646
714
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
647
715
  const response = await apiInstance.postSubmodelElementSubmodelRepoRaw({
648
716
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -653,6 +721,7 @@ export class SubmodelRepositoryClient {
653
721
  success: true,
654
722
  data: convertApiSubmodelElementToCoreSubmodelElement(result),
655
723
  statusCode: response.raw.status,
724
+ etag: getEtag(response.raw),
656
725
  };
657
726
  }
658
727
  catch (err) {
@@ -661,6 +730,7 @@ export class SubmodelRepositoryClient {
661
730
  success: false,
662
731
  error: customError,
663
732
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
733
+ ...getConditionalErrorFields(err),
664
734
  };
665
735
  }
666
736
  }
@@ -673,13 +743,14 @@ export class SubmodelRepositoryClient {
673
743
  * - idShortPath: IdShort path to the submodel element (dot-separated)
674
744
  * - level?: Determines the structural depth of the respective resource content
675
745
  * - extent?: Determines to which extent the resource is being serialized
746
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
676
747
  *
677
748
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
678
749
  */
679
750
  async getSubmodelElementByPath(options) {
680
- const { configuration, submodelIdentifier, idShortPath, level, extent } = options;
751
+ const { configuration, submodelIdentifier, idShortPath, level, extent, ifNoneMatch } = options;
681
752
  try {
682
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
753
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
683
754
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
684
755
  const response = await apiInstance.getSubmodelElementByPathSubmodelRepoRaw({
685
756
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -692,14 +763,20 @@ export class SubmodelRepositoryClient {
692
763
  success: true,
693
764
  data: convertApiSubmodelElementToCoreSubmodelElement(result),
694
765
  statusCode: response.raw.status,
766
+ etag: getEtag(response.raw),
695
767
  };
696
768
  }
697
769
  catch (err) {
770
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
771
+ if (notModified) {
772
+ return notModified;
773
+ }
698
774
  const customError = await handleApiError(err);
699
775
  return {
700
776
  success: false,
701
777
  error: customError,
702
778
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
779
+ ...getConditionalErrorFields(err),
703
780
  };
704
781
  }
705
782
  }
@@ -710,27 +787,33 @@ export class SubmodelRepositoryClient {
710
787
  * - configuration: The http request options
711
788
  * - submodelIdentifier: The Submodel's unique id
712
789
  * - idShortPath: IdShort path to the submodel element (dot-separated)
790
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
713
791
  *
714
792
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
715
793
  */
716
794
  async getSubmodelElementByPathMetadata(options) {
717
- const { configuration, submodelIdentifier, idShortPath } = options;
795
+ const { configuration, submodelIdentifier, idShortPath, ifNoneMatch } = options;
718
796
  try {
719
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
797
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
720
798
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
721
799
  const response = await apiInstance.getSubmodelElementByPathMetadataSubmodelRepoRaw({
722
800
  submodelIdentifier: encodedSubmodelIdentifier,
723
801
  idShortPath: idShortPath,
724
802
  });
725
803
  const result = await response.value();
726
- return { success: true, data: result, statusCode: response.raw.status };
804
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
727
805
  }
728
806
  catch (err) {
807
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
808
+ if (notModified) {
809
+ return notModified;
810
+ }
729
811
  const customError = await handleApiError(err);
730
812
  return {
731
813
  success: false,
732
814
  error: customError,
733
815
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
816
+ ...getConditionalErrorFields(err),
734
817
  };
735
818
  }
736
819
  }
@@ -741,27 +824,33 @@ export class SubmodelRepositoryClient {
741
824
  * - configuration: The http request options
742
825
  * - submodelIdentifier: The Submodel's unique id
743
826
  * - idShortPath: IdShort path to the submodel element (dot-separated)
827
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
744
828
  *
745
829
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
746
830
  */
747
831
  async getSubmodelElementByPathReference(options) {
748
- const { configuration, submodelIdentifier, idShortPath } = options;
832
+ const { configuration, submodelIdentifier, idShortPath, ifNoneMatch } = options;
749
833
  try {
750
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
834
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
751
835
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
752
836
  const response = await apiInstance.getSubmodelElementByPathReferenceSubmodelRepoRaw({
753
837
  submodelIdentifier: encodedSubmodelIdentifier,
754
838
  idShortPath: idShortPath,
755
839
  });
756
840
  const result = await response.value();
757
- return { success: true, data: result, statusCode: response.raw.status };
841
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
758
842
  }
759
843
  catch (err) {
844
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
845
+ if (notModified) {
846
+ return notModified;
847
+ }
760
848
  const customError = await handleApiError(err);
761
849
  return {
762
850
  success: false,
763
851
  error: customError,
764
852
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
853
+ ...getConditionalErrorFields(err),
765
854
  };
766
855
  }
767
856
  }
@@ -773,13 +862,14 @@ export class SubmodelRepositoryClient {
773
862
  * - submodelIdentifier: The Submodel's unique id
774
863
  * - idShortPath: IdShort path to the submodel element (dot-separated)
775
864
  * - level?: Determines the structural depth of the respective resource content
865
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
776
866
  *
777
867
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
778
868
  */
779
869
  async getSubmodelElementByPathPath(options) {
780
- const { configuration, submodelIdentifier, idShortPath, level } = options;
870
+ const { configuration, submodelIdentifier, idShortPath, level, ifNoneMatch } = options;
781
871
  try {
782
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
872
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
783
873
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
784
874
  const response = await apiInstance.getSubmodelElementByPathPathSubmodelRepoRaw({
785
875
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -787,14 +877,19 @@ export class SubmodelRepositoryClient {
787
877
  level: level,
788
878
  });
789
879
  const result = await response.value();
790
- return { success: true, data: result, statusCode: response.raw.status };
880
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
791
881
  }
792
882
  catch (err) {
883
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
884
+ if (notModified) {
885
+ return notModified;
886
+ }
793
887
  const customError = await handleApiError(err);
794
888
  return {
795
889
  success: false,
796
890
  error: customError,
797
891
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
892
+ ...getConditionalErrorFields(err),
798
893
  };
799
894
  }
800
895
  }
@@ -806,13 +901,14 @@ export class SubmodelRepositoryClient {
806
901
  * - submodelIdentifier: The Submodel’s unique id
807
902
  * - idShortPath: IdShort path to the submodel element (dot-separated)
808
903
  * - submodelElement: SubmodelElement object
904
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
809
905
  *
810
906
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
811
907
  */
812
908
  async postSubmodelElementByPath(options) {
813
- const { configuration, submodelIdentifier, idShortPath, submodelElement } = options;
909
+ const { configuration, submodelIdentifier, idShortPath, submodelElement, ifMatch } = options;
814
910
  try {
815
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
911
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
816
912
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
817
913
  const response = await apiInstance.postSubmodelElementByPathSubmodelRepoRaw({
818
914
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -824,6 +920,7 @@ export class SubmodelRepositoryClient {
824
920
  success: true,
825
921
  data: convertApiSubmodelElementToCoreSubmodelElement(result),
826
922
  statusCode: response.raw.status,
923
+ etag: getEtag(response.raw),
827
924
  };
828
925
  }
829
926
  catch (err) {
@@ -832,6 +929,7 @@ export class SubmodelRepositoryClient {
832
929
  success: false,
833
930
  error: customError,
834
931
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
932
+ ...getConditionalErrorFields(err),
835
933
  };
836
934
  }
837
935
  }
@@ -842,20 +940,21 @@ export class SubmodelRepositoryClient {
842
940
  * - configuration: The http request options.
843
941
  * - submodelIdentifier: The Submodel’s unique id
844
942
  * - idShortPath: IdShort path to the submodel element (dot-separated)
943
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
845
944
  *
846
945
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
847
946
  */
848
947
  async deleteSubmodelElementByPath(options) {
849
- const { configuration, submodelIdentifier, idShortPath } = options;
948
+ const { configuration, submodelIdentifier, idShortPath, ifMatch } = options;
850
949
  try {
851
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
950
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
852
951
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
853
952
  const response = await apiInstance.deleteSubmodelElementByPathSubmodelRepoRaw({
854
953
  submodelIdentifier: encodedSubmodelIdentifier,
855
954
  idShortPath: idShortPath,
856
955
  });
857
956
  const result = await response.value();
858
- return { success: true, data: result, statusCode: response.raw.status };
957
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
859
958
  }
860
959
  catch (err) {
861
960
  const customError = await handleApiError(err);
@@ -863,6 +962,7 @@ export class SubmodelRepositoryClient {
863
962
  success: false,
864
963
  error: customError,
865
964
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
965
+ ...getConditionalErrorFields(err),
866
966
  };
867
967
  }
868
968
  }
@@ -875,13 +975,15 @@ export class SubmodelRepositoryClient {
875
975
  * - idShortPath: IdShort path to the submodel element (dot-separated)
876
976
  * - submodelElement: SubmodelElement object
877
977
  * - level?: Determines the structural depth of the respective resource content
978
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
979
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
878
980
  *
879
981
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
880
982
  */
881
983
  async putSubmodelElementByPath(options) {
882
- const { configuration, submodelIdentifier, idShortPath, submodelElement, level } = options;
984
+ const { configuration, submodelIdentifier, idShortPath, submodelElement, level, ifMatch, ifNoneMatch } = options;
883
985
  try {
884
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
986
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
885
987
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
886
988
  const response = await apiInstance.putSubmodelElementByPathSubmodelRepoRaw({
887
989
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -890,13 +992,14 @@ export class SubmodelRepositoryClient {
890
992
  level: level,
891
993
  });
892
994
  if (response.raw.status === 204) {
893
- return { success: true, data: undefined, statusCode: response.raw.status };
995
+ return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
894
996
  }
895
997
  const result = await response.value();
896
998
  return {
897
999
  success: true,
898
1000
  data: result ? convertApiSubmodelElementToCoreSubmodelElement(result) : undefined,
899
1001
  statusCode: response.raw.status,
1002
+ etag: getEtag(response.raw),
900
1003
  };
901
1004
  }
902
1005
  catch (err) {
@@ -905,6 +1008,7 @@ export class SubmodelRepositoryClient {
905
1008
  success: false,
906
1009
  error: customError,
907
1010
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1011
+ ...getConditionalErrorFields(err),
908
1012
  };
909
1013
  }
910
1014
  }
@@ -917,13 +1021,14 @@ export class SubmodelRepositoryClient {
917
1021
  * - idShortPath: IdShort path to the submodel element (dot-separated)
918
1022
  * - submodelElement: SubmodelElement object
919
1023
  * - level?: Determines the structural depth of the respective resource content
1024
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
920
1025
  *
921
1026
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
922
1027
  */
923
1028
  async patchSubmodelElementByPath(options) {
924
- const { configuration, submodelIdentifier, idShortPath, submodelElement, level } = options;
1029
+ const { configuration, submodelIdentifier, idShortPath, submodelElement, level, ifMatch } = options;
925
1030
  try {
926
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1031
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
927
1032
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
928
1033
  const response = await apiInstance.patchSubmodelElementByPathSubmodelRepoRaw({
929
1034
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -932,7 +1037,7 @@ export class SubmodelRepositoryClient {
932
1037
  level: level,
933
1038
  });
934
1039
  const result = await response.value();
935
- return { success: true, data: result, statusCode: response.raw.status };
1040
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
936
1041
  }
937
1042
  catch (err) {
938
1043
  const customError = await handleApiError(err);
@@ -940,6 +1045,7 @@ export class SubmodelRepositoryClient {
940
1045
  success: false,
941
1046
  error: customError,
942
1047
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1048
+ ...getConditionalErrorFields(err),
943
1049
  };
944
1050
  }
945
1051
  }
@@ -949,26 +1055,32 @@ export class SubmodelRepositoryClient {
949
1055
  * @param options Object containing:
950
1056
  * - configuration: The http request options
951
1057
  * - submodelIdentifier: The Submodel’s unique id
1058
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
952
1059
  *
953
1060
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
954
1061
  */
955
1062
  async getSubmodelByIdMetadata(options) {
956
- const { configuration, submodelIdentifier } = options;
1063
+ const { configuration, submodelIdentifier, ifNoneMatch } = options;
957
1064
  try {
958
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1065
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
959
1066
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
960
1067
  const response = await apiInstance.getSubmodelByIdMetadataRaw({
961
1068
  submodelIdentifier: encodedSubmodelIdentifier,
962
1069
  });
963
1070
  const result = await response.value();
964
- return { success: true, data: result, statusCode: response.raw.status };
1071
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
965
1072
  }
966
1073
  catch (err) {
1074
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1075
+ if (notModified) {
1076
+ return notModified;
1077
+ }
967
1078
  const customError = await handleApiError(err);
968
1079
  return {
969
1080
  success: false,
970
1081
  error: customError,
971
1082
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1083
+ ...getConditionalErrorFields(err),
972
1084
  };
973
1085
  }
974
1086
  }
@@ -980,13 +1092,14 @@ export class SubmodelRepositoryClient {
980
1092
  * - submodelIdentifier: The Submodel's unique id
981
1093
  * - submodelMetadata: SubmodelMetadata object
982
1094
  * - level?: Determines the structural depth of the respective resource content
1095
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
983
1096
  *
984
1097
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
985
1098
  */
986
1099
  async patchSubmodelByIdMetadata(options) {
987
- const { configuration, submodelIdentifier, submodelMetadata, level } = options;
1100
+ const { configuration, submodelIdentifier, submodelMetadata, level, ifMatch } = options;
988
1101
  try {
989
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1102
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
990
1103
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
991
1104
  const response = await apiInstance.patchSubmodelByIdMetadataRaw({
992
1105
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -994,7 +1107,7 @@ export class SubmodelRepositoryClient {
994
1107
  level: level,
995
1108
  });
996
1109
  const result = await response.value();
997
- return { success: true, data: result, statusCode: response.raw.status };
1110
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
998
1111
  }
999
1112
  catch (err) {
1000
1113
  const customError = await handleApiError(err);
@@ -1002,6 +1115,7 @@ export class SubmodelRepositoryClient {
1002
1115
  success: false,
1003
1116
  error: customError,
1004
1117
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1118
+ ...getConditionalErrorFields(err),
1005
1119
  };
1006
1120
  }
1007
1121
  }
@@ -1013,13 +1127,14 @@ export class SubmodelRepositoryClient {
1013
1127
  * - submodelIdentifier: The Submodel’s unique id
1014
1128
  * - level?: Determines the structural depth of the respective resource content
1015
1129
  * - extent?: Determines to which extent the resource is being serialized
1130
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
1016
1131
  *
1017
1132
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1018
1133
  */
1019
1134
  async getSubmodelByIdValueOnly(options) {
1020
- const { configuration, submodelIdentifier, level, extent } = options;
1135
+ const { configuration, submodelIdentifier, level, extent, ifNoneMatch } = options;
1021
1136
  try {
1022
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1137
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
1023
1138
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1024
1139
  const response = await apiInstance.getSubmodelByIdValueOnlyRaw({
1025
1140
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1027,14 +1142,19 @@ export class SubmodelRepositoryClient {
1027
1142
  extent: extent,
1028
1143
  });
1029
1144
  const result = await response.value();
1030
- return { success: true, data: result, statusCode: response.raw.status };
1145
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1031
1146
  }
1032
1147
  catch (err) {
1148
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1149
+ if (notModified) {
1150
+ return notModified;
1151
+ }
1033
1152
  const customError = await handleApiError(err);
1034
1153
  return {
1035
1154
  success: false,
1036
1155
  error: customError,
1037
1156
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1157
+ ...getConditionalErrorFields(err),
1038
1158
  };
1039
1159
  }
1040
1160
  }
@@ -1046,13 +1166,14 @@ export class SubmodelRepositoryClient {
1046
1166
  * - submodelIdentifier: The Submodel's unique id
1047
1167
  * - body: Value-only payload object
1048
1168
  * - level?: Determines the structural depth of the respective resource content
1169
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1049
1170
  *
1050
1171
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1051
1172
  */
1052
1173
  async patchSubmodelByIdValueOnly(options) {
1053
- const { configuration, submodelIdentifier, body, level } = options;
1174
+ const { configuration, submodelIdentifier, body, level, ifMatch } = options;
1054
1175
  try {
1055
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1176
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1056
1177
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1057
1178
  const response = await apiInstance.patchSubmodelByIdValueOnlyRaw({
1058
1179
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1060,7 +1181,7 @@ export class SubmodelRepositoryClient {
1060
1181
  level: level,
1061
1182
  });
1062
1183
  const result = await response.value();
1063
- return { success: true, data: result, statusCode: response.raw.status };
1184
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1064
1185
  }
1065
1186
  catch (err) {
1066
1187
  const customError = await handleApiError(err);
@@ -1068,6 +1189,7 @@ export class SubmodelRepositoryClient {
1068
1189
  success: false,
1069
1190
  error: customError,
1070
1191
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1192
+ ...getConditionalErrorFields(err),
1071
1193
  };
1072
1194
  }
1073
1195
  }
@@ -1080,13 +1202,14 @@ export class SubmodelRepositoryClient {
1080
1202
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1081
1203
  * - level?: Determines the structural depth of the respective resource content
1082
1204
  * - extent?: Determines to which extent the resource is being serialized
1205
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
1083
1206
  *
1084
1207
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1085
1208
  */
1086
1209
  async getSubmodelElementByPathValueOnly(options) {
1087
- const { configuration, submodelIdentifier, idShortPath, level, extent } = options;
1210
+ const { configuration, submodelIdentifier, idShortPath, level, extent, ifNoneMatch } = options;
1088
1211
  try {
1089
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1212
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
1090
1213
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1091
1214
  const response = await apiInstance.getSubmodelElementByPathValueOnlySubmodelRepoRaw({
1092
1215
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1095,14 +1218,19 @@ export class SubmodelRepositoryClient {
1095
1218
  extent: extent,
1096
1219
  });
1097
1220
  const result = await response.value();
1098
- return { success: true, data: result, statusCode: response.raw.status };
1221
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1099
1222
  }
1100
1223
  catch (err) {
1224
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1225
+ if (notModified) {
1226
+ return notModified;
1227
+ }
1101
1228
  const customError = await handleApiError(err);
1102
1229
  return {
1103
1230
  success: false,
1104
1231
  error: customError,
1105
1232
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1233
+ ...getConditionalErrorFields(err),
1106
1234
  };
1107
1235
  }
1108
1236
  }
@@ -1115,13 +1243,14 @@ export class SubmodelRepositoryClient {
1115
1243
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1116
1244
  * - submodelElementValue: SubmodelElementValue object
1117
1245
  * - level?: Determines the structural depth of the respective resource content
1246
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1118
1247
  *
1119
1248
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1120
1249
  */
1121
1250
  async patchSubmodelElementByPathValueOnly(options) {
1122
- const { configuration, submodelIdentifier, idShortPath, submodelElementValue, level } = options;
1251
+ const { configuration, submodelIdentifier, idShortPath, submodelElementValue, level, ifMatch } = options;
1123
1252
  try {
1124
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1253
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1125
1254
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1126
1255
  const response = await apiInstance.patchSubmodelElementByPathValueOnlySubmodelRepoRaw({
1127
1256
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1130,7 +1259,7 @@ export class SubmodelRepositoryClient {
1130
1259
  level: level,
1131
1260
  });
1132
1261
  const result = await response.value();
1133
- return { success: true, data: result, statusCode: response.raw.status };
1262
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1134
1263
  }
1135
1264
  catch (err) {
1136
1265
  const customError = await handleApiError(err);
@@ -1138,6 +1267,7 @@ export class SubmodelRepositoryClient {
1138
1267
  success: false,
1139
1268
  error: customError,
1140
1269
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1270
+ ...getConditionalErrorFields(err),
1141
1271
  };
1142
1272
  }
1143
1273
  }
@@ -1149,13 +1279,14 @@ export class SubmodelRepositoryClient {
1149
1279
  * - submodelIdentifier: The Submodel's unique id
1150
1280
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1151
1281
  * - submodelElementMetadata: SubmodelElementMetadata object
1282
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1152
1283
  *
1153
1284
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1154
1285
  */
1155
1286
  async patchSubmodelElementByPathMetadata(options) {
1156
- const { configuration, submodelIdentifier, idShortPath, submodelElementMetadata } = options;
1287
+ const { configuration, submodelIdentifier, idShortPath, submodelElementMetadata, ifMatch } = options;
1157
1288
  try {
1158
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1289
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1159
1290
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1160
1291
  const response = await apiInstance.patchSubmodelElementByPathMetadataSubmodelRepoRaw({
1161
1292
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1163,7 +1294,7 @@ export class SubmodelRepositoryClient {
1163
1294
  submodelElementMetadata: submodelElementMetadata,
1164
1295
  });
1165
1296
  const result = await response.value();
1166
- return { success: true, data: result, statusCode: response.raw.status };
1297
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1167
1298
  }
1168
1299
  catch (err) {
1169
1300
  const customError = await handleApiError(err);
@@ -1171,6 +1302,7 @@ export class SubmodelRepositoryClient {
1171
1302
  success: false,
1172
1303
  error: customError,
1173
1304
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1305
+ ...getConditionalErrorFields(err),
1174
1306
  };
1175
1307
  }
1176
1308
  }
@@ -1181,27 +1313,33 @@ export class SubmodelRepositoryClient {
1181
1313
  * - configuration: The http request options
1182
1314
  * - submodelIdentifier: The Submodel's unique id
1183
1315
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1316
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
1184
1317
  *
1185
1318
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1186
1319
  */
1187
1320
  async getFileByPath(options) {
1188
- const { configuration, submodelIdentifier, idShortPath } = options;
1321
+ const { configuration, submodelIdentifier, idShortPath, ifNoneMatch } = options;
1189
1322
  try {
1190
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1323
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
1191
1324
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1192
1325
  const response = await apiInstance.getFileByPathSubmodelRepoRaw({
1193
1326
  submodelIdentifier: encodedSubmodelIdentifier,
1194
1327
  idShortPath: idShortPath,
1195
1328
  });
1196
1329
  const result = await response.value();
1197
- return { success: true, data: result, statusCode: response.raw.status };
1330
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1198
1331
  }
1199
1332
  catch (err) {
1333
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1334
+ if (notModified) {
1335
+ return notModified;
1336
+ }
1200
1337
  const customError = await handleApiError(err);
1201
1338
  return {
1202
1339
  success: false,
1203
1340
  error: customError,
1204
1341
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1342
+ ...getConditionalErrorFields(err),
1205
1343
  };
1206
1344
  }
1207
1345
  }
@@ -1214,13 +1352,15 @@ export class SubmodelRepositoryClient {
1214
1352
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1215
1353
  * - fileName?: Name of the uploaded file
1216
1354
  * - file?: File content
1355
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1356
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
1217
1357
  *
1218
1358
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1219
1359
  */
1220
1360
  async putFileByPath(options) {
1221
- const { configuration, submodelIdentifier, idShortPath, fileName, file } = options;
1361
+ const { configuration, submodelIdentifier, idShortPath, fileName, file, ifMatch, ifNoneMatch } = options;
1222
1362
  try {
1223
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1363
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
1224
1364
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1225
1365
  const response = await apiInstance.putFileByPathSubmodelRepoRaw({
1226
1366
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1229,7 +1369,7 @@ export class SubmodelRepositoryClient {
1229
1369
  file: file,
1230
1370
  });
1231
1371
  const result = await response.value();
1232
- return { success: true, data: result, statusCode: response.raw.status };
1372
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1233
1373
  }
1234
1374
  catch (err) {
1235
1375
  const customError = await handleApiError(err);
@@ -1237,6 +1377,7 @@ export class SubmodelRepositoryClient {
1237
1377
  success: false,
1238
1378
  error: customError,
1239
1379
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1380
+ ...getConditionalErrorFields(err),
1240
1381
  };
1241
1382
  }
1242
1383
  }
@@ -1247,20 +1388,21 @@ export class SubmodelRepositoryClient {
1247
1388
  * - configuration: The http request options
1248
1389
  * - submodelIdentifier: The Submodel's unique id
1249
1390
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1391
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1250
1392
  *
1251
1393
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1252
1394
  */
1253
1395
  async deleteFileByPath(options) {
1254
- const { configuration, submodelIdentifier, idShortPath } = options;
1396
+ const { configuration, submodelIdentifier, idShortPath, ifMatch } = options;
1255
1397
  try {
1256
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1398
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1257
1399
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1258
1400
  const response = await apiInstance.deleteFileByPathSubmodelRepoRaw({
1259
1401
  submodelIdentifier: encodedSubmodelIdentifier,
1260
1402
  idShortPath: idShortPath,
1261
1403
  });
1262
1404
  const result = await response.value();
1263
- return { success: true, data: result, statusCode: response.raw.status };
1405
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1264
1406
  }
1265
1407
  catch (err) {
1266
1408
  const customError = await handleApiError(err);
@@ -1268,6 +1410,7 @@ export class SubmodelRepositoryClient {
1268
1410
  success: false,
1269
1411
  error: customError,
1270
1412
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1413
+ ...getConditionalErrorFields(err),
1271
1414
  };
1272
1415
  }
1273
1416
  }
@@ -1280,13 +1423,14 @@ export class SubmodelRepositoryClient {
1280
1423
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1281
1424
  * - operationRequest: Operation request object
1282
1425
  * - async?: Determines whether an operation invocation is performed asynchronously or synchronously
1426
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1283
1427
  *
1284
1428
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1285
1429
  */
1286
1430
  async postInvokeOperationSubmodelRepo(options) {
1287
- const { configuration, submodelIdentifier, idShortPath, operationRequest } = options;
1431
+ const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
1288
1432
  try {
1289
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1433
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1290
1434
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1291
1435
  const response = await apiInstance.invokeOperationSubmodelRepoRaw({
1292
1436
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1295,7 +1439,7 @@ export class SubmodelRepositoryClient {
1295
1439
  //async: async,
1296
1440
  });
1297
1441
  const result = await response.value();
1298
- return { success: true, data: result, statusCode: response.raw.status };
1442
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1299
1443
  }
1300
1444
  catch (err) {
1301
1445
  const customError = await handleApiError(err);
@@ -1303,6 +1447,7 @@ export class SubmodelRepositoryClient {
1303
1447
  success: false,
1304
1448
  error: customError,
1305
1449
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1450
+ ...getConditionalErrorFields(err),
1306
1451
  };
1307
1452
  }
1308
1453
  }
@@ -1315,13 +1460,14 @@ export class SubmodelRepositoryClient {
1315
1460
  * - submodelIdentifier: The Submodel’s unique id
1316
1461
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1317
1462
  * - operationRequestValueOnly: Operation request object
1463
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1318
1464
  *
1319
1465
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1320
1466
  */
1321
1467
  async postInvokeOperationValueOnly(options) {
1322
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
1468
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
1323
1469
  try {
1324
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1470
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1325
1471
  const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
1326
1472
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1327
1473
  const response = await apiInstance.invokeOperationValueOnlyRaw({
@@ -1331,7 +1477,7 @@ export class SubmodelRepositoryClient {
1331
1477
  operationRequestValueOnly: operationRequestValueOnly,
1332
1478
  });
1333
1479
  const result = await response.value();
1334
- return { success: true, data: result, statusCode: response.raw.status };
1480
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1335
1481
  }
1336
1482
  catch (err) {
1337
1483
  const customError = await handleApiError(err);
@@ -1339,6 +1485,7 @@ export class SubmodelRepositoryClient {
1339
1485
  success: false,
1340
1486
  error: customError,
1341
1487
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1488
+ ...getConditionalErrorFields(err),
1342
1489
  };
1343
1490
  }
1344
1491
  }
@@ -1350,13 +1497,14 @@ export class SubmodelRepositoryClient {
1350
1497
  * - submodelIdentifier: The Submodel’s unique id
1351
1498
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1352
1499
  * - operationRequest: Operation request object
1500
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1353
1501
  *
1354
1502
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1355
1503
  */
1356
1504
  async postInvokeOperationAsync(options) {
1357
- const { configuration, submodelIdentifier, idShortPath, operationRequest } = options;
1505
+ const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
1358
1506
  try {
1359
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1507
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1360
1508
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1361
1509
  const response = await apiInstance.invokeOperationAsyncRaw({
1362
1510
  submodelIdentifier: encodedSubmodelIdentifier,
@@ -1364,7 +1512,7 @@ export class SubmodelRepositoryClient {
1364
1512
  operationRequest: operationRequest,
1365
1513
  });
1366
1514
  const result = await response.value();
1367
- return { success: true, data: result, statusCode: response.raw.status };
1515
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1368
1516
  }
1369
1517
  catch (err) {
1370
1518
  const customError = await handleApiError(err);
@@ -1372,6 +1520,7 @@ export class SubmodelRepositoryClient {
1372
1520
  success: false,
1373
1521
  error: customError,
1374
1522
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1523
+ ...getConditionalErrorFields(err),
1375
1524
  };
1376
1525
  }
1377
1526
  }
@@ -1384,13 +1533,14 @@ export class SubmodelRepositoryClient {
1384
1533
  * - submodelIdentifier: The Submodel’s unique id
1385
1534
  * - idShortPath: IdShort path to the submodel element (dot-separated)
1386
1535
  * - operationRequestValueOnly: Operation request object
1536
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
1387
1537
  *
1388
1538
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1389
1539
  */
1390
1540
  async postInvokeOperationAsyncValueOnly(options) {
1391
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
1541
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
1392
1542
  try {
1393
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1543
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1394
1544
  const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
1395
1545
  const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1396
1546
  const response = await apiInstance.invokeOperationAsyncValueOnlyRaw({
@@ -1400,7 +1550,7 @@ export class SubmodelRepositoryClient {
1400
1550
  operationRequestValueOnly: operationRequestValueOnly,
1401
1551
  });
1402
1552
  const result = await response.value();
1403
- return { success: true, data: result, statusCode: response.raw.status };
1553
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1404
1554
  }
1405
1555
  catch (err) {
1406
1556
  const customError = await handleApiError(err);
@@ -1408,6 +1558,7 @@ export class SubmodelRepositoryClient {
1408
1558
  success: false,
1409
1559
  error: customError,
1410
1560
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1561
+ ...getConditionalErrorFields(err),
1411
1562
  };
1412
1563
  }
1413
1564
  }
@@ -1433,7 +1584,7 @@ export class SubmodelRepositoryClient {
1433
1584
  handleId: handleId,
1434
1585
  });
1435
1586
  const result = await response.value();
1436
- return { success: true, data: result, statusCode: response.raw.status };
1587
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1437
1588
  }
1438
1589
  catch (err) {
1439
1590
  const customError = await handleApiError(err);
@@ -1441,6 +1592,7 @@ export class SubmodelRepositoryClient {
1441
1592
  success: false,
1442
1593
  error: customError,
1443
1594
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1595
+ ...getConditionalErrorFields(err),
1444
1596
  };
1445
1597
  }
1446
1598
  }
@@ -1466,7 +1618,7 @@ export class SubmodelRepositoryClient {
1466
1618
  handleId: handleId,
1467
1619
  });
1468
1620
  const result = await response.value();
1469
- return { success: true, data: result, statusCode: response.raw.status };
1621
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1470
1622
  }
1471
1623
  catch (err) {
1472
1624
  const customError = await handleApiError(err);
@@ -1474,6 +1626,7 @@ export class SubmodelRepositoryClient {
1474
1626
  success: false,
1475
1627
  error: customError,
1476
1628
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1629
+ ...getConditionalErrorFields(err),
1477
1630
  };
1478
1631
  }
1479
1632
  }
@@ -1499,7 +1652,7 @@ export class SubmodelRepositoryClient {
1499
1652
  handleId: handleId,
1500
1653
  });
1501
1654
  const result = await response.value();
1502
- return { success: true, data: result, statusCode: response.raw.status };
1655
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1503
1656
  }
1504
1657
  catch (err) {
1505
1658
  const customError = await handleApiError(err);
@@ -1507,6 +1660,7 @@ export class SubmodelRepositoryClient {
1507
1660
  success: false,
1508
1661
  error: customError,
1509
1662
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1663
+ ...getConditionalErrorFields(err),
1510
1664
  };
1511
1665
  }
1512
1666
  }
@@ -1531,7 +1685,7 @@ export class SubmodelRepositoryClient {
1531
1685
  includeConceptDescriptions: includeConceptDescriptions,
1532
1686
  });
1533
1687
  const result = await response.value();
1534
- return { success: true, data: result, statusCode: response.raw.status };
1688
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1535
1689
  }
1536
1690
  catch (err) {
1537
1691
  const customError = await handleApiError(err);
@@ -1539,6 +1693,7 @@ export class SubmodelRepositoryClient {
1539
1693
  success: false,
1540
1694
  error: customError,
1541
1695
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1696
+ ...getConditionalErrorFields(err),
1542
1697
  };
1543
1698
  }
1544
1699
  }
@@ -1556,7 +1711,7 @@ export class SubmodelRepositoryClient {
1556
1711
  const apiInstance = new SubmodelRepositoryService.DescriptionAPIApi(applyDefaults(configuration));
1557
1712
  const response = await apiInstance.getSelfDescriptionRaw();
1558
1713
  const result = await response.value();
1559
- return { success: true, data: result, statusCode: response.raw.status };
1714
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1560
1715
  }
1561
1716
  catch (err) {
1562
1717
  const customError = await handleApiError(err);
@@ -1564,6 +1719,7 @@ export class SubmodelRepositoryClient {
1564
1719
  success: false,
1565
1720
  error: customError,
1566
1721
  statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1722
+ ...getConditionalErrorFields(err),
1567
1723
  };
1568
1724
  }
1569
1725
  }