basyx-typescript-sdk 2.2.4 → 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.
Files changed (62) hide show
  1. package/README.md +169 -0
  2. package/bundle/index.cjs +3484 -2149
  3. package/bundle/index.cjs.map +1 -1
  4. package/bundle/index.mjs +3484 -2149
  5. package/bundle/index.mjs.map +1 -1
  6. package/dist/clients/AasDiscoveryClient.d.ts +12 -5
  7. package/dist/clients/AasDiscoveryClient.js +104 -27
  8. package/dist/clients/AasRegistryClient.d.ts +32 -10
  9. package/dist/clients/AasRegistryClient.js +211 -61
  10. package/dist/clients/AasRepositoryClient.d.ts +231 -60
  11. package/dist/clients/AasRepositoryClient.js +1021 -353
  12. package/dist/clients/AasxFileClient.d.ts +29 -3
  13. package/dist/clients/AasxFileClient.js +122 -31
  14. package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +14 -4
  15. package/dist/clients/ConceptDescriptionRepositoryClient.js +127 -35
  16. package/dist/clients/SubmodelRegistryClient.d.ts +14 -4
  17. package/dist/clients/SubmodelRegistryClient.js +117 -27
  18. package/dist/clients/SubmodelRepositoryClient.d.ts +339 -58
  19. package/dist/clients/SubmodelRepositoryClient.js +913 -269
  20. package/dist/generated/AasDiscoveryService/models/index.d.ts +2 -2
  21. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +1 -1
  22. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +1 -1
  23. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.d.ts +1 -1
  24. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.js +1 -1
  25. package/dist/generated/AasRegistryService/index.d.ts +1 -1
  26. package/dist/generated/AasRegistryService/index.js +1 -1
  27. package/dist/generated/AasRegistryService/models/index.d.ts +3 -3
  28. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +3 -3
  29. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +1 -1
  30. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.d.ts +1 -1
  31. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.js +1 -1
  32. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.d.ts +1 -1
  33. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.js +1 -1
  34. package/dist/generated/AasRepositoryService/index.d.ts +1 -1
  35. package/dist/generated/AasRepositoryService/index.js +1 -1
  36. package/dist/generated/AasRepositoryService/models/index.d.ts +7 -7
  37. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.d.ts +5 -3
  38. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.js +6 -0
  39. package/dist/generated/AasxFileService/apis/DescriptionAPIApi.d.ts +26 -0
  40. package/dist/generated/AasxFileService/apis/DescriptionAPIApi.js +40 -0
  41. package/dist/generated/AasxFileService/apis/index.d.ts +1 -0
  42. package/dist/generated/AasxFileService/apis/index.js +1 -0
  43. package/dist/generated/AasxFileService/models/index.d.ts +45 -0
  44. package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +2 -2
  45. package/dist/generated/SubmodelRegistryService/models/index.d.ts +2 -2
  46. package/dist/generated/SubmodelRepositoryService/models/index.d.ts +9 -9
  47. package/dist/generated/runtime.js +7 -0
  48. package/dist/lib/apiConfig.d.ts +2 -1
  49. package/dist/lib/apiConfig.js +27 -2
  50. package/dist/lib/conditionalRequests.d.ts +28 -0
  51. package/dist/lib/conditionalRequests.js +55 -0
  52. package/dist/lib/errorHandler.js +13 -2
  53. package/dist/models/api.d.ts +40 -2
  54. package/dist/services/AasService.d.ts +34 -4
  55. package/dist/services/AasService.js +159 -33
  56. package/dist/services/SubmodelService.d.ts +34 -4
  57. package/dist/services/SubmodelService.js +168 -28
  58. package/package.json +14 -3
  59. package/dist/generated/AasRegistryService/runtime.d.ts +0 -181
  60. package/dist/generated/AasRegistryService/runtime.js +0 -326
  61. package/dist/generated/AasRepositoryService/runtime.d.ts +0 -181
  62. package/dist/generated/AasRepositoryService/runtime.js +0 -326
@@ -1,10 +1,33 @@
1
1
  import { SubmodelRepositoryService } from '../generated'; // Updated import
2
+ import { RequiredError } from '../generated/runtime';
2
3
  import { applyDefaults } from '../lib/apiConfig';
3
4
  import { base64Encode } from '../lib/base64Url';
5
+ import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
4
6
  import { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from '../lib/convertSubmodelTypes';
5
7
  import { handleApiError } from '../lib/errorHandler';
6
8
  //import { SubmodelElement } from 'src/generated/SubmodelRepositoryService';
7
9
  export class SubmodelRepositoryClient {
10
+ static requireIdentifier(value, field) {
11
+ if (value === null || value === undefined || value.trim() === '') {
12
+ throw new RequiredError(field, `Required parameter "${field}" was null, undefined, or empty.`);
13
+ }
14
+ return value;
15
+ }
16
+ static extractStatusCode(err, parsedError) {
17
+ const responseStatus = err?.response?.status;
18
+ if (typeof responseStatus === 'number') {
19
+ return responseStatus;
20
+ }
21
+ if (err instanceof RequiredError || err?.name === 'RequiredError') {
22
+ return 400;
23
+ }
24
+ const code = parsedError?.messages?.[0]?.code;
25
+ if (!code) {
26
+ return undefined;
27
+ }
28
+ const parsedCode = Number.parseInt(code, 10);
29
+ return Number.isNaN(parsedCode) ? undefined : parsedCode;
30
+ }
8
31
  /**
9
32
  * Returns all Submodels
10
33
  *
@@ -13,7 +36,7 @@ export class SubmodelRepositoryClient {
13
36
  * - semanticId?: The value of the semantic id reference
14
37
  * - idShort?: The Asset Administration Shell's IdShort
15
38
  * - limit?: The maximum number of elements in the response array
16
- * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
39
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
17
40
  * - level?: Determines the structural depth of the respective resource content
18
41
  * - extent?: Determines to which extent the resource is being serialized
19
42
  *
@@ -23,8 +46,8 @@ export class SubmodelRepositoryClient {
23
46
  const { configuration, semanticId, idShort, limit, cursor, level, extent } = options;
24
47
  try {
25
48
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
26
- const encodedSemanticId = semanticId ? base64Encode(JSON.stringify(semanticId)) : undefined;
27
- const result = await apiInstance.getAllSubmodels({
49
+ const encodedSemanticId = semanticId ? base64Encode(semanticId) : undefined;
50
+ const response = await apiInstance.getAllSubmodelsRaw({
28
51
  semanticId: encodedSemanticId,
29
52
  idShort: idShort,
30
53
  limit: limit,
@@ -32,47 +55,81 @@ export class SubmodelRepositoryClient {
32
55
  level: level,
33
56
  extent: extent,
34
57
  });
58
+ const result = await response.value();
35
59
  const submodels = (result.result ?? []).map(convertApiSubmodelToCoreSubmodel);
36
60
  return {
37
61
  success: true,
38
- data: { pagedResult: result.pagingMetadata, result: submodels },
62
+ data: { pagedResult: result.paging_metadata, result: submodels },
63
+ statusCode: response.raw.status,
64
+ etag: getEtag(response.raw),
39
65
  };
40
66
  }
41
67
  catch (err) {
42
68
  const customError = await handleApiError(err);
43
- return { success: false, error: customError };
69
+ return {
70
+ success: false,
71
+ error: customError,
72
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
73
+ ...getConditionalErrorFields(err),
74
+ };
44
75
  }
45
76
  }
46
77
  /**
47
78
  * Returns all Submodels in metadata representation
79
+ *
80
+ * @param options Object containing:
81
+ * - configuration: The http request options
82
+ * - semanticId?: The value of the semantic id reference
83
+ * - idShort?: The Asset Administration Shell's IdShort
84
+ * - limit?: The maximum number of elements in the response array
85
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
86
+ *
87
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
48
88
  */
49
89
  async getAllSubmodelsMetadata(options) {
50
90
  const { configuration, semanticId, idShort, limit, cursor } = options;
51
91
  try {
52
92
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
53
- const encodedSemanticId = semanticId ? base64Encode(JSON.stringify(semanticId)) : undefined;
54
- const result = await apiInstance.getAllSubmodelsMetadata({
93
+ const encodedSemanticId = semanticId ? base64Encode(semanticId) : undefined;
94
+ const response = await apiInstance.getAllSubmodelsMetadataRaw({
55
95
  semanticId: encodedSemanticId,
56
96
  idShort: idShort,
57
97
  limit: limit,
58
98
  cursor: cursor,
59
99
  });
60
- return { success: true, data: result };
100
+ const result = await response.value();
101
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
61
102
  }
62
103
  catch (err) {
63
104
  const customError = await handleApiError(err);
64
- return { success: false, error: customError };
105
+ return {
106
+ success: false,
107
+ error: customError,
108
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
109
+ ...getConditionalErrorFields(err),
110
+ };
65
111
  }
66
112
  }
67
113
  /**
68
114
  * Returns all Submodels in value-only representation
115
+ *
116
+ * @param options Object containing:
117
+ * - configuration: The http request options
118
+ * - semanticId?: The value of the semantic id reference
119
+ * - idShort?: The Asset Administration Shell's IdShort
120
+ * - limit?: The maximum number of elements in the response array
121
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
122
+ * - level?: Determines the structural depth of the respective resource content
123
+ * - extent?: Determines to which extent the resource is being serialized
124
+ *
125
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
69
126
  */
70
127
  async getAllSubmodelsValueOnly(options) {
71
128
  const { configuration, semanticId, idShort, limit, cursor, level, extent } = options;
72
129
  try {
73
130
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
74
- const encodedSemanticId = semanticId ? base64Encode(JSON.stringify(semanticId)) : undefined;
75
- const result = await apiInstance.getAllSubmodelsValueOnly({
131
+ const encodedSemanticId = semanticId ? base64Encode(semanticId) : undefined;
132
+ const response = await apiInstance.getAllSubmodelsValueOnlyRaw({
76
133
  semanticId: encodedSemanticId,
77
134
  idShort: idShort,
78
135
  limit: limit,
@@ -80,55 +137,93 @@ export class SubmodelRepositoryClient {
80
137
  level: level,
81
138
  extent: extent,
82
139
  });
83
- return { success: true, data: result };
140
+ const result = await response.value();
141
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
84
142
  }
85
143
  catch (err) {
86
144
  const customError = await handleApiError(err);
87
- return { success: false, error: customError };
145
+ return {
146
+ success: false,
147
+ error: customError,
148
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
149
+ ...getConditionalErrorFields(err),
150
+ };
88
151
  }
89
152
  }
90
153
  /**
91
154
  * Returns references to all Submodels
155
+ *
156
+ * @param options Object containing:
157
+ * - configuration: The http request options
158
+ * - semanticId?: The value of the semantic id reference
159
+ * - idShort?: The Asset Administration Shell's IdShort
160
+ * - limit?: The maximum number of elements in the response array
161
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
162
+ * - level?: Determines the structural depth of the respective resource content
163
+ *
164
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
92
165
  */
93
166
  async getAllSubmodelsReference(options) {
94
167
  const { configuration, semanticId, idShort, limit, cursor, level } = options;
95
168
  try {
96
169
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
97
- const encodedSemanticId = semanticId ? base64Encode(JSON.stringify(semanticId)) : undefined;
98
- const result = await apiInstance.getAllSubmodelsReference({
170
+ const encodedSemanticId = semanticId ? base64Encode(semanticId) : undefined;
171
+ const response = await apiInstance.getAllSubmodelsReferenceRaw({
99
172
  semanticId: encodedSemanticId,
100
173
  idShort: idShort,
101
174
  limit: limit,
102
175
  cursor: cursor,
103
176
  level: level,
104
177
  });
105
- return { success: true, data: result };
178
+ const result = await response.value();
179
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
106
180
  }
107
181
  catch (err) {
108
182
  const customError = await handleApiError(err);
109
- return { success: false, error: customError };
183
+ return {
184
+ success: false,
185
+ error: customError,
186
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
187
+ ...getConditionalErrorFields(err),
188
+ };
110
189
  }
111
190
  }
112
191
  /**
113
192
  * Returns paths of all Submodels
193
+ *
194
+ * @param options Object containing:
195
+ * - configuration: The http request options
196
+ * - semanticId?: The value of the semantic id reference
197
+ * - idShort?: The Asset Administration Shell's IdShort
198
+ * - limit?: The maximum number of elements in the response array
199
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
200
+ * - level?: Determines the structural depth of the respective resource content
201
+ *
202
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
114
203
  */
115
204
  async getAllSubmodelsPath(options) {
116
205
  const { configuration, semanticId, idShort, limit, cursor, level } = options;
117
206
  try {
118
207
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
119
- const encodedSemanticId = semanticId ? base64Encode(JSON.stringify(semanticId)) : undefined;
120
- const result = await apiInstance.getAllSubmodelsPath({
208
+ const encodedSemanticId = semanticId ? base64Encode(semanticId) : undefined;
209
+ const response = await apiInstance.getAllSubmodelsPathRaw({
121
210
  semanticId: encodedSemanticId,
122
211
  idShort: idShort,
123
212
  limit: limit,
124
213
  cursor: cursor,
125
214
  level: level,
126
215
  });
127
- return { success: true, data: result };
216
+ const result = await response.value();
217
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
128
218
  }
129
219
  catch (err) {
130
220
  const customError = await handleApiError(err);
131
- return { success: false, error: customError };
221
+ return {
222
+ success: false,
223
+ error: customError,
224
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
225
+ ...getConditionalErrorFields(err),
226
+ };
132
227
  }
133
228
  }
134
229
  /**
@@ -144,14 +239,25 @@ export class SubmodelRepositoryClient {
144
239
  const { configuration, submodel } = options;
145
240
  try {
146
241
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
147
- const result = await apiInstance.postSubmodel({
242
+ const response = await apiInstance.postSubmodelRaw({
148
243
  submodel: convertCoreSubmodelToApiSubmodel(submodel),
149
244
  });
150
- return { success: true, data: convertApiSubmodelToCoreSubmodel(result) };
245
+ const result = await response.value();
246
+ return {
247
+ success: true,
248
+ data: convertApiSubmodelToCoreSubmodel(result),
249
+ statusCode: response.raw.status,
250
+ etag: getEtag(response.raw),
251
+ };
151
252
  }
152
253
  catch (err) {
153
254
  const customError = await handleApiError(err);
154
- return { success: false, error: customError };
255
+ return {
256
+ success: false,
257
+ error: customError,
258
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
259
+ ...getConditionalErrorFields(err),
260
+ };
155
261
  }
156
262
  }
157
263
  /**
@@ -160,22 +266,29 @@ export class SubmodelRepositoryClient {
160
266
  * @param options Object containing:
161
267
  * - configuration: The http request options
162
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
163
270
  *
164
271
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
165
272
  */
166
273
  async deleteSubmodelById(options) {
167
- const { configuration, submodelIdentifier } = options;
274
+ const { configuration, submodelIdentifier, ifMatch } = options;
168
275
  try {
169
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
170
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
171
- const result = await apiInstance.deleteSubmodelById({
276
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
277
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
278
+ const response = await apiInstance.deleteSubmodelByIdRaw({
172
279
  submodelIdentifier: encodedSubmodelIdentifier,
173
280
  });
174
- return { success: true, data: result };
281
+ const result = await response.value();
282
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
175
283
  }
176
284
  catch (err) {
177
285
  const customError = await handleApiError(err);
178
- return { success: false, error: customError };
286
+ return {
287
+ success: false,
288
+ error: customError,
289
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
290
+ ...getConditionalErrorFields(err),
291
+ };
179
292
  }
180
293
  }
181
294
  /**
@@ -186,61 +299,112 @@ export class SubmodelRepositoryClient {
186
299
  * - submodelIdentifier: The Submodel’s unique id
187
300
  * - level?: Determines the structural depth of the respective resource content
188
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`
189
303
  *
190
304
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
191
305
  */
192
306
  async getSubmodelById(options) {
193
- const { configuration, submodelIdentifier, level, extent } = options;
307
+ const { configuration, submodelIdentifier, level, extent, ifNoneMatch } = options;
194
308
  try {
195
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
196
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
197
- const result = await apiInstance.getSubmodelById({
309
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
310
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
311
+ const response = await apiInstance.getSubmodelByIdRaw({
198
312
  submodelIdentifier: encodedSubmodelIdentifier,
199
313
  level: level,
200
314
  extent: extent,
201
315
  });
202
- return { success: true, data: convertApiSubmodelToCoreSubmodel(result) };
316
+ const result = await response.value();
317
+ return {
318
+ success: true,
319
+ data: convertApiSubmodelToCoreSubmodel(result),
320
+ statusCode: response.raw.status,
321
+ etag: getEtag(response.raw),
322
+ };
203
323
  }
204
324
  catch (err) {
325
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
326
+ if (notModified) {
327
+ return notModified;
328
+ }
205
329
  const customError = await handleApiError(err);
206
- return { success: false, error: customError };
330
+ return {
331
+ success: false,
332
+ error: customError,
333
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
334
+ ...getConditionalErrorFields(err),
335
+ };
207
336
  }
208
337
  }
209
338
  /**
210
339
  * Returns a specific Submodel in reference representation
340
+ *
341
+ * @param options Object containing:
342
+ * - configuration: The http request options
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`
345
+ *
346
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
211
347
  */
212
348
  async getSubmodelByIdReference(options) {
213
- const { configuration, submodelIdentifier } = options;
349
+ const { configuration, submodelIdentifier, ifNoneMatch } = options;
214
350
  try {
215
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
216
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
217
- const result = await apiInstance.getSubmodelByIdReference({
351
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
352
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
353
+ const response = await apiInstance.getSubmodelByIdReferenceRaw({
218
354
  submodelIdentifier: encodedSubmodelIdentifier,
219
355
  });
220
- return { success: true, data: result };
356
+ const result = await response.value();
357
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
221
358
  }
222
359
  catch (err) {
360
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
361
+ if (notModified) {
362
+ return notModified;
363
+ }
223
364
  const customError = await handleApiError(err);
224
- return { success: false, error: customError };
365
+ return {
366
+ success: false,
367
+ error: customError,
368
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
369
+ ...getConditionalErrorFields(err),
370
+ };
225
371
  }
226
372
  }
227
373
  /**
228
374
  * Returns a specific Submodel in path representation
375
+ *
376
+ * @param options Object containing:
377
+ * - configuration: The http request options
378
+ * - submodelIdentifier: The Submodel's unique id
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`
381
+ *
382
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
229
383
  */
230
384
  async getSubmodelByIdPath(options) {
231
- const { configuration, submodelIdentifier, level } = options;
385
+ const { configuration, submodelIdentifier, level, ifNoneMatch } = options;
232
386
  try {
233
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
234
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
235
- const result = await apiInstance.getSubmodelByIdPath({
387
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
388
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
389
+ const response = await apiInstance.getSubmodelByIdPathRaw({
236
390
  submodelIdentifier: encodedSubmodelIdentifier,
237
391
  level: level,
238
392
  });
239
- return { success: true, data: result };
393
+ const result = await response.value();
394
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
240
395
  }
241
396
  catch (err) {
397
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
398
+ if (notModified) {
399
+ return notModified;
400
+ }
242
401
  const customError = await handleApiError(err);
243
- return { success: false, error: customError };
402
+ return {
403
+ success: false,
404
+ error: customError,
405
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
406
+ ...getConditionalErrorFields(err),
407
+ };
244
408
  }
245
409
  }
246
410
  /**
@@ -250,43 +414,74 @@ export class SubmodelRepositoryClient {
250
414
  * - configuration: The http request options
251
415
  * - submodelIdentifier: The Submodel’s unique id
252
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)
253
419
  *
254
420
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
255
421
  */
256
422
  async putSubmodelById(options) {
257
- const { configuration, submodelIdentifier, submodel } = options;
423
+ const { configuration, submodelIdentifier, submodel, ifMatch, ifNoneMatch } = options;
258
424
  try {
259
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
260
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
261
- const result = await apiInstance.putSubmodelById({
425
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
426
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
427
+ const response = await apiInstance.putSubmodelByIdRaw({
262
428
  submodelIdentifier: encodedSubmodelIdentifier,
263
429
  submodel: convertCoreSubmodelToApiSubmodel(submodel),
264
430
  });
265
- return { success: true, data: result ? convertApiSubmodelToCoreSubmodel(result) : undefined };
431
+ if (response.raw.status === 204) {
432
+ return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
433
+ }
434
+ const result = await response.value();
435
+ return {
436
+ success: true,
437
+ data: result ? convertApiSubmodelToCoreSubmodel(result) : undefined,
438
+ statusCode: response.raw.status,
439
+ etag: getEtag(response.raw),
440
+ };
266
441
  }
267
442
  catch (err) {
268
443
  const customError = await handleApiError(err);
269
- return { success: false, error: customError };
444
+ return {
445
+ success: false,
446
+ error: customError,
447
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
448
+ ...getConditionalErrorFields(err),
449
+ };
270
450
  }
271
451
  }
272
452
  /**
273
453
  * Updates an existing Submodel partially
454
+ *
455
+ * @param options Object containing:
456
+ * - configuration: The http request options
457
+ * - submodelIdentifier: The Submodel's unique id
458
+ * - submodel: Submodel object
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
461
+ *
462
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
274
463
  */
275
464
  async patchSubmodelById(options) {
276
- const { configuration, submodelIdentifier, submodel, level } = options;
465
+ const { configuration, submodelIdentifier, submodel, level, ifMatch } = options;
277
466
  try {
278
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
279
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
280
- const result = await apiInstance.patchSubmodelById({
467
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
468
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
469
+ const response = await apiInstance.patchSubmodelByIdRaw({
281
470
  submodelIdentifier: encodedSubmodelIdentifier,
282
471
  submodel: convertCoreSubmodelToApiSubmodel(submodel),
283
472
  level: level,
284
473
  });
285
- return { success: true, data: result };
474
+ const result = await response.value();
475
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
286
476
  }
287
477
  catch (err) {
288
478
  const customError = await handleApiError(err);
289
- return { success: false, error: customError };
479
+ return {
480
+ success: false,
481
+ error: customError,
482
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
483
+ ...getConditionalErrorFields(err),
484
+ };
290
485
  }
291
486
  }
292
487
  /**
@@ -296,117 +491,210 @@ export class SubmodelRepositoryClient {
296
491
  * - configuration: The http request options
297
492
  * - submodelIdentifier: The Submodel’s unique id
298
493
  * - limit?: The maximum number of elements in the response array
299
- * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
494
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
300
495
  * - level?: Determines the structural depth of the respective resource content
301
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`
302
498
  *
303
499
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
304
500
  */
305
501
  async getAllSubmodelElements(options) {
306
- const { configuration, submodelIdentifier, limit, cursor, level, extent } = options;
502
+ const { configuration, submodelIdentifier, limit, cursor, level, extent, ifNoneMatch } = options;
307
503
  try {
308
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
309
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
310
- const result = await apiInstance.getAllSubmodelElements({
504
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
505
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
506
+ const response = await apiInstance.getAllSubmodelElementsRaw({
311
507
  submodelIdentifier: encodedSubmodelIdentifier,
312
508
  limit: limit,
313
509
  cursor: cursor,
314
510
  level: level,
315
511
  extent: extent,
316
512
  });
513
+ const result = await response.value();
317
514
  const submodelElements = (result.result ?? []).map(convertApiSubmodelElementToCoreSubmodelElement);
318
515
  return {
319
516
  success: true,
320
- data: { pagedResult: result.pagingMetadata, result: submodelElements },
517
+ data: { pagedResult: result.paging_metadata, result: submodelElements },
518
+ statusCode: response.raw.status,
519
+ etag: getEtag(response.raw),
321
520
  };
322
521
  }
323
522
  catch (err) {
523
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
524
+ if (notModified) {
525
+ return notModified;
526
+ }
324
527
  const customError = await handleApiError(err);
325
- return { success: false, error: customError };
528
+ return {
529
+ success: false,
530
+ error: customError,
531
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
532
+ ...getConditionalErrorFields(err),
533
+ };
326
534
  }
327
535
  }
328
536
  /**
329
537
  * Returns all submodel elements in metadata representation
538
+ *
539
+ * @param options Object containing:
540
+ * - configuration: The http request options
541
+ * - submodelIdentifier: The Submodel's unique id
542
+ * - limit?: The maximum number of elements in the response array
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`
545
+ *
546
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
330
547
  */
331
548
  async getAllSubmodelElementsMetadata(options) {
332
- const { configuration, submodelIdentifier, limit, cursor } = options;
549
+ const { configuration, submodelIdentifier, limit, cursor, ifNoneMatch } = options;
333
550
  try {
334
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
335
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
336
- const result = await apiInstance.getAllSubmodelElementsMetadataSubmodelRepo({
551
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
552
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
553
+ const response = await apiInstance.getAllSubmodelElementsMetadataSubmodelRepoRaw({
337
554
  submodelIdentifier: encodedSubmodelIdentifier,
338
555
  limit: limit,
339
556
  cursor: cursor,
340
557
  });
341
- return { success: true, data: result };
558
+ const result = await response.value();
559
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
342
560
  }
343
561
  catch (err) {
562
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
563
+ if (notModified) {
564
+ return notModified;
565
+ }
344
566
  const customError = await handleApiError(err);
345
- return { success: false, error: customError };
567
+ return {
568
+ success: false,
569
+ error: customError,
570
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
571
+ ...getConditionalErrorFields(err),
572
+ };
346
573
  }
347
574
  }
348
575
  /**
349
576
  * Returns all submodel elements in value-only representation
577
+ *
578
+ * @param options Object containing:
579
+ * - configuration: The http request options
580
+ * - submodelIdentifier: The Submodel's unique id
581
+ * - limit?: The maximum number of elements in the response array
582
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
583
+ * - level?: Determines the structural depth of the respective resource content
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`
586
+ *
587
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
350
588
  */
351
589
  async getAllSubmodelElementsValueOnly(options) {
352
- const { configuration, submodelIdentifier, limit, cursor, level, extent } = options;
590
+ const { configuration, submodelIdentifier, limit, cursor, level, extent, ifNoneMatch } = options;
353
591
  try {
354
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
355
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
356
- const result = await apiInstance.getAllSubmodelElementsValueOnlySubmodelRepo({
592
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
593
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
594
+ const response = await apiInstance.getAllSubmodelElementsValueOnlySubmodelRepoRaw({
357
595
  submodelIdentifier: encodedSubmodelIdentifier,
358
596
  limit: limit,
359
597
  cursor: cursor,
360
598
  level: level,
361
599
  extent: extent,
362
600
  });
363
- return { success: true, data: result };
601
+ const result = await response.value();
602
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
364
603
  }
365
604
  catch (err) {
605
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
606
+ if (notModified) {
607
+ return notModified;
608
+ }
366
609
  const customError = await handleApiError(err);
367
- return { success: false, error: customError };
610
+ return {
611
+ success: false,
612
+ error: customError,
613
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
614
+ ...getConditionalErrorFields(err),
615
+ };
368
616
  }
369
617
  }
370
618
  /**
371
619
  * Returns references to all submodel elements
620
+ *
621
+ * @param options Object containing:
622
+ * - configuration: The http request options
623
+ * - submodelIdentifier: The Submodel's unique id
624
+ * - limit?: The maximum number of elements in the response array
625
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
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`
628
+ *
629
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
372
630
  */
373
631
  async getAllSubmodelElementsReference(options) {
374
- const { configuration, submodelIdentifier, limit, cursor, level } = options;
632
+ const { configuration, submodelIdentifier, limit, cursor, level, ifNoneMatch } = options;
375
633
  try {
376
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
377
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
378
- const result = await apiInstance.getAllSubmodelElementsReferenceSubmodelRepo({
634
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
635
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
636
+ const response = await apiInstance.getAllSubmodelElementsReferenceSubmodelRepoRaw({
379
637
  submodelIdentifier: encodedSubmodelIdentifier,
380
638
  limit: limit,
381
639
  cursor: cursor,
382
640
  level: level,
383
641
  });
384
- return { success: true, data: result };
642
+ const result = await response.value();
643
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
385
644
  }
386
645
  catch (err) {
646
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
647
+ if (notModified) {
648
+ return notModified;
649
+ }
387
650
  const customError = await handleApiError(err);
388
- return { success: false, error: customError };
651
+ return {
652
+ success: false,
653
+ error: customError,
654
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
655
+ ...getConditionalErrorFields(err),
656
+ };
389
657
  }
390
658
  }
391
659
  /**
392
660
  * Returns paths of all submodel elements
661
+ *
662
+ * @param options Object containing:
663
+ * - configuration: The http request options
664
+ * - submodelIdentifier: The Submodel's unique id
665
+ * - limit?: The maximum number of elements in the response array
666
+ * - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
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`
669
+ *
670
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
393
671
  */
394
672
  async getAllSubmodelElementsPath(options) {
395
- const { configuration, submodelIdentifier, limit, cursor, level } = options;
673
+ const { configuration, submodelIdentifier, limit, cursor, level, ifNoneMatch } = options;
396
674
  try {
397
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
398
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
399
- const result = await apiInstance.getAllSubmodelElementsPathSubmodelRepo({
675
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
676
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
677
+ const response = await apiInstance.getAllSubmodelElementsPathSubmodelRepoRaw({
400
678
  submodelIdentifier: encodedSubmodelIdentifier,
401
679
  limit: limit,
402
680
  cursor: cursor,
403
681
  level: level,
404
682
  });
405
- return { success: true, data: result };
683
+ const result = await response.value();
684
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
406
685
  }
407
686
  catch (err) {
687
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
688
+ if (notModified) {
689
+ return notModified;
690
+ }
408
691
  const customError = await handleApiError(err);
409
- return { success: false, error: customError };
692
+ return {
693
+ success: false,
694
+ error: customError,
695
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
696
+ ...getConditionalErrorFields(err),
697
+ };
410
698
  }
411
699
  }
412
700
  /**
@@ -415,23 +703,35 @@ export class SubmodelRepositoryClient {
415
703
  * @param options Object containing:
416
704
  * - configuration: The http request options
417
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
418
707
  *
419
708
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
420
709
  */
421
710
  async postSubmodelElement(options) {
422
- const { configuration, submodelIdentifier, submodelElement } = options;
711
+ const { configuration, submodelIdentifier, submodelElement, ifMatch } = options;
423
712
  try {
424
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
425
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
426
- const result = await apiInstance.postSubmodelElementSubmodelRepo({
713
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
714
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
715
+ const response = await apiInstance.postSubmodelElementSubmodelRepoRaw({
427
716
  submodelIdentifier: encodedSubmodelIdentifier,
428
717
  submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
429
718
  });
430
- return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
719
+ const result = await response.value();
720
+ return {
721
+ success: true,
722
+ data: convertApiSubmodelElementToCoreSubmodelElement(result),
723
+ statusCode: response.raw.status,
724
+ etag: getEtag(response.raw),
725
+ };
431
726
  }
432
727
  catch (err) {
433
728
  const customError = await handleApiError(err);
434
- return { success: false, error: customError };
729
+ return {
730
+ success: false,
731
+ error: customError,
732
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
733
+ ...getConditionalErrorFields(err),
734
+ };
435
735
  }
436
736
  }
437
737
  /**
@@ -443,83 +743,154 @@ export class SubmodelRepositoryClient {
443
743
  * - idShortPath: IdShort path to the submodel element (dot-separated)
444
744
  * - level?: Determines the structural depth of the respective resource content
445
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`
446
747
  *
447
748
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
448
749
  */
449
750
  async getSubmodelElementByPath(options) {
450
- const { configuration, submodelIdentifier, idShortPath, level, extent } = options;
751
+ const { configuration, submodelIdentifier, idShortPath, level, extent, ifNoneMatch } = options;
451
752
  try {
452
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
453
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
454
- const result = await apiInstance.getSubmodelElementByPathSubmodelRepo({
753
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
754
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
755
+ const response = await apiInstance.getSubmodelElementByPathSubmodelRepoRaw({
455
756
  submodelIdentifier: encodedSubmodelIdentifier,
456
757
  idShortPath: idShortPath,
457
758
  level: level,
458
759
  extent: extent,
459
760
  });
460
- return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
761
+ const result = await response.value();
762
+ return {
763
+ success: true,
764
+ data: convertApiSubmodelElementToCoreSubmodelElement(result),
765
+ statusCode: response.raw.status,
766
+ etag: getEtag(response.raw),
767
+ };
461
768
  }
462
769
  catch (err) {
770
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
771
+ if (notModified) {
772
+ return notModified;
773
+ }
463
774
  const customError = await handleApiError(err);
464
- return { success: false, error: customError };
775
+ return {
776
+ success: false,
777
+ error: customError,
778
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
779
+ ...getConditionalErrorFields(err),
780
+ };
465
781
  }
466
782
  }
467
783
  /**
468
784
  * Returns metadata attributes of a specific submodel element
785
+ *
786
+ * @param options Object containing:
787
+ * - configuration: The http request options
788
+ * - submodelIdentifier: The Submodel's unique id
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`
791
+ *
792
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
469
793
  */
470
794
  async getSubmodelElementByPathMetadata(options) {
471
- const { configuration, submodelIdentifier, idShortPath } = options;
795
+ const { configuration, submodelIdentifier, idShortPath, ifNoneMatch } = options;
472
796
  try {
473
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
474
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
475
- const result = await apiInstance.getSubmodelElementByPathMetadataSubmodelRepo({
797
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
798
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
799
+ const response = await apiInstance.getSubmodelElementByPathMetadataSubmodelRepoRaw({
476
800
  submodelIdentifier: encodedSubmodelIdentifier,
477
801
  idShortPath: idShortPath,
478
802
  });
479
- return { success: true, data: result };
803
+ const result = await response.value();
804
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
480
805
  }
481
806
  catch (err) {
807
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
808
+ if (notModified) {
809
+ return notModified;
810
+ }
482
811
  const customError = await handleApiError(err);
483
- return { success: false, error: customError };
812
+ return {
813
+ success: false,
814
+ error: customError,
815
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
816
+ ...getConditionalErrorFields(err),
817
+ };
484
818
  }
485
819
  }
486
820
  /**
487
821
  * Returns a specific submodel element in reference representation
822
+ *
823
+ * @param options Object containing:
824
+ * - configuration: The http request options
825
+ * - submodelIdentifier: The Submodel's unique id
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`
828
+ *
829
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
488
830
  */
489
831
  async getSubmodelElementByPathReference(options) {
490
- const { configuration, submodelIdentifier, idShortPath } = options;
832
+ const { configuration, submodelIdentifier, idShortPath, ifNoneMatch } = options;
491
833
  try {
492
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
493
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
494
- const result = await apiInstance.getSubmodelElementByPathReferenceSubmodelRepo({
834
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
835
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
836
+ const response = await apiInstance.getSubmodelElementByPathReferenceSubmodelRepoRaw({
495
837
  submodelIdentifier: encodedSubmodelIdentifier,
496
838
  idShortPath: idShortPath,
497
839
  });
498
- return { success: true, data: result };
840
+ const result = await response.value();
841
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
499
842
  }
500
843
  catch (err) {
844
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
845
+ if (notModified) {
846
+ return notModified;
847
+ }
501
848
  const customError = await handleApiError(err);
502
- return { success: false, error: customError };
849
+ return {
850
+ success: false,
851
+ error: customError,
852
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
853
+ ...getConditionalErrorFields(err),
854
+ };
503
855
  }
504
856
  }
505
857
  /**
506
858
  * Returns a specific submodel element in path representation
859
+ *
860
+ * @param options Object containing:
861
+ * - configuration: The http request options
862
+ * - submodelIdentifier: The Submodel's unique id
863
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
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`
866
+ *
867
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
507
868
  */
508
869
  async getSubmodelElementByPathPath(options) {
509
- const { configuration, submodelIdentifier, idShortPath, level } = options;
870
+ const { configuration, submodelIdentifier, idShortPath, level, ifNoneMatch } = options;
510
871
  try {
511
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
512
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
513
- const result = await apiInstance.getSubmodelElementByPathPathSubmodelRepo({
872
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
873
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
874
+ const response = await apiInstance.getSubmodelElementByPathPathSubmodelRepoRaw({
514
875
  submodelIdentifier: encodedSubmodelIdentifier,
515
876
  idShortPath: idShortPath,
516
877
  level: level,
517
878
  });
518
- return { success: true, data: result };
879
+ const result = await response.value();
880
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
519
881
  }
520
882
  catch (err) {
883
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
884
+ if (notModified) {
885
+ return notModified;
886
+ }
521
887
  const customError = await handleApiError(err);
522
- return { success: false, error: customError };
888
+ return {
889
+ success: false,
890
+ error: customError,
891
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
892
+ ...getConditionalErrorFields(err),
893
+ };
523
894
  }
524
895
  }
525
896
  /**
@@ -530,24 +901,36 @@ export class SubmodelRepositoryClient {
530
901
  * - submodelIdentifier: The Submodel’s unique id
531
902
  * - idShortPath: IdShort path to the submodel element (dot-separated)
532
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
533
905
  *
534
906
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
535
907
  */
536
908
  async postSubmodelElementByPath(options) {
537
- const { configuration, submodelIdentifier, idShortPath, submodelElement } = options;
909
+ const { configuration, submodelIdentifier, idShortPath, submodelElement, ifMatch } = options;
538
910
  try {
539
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
540
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
541
- const result = await apiInstance.postSubmodelElementByPathSubmodelRepo({
911
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
912
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
913
+ const response = await apiInstance.postSubmodelElementByPathSubmodelRepoRaw({
542
914
  submodelIdentifier: encodedSubmodelIdentifier,
543
915
  idShortPath: idShortPath,
544
916
  submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
545
917
  });
546
- return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
918
+ const result = await response.value();
919
+ return {
920
+ success: true,
921
+ data: convertApiSubmodelElementToCoreSubmodelElement(result),
922
+ statusCode: response.raw.status,
923
+ etag: getEtag(response.raw),
924
+ };
547
925
  }
548
926
  catch (err) {
549
927
  const customError = await handleApiError(err);
550
- return { success: false, error: customError };
928
+ return {
929
+ success: false,
930
+ error: customError,
931
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
932
+ ...getConditionalErrorFields(err),
933
+ };
551
934
  }
552
935
  }
553
936
  /**
@@ -557,23 +940,30 @@ export class SubmodelRepositoryClient {
557
940
  * - configuration: The http request options.
558
941
  * - submodelIdentifier: The Submodel’s unique id
559
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
560
944
  *
561
945
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
562
946
  */
563
947
  async deleteSubmodelElementByPath(options) {
564
- const { configuration, submodelIdentifier, idShortPath } = options;
948
+ const { configuration, submodelIdentifier, idShortPath, ifMatch } = options;
565
949
  try {
566
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
567
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
568
- const result = await apiInstance.deleteSubmodelElementByPathSubmodelRepo({
950
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
951
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
952
+ const response = await apiInstance.deleteSubmodelElementByPathSubmodelRepoRaw({
569
953
  submodelIdentifier: encodedSubmodelIdentifier,
570
954
  idShortPath: idShortPath,
571
955
  });
572
- return { success: true, data: result };
956
+ const result = await response.value();
957
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
573
958
  }
574
959
  catch (err) {
575
960
  const customError = await handleApiError(err);
576
- return { success: false, error: customError };
961
+ return {
962
+ success: false,
963
+ error: customError,
964
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
965
+ ...getConditionalErrorFields(err),
966
+ };
577
967
  }
578
968
  }
579
969
  /**
@@ -585,46 +975,78 @@ export class SubmodelRepositoryClient {
585
975
  * - idShortPath: IdShort path to the submodel element (dot-separated)
586
976
  * - submodelElement: SubmodelElement object
587
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)
588
980
  *
589
981
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
590
982
  */
591
983
  async putSubmodelElementByPath(options) {
592
- const { configuration, submodelIdentifier, idShortPath, submodelElement, level } = options;
984
+ const { configuration, submodelIdentifier, idShortPath, submodelElement, level, ifMatch, ifNoneMatch } = options;
593
985
  try {
594
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
595
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
596
- const result = await apiInstance.putSubmodelElementByPathSubmodelRepo({
986
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
987
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
988
+ const response = await apiInstance.putSubmodelElementByPathSubmodelRepoRaw({
597
989
  submodelIdentifier: encodedSubmodelIdentifier,
598
990
  idShortPath: idShortPath,
599
991
  submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
600
992
  level: level,
601
993
  });
602
- return { success: true, data: result ? convertApiSubmodelElementToCoreSubmodelElement(result) : undefined };
994
+ if (response.raw.status === 204) {
995
+ return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
996
+ }
997
+ const result = await response.value();
998
+ return {
999
+ success: true,
1000
+ data: result ? convertApiSubmodelElementToCoreSubmodelElement(result) : undefined,
1001
+ statusCode: response.raw.status,
1002
+ etag: getEtag(response.raw),
1003
+ };
603
1004
  }
604
1005
  catch (err) {
605
1006
  const customError = await handleApiError(err);
606
- return { success: false, error: customError };
1007
+ return {
1008
+ success: false,
1009
+ error: customError,
1010
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1011
+ ...getConditionalErrorFields(err),
1012
+ };
607
1013
  }
608
1014
  }
609
1015
  /**
610
1016
  * Updates values of an existing submodel element at a specified path
1017
+ *
1018
+ * @param options Object containing:
1019
+ * - configuration: The http request options
1020
+ * - submodelIdentifier: The Submodel's unique id
1021
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1022
+ * - submodelElement: SubmodelElement object
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
1025
+ *
1026
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
611
1027
  */
612
1028
  async patchSubmodelElementByPath(options) {
613
- const { configuration, submodelIdentifier, idShortPath, submodelElement, level } = options;
1029
+ const { configuration, submodelIdentifier, idShortPath, submodelElement, level, ifMatch } = options;
614
1030
  try {
615
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
616
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
617
- const result = await apiInstance.patchSubmodelElementByPathSubmodelRepo({
1031
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1032
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1033
+ const response = await apiInstance.patchSubmodelElementByPathSubmodelRepoRaw({
618
1034
  submodelIdentifier: encodedSubmodelIdentifier,
619
1035
  idShortPath: idShortPath,
620
1036
  submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
621
1037
  level: level,
622
1038
  });
623
- return { success: true, data: result };
1039
+ const result = await response.value();
1040
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
624
1041
  }
625
1042
  catch (err) {
626
1043
  const customError = await handleApiError(err);
627
- return { success: false, error: customError };
1044
+ return {
1045
+ success: false,
1046
+ error: customError,
1047
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1048
+ ...getConditionalErrorFields(err),
1049
+ };
628
1050
  }
629
1051
  }
630
1052
  /**
@@ -633,42 +1055,68 @@ export class SubmodelRepositoryClient {
633
1055
  * @param options Object containing:
634
1056
  * - configuration: The http request options
635
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`
636
1059
  *
637
1060
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
638
1061
  */
639
1062
  async getSubmodelByIdMetadata(options) {
640
- const { configuration, submodelIdentifier } = options;
1063
+ const { configuration, submodelIdentifier, ifNoneMatch } = options;
641
1064
  try {
642
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
643
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
644
- const result = await apiInstance.getSubmodelByIdMetadata({
1065
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
1066
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1067
+ const response = await apiInstance.getSubmodelByIdMetadataRaw({
645
1068
  submodelIdentifier: encodedSubmodelIdentifier,
646
1069
  });
647
- return { success: true, data: result };
1070
+ const result = await response.value();
1071
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
648
1072
  }
649
1073
  catch (err) {
1074
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1075
+ if (notModified) {
1076
+ return notModified;
1077
+ }
650
1078
  const customError = await handleApiError(err);
651
- return { success: false, error: customError };
1079
+ return {
1080
+ success: false,
1081
+ error: customError,
1082
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1083
+ ...getConditionalErrorFields(err),
1084
+ };
652
1085
  }
653
1086
  }
654
1087
  /**
655
1088
  * Updates metadata attributes of an existing Submodel
1089
+ *
1090
+ * @param options Object containing:
1091
+ * - configuration: The http request options
1092
+ * - submodelIdentifier: The Submodel's unique id
1093
+ * - submodelMetadata: SubmodelMetadata object
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
1096
+ *
1097
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
656
1098
  */
657
1099
  async patchSubmodelByIdMetadata(options) {
658
- const { configuration, submodelIdentifier, submodelMetadata, level } = options;
1100
+ const { configuration, submodelIdentifier, submodelMetadata, level, ifMatch } = options;
659
1101
  try {
660
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
661
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
662
- const result = await apiInstance.patchSubmodelByIdMetadata({
1102
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1103
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1104
+ const response = await apiInstance.patchSubmodelByIdMetadataRaw({
663
1105
  submodelIdentifier: encodedSubmodelIdentifier,
664
1106
  submodelMetadata: submodelMetadata,
665
1107
  level: level,
666
1108
  });
667
- return { success: true, data: result };
1109
+ const result = await response.value();
1110
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
668
1111
  }
669
1112
  catch (err) {
670
1113
  const customError = await handleApiError(err);
671
- return { success: false, error: customError };
1114
+ return {
1115
+ success: false,
1116
+ error: customError,
1117
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1118
+ ...getConditionalErrorFields(err),
1119
+ };
672
1120
  }
673
1121
  }
674
1122
  /**
@@ -679,51 +1127,70 @@ export class SubmodelRepositoryClient {
679
1127
  * - submodelIdentifier: The Submodel’s unique id
680
1128
  * - level?: Determines the structural depth of the respective resource content
681
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`
682
1131
  *
683
1132
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
684
1133
  */
685
1134
  async getSubmodelByIdValueOnly(options) {
686
- const { configuration, submodelIdentifier, level, extent } = options;
1135
+ const { configuration, submodelIdentifier, level, extent, ifNoneMatch } = options;
687
1136
  try {
688
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
689
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
690
- const result = await apiInstance.getSubmodelByIdValueOnly({
1137
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
1138
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1139
+ const response = await apiInstance.getSubmodelByIdValueOnlyRaw({
691
1140
  submodelIdentifier: encodedSubmodelIdentifier,
692
1141
  level: level,
693
1142
  extent: extent,
694
1143
  });
695
- return { success: true, data: result };
1144
+ const result = await response.value();
1145
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
696
1146
  }
697
1147
  catch (err) {
1148
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1149
+ if (notModified) {
1150
+ return notModified;
1151
+ }
698
1152
  const customError = await handleApiError(err);
699
- return { success: false, error: customError };
1153
+ return {
1154
+ success: false,
1155
+ error: customError,
1156
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1157
+ ...getConditionalErrorFields(err),
1158
+ };
700
1159
  }
701
1160
  }
702
1161
  /**
703
- // * Updates the values of an existing Submodel
704
- // *
705
- // * @param options Object containing:
706
- // * - configuration: The http request options
707
- // * - submodelIdentifier: The Submodel’s unique id
708
- // * - level?: Determines the structural depth of the respective resource content
709
- // *
710
- // * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
711
- // */
1162
+ * Updates the values of an existing Submodel
1163
+ *
1164
+ * @param options Object containing:
1165
+ * - configuration: The http request options
1166
+ * - submodelIdentifier: The Submodel's unique id
1167
+ * - body: Value-only payload object
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
1170
+ *
1171
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1172
+ */
712
1173
  async patchSubmodelByIdValueOnly(options) {
713
- const { configuration, submodelIdentifier, body, level } = options;
1174
+ const { configuration, submodelIdentifier, body, level, ifMatch } = options;
714
1175
  try {
715
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
716
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
717
- const result = await apiInstance.patchSubmodelByIdValueOnly({
1176
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1177
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1178
+ const response = await apiInstance.patchSubmodelByIdValueOnlyRaw({
718
1179
  submodelIdentifier: encodedSubmodelIdentifier,
719
1180
  body: body,
720
1181
  level: level,
721
1182
  });
722
- return { success: true, data: result };
1183
+ const result = await response.value();
1184
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
723
1185
  }
724
1186
  catch (err) {
725
1187
  const customError = await handleApiError(err);
726
- return { success: false, error: customError };
1188
+ return {
1189
+ success: false,
1190
+ error: customError,
1191
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1192
+ ...getConditionalErrorFields(err),
1193
+ };
727
1194
  }
728
1195
  }
729
1196
  /**
@@ -735,134 +1202,216 @@ export class SubmodelRepositoryClient {
735
1202
  * - idShortPath: IdShort path to the submodel element (dot-separated)
736
1203
  * - level?: Determines the structural depth of the respective resource content
737
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`
738
1206
  *
739
1207
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
740
1208
  */
741
1209
  async getSubmodelElementByPathValueOnly(options) {
742
- const { configuration, submodelIdentifier, idShortPath, level, extent } = options;
1210
+ const { configuration, submodelIdentifier, idShortPath, level, extent, ifNoneMatch } = options;
743
1211
  try {
744
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
745
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
746
- const result = await apiInstance.getSubmodelElementByPathValueOnlySubmodelRepo({
1212
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
1213
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1214
+ const response = await apiInstance.getSubmodelElementByPathValueOnlySubmodelRepoRaw({
747
1215
  submodelIdentifier: encodedSubmodelIdentifier,
748
1216
  idShortPath: idShortPath,
749
1217
  level: level,
750
1218
  extent: extent,
751
1219
  });
752
- return { success: true, data: result };
1220
+ const result = await response.value();
1221
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
753
1222
  }
754
1223
  catch (err) {
1224
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1225
+ if (notModified) {
1226
+ return notModified;
1227
+ }
755
1228
  const customError = await handleApiError(err);
756
- return { success: false, error: customError };
1229
+ return {
1230
+ success: false,
1231
+ error: customError,
1232
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1233
+ ...getConditionalErrorFields(err),
1234
+ };
757
1235
  }
758
1236
  }
759
1237
  /**
760
- // * Updates the value of an existing SubmodelElement
761
- // *
762
- // * @param options Object containing:
763
- // * - configuration: The http request options
764
- // * - submodelIdentifier: The Submodel’s unique id
765
- // * - idShortPath: IdShort path to the submodel element (dot-separated)
766
- // * - submodelElementValue: SubmodelElementValue object
767
- // * - level?: Determines the structural depth of the respective resource content
768
- // *
769
- // * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
770
- // */
1238
+ * Updates the value of an existing SubmodelElement
1239
+ *
1240
+ * @param options Object containing:
1241
+ * - configuration: The http request options
1242
+ * - submodelIdentifier: The Submodel's unique id
1243
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1244
+ * - submodelElementValue: SubmodelElementValue object
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
1247
+ *
1248
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1249
+ */
771
1250
  async patchSubmodelElementByPathValueOnly(options) {
772
- const { configuration, submodelIdentifier, idShortPath, submodelElementValue, level } = options;
1251
+ const { configuration, submodelIdentifier, idShortPath, submodelElementValue, level, ifMatch } = options;
773
1252
  try {
774
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
775
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
776
- const result = await apiInstance.patchSubmodelElementByPathValueOnlySubmodelRepo({
1253
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1254
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1255
+ const response = await apiInstance.patchSubmodelElementByPathValueOnlySubmodelRepoRaw({
777
1256
  submodelIdentifier: encodedSubmodelIdentifier,
778
1257
  idShortPath: idShortPath,
779
1258
  submodelElementValue: submodelElementValue,
780
1259
  level: level,
781
1260
  });
782
- return { success: true, data: result };
1261
+ const result = await response.value();
1262
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
783
1263
  }
784
1264
  catch (err) {
785
1265
  const customError = await handleApiError(err);
786
- return { success: false, error: customError };
1266
+ return {
1267
+ success: false,
1268
+ error: customError,
1269
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1270
+ ...getConditionalErrorFields(err),
1271
+ };
787
1272
  }
788
1273
  }
789
1274
  /**
790
1275
  * Updates metadata attributes of an existing SubmodelElement
1276
+ *
1277
+ * @param options Object containing:
1278
+ * - configuration: The http request options
1279
+ * - submodelIdentifier: The Submodel's unique id
1280
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
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
1283
+ *
1284
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
791
1285
  */
792
1286
  async patchSubmodelElementByPathMetadata(options) {
793
- const { configuration, submodelIdentifier, idShortPath, submodelElementMetadata } = options;
1287
+ const { configuration, submodelIdentifier, idShortPath, submodelElementMetadata, ifMatch } = options;
794
1288
  try {
795
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
796
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
797
- const result = await apiInstance.patchSubmodelElementByPathMetadataSubmodelRepo({
1289
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1290
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1291
+ const response = await apiInstance.patchSubmodelElementByPathMetadataSubmodelRepoRaw({
798
1292
  submodelIdentifier: encodedSubmodelIdentifier,
799
1293
  idShortPath: idShortPath,
800
1294
  submodelElementMetadata: submodelElementMetadata,
801
1295
  });
802
- return { success: true, data: result };
1296
+ const result = await response.value();
1297
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
803
1298
  }
804
1299
  catch (err) {
805
1300
  const customError = await handleApiError(err);
806
- return { success: false, error: customError };
1301
+ return {
1302
+ success: false,
1303
+ error: customError,
1304
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1305
+ ...getConditionalErrorFields(err),
1306
+ };
807
1307
  }
808
1308
  }
809
1309
  /**
810
1310
  * Returns file content for a submodel element at a specified path
1311
+ *
1312
+ * @param options Object containing:
1313
+ * - configuration: The http request options
1314
+ * - submodelIdentifier: The Submodel's unique id
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`
1317
+ *
1318
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
811
1319
  */
812
1320
  async getFileByPath(options) {
813
- const { configuration, submodelIdentifier, idShortPath } = options;
1321
+ const { configuration, submodelIdentifier, idShortPath, ifNoneMatch } = options;
814
1322
  try {
815
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
816
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
817
- const result = await apiInstance.getFileByPathSubmodelRepo({
1323
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
1324
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1325
+ const response = await apiInstance.getFileByPathSubmodelRepoRaw({
818
1326
  submodelIdentifier: encodedSubmodelIdentifier,
819
1327
  idShortPath: idShortPath,
820
1328
  });
821
- return { success: true, data: result };
1329
+ const result = await response.value();
1330
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
822
1331
  }
823
1332
  catch (err) {
1333
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
1334
+ if (notModified) {
1335
+ return notModified;
1336
+ }
824
1337
  const customError = await handleApiError(err);
825
- return { success: false, error: customError };
1338
+ return {
1339
+ success: false,
1340
+ error: customError,
1341
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1342
+ ...getConditionalErrorFields(err),
1343
+ };
826
1344
  }
827
1345
  }
828
1346
  /**
829
1347
  * Updates file content for a submodel element at a specified path
1348
+ *
1349
+ * @param options Object containing:
1350
+ * - configuration: The http request options
1351
+ * - submodelIdentifier: The Submodel's unique id
1352
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1353
+ * - fileName?: Name of the uploaded file
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)
1357
+ *
1358
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
830
1359
  */
831
1360
  async putFileByPath(options) {
832
- const { configuration, submodelIdentifier, idShortPath, fileName, file } = options;
1361
+ const { configuration, submodelIdentifier, idShortPath, fileName, file, ifMatch, ifNoneMatch } = options;
833
1362
  try {
834
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
835
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
836
- const result = await apiInstance.putFileByPathSubmodelRepo({
1363
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
1364
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1365
+ const response = await apiInstance.putFileByPathSubmodelRepoRaw({
837
1366
  submodelIdentifier: encodedSubmodelIdentifier,
838
1367
  idShortPath: idShortPath,
839
1368
  fileName: fileName,
840
1369
  file: file,
841
1370
  });
842
- return { success: true, data: result };
1371
+ const result = await response.value();
1372
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
843
1373
  }
844
1374
  catch (err) {
845
1375
  const customError = await handleApiError(err);
846
- return { success: false, error: customError };
1376
+ return {
1377
+ success: false,
1378
+ error: customError,
1379
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1380
+ ...getConditionalErrorFields(err),
1381
+ };
847
1382
  }
848
1383
  }
849
1384
  /**
850
1385
  * Deletes file content of an existing submodel element at a specified path
1386
+ *
1387
+ * @param options Object containing:
1388
+ * - configuration: The http request options
1389
+ * - submodelIdentifier: The Submodel's unique id
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
1392
+ *
1393
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
851
1394
  */
852
1395
  async deleteFileByPath(options) {
853
- const { configuration, submodelIdentifier, idShortPath } = options;
1396
+ const { configuration, submodelIdentifier, idShortPath, ifMatch } = options;
854
1397
  try {
855
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
856
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
857
- const result = await apiInstance.deleteFileByPathSubmodelRepo({
1398
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1399
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1400
+ const response = await apiInstance.deleteFileByPathSubmodelRepoRaw({
858
1401
  submodelIdentifier: encodedSubmodelIdentifier,
859
1402
  idShortPath: idShortPath,
860
1403
  });
861
- return { success: true, data: result };
1404
+ const result = await response.value();
1405
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
862
1406
  }
863
1407
  catch (err) {
864
1408
  const customError = await handleApiError(err);
865
- return { success: false, error: customError };
1409
+ return {
1410
+ success: false,
1411
+ error: customError,
1412
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1413
+ ...getConditionalErrorFields(err),
1414
+ };
866
1415
  }
867
1416
  }
868
1417
  /**
@@ -874,25 +1423,32 @@ export class SubmodelRepositoryClient {
874
1423
  * - idShortPath: IdShort path to the submodel element (dot-separated)
875
1424
  * - operationRequest: Operation request object
876
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
877
1427
  *
878
1428
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
879
1429
  */
880
1430
  async postInvokeOperationSubmodelRepo(options) {
881
- const { configuration, submodelIdentifier, idShortPath, operationRequest } = options;
1431
+ const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
882
1432
  try {
883
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
884
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
885
- const result = await apiInstance.invokeOperationSubmodelRepo({
1433
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1434
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1435
+ const response = await apiInstance.invokeOperationSubmodelRepoRaw({
886
1436
  submodelIdentifier: encodedSubmodelIdentifier,
887
1437
  idShortPath: idShortPath,
888
1438
  operationRequest: operationRequest,
889
1439
  //async: async,
890
1440
  });
891
- return { success: true, data: result };
1441
+ const result = await response.value();
1442
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
892
1443
  }
893
1444
  catch (err) {
894
1445
  const customError = await handleApiError(err);
895
- return { success: false, error: customError };
1446
+ return {
1447
+ success: false,
1448
+ error: customError,
1449
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1450
+ ...getConditionalErrorFields(err),
1451
+ };
896
1452
  }
897
1453
  }
898
1454
  /**
@@ -904,26 +1460,33 @@ export class SubmodelRepositoryClient {
904
1460
  * - submodelIdentifier: The Submodel’s unique id
905
1461
  * - idShortPath: IdShort path to the submodel element (dot-separated)
906
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
907
1464
  *
908
1465
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
909
1466
  */
910
1467
  async postInvokeOperationValueOnly(options) {
911
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
1468
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
912
1469
  try {
913
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
914
- const encodedAasIdentifier = base64Encode(aasIdentifier);
915
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
916
- const result = await apiInstance.invokeOperationValueOnly({
1470
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1471
+ const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
1472
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1473
+ const response = await apiInstance.invokeOperationValueOnlyRaw({
917
1474
  aasIdentifier: encodedAasIdentifier,
918
1475
  submodelIdentifier: encodedSubmodelIdentifier,
919
1476
  idShortPath: idShortPath,
920
1477
  operationRequestValueOnly: operationRequestValueOnly,
921
1478
  });
922
- return { success: true, data: result };
1479
+ const result = await response.value();
1480
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
923
1481
  }
924
1482
  catch (err) {
925
1483
  const customError = await handleApiError(err);
926
- return { success: false, error: customError };
1484
+ return {
1485
+ success: false,
1486
+ error: customError,
1487
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1488
+ ...getConditionalErrorFields(err),
1489
+ };
927
1490
  }
928
1491
  }
929
1492
  /**
@@ -934,24 +1497,31 @@ export class SubmodelRepositoryClient {
934
1497
  * - submodelIdentifier: The Submodel’s unique id
935
1498
  * - idShortPath: IdShort path to the submodel element (dot-separated)
936
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
937
1501
  *
938
1502
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
939
1503
  */
940
1504
  async postInvokeOperationAsync(options) {
941
- const { configuration, submodelIdentifier, idShortPath, operationRequest } = options;
1505
+ const { configuration, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
942
1506
  try {
943
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
944
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
945
- const result = await apiInstance.invokeOperationAsync({
1507
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1508
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1509
+ const response = await apiInstance.invokeOperationAsyncRaw({
946
1510
  submodelIdentifier: encodedSubmodelIdentifier,
947
1511
  idShortPath: idShortPath,
948
1512
  operationRequest: operationRequest,
949
1513
  });
950
- return { success: true, data: result };
1514
+ const result = await response.value();
1515
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
951
1516
  }
952
1517
  catch (err) {
953
1518
  const customError = await handleApiError(err);
954
- return { success: false, error: customError };
1519
+ return {
1520
+ success: false,
1521
+ error: customError,
1522
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1523
+ ...getConditionalErrorFields(err),
1524
+ };
955
1525
  }
956
1526
  }
957
1527
  /**
@@ -963,120 +1533,194 @@ export class SubmodelRepositoryClient {
963
1533
  * - submodelIdentifier: The Submodel’s unique id
964
1534
  * - idShortPath: IdShort path to the submodel element (dot-separated)
965
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
966
1537
  *
967
1538
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
968
1539
  */
969
1540
  async postInvokeOperationAsyncValueOnly(options) {
970
- const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
1541
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
971
1542
  try {
972
- const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
973
- const encodedAasIdentifier = base64Encode(aasIdentifier);
974
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
975
- const result = await apiInstance.invokeOperationAsyncValueOnly({
1543
+ const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
1544
+ const encodedAasIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
1545
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1546
+ const response = await apiInstance.invokeOperationAsyncValueOnlyRaw({
976
1547
  aasIdentifier: encodedAasIdentifier,
977
1548
  submodelIdentifier: encodedSubmodelIdentifier,
978
1549
  idShortPath: idShortPath,
979
1550
  operationRequestValueOnly: operationRequestValueOnly,
980
1551
  });
981
- return { success: true, data: result };
1552
+ const result = await response.value();
1553
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
982
1554
  }
983
1555
  catch (err) {
984
1556
  const customError = await handleApiError(err);
985
- return { success: false, error: customError };
1557
+ return {
1558
+ success: false,
1559
+ error: customError,
1560
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1561
+ ...getConditionalErrorFields(err),
1562
+ };
986
1563
  }
987
1564
  }
988
1565
  /**
989
1566
  * Returns status of an asynchronously invoked operation
1567
+ *
1568
+ * @param options Object containing:
1569
+ * - configuration: The http request options
1570
+ * - submodelIdentifier: The Submodel's unique id
1571
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1572
+ * - handleId: Identifier of the asynchronous invocation handle
1573
+ *
1574
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
990
1575
  */
991
1576
  async getOperationAsyncStatus(options) {
992
1577
  const { configuration, submodelIdentifier, idShortPath, handleId } = options;
993
1578
  try {
994
1579
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
995
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
996
- const result = await apiInstance.getOperationAsyncStatus({
1580
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1581
+ const response = await apiInstance.getOperationAsyncStatusRaw({
997
1582
  submodelIdentifier: encodedSubmodelIdentifier,
998
1583
  idShortPath: idShortPath,
999
1584
  handleId: handleId,
1000
1585
  });
1001
- return { success: true, data: result };
1586
+ const result = await response.value();
1587
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1002
1588
  }
1003
1589
  catch (err) {
1004
1590
  const customError = await handleApiError(err);
1005
- return { success: false, error: customError };
1591
+ return {
1592
+ success: false,
1593
+ error: customError,
1594
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1595
+ ...getConditionalErrorFields(err),
1596
+ };
1006
1597
  }
1007
1598
  }
1008
1599
  /**
1009
1600
  * Returns result of an asynchronously invoked operation
1601
+ *
1602
+ * @param options Object containing:
1603
+ * - configuration: The http request options
1604
+ * - submodelIdentifier: The Submodel's unique id
1605
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1606
+ * - handleId: Identifier of the asynchronous invocation handle
1607
+ *
1608
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1010
1609
  */
1011
1610
  async getOperationAsyncResult(options) {
1012
1611
  const { configuration, submodelIdentifier, idShortPath, handleId } = options;
1013
1612
  try {
1014
1613
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1015
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1016
- const result = await apiInstance.getOperationAsyncResult({
1614
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1615
+ const response = await apiInstance.getOperationAsyncResultRaw({
1017
1616
  submodelIdentifier: encodedSubmodelIdentifier,
1018
1617
  idShortPath: idShortPath,
1019
1618
  handleId: handleId,
1020
1619
  });
1021
- return { success: true, data: result };
1620
+ const result = await response.value();
1621
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1022
1622
  }
1023
1623
  catch (err) {
1024
1624
  const customError = await handleApiError(err);
1025
- return { success: false, error: customError };
1625
+ return {
1626
+ success: false,
1627
+ error: customError,
1628
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1629
+ ...getConditionalErrorFields(err),
1630
+ };
1026
1631
  }
1027
1632
  }
1028
1633
  /**
1029
1634
  * Returns result of an asynchronously invoked operation in value-only representation
1635
+ *
1636
+ * @param options Object containing:
1637
+ * - configuration: The http request options
1638
+ * - submodelIdentifier: The Submodel's unique id
1639
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1640
+ * - handleId: Identifier of the asynchronous invocation handle
1641
+ *
1642
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1030
1643
  */
1031
1644
  async getOperationAsyncResultValueOnly(options) {
1032
1645
  const { configuration, submodelIdentifier, idShortPath, handleId } = options;
1033
1646
  try {
1034
1647
  const apiInstance = new SubmodelRepositoryService.SubmodelRepositoryAPIApi(applyDefaults(configuration));
1035
- const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1036
- const result = await apiInstance.getOperationAsyncResultValueOnly({
1648
+ const encodedSubmodelIdentifier = base64Encode(SubmodelRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
1649
+ const response = await apiInstance.getOperationAsyncResultValueOnlyRaw({
1037
1650
  submodelIdentifier: encodedSubmodelIdentifier,
1038
1651
  idShortPath: idShortPath,
1039
1652
  handleId: handleId,
1040
1653
  });
1041
- return { success: true, data: result };
1654
+ const result = await response.value();
1655
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1042
1656
  }
1043
1657
  catch (err) {
1044
1658
  const customError = await handleApiError(err);
1045
- return { success: false, error: customError };
1659
+ return {
1660
+ success: false,
1661
+ error: customError,
1662
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1663
+ ...getConditionalErrorFields(err),
1664
+ };
1046
1665
  }
1047
1666
  }
1048
1667
  /**
1049
1668
  * Returns an appropriate serialization based on the specified format
1669
+ *
1670
+ * @param options Object containing:
1671
+ * - configuration: The http request options
1672
+ * - aasIds?: Asset Administration Shell IDs
1673
+ * - submodelIds?: Submodel IDs
1674
+ * - includeConceptDescriptions?: Whether to include referenced ConceptDescriptions in the serialization result
1675
+ *
1676
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1050
1677
  */
1051
1678
  async generateSerializationByIds(options) {
1052
1679
  const { configuration, aasIds, submodelIds, includeConceptDescriptions } = options;
1053
1680
  try {
1054
1681
  const apiInstance = new SubmodelRepositoryService.SerializationAPIApi(applyDefaults(configuration));
1055
- const result = await apiInstance.generateSerializationByIds({
1682
+ const response = await apiInstance.generateSerializationByIdsRaw({
1056
1683
  aasIds: aasIds,
1057
1684
  submodelIds: submodelIds,
1058
1685
  includeConceptDescriptions: includeConceptDescriptions,
1059
1686
  });
1060
- return { success: true, data: result };
1687
+ const result = await response.value();
1688
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1061
1689
  }
1062
1690
  catch (err) {
1063
1691
  const customError = await handleApiError(err);
1064
- return { success: false, error: customError };
1692
+ return {
1693
+ success: false,
1694
+ error: customError,
1695
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1696
+ ...getConditionalErrorFields(err),
1697
+ };
1065
1698
  }
1066
1699
  }
1067
1700
  /**
1068
1701
  * Returns the self-describing information of a network resource (ServiceDescription)
1702
+ *
1703
+ * @param options Object containing:
1704
+ * - configuration: The http request options
1705
+ *
1706
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1069
1707
  */
1070
1708
  async getSelfDescription(options) {
1071
1709
  const { configuration } = options;
1072
1710
  try {
1073
1711
  const apiInstance = new SubmodelRepositoryService.DescriptionAPIApi(applyDefaults(configuration));
1074
- const result = await apiInstance.getSelfDescription();
1075
- return { success: true, data: result };
1712
+ const response = await apiInstance.getSelfDescriptionRaw();
1713
+ const result = await response.value();
1714
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
1076
1715
  }
1077
1716
  catch (err) {
1078
1717
  const customError = await handleApiError(err);
1079
- return { success: false, error: customError };
1718
+ return {
1719
+ success: false,
1720
+ error: customError,
1721
+ statusCode: SubmodelRepositoryClient.extractStatusCode(err, customError),
1722
+ ...getConditionalErrorFields(err),
1723
+ };
1080
1724
  }
1081
1725
  }
1082
1726
  }