basyx-typescript-sdk 2.2.5 → 2.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +54 -0
- package/bundle/index.cjs +1181 -511
- package/bundle/index.cjs.map +1 -1
- package/bundle/index.mjs +1181 -511
- package/bundle/index.mjs.map +1 -1
- package/dist/clients/AasDiscoveryClient.d.ts +9 -3
- package/dist/clients/AasDiscoveryClient.js +28 -9
- package/dist/clients/AasRegistryClient.d.ts +28 -8
- package/dist/clients/AasRegistryClient.js +63 -21
- package/dist/clients/AasRepositoryClient.d.ts +170 -56
- package/dist/clients/AasRepositoryClient.js +385 -136
- package/dist/clients/AasxFileClient.d.ts +11 -3
- package/dist/clients/AasxFileClient.js +27 -11
- package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +11 -3
- package/dist/clients/ConceptDescriptionRepositoryClient.js +40 -12
- package/dist/clients/SubmodelRegistryClient.d.ts +11 -3
- package/dist/clients/SubmodelRegistryClient.js +28 -8
- package/dist/clients/SubmodelRepositoryClient.d.ts +108 -34
- package/dist/clients/SubmodelRepositoryClient.js +262 -106
- package/dist/lib/apiConfig.d.ts +2 -1
- package/dist/lib/apiConfig.js +27 -2
- package/dist/lib/conditionalRequests.d.ts +28 -0
- package/dist/lib/conditionalRequests.js +55 -0
- package/dist/models/api.d.ts +38 -2
- package/dist/services/AasService.d.ts +13 -3
- package/dist/services/AasService.js +45 -7
- package/dist/services/SubmodelService.d.ts +13 -3
- package/dist/services/SubmodelService.js +49 -7
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@ import { AasRepositoryService } from '../generated';
|
|
|
2
2
|
import { RequiredError } from '../generated/runtime';
|
|
3
3
|
import { applyDefaults } from '../lib/apiConfig';
|
|
4
4
|
import { base64Encode } from '../lib/base64Url';
|
|
5
|
+
import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
|
|
5
6
|
import { convertApiAasToCoreAas, convertApiAssetInformationToCoreAssetInformation, convertApiReferenceToCoreReference, convertCoreAasToApiAas, convertCoreAssetInformationToApiAssetInformation, convertCoreReferenceToApiReference, } from '../lib/convertAasTypes';
|
|
6
7
|
import { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from '../lib/convertSubmodelTypes';
|
|
7
8
|
import { handleApiError } from '../lib/errorHandler';
|
|
@@ -56,6 +57,7 @@ export class AasRepositoryClient {
|
|
|
56
57
|
success: true,
|
|
57
58
|
data: { pagedResult: result.paging_metadata, result: shells },
|
|
58
59
|
statusCode: response.raw.status,
|
|
60
|
+
etag: getEtag(response.raw),
|
|
59
61
|
};
|
|
60
62
|
}
|
|
61
63
|
catch (err) {
|
|
@@ -64,6 +66,7 @@ export class AasRepositoryClient {
|
|
|
64
66
|
success: false,
|
|
65
67
|
error: customError,
|
|
66
68
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
69
|
+
...getConditionalErrorFields(err),
|
|
67
70
|
};
|
|
68
71
|
}
|
|
69
72
|
}
|
|
@@ -96,6 +99,7 @@ export class AasRepositoryClient {
|
|
|
96
99
|
success: true,
|
|
97
100
|
data: { pagedResult: result.paging_metadata, result: shellReferences },
|
|
98
101
|
statusCode: response.raw.status,
|
|
102
|
+
etag: getEtag(response.raw),
|
|
99
103
|
};
|
|
100
104
|
}
|
|
101
105
|
catch (err) {
|
|
@@ -104,6 +108,7 @@ export class AasRepositoryClient {
|
|
|
104
108
|
success: false,
|
|
105
109
|
error: customError,
|
|
106
110
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
111
|
+
...getConditionalErrorFields(err),
|
|
107
112
|
};
|
|
108
113
|
}
|
|
109
114
|
}
|
|
@@ -124,7 +129,12 @@ export class AasRepositoryClient {
|
|
|
124
129
|
assetAdministrationShell: convertCoreAasToApiAas(assetAdministrationShell),
|
|
125
130
|
});
|
|
126
131
|
const result = await response.value();
|
|
127
|
-
return {
|
|
132
|
+
return {
|
|
133
|
+
success: true,
|
|
134
|
+
data: convertApiAasToCoreAas(result),
|
|
135
|
+
statusCode: response.raw.status,
|
|
136
|
+
etag: getEtag(response.raw),
|
|
137
|
+
};
|
|
128
138
|
}
|
|
129
139
|
catch (err) {
|
|
130
140
|
const customError = await handleApiError(err);
|
|
@@ -132,6 +142,7 @@ export class AasRepositoryClient {
|
|
|
132
142
|
success: false,
|
|
133
143
|
error: customError,
|
|
134
144
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
145
|
+
...getConditionalErrorFields(err),
|
|
135
146
|
};
|
|
136
147
|
}
|
|
137
148
|
}
|
|
@@ -141,19 +152,20 @@ export class AasRepositoryClient {
|
|
|
141
152
|
* @param options Object containing:
|
|
142
153
|
* - configuration: The http request options
|
|
143
154
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
155
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
144
156
|
*
|
|
145
157
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
146
158
|
*/
|
|
147
159
|
async deleteAssetAdministrationShellById(options) {
|
|
148
|
-
const { configuration, aasIdentifier } = options;
|
|
160
|
+
const { configuration, aasIdentifier, ifMatch } = options;
|
|
149
161
|
try {
|
|
150
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
162
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
151
163
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
152
164
|
const response = await apiInstance.deleteAssetAdministrationShellByIdRaw({
|
|
153
165
|
aasIdentifier: encodedAasIdentifier,
|
|
154
166
|
});
|
|
155
167
|
const result = await response.value();
|
|
156
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
168
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
157
169
|
}
|
|
158
170
|
catch (err) {
|
|
159
171
|
const customError = await handleApiError(err);
|
|
@@ -161,6 +173,7 @@ export class AasRepositoryClient {
|
|
|
161
173
|
success: false,
|
|
162
174
|
error: customError,
|
|
163
175
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
176
|
+
...getConditionalErrorFields(err),
|
|
164
177
|
};
|
|
165
178
|
}
|
|
166
179
|
}
|
|
@@ -170,26 +183,37 @@ export class AasRepositoryClient {
|
|
|
170
183
|
* @param options Object containing:
|
|
171
184
|
* - configuration: The http request options
|
|
172
185
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
186
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
173
187
|
*
|
|
174
188
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
175
189
|
*/
|
|
176
190
|
async getAssetAdministrationShellById(options) {
|
|
177
|
-
const { configuration, aasIdentifier } = options;
|
|
191
|
+
const { configuration, aasIdentifier, ifNoneMatch } = options;
|
|
178
192
|
try {
|
|
179
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
193
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
180
194
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
181
195
|
const response = await apiInstance.getAssetAdministrationShellByIdRaw({
|
|
182
196
|
aasIdentifier: encodedAasIdentifier,
|
|
183
197
|
});
|
|
184
198
|
const result = await response.value();
|
|
185
|
-
return {
|
|
199
|
+
return {
|
|
200
|
+
success: true,
|
|
201
|
+
data: convertApiAasToCoreAas(result),
|
|
202
|
+
statusCode: response.raw.status,
|
|
203
|
+
etag: getEtag(response.raw),
|
|
204
|
+
};
|
|
186
205
|
}
|
|
187
206
|
catch (err) {
|
|
207
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
208
|
+
if (notModified) {
|
|
209
|
+
return notModified;
|
|
210
|
+
}
|
|
188
211
|
const customError = await handleApiError(err);
|
|
189
212
|
return {
|
|
190
213
|
success: false,
|
|
191
214
|
error: customError,
|
|
192
215
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
216
|
+
...getConditionalErrorFields(err),
|
|
193
217
|
};
|
|
194
218
|
}
|
|
195
219
|
}
|
|
@@ -200,26 +224,29 @@ export class AasRepositoryClient {
|
|
|
200
224
|
* - configuration: The http request options
|
|
201
225
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
202
226
|
* - assetAdministrationShell: Asset Administration Shell object
|
|
227
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
228
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
203
229
|
*
|
|
204
230
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
205
231
|
*/
|
|
206
232
|
async putAssetAdministrationShellById(options) {
|
|
207
|
-
const { configuration, aasIdentifier, assetAdministrationShell } = options;
|
|
233
|
+
const { configuration, aasIdentifier, assetAdministrationShell, ifMatch, ifNoneMatch } = options;
|
|
208
234
|
try {
|
|
209
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
235
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
210
236
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
211
237
|
const response = await apiInstance.putAssetAdministrationShellByIdRaw({
|
|
212
238
|
aasIdentifier: encodedAasIdentifier,
|
|
213
239
|
assetAdministrationShell: convertCoreAasToApiAas(assetAdministrationShell),
|
|
214
240
|
});
|
|
215
241
|
if (response.raw.status === 204) {
|
|
216
|
-
return { success: true, data: undefined, statusCode: response.raw.status };
|
|
242
|
+
return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
217
243
|
}
|
|
218
244
|
const result = await response.value();
|
|
219
245
|
return {
|
|
220
246
|
success: true,
|
|
221
247
|
data: result ? convertApiAasToCoreAas(result) : undefined,
|
|
222
248
|
statusCode: response.raw.status,
|
|
249
|
+
etag: getEtag(response.raw),
|
|
223
250
|
};
|
|
224
251
|
}
|
|
225
252
|
catch (err) {
|
|
@@ -228,6 +255,7 @@ export class AasRepositoryClient {
|
|
|
228
255
|
success: false,
|
|
229
256
|
error: customError,
|
|
230
257
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
258
|
+
...getConditionalErrorFields(err),
|
|
231
259
|
};
|
|
232
260
|
}
|
|
233
261
|
}
|
|
@@ -237,13 +265,14 @@ export class AasRepositoryClient {
|
|
|
237
265
|
* @param options Object containing:
|
|
238
266
|
* - configuration: The http request options
|
|
239
267
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
268
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
240
269
|
*
|
|
241
270
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
242
271
|
*/
|
|
243
272
|
async getAssetAdministrationShellByIdReferenceAasRepository(options) {
|
|
244
|
-
const { configuration, aasIdentifier } = options;
|
|
273
|
+
const { configuration, aasIdentifier, ifNoneMatch } = options;
|
|
245
274
|
try {
|
|
246
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
275
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
247
276
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
248
277
|
const response = await apiInstance.getAssetAdministrationShellByIdReferenceAasRepositoryRaw({
|
|
249
278
|
aasIdentifier: encodedAasIdentifier,
|
|
@@ -253,14 +282,20 @@ export class AasRepositoryClient {
|
|
|
253
282
|
success: true,
|
|
254
283
|
data: convertApiReferenceToCoreReference(result),
|
|
255
284
|
statusCode: response.raw.status,
|
|
285
|
+
etag: getEtag(response.raw),
|
|
256
286
|
};
|
|
257
287
|
}
|
|
258
288
|
catch (err) {
|
|
289
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
290
|
+
if (notModified) {
|
|
291
|
+
return notModified;
|
|
292
|
+
}
|
|
259
293
|
const customError = await handleApiError(err);
|
|
260
294
|
return {
|
|
261
295
|
success: false,
|
|
262
296
|
error: customError,
|
|
263
297
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
298
|
+
...getConditionalErrorFields(err),
|
|
264
299
|
};
|
|
265
300
|
}
|
|
266
301
|
}
|
|
@@ -270,13 +305,14 @@ export class AasRepositoryClient {
|
|
|
270
305
|
* @param options Object containing:
|
|
271
306
|
* - configuration: The http request options
|
|
272
307
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
308
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
273
309
|
*
|
|
274
310
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
275
311
|
*/
|
|
276
312
|
async getAssetInformationAasRepository(options) {
|
|
277
|
-
const { configuration, aasIdentifier } = options;
|
|
313
|
+
const { configuration, aasIdentifier, ifNoneMatch } = options;
|
|
278
314
|
try {
|
|
279
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
315
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
280
316
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
281
317
|
const response = await apiInstance.getAssetInformationAasRepositoryRaw({
|
|
282
318
|
aasIdentifier: encodedAasIdentifier,
|
|
@@ -286,14 +322,20 @@ export class AasRepositoryClient {
|
|
|
286
322
|
success: true,
|
|
287
323
|
data: convertApiAssetInformationToCoreAssetInformation(result),
|
|
288
324
|
statusCode: response.raw.status,
|
|
325
|
+
etag: getEtag(response.raw),
|
|
289
326
|
};
|
|
290
327
|
}
|
|
291
328
|
catch (err) {
|
|
329
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
330
|
+
if (notModified) {
|
|
331
|
+
return notModified;
|
|
332
|
+
}
|
|
292
333
|
const customError = await handleApiError(err);
|
|
293
334
|
return {
|
|
294
335
|
success: false,
|
|
295
336
|
error: customError,
|
|
296
337
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
338
|
+
...getConditionalErrorFields(err),
|
|
297
339
|
};
|
|
298
340
|
}
|
|
299
341
|
}
|
|
@@ -304,20 +346,22 @@ export class AasRepositoryClient {
|
|
|
304
346
|
* - configuration: The http request options
|
|
305
347
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
306
348
|
* - assetInformation: Asset Information object
|
|
349
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
350
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
307
351
|
*
|
|
308
352
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
309
353
|
*/
|
|
310
354
|
async putAssetInformationAasRepository(options) {
|
|
311
|
-
const { configuration, aasIdentifier, assetInformation } = options;
|
|
355
|
+
const { configuration, aasIdentifier, assetInformation, ifMatch, ifNoneMatch } = options;
|
|
312
356
|
try {
|
|
313
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
357
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
314
358
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
315
359
|
const response = await apiInstance.putAssetInformationAasRepositoryRaw({
|
|
316
360
|
aasIdentifier: encodedAasIdentifier,
|
|
317
361
|
assetInformation: convertCoreAssetInformationToApiAssetInformation(assetInformation),
|
|
318
362
|
});
|
|
319
363
|
const result = await response.value();
|
|
320
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
364
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
321
365
|
}
|
|
322
366
|
catch (err) {
|
|
323
367
|
const customError = await handleApiError(err);
|
|
@@ -325,6 +369,7 @@ export class AasRepositoryClient {
|
|
|
325
369
|
success: false,
|
|
326
370
|
error: customError,
|
|
327
371
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
372
|
+
...getConditionalErrorFields(err),
|
|
328
373
|
};
|
|
329
374
|
}
|
|
330
375
|
}
|
|
@@ -334,22 +379,23 @@ export class AasRepositoryClient {
|
|
|
334
379
|
* @param options Object containing:
|
|
335
380
|
* - configuration: The http request options
|
|
336
381
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
382
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
337
383
|
*
|
|
338
384
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
339
385
|
*/
|
|
340
386
|
async deleteThumbnailAasRepository(options) {
|
|
341
|
-
const { configuration, aasIdentifier } = options;
|
|
387
|
+
const { configuration, aasIdentifier, ifMatch } = options;
|
|
342
388
|
try {
|
|
343
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
389
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
344
390
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
345
391
|
const response = await apiInstance.deleteThumbnailAasRepositoryRaw({
|
|
346
392
|
aasIdentifier: encodedAasIdentifier,
|
|
347
393
|
});
|
|
348
394
|
if (response.raw.status === 204) {
|
|
349
|
-
return { success: true, data: undefined, statusCode: response.raw.status };
|
|
395
|
+
return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
350
396
|
}
|
|
351
397
|
const result = await response.value();
|
|
352
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
398
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
353
399
|
}
|
|
354
400
|
catch (err) {
|
|
355
401
|
const customError = await handleApiError(err);
|
|
@@ -357,6 +403,7 @@ export class AasRepositoryClient {
|
|
|
357
403
|
success: false,
|
|
358
404
|
error: customError,
|
|
359
405
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
406
|
+
...getConditionalErrorFields(err),
|
|
360
407
|
};
|
|
361
408
|
}
|
|
362
409
|
}
|
|
@@ -366,26 +413,32 @@ export class AasRepositoryClient {
|
|
|
366
413
|
* @param options Object containing:
|
|
367
414
|
* - configuration: The http request options
|
|
368
415
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
416
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
369
417
|
*
|
|
370
418
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
371
419
|
*/
|
|
372
420
|
async getThumbnailAasRepository(options) {
|
|
373
|
-
const { configuration, aasIdentifier } = options;
|
|
421
|
+
const { configuration, aasIdentifier, ifNoneMatch } = options;
|
|
374
422
|
try {
|
|
375
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
423
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
376
424
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
377
425
|
const response = await apiInstance.getThumbnailAasRepositoryRaw({
|
|
378
426
|
aasIdentifier: encodedAasIdentifier,
|
|
379
427
|
});
|
|
380
428
|
const result = await response.value();
|
|
381
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
429
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
382
430
|
}
|
|
383
431
|
catch (err) {
|
|
432
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
433
|
+
if (notModified) {
|
|
434
|
+
return notModified;
|
|
435
|
+
}
|
|
384
436
|
const customError = await handleApiError(err);
|
|
385
437
|
return {
|
|
386
438
|
success: false,
|
|
387
439
|
error: customError,
|
|
388
440
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
441
|
+
...getConditionalErrorFields(err),
|
|
389
442
|
};
|
|
390
443
|
}
|
|
391
444
|
}
|
|
@@ -397,13 +450,15 @@ export class AasRepositoryClient {
|
|
|
397
450
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
398
451
|
* - fileName: The name of the file
|
|
399
452
|
* - file: The file to upload
|
|
453
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
454
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
400
455
|
*
|
|
401
456
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
402
457
|
*/
|
|
403
458
|
async putThumbnailAasRepository(options) {
|
|
404
|
-
const { configuration, aasIdentifier, fileName, file } = options;
|
|
459
|
+
const { configuration, aasIdentifier, fileName, file, ifMatch, ifNoneMatch } = options;
|
|
405
460
|
try {
|
|
406
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
461
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
407
462
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
408
463
|
const response = await apiInstance.putThumbnailAasRepositoryRaw({
|
|
409
464
|
aasIdentifier: encodedAasIdentifier,
|
|
@@ -411,7 +466,7 @@ export class AasRepositoryClient {
|
|
|
411
466
|
file: file,
|
|
412
467
|
});
|
|
413
468
|
const result = await response.value();
|
|
414
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
469
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
415
470
|
}
|
|
416
471
|
catch (err) {
|
|
417
472
|
const customError = await handleApiError(err);
|
|
@@ -419,6 +474,7 @@ export class AasRepositoryClient {
|
|
|
419
474
|
success: false,
|
|
420
475
|
error: customError,
|
|
421
476
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
477
|
+
...getConditionalErrorFields(err),
|
|
422
478
|
};
|
|
423
479
|
}
|
|
424
480
|
}
|
|
@@ -430,13 +486,14 @@ export class AasRepositoryClient {
|
|
|
430
486
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
431
487
|
* - limit?: The maximum number of elements in the response array
|
|
432
488
|
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
489
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
433
490
|
*
|
|
434
491
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
435
492
|
*/
|
|
436
493
|
async getAllSubmodelReferencesAasRepository(options) {
|
|
437
|
-
const { configuration, aasIdentifier, limit, cursor } = options;
|
|
494
|
+
const { configuration, aasIdentifier, limit, cursor, ifNoneMatch } = options;
|
|
438
495
|
try {
|
|
439
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
496
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
440
497
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
441
498
|
const response = await apiInstance.getAllSubmodelReferencesAasRepositoryRaw({
|
|
442
499
|
aasIdentifier: encodedAasIdentifier,
|
|
@@ -452,14 +509,20 @@ export class AasRepositoryClient {
|
|
|
452
509
|
result: submodelReferences,
|
|
453
510
|
},
|
|
454
511
|
statusCode: response.raw.status,
|
|
512
|
+
etag: getEtag(response.raw),
|
|
455
513
|
};
|
|
456
514
|
}
|
|
457
515
|
catch (err) {
|
|
516
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
517
|
+
if (notModified) {
|
|
518
|
+
return notModified;
|
|
519
|
+
}
|
|
458
520
|
const customError = await handleApiError(err);
|
|
459
521
|
return {
|
|
460
522
|
success: false,
|
|
461
523
|
error: customError,
|
|
462
524
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
525
|
+
...getConditionalErrorFields(err),
|
|
463
526
|
};
|
|
464
527
|
}
|
|
465
528
|
}
|
|
@@ -470,20 +533,26 @@ export class AasRepositoryClient {
|
|
|
470
533
|
* - configuration: The http request options
|
|
471
534
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
472
535
|
* - submodelReference: Reference to the Submodel
|
|
536
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
473
537
|
*
|
|
474
538
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
475
539
|
*/
|
|
476
540
|
async postSubmodelReferenceAasRepository(options) {
|
|
477
|
-
const { configuration, aasIdentifier, submodelReference } = options;
|
|
541
|
+
const { configuration, aasIdentifier, submodelReference, ifMatch } = options;
|
|
478
542
|
try {
|
|
479
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
543
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
480
544
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
481
545
|
const response = await apiInstance.postSubmodelReferenceAasRepositoryRaw({
|
|
482
546
|
aasIdentifier: encodedAasIdentifier,
|
|
483
547
|
reference: convertCoreReferenceToApiReference(submodelReference),
|
|
484
548
|
});
|
|
485
549
|
const result = await response.value();
|
|
486
|
-
return {
|
|
550
|
+
return {
|
|
551
|
+
success: true,
|
|
552
|
+
data: convertApiReferenceToCoreReference(result),
|
|
553
|
+
statusCode: response.raw.status,
|
|
554
|
+
etag: getEtag(response.raw),
|
|
555
|
+
};
|
|
487
556
|
}
|
|
488
557
|
catch (err) {
|
|
489
558
|
const customError = await handleApiError(err);
|
|
@@ -491,6 +560,7 @@ export class AasRepositoryClient {
|
|
|
491
560
|
success: false,
|
|
492
561
|
error: customError,
|
|
493
562
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
563
|
+
...getConditionalErrorFields(err),
|
|
494
564
|
};
|
|
495
565
|
}
|
|
496
566
|
}
|
|
@@ -501,13 +571,14 @@ export class AasRepositoryClient {
|
|
|
501
571
|
* - configuration: The http request options
|
|
502
572
|
* - aasIdentifier: Unique ID of the AAS
|
|
503
573
|
* - submodelIdentifier: The submodel's unique ID
|
|
574
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
504
575
|
*
|
|
505
576
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
506
577
|
*/
|
|
507
578
|
async deleteSubmodelReferenceAasRepository(options) {
|
|
508
|
-
const { configuration, aasIdentifier, submodelIdentifier } = options;
|
|
579
|
+
const { configuration, aasIdentifier, submodelIdentifier, ifMatch } = options;
|
|
509
580
|
try {
|
|
510
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
581
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
511
582
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
512
583
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
513
584
|
const response = await apiInstance.deleteSubmodelReferenceAasRepositoryRaw({
|
|
@@ -515,7 +586,7 @@ export class AasRepositoryClient {
|
|
|
515
586
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
516
587
|
});
|
|
517
588
|
const result = await response.value();
|
|
518
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
589
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
519
590
|
}
|
|
520
591
|
catch (err) {
|
|
521
592
|
const customError = await handleApiError(err);
|
|
@@ -523,6 +594,7 @@ export class AasRepositoryClient {
|
|
|
523
594
|
success: false,
|
|
524
595
|
error: customError,
|
|
525
596
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
597
|
+
...getConditionalErrorFields(err),
|
|
526
598
|
};
|
|
527
599
|
}
|
|
528
600
|
}
|
|
@@ -559,13 +631,14 @@ export class AasRepositoryClient {
|
|
|
559
631
|
* - submodelIdentifier: The submodel's unique ID
|
|
560
632
|
* - level?: Determines the structural depth of the respective resource content
|
|
561
633
|
* - extent?: Determines to which extent the resource is being serialized
|
|
634
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
562
635
|
*
|
|
563
636
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
564
637
|
*/
|
|
565
638
|
async getSubmodelByIdAasRepository(options) {
|
|
566
|
-
const { configuration, aasIdentifier, submodelIdentifier, level, extent } = options;
|
|
639
|
+
const { configuration, aasIdentifier, submodelIdentifier, level, extent, ifNoneMatch } = options;
|
|
567
640
|
try {
|
|
568
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
641
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
569
642
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
570
643
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
571
644
|
const response = await apiInstance.getSubmodelByIdAasRepositoryRaw({
|
|
@@ -575,14 +648,24 @@ export class AasRepositoryClient {
|
|
|
575
648
|
extent: extent,
|
|
576
649
|
});
|
|
577
650
|
const result = await response.value();
|
|
578
|
-
return {
|
|
651
|
+
return {
|
|
652
|
+
success: true,
|
|
653
|
+
data: convertApiSubmodelToCoreSubmodel(result),
|
|
654
|
+
statusCode: response.raw.status,
|
|
655
|
+
etag: getEtag(response.raw),
|
|
656
|
+
};
|
|
579
657
|
}
|
|
580
658
|
catch (err) {
|
|
659
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
660
|
+
if (notModified) {
|
|
661
|
+
return notModified;
|
|
662
|
+
}
|
|
581
663
|
const customError = await handleApiError(err);
|
|
582
664
|
return {
|
|
583
665
|
success: false,
|
|
584
666
|
error: customError,
|
|
585
667
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
668
|
+
...getConditionalErrorFields(err),
|
|
586
669
|
};
|
|
587
670
|
}
|
|
588
671
|
}
|
|
@@ -594,13 +677,15 @@ export class AasRepositoryClient {
|
|
|
594
677
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
595
678
|
* - submodelIdentifier: The Submodel’s unique id
|
|
596
679
|
* - submodel: Submodel object
|
|
680
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
681
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
597
682
|
*
|
|
598
683
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
599
684
|
*/
|
|
600
685
|
async putSubmodelByIdAasRepository(options) {
|
|
601
|
-
const { configuration, aasIdentifier, submodelIdentifier, submodel } = options;
|
|
686
|
+
const { configuration, aasIdentifier, submodelIdentifier, submodel, ifMatch, ifNoneMatch } = options;
|
|
602
687
|
try {
|
|
603
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
688
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
604
689
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
605
690
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
606
691
|
const response = await apiInstance.putSubmodelByIdAasRepositoryRaw({
|
|
@@ -609,7 +694,7 @@ export class AasRepositoryClient {
|
|
|
609
694
|
submodel: convertCoreSubmodelToApiSubmodel(submodel),
|
|
610
695
|
});
|
|
611
696
|
if (response.raw.status === 204) {
|
|
612
|
-
return { success: true, data: undefined, statusCode: response.raw.status };
|
|
697
|
+
return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
613
698
|
}
|
|
614
699
|
if (response.raw.status === 201) {
|
|
615
700
|
try {
|
|
@@ -618,11 +703,17 @@ export class AasRepositoryClient {
|
|
|
618
703
|
success: true,
|
|
619
704
|
data: createdSubmodel ? convertApiSubmodelToCoreSubmodel(createdSubmodel) : undefined,
|
|
620
705
|
statusCode: response.raw.status,
|
|
706
|
+
etag: getEtag(response.raw),
|
|
621
707
|
};
|
|
622
708
|
}
|
|
623
709
|
catch {
|
|
624
710
|
// Some servers acknowledge creation with an empty or non-JSON body.
|
|
625
|
-
return {
|
|
711
|
+
return {
|
|
712
|
+
success: true,
|
|
713
|
+
data: undefined,
|
|
714
|
+
statusCode: response.raw.status,
|
|
715
|
+
etag: getEtag(response.raw),
|
|
716
|
+
};
|
|
626
717
|
}
|
|
627
718
|
}
|
|
628
719
|
const result = await response.value();
|
|
@@ -630,6 +721,7 @@ export class AasRepositoryClient {
|
|
|
630
721
|
success: true,
|
|
631
722
|
data: result ? convertApiSubmodelToCoreSubmodel(result) : undefined,
|
|
632
723
|
statusCode: response.raw.status,
|
|
724
|
+
etag: getEtag(response.raw),
|
|
633
725
|
};
|
|
634
726
|
}
|
|
635
727
|
catch (err) {
|
|
@@ -638,6 +730,7 @@ export class AasRepositoryClient {
|
|
|
638
730
|
success: false,
|
|
639
731
|
error: customError,
|
|
640
732
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
733
|
+
...getConditionalErrorFields(err),
|
|
641
734
|
};
|
|
642
735
|
}
|
|
643
736
|
}
|
|
@@ -648,13 +741,14 @@ export class AasRepositoryClient {
|
|
|
648
741
|
* - configuration: The http request options
|
|
649
742
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
650
743
|
* - submodelIdentifier: The Submodel’s unique id
|
|
744
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
651
745
|
*
|
|
652
746
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
653
747
|
*/
|
|
654
748
|
async deleteSubmodelByIdAasRepository(options) {
|
|
655
|
-
const { configuration, aasIdentifier, submodelIdentifier } = options;
|
|
749
|
+
const { configuration, aasIdentifier, submodelIdentifier, ifMatch } = options;
|
|
656
750
|
try {
|
|
657
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
751
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
658
752
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
659
753
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
660
754
|
const response = await apiInstance.deleteSubmodelByIdAasRepositoryRaw({
|
|
@@ -662,7 +756,7 @@ export class AasRepositoryClient {
|
|
|
662
756
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
663
757
|
});
|
|
664
758
|
const result = await response.value();
|
|
665
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
759
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
666
760
|
}
|
|
667
761
|
catch (err) {
|
|
668
762
|
const customError = await handleApiError(err);
|
|
@@ -670,6 +764,7 @@ export class AasRepositoryClient {
|
|
|
670
764
|
success: false,
|
|
671
765
|
error: customError,
|
|
672
766
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
767
|
+
...getConditionalErrorFields(err),
|
|
673
768
|
};
|
|
674
769
|
}
|
|
675
770
|
}
|
|
@@ -682,13 +777,14 @@ export class AasRepositoryClient {
|
|
|
682
777
|
* - submodelIdentifier: The Submodel’s unique id
|
|
683
778
|
* - submodel: Submodel object
|
|
684
779
|
* - level?: Determines the structural depth of the respective resource content
|
|
780
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
685
781
|
*
|
|
686
782
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
687
783
|
*/
|
|
688
784
|
async patchSubmodelAasRepository(options) {
|
|
689
|
-
const { configuration, aasIdentifier, submodelIdentifier, submodel, level } = options;
|
|
785
|
+
const { configuration, aasIdentifier, submodelIdentifier, submodel, level, ifMatch } = options;
|
|
690
786
|
try {
|
|
691
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
787
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
692
788
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
693
789
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
694
790
|
const response = await apiInstance.patchSubmodelAasRepositoryRaw({
|
|
@@ -698,7 +794,7 @@ export class AasRepositoryClient {
|
|
|
698
794
|
level: level,
|
|
699
795
|
});
|
|
700
796
|
const result = await response.value();
|
|
701
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
797
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
702
798
|
}
|
|
703
799
|
catch (err) {
|
|
704
800
|
const customError = await handleApiError(err);
|
|
@@ -706,6 +802,7 @@ export class AasRepositoryClient {
|
|
|
706
802
|
success: false,
|
|
707
803
|
error: customError,
|
|
708
804
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
805
|
+
...getConditionalErrorFields(err),
|
|
709
806
|
};
|
|
710
807
|
}
|
|
711
808
|
}
|
|
@@ -716,13 +813,14 @@ export class AasRepositoryClient {
|
|
|
716
813
|
* - configuration: The http request options
|
|
717
814
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
718
815
|
* - submodelIdentifier: The Submodel’s unique id
|
|
816
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
719
817
|
*
|
|
720
818
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
721
819
|
*/
|
|
722
820
|
async getSubmodelByIdMetadataAasRepository(options) {
|
|
723
|
-
const { configuration, aasIdentifier, submodelIdentifier } = options;
|
|
821
|
+
const { configuration, aasIdentifier, submodelIdentifier, ifNoneMatch } = options;
|
|
724
822
|
try {
|
|
725
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
823
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
726
824
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
727
825
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
728
826
|
const response = await apiInstance.getSubmodelByIdMetadataAasRepositoryRaw({
|
|
@@ -730,14 +828,19 @@ export class AasRepositoryClient {
|
|
|
730
828
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
731
829
|
});
|
|
732
830
|
const result = await response.value();
|
|
733
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
831
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
734
832
|
}
|
|
735
833
|
catch (err) {
|
|
834
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
835
|
+
if (notModified) {
|
|
836
|
+
return notModified;
|
|
837
|
+
}
|
|
736
838
|
const customError = await handleApiError(err);
|
|
737
839
|
return {
|
|
738
840
|
success: false,
|
|
739
841
|
error: customError,
|
|
740
842
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
843
|
+
...getConditionalErrorFields(err),
|
|
741
844
|
};
|
|
742
845
|
}
|
|
743
846
|
}
|
|
@@ -749,13 +852,14 @@ export class AasRepositoryClient {
|
|
|
749
852
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
750
853
|
* - submodelIdentifier: The Submodel’s unique id
|
|
751
854
|
* - submodelMetadata: The Submodel Metadata object
|
|
855
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
752
856
|
*
|
|
753
857
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
754
858
|
*/
|
|
755
859
|
async patchSubmodelByIdMetadataAasRepository(options) {
|
|
756
|
-
const { configuration, aasIdentifier, submodelIdentifier, submodelMetadata } = options;
|
|
860
|
+
const { configuration, aasIdentifier, submodelIdentifier, submodelMetadata, ifMatch } = options;
|
|
757
861
|
try {
|
|
758
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
862
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
759
863
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
760
864
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
761
865
|
const response = await apiInstance.patchSubmodelByIdMetadataAasRepositoryRaw({
|
|
@@ -764,7 +868,7 @@ export class AasRepositoryClient {
|
|
|
764
868
|
submodelMetadata: submodelMetadata,
|
|
765
869
|
});
|
|
766
870
|
const result = await response.value();
|
|
767
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
871
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
768
872
|
}
|
|
769
873
|
catch (err) {
|
|
770
874
|
const customError = await handleApiError(err);
|
|
@@ -772,6 +876,7 @@ export class AasRepositoryClient {
|
|
|
772
876
|
success: false,
|
|
773
877
|
error: customError,
|
|
774
878
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
879
|
+
...getConditionalErrorFields(err),
|
|
775
880
|
};
|
|
776
881
|
}
|
|
777
882
|
}
|
|
@@ -784,13 +889,14 @@ export class AasRepositoryClient {
|
|
|
784
889
|
* - submodelIdentifier: The Submodel’s unique id
|
|
785
890
|
* - level?: Determines the structural depth of the respective resource content
|
|
786
891
|
* - extent?: Determines to which extent the resource is being serialized
|
|
892
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
787
893
|
*
|
|
788
894
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
789
895
|
*/
|
|
790
896
|
async getSubmodelByIdValueOnlyAasRepository(options) {
|
|
791
|
-
const { configuration, aasIdentifier, submodelIdentifier, level, extent } = options;
|
|
897
|
+
const { configuration, aasIdentifier, submodelIdentifier, level, extent, ifNoneMatch } = options;
|
|
792
898
|
try {
|
|
793
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
899
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
794
900
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
795
901
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
796
902
|
const response = await apiInstance.getSubmodelByIdValueOnlyAasRepositoryRaw({
|
|
@@ -800,14 +906,19 @@ export class AasRepositoryClient {
|
|
|
800
906
|
extent: extent,
|
|
801
907
|
});
|
|
802
908
|
const result = await response.value();
|
|
803
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
909
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
804
910
|
}
|
|
805
911
|
catch (err) {
|
|
912
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
913
|
+
if (notModified) {
|
|
914
|
+
return notModified;
|
|
915
|
+
}
|
|
806
916
|
const customError = await handleApiError(err);
|
|
807
917
|
return {
|
|
808
918
|
success: false,
|
|
809
919
|
error: customError,
|
|
810
920
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
921
|
+
...getConditionalErrorFields(err),
|
|
811
922
|
};
|
|
812
923
|
}
|
|
813
924
|
}
|
|
@@ -819,13 +930,14 @@ export class AasRepositoryClient {
|
|
|
819
930
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
820
931
|
* - submodelIdentifier: The Submodel’s unique id
|
|
821
932
|
* - level?: Determines the structural depth of the respective resource content
|
|
933
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
822
934
|
*
|
|
823
935
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
824
936
|
*/
|
|
825
937
|
async patchSubmodelByIdValueOnlyAasRepository(options) {
|
|
826
|
-
const { configuration, aasIdentifier, submodelIdentifier, body, level } = options;
|
|
938
|
+
const { configuration, aasIdentifier, submodelIdentifier, body, level, ifMatch } = options;
|
|
827
939
|
try {
|
|
828
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
940
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
829
941
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
830
942
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
831
943
|
const response = await apiInstance.patchSubmodelByIdValueOnlyAasRepositoryRaw({
|
|
@@ -835,7 +947,7 @@ export class AasRepositoryClient {
|
|
|
835
947
|
level: level,
|
|
836
948
|
});
|
|
837
949
|
const result = await response.value();
|
|
838
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
950
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
839
951
|
}
|
|
840
952
|
catch (err) {
|
|
841
953
|
const customError = await handleApiError(err);
|
|
@@ -843,6 +955,7 @@ export class AasRepositoryClient {
|
|
|
843
955
|
success: false,
|
|
844
956
|
error: customError,
|
|
845
957
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
958
|
+
...getConditionalErrorFields(err),
|
|
846
959
|
};
|
|
847
960
|
}
|
|
848
961
|
}
|
|
@@ -853,13 +966,14 @@ export class AasRepositoryClient {
|
|
|
853
966
|
* - configuration: The http request options
|
|
854
967
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
855
968
|
* - submodelIdentifier: The submodel's unique ID
|
|
969
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
856
970
|
*
|
|
857
971
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
858
972
|
*/
|
|
859
973
|
async getSubmodelByIdReferenceAasRepository(options) {
|
|
860
|
-
const { configuration, aasIdentifier, submodelIdentifier } = options;
|
|
974
|
+
const { configuration, aasIdentifier, submodelIdentifier, ifNoneMatch } = options;
|
|
861
975
|
try {
|
|
862
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
976
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
863
977
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
864
978
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
865
979
|
const response = await apiInstance.getSubmodelByIdReferenceAasRepositoryRaw({
|
|
@@ -867,14 +981,24 @@ export class AasRepositoryClient {
|
|
|
867
981
|
submodelIdentifier: encodedSubmodelIdentifier,
|
|
868
982
|
});
|
|
869
983
|
const result = await response.value();
|
|
870
|
-
return {
|
|
984
|
+
return {
|
|
985
|
+
success: true,
|
|
986
|
+
data: convertApiReferenceToCoreReference(result),
|
|
987
|
+
statusCode: response.raw.status,
|
|
988
|
+
etag: getEtag(response.raw),
|
|
989
|
+
};
|
|
871
990
|
}
|
|
872
991
|
catch (err) {
|
|
992
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
993
|
+
if (notModified) {
|
|
994
|
+
return notModified;
|
|
995
|
+
}
|
|
873
996
|
const customError = await handleApiError(err);
|
|
874
997
|
return {
|
|
875
998
|
success: false,
|
|
876
999
|
error: customError,
|
|
877
1000
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1001
|
+
...getConditionalErrorFields(err),
|
|
878
1002
|
};
|
|
879
1003
|
}
|
|
880
1004
|
}
|
|
@@ -886,13 +1010,14 @@ export class AasRepositoryClient {
|
|
|
886
1010
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
887
1011
|
* - submodelIdentifier: The submodel's unique ID
|
|
888
1012
|
* - level?: Determines the structural depth of the respective resource content
|
|
1013
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
889
1014
|
*
|
|
890
1015
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
891
1016
|
*/
|
|
892
1017
|
async getSubmodelByIdPathAasRepository(options) {
|
|
893
|
-
const { configuration, aasIdentifier, submodelIdentifier, level } = options;
|
|
1018
|
+
const { configuration, aasIdentifier, submodelIdentifier, level, ifNoneMatch } = options;
|
|
894
1019
|
try {
|
|
895
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1020
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
896
1021
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
897
1022
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
898
1023
|
const response = await apiInstance.getSubmodelByIdPathAasRepositoryRaw({
|
|
@@ -901,14 +1026,19 @@ export class AasRepositoryClient {
|
|
|
901
1026
|
level: level,
|
|
902
1027
|
});
|
|
903
1028
|
const result = await response.value();
|
|
904
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1029
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
905
1030
|
}
|
|
906
1031
|
catch (err) {
|
|
1032
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1033
|
+
if (notModified) {
|
|
1034
|
+
return notModified;
|
|
1035
|
+
}
|
|
907
1036
|
const customError = await handleApiError(err);
|
|
908
1037
|
return {
|
|
909
1038
|
success: false,
|
|
910
1039
|
error: customError,
|
|
911
1040
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1041
|
+
...getConditionalErrorFields(err),
|
|
912
1042
|
};
|
|
913
1043
|
}
|
|
914
1044
|
}
|
|
@@ -923,13 +1053,14 @@ export class AasRepositoryClient {
|
|
|
923
1053
|
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
924
1054
|
* - level?: Determines the structural depth of the respective resource content
|
|
925
1055
|
* - extent?: Determines to which extent the resource is being serialized
|
|
1056
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
926
1057
|
*
|
|
927
1058
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
928
1059
|
*/
|
|
929
1060
|
async getAllSubmodelElementsAasRepository(options) {
|
|
930
|
-
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, extent } = options;
|
|
1061
|
+
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, extent, ifNoneMatch } = options;
|
|
931
1062
|
try {
|
|
932
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1063
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
933
1064
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
934
1065
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
935
1066
|
const response = await apiInstance.getAllSubmodelElementsAasRepositoryRaw({
|
|
@@ -946,14 +1077,20 @@ export class AasRepositoryClient {
|
|
|
946
1077
|
success: true,
|
|
947
1078
|
data: { pagedResult: result.paging_metadata, result: submodelElements },
|
|
948
1079
|
statusCode: response.raw.status,
|
|
1080
|
+
etag: getEtag(response.raw),
|
|
949
1081
|
};
|
|
950
1082
|
}
|
|
951
1083
|
catch (err) {
|
|
1084
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1085
|
+
if (notModified) {
|
|
1086
|
+
return notModified;
|
|
1087
|
+
}
|
|
952
1088
|
const customError = await handleApiError(err);
|
|
953
1089
|
return {
|
|
954
1090
|
success: false,
|
|
955
1091
|
error: customError,
|
|
956
1092
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1093
|
+
...getConditionalErrorFields(err),
|
|
957
1094
|
};
|
|
958
1095
|
}
|
|
959
1096
|
}
|
|
@@ -965,13 +1102,14 @@ export class AasRepositoryClient {
|
|
|
965
1102
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
966
1103
|
* - submodelIdentifier: The Submodel’s unique id
|
|
967
1104
|
* - submodelElement: The Submodel Element object
|
|
1105
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
968
1106
|
*
|
|
969
1107
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
970
1108
|
*/
|
|
971
1109
|
async postSubmodelElementAasRepository(options) {
|
|
972
|
-
const { configuration, aasIdentifier, submodelIdentifier, submodelElement } = options;
|
|
1110
|
+
const { configuration, aasIdentifier, submodelIdentifier, submodelElement, ifMatch } = options;
|
|
973
1111
|
try {
|
|
974
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1112
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
975
1113
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
976
1114
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
977
1115
|
const response = await apiInstance.postSubmodelElementAasRepositoryRaw({
|
|
@@ -984,6 +1122,7 @@ export class AasRepositoryClient {
|
|
|
984
1122
|
success: true,
|
|
985
1123
|
data: convertApiSubmodelElementToCoreSubmodelElement(result),
|
|
986
1124
|
statusCode: response.raw.status,
|
|
1125
|
+
etag: getEtag(response.raw),
|
|
987
1126
|
};
|
|
988
1127
|
}
|
|
989
1128
|
catch (err) {
|
|
@@ -992,6 +1131,7 @@ export class AasRepositoryClient {
|
|
|
992
1131
|
success: false,
|
|
993
1132
|
error: customError,
|
|
994
1133
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1134
|
+
...getConditionalErrorFields(err),
|
|
995
1135
|
};
|
|
996
1136
|
}
|
|
997
1137
|
}
|
|
@@ -1004,13 +1144,14 @@ export class AasRepositoryClient {
|
|
|
1004
1144
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1005
1145
|
* - limit?: The maximum number of elements in the response array
|
|
1006
1146
|
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
1147
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1007
1148
|
*
|
|
1008
1149
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1009
1150
|
*/
|
|
1010
1151
|
async getAllSubmodelElementsMetadataAasRepository(options) {
|
|
1011
|
-
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor } = options;
|
|
1152
|
+
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, ifNoneMatch } = options;
|
|
1012
1153
|
try {
|
|
1013
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1154
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1014
1155
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1015
1156
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1016
1157
|
const response = await apiInstance.getAllSubmodelElementsMetadataAasRepositoryRaw({
|
|
@@ -1026,14 +1167,20 @@ export class AasRepositoryClient {
|
|
|
1026
1167
|
success: true,
|
|
1027
1168
|
data: { pagedResult: result.paging_metadata, result: submodelElementsMetadata },
|
|
1028
1169
|
statusCode: response.raw.status,
|
|
1170
|
+
etag: getEtag(response.raw),
|
|
1029
1171
|
};
|
|
1030
1172
|
}
|
|
1031
1173
|
catch (err) {
|
|
1174
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1175
|
+
if (notModified) {
|
|
1176
|
+
return notModified;
|
|
1177
|
+
}
|
|
1032
1178
|
const customError = await handleApiError(err);
|
|
1033
1179
|
return {
|
|
1034
1180
|
success: false,
|
|
1035
1181
|
error: customError,
|
|
1036
1182
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1183
|
+
...getConditionalErrorFields(err),
|
|
1037
1184
|
};
|
|
1038
1185
|
}
|
|
1039
1186
|
}
|
|
@@ -1047,13 +1194,14 @@ export class AasRepositoryClient {
|
|
|
1047
1194
|
* - limit?: The maximum number of elements in the response array
|
|
1048
1195
|
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
1049
1196
|
* - level?: Determines the structural depth of the respective resource content
|
|
1197
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1050
1198
|
*
|
|
1051
1199
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1052
1200
|
*/
|
|
1053
1201
|
async getAllSubmodelElementsValueOnlyAasRepository(options) {
|
|
1054
|
-
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level } = options;
|
|
1202
|
+
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, ifNoneMatch } = options;
|
|
1055
1203
|
try {
|
|
1056
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1204
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1057
1205
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1058
1206
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1059
1207
|
const response = await apiInstance.getAllSubmodelElementsValueOnlyAasRepositoryRaw({
|
|
@@ -1070,14 +1218,20 @@ export class AasRepositoryClient {
|
|
|
1070
1218
|
success: true,
|
|
1071
1219
|
data: { pagedResult: result.paging_metadata, result: submodelElementValues },
|
|
1072
1220
|
statusCode: response.raw.status,
|
|
1221
|
+
etag: getEtag(response.raw),
|
|
1073
1222
|
};
|
|
1074
1223
|
}
|
|
1075
1224
|
catch (err) {
|
|
1225
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1226
|
+
if (notModified) {
|
|
1227
|
+
return notModified;
|
|
1228
|
+
}
|
|
1076
1229
|
const customError = await handleApiError(err);
|
|
1077
1230
|
return {
|
|
1078
1231
|
success: false,
|
|
1079
1232
|
error: customError,
|
|
1080
1233
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1234
|
+
...getConditionalErrorFields(err),
|
|
1081
1235
|
};
|
|
1082
1236
|
}
|
|
1083
1237
|
}
|
|
@@ -1091,13 +1245,14 @@ export class AasRepositoryClient {
|
|
|
1091
1245
|
* - limit?: The maximum number of elements in the response array
|
|
1092
1246
|
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
1093
1247
|
* - level?: Determines the structural depth of the respective resource content
|
|
1248
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1094
1249
|
*
|
|
1095
1250
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1096
1251
|
*/
|
|
1097
1252
|
async getAllSubmodelElementsReferenceAasRepository(options) {
|
|
1098
|
-
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level } = options;
|
|
1253
|
+
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, ifNoneMatch } = options;
|
|
1099
1254
|
try {
|
|
1100
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1255
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1101
1256
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1102
1257
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1103
1258
|
const response = await apiInstance.getAllSubmodelElementsReferenceAasRepositoryRaw({
|
|
@@ -1113,14 +1268,20 @@ export class AasRepositoryClient {
|
|
|
1113
1268
|
success: true,
|
|
1114
1269
|
data: { pagedResult: result.paging_metadata, result: submodelElementReferences },
|
|
1115
1270
|
statusCode: response.raw.status,
|
|
1271
|
+
etag: getEtag(response.raw),
|
|
1116
1272
|
};
|
|
1117
1273
|
}
|
|
1118
1274
|
catch (err) {
|
|
1275
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1276
|
+
if (notModified) {
|
|
1277
|
+
return notModified;
|
|
1278
|
+
}
|
|
1119
1279
|
const customError = await handleApiError(err);
|
|
1120
1280
|
return {
|
|
1121
1281
|
success: false,
|
|
1122
1282
|
error: customError,
|
|
1123
1283
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1284
|
+
...getConditionalErrorFields(err),
|
|
1124
1285
|
};
|
|
1125
1286
|
}
|
|
1126
1287
|
}
|
|
@@ -1135,13 +1296,14 @@ export class AasRepositoryClient {
|
|
|
1135
1296
|
* - cursor?: A server-generated identifier retrieved from paging_metadata that specifies from which position the result listing should continue
|
|
1136
1297
|
* - level?: Determines the structural depth of the respective resource content
|
|
1137
1298
|
* - extent?: Determines to which extent the resource is being serialized
|
|
1299
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1138
1300
|
*
|
|
1139
1301
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1140
1302
|
*/
|
|
1141
1303
|
async getAllSubmodelElementsPathAasRepository(options) {
|
|
1142
|
-
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, extent } = options;
|
|
1304
|
+
const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, extent, ifNoneMatch } = options;
|
|
1143
1305
|
try {
|
|
1144
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1306
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1145
1307
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1146
1308
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1147
1309
|
const response = await apiInstance.getAllSubmodelElementsPathAasRepositoryRaw({
|
|
@@ -1159,14 +1321,20 @@ export class AasRepositoryClient {
|
|
|
1159
1321
|
success: true,
|
|
1160
1322
|
data: { pagedResult: result.paging_metadata, result: submodelElements },
|
|
1161
1323
|
statusCode: response.raw.status,
|
|
1324
|
+
etag: getEtag(response.raw),
|
|
1162
1325
|
};
|
|
1163
1326
|
}
|
|
1164
1327
|
catch (err) {
|
|
1328
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1329
|
+
if (notModified) {
|
|
1330
|
+
return notModified;
|
|
1331
|
+
}
|
|
1165
1332
|
const customError = await handleApiError(err);
|
|
1166
1333
|
return {
|
|
1167
1334
|
success: false,
|
|
1168
1335
|
error: customError,
|
|
1169
1336
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1337
|
+
...getConditionalErrorFields(err),
|
|
1170
1338
|
};
|
|
1171
1339
|
}
|
|
1172
1340
|
}
|
|
@@ -1180,13 +1348,14 @@ export class AasRepositoryClient {
|
|
|
1180
1348
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1181
1349
|
* - level?: Determines the structural depth of the respective resource content
|
|
1182
1350
|
* - extent?: Determines to which extent the resource is being serialized
|
|
1351
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1183
1352
|
*
|
|
1184
1353
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1185
1354
|
*/
|
|
1186
1355
|
async getSubmodelElementByPathAasRepository(options) {
|
|
1187
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, extent } = options;
|
|
1356
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, extent, ifNoneMatch } = options;
|
|
1188
1357
|
try {
|
|
1189
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1358
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1190
1359
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1191
1360
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1192
1361
|
const response = await apiInstance.getSubmodelElementByPathAasRepositoryRaw({
|
|
@@ -1201,14 +1370,20 @@ export class AasRepositoryClient {
|
|
|
1201
1370
|
success: true,
|
|
1202
1371
|
data: convertApiSubmodelElementToCoreSubmodelElement(result),
|
|
1203
1372
|
statusCode: response.raw.status,
|
|
1373
|
+
etag: getEtag(response.raw),
|
|
1204
1374
|
};
|
|
1205
1375
|
}
|
|
1206
1376
|
catch (err) {
|
|
1377
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1378
|
+
if (notModified) {
|
|
1379
|
+
return notModified;
|
|
1380
|
+
}
|
|
1207
1381
|
const customError = await handleApiError(err);
|
|
1208
1382
|
return {
|
|
1209
1383
|
success: false,
|
|
1210
1384
|
error: customError,
|
|
1211
1385
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1386
|
+
...getConditionalErrorFields(err),
|
|
1212
1387
|
};
|
|
1213
1388
|
}
|
|
1214
1389
|
}
|
|
@@ -1221,13 +1396,14 @@ export class AasRepositoryClient {
|
|
|
1221
1396
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1222
1397
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1223
1398
|
* - submodelElement: SubmodelElement object
|
|
1399
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1224
1400
|
*
|
|
1225
1401
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1226
1402
|
*/
|
|
1227
1403
|
async postSubmodelElementByPathAasRepository(options) {
|
|
1228
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement } = options;
|
|
1404
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement, ifMatch } = options;
|
|
1229
1405
|
try {
|
|
1230
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1406
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1231
1407
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1232
1408
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1233
1409
|
const response = await apiInstance.postSubmodelElementByPathAasRepositoryRaw({
|
|
@@ -1241,6 +1417,7 @@ export class AasRepositoryClient {
|
|
|
1241
1417
|
success: true,
|
|
1242
1418
|
data: convertApiSubmodelElementToCoreSubmodelElement(result),
|
|
1243
1419
|
statusCode: response.raw.status,
|
|
1420
|
+
etag: getEtag(response.raw),
|
|
1244
1421
|
};
|
|
1245
1422
|
}
|
|
1246
1423
|
catch (err) {
|
|
@@ -1249,6 +1426,7 @@ export class AasRepositoryClient {
|
|
|
1249
1426
|
success: false,
|
|
1250
1427
|
error: customError,
|
|
1251
1428
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1429
|
+
...getConditionalErrorFields(err),
|
|
1252
1430
|
};
|
|
1253
1431
|
}
|
|
1254
1432
|
}
|
|
@@ -1260,13 +1438,14 @@ export class AasRepositoryClient {
|
|
|
1260
1438
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
1261
1439
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1262
1440
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1441
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1263
1442
|
*
|
|
1264
1443
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1265
1444
|
*/
|
|
1266
1445
|
async deleteSubmodelElementByPathAasRepository(options) {
|
|
1267
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
|
|
1446
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, ifMatch } = options;
|
|
1268
1447
|
try {
|
|
1269
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1448
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1270
1449
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1271
1450
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1272
1451
|
const response = await apiInstance.deleteSubmodelElementByPathAasRepositoryRaw({
|
|
@@ -1275,7 +1454,7 @@ export class AasRepositoryClient {
|
|
|
1275
1454
|
idShortPath: idShortPath,
|
|
1276
1455
|
});
|
|
1277
1456
|
const result = await response.value();
|
|
1278
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1457
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1279
1458
|
}
|
|
1280
1459
|
catch (err) {
|
|
1281
1460
|
const customError = await handleApiError(err);
|
|
@@ -1283,6 +1462,7 @@ export class AasRepositoryClient {
|
|
|
1283
1462
|
success: false,
|
|
1284
1463
|
error: customError,
|
|
1285
1464
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1465
|
+
...getConditionalErrorFields(err),
|
|
1286
1466
|
};
|
|
1287
1467
|
}
|
|
1288
1468
|
}
|
|
@@ -1295,13 +1475,15 @@ export class AasRepositoryClient {
|
|
|
1295
1475
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1296
1476
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1297
1477
|
* - submodelElement: SubmodelElement object
|
|
1478
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1479
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
1298
1480
|
*
|
|
1299
1481
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1300
1482
|
*/
|
|
1301
1483
|
async putSubmodelElementByPathAasRepository(options) {
|
|
1302
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement } = options;
|
|
1484
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement, ifMatch, ifNoneMatch } = options;
|
|
1303
1485
|
try {
|
|
1304
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1486
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
1305
1487
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1306
1488
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1307
1489
|
const response = await apiInstance.putSubmodelElementByPathAasRepositoryRaw({
|
|
@@ -1311,7 +1493,7 @@ export class AasRepositoryClient {
|
|
|
1311
1493
|
submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
|
|
1312
1494
|
});
|
|
1313
1495
|
if (response.raw.status === 204) {
|
|
1314
|
-
return { success: true, data: undefined, statusCode: response.raw.status };
|
|
1496
|
+
return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1315
1497
|
}
|
|
1316
1498
|
if (response.raw.status === 201) {
|
|
1317
1499
|
try {
|
|
@@ -1322,11 +1504,17 @@ export class AasRepositoryClient {
|
|
|
1322
1504
|
? convertApiSubmodelElementToCoreSubmodelElement(createdSubmodelElement)
|
|
1323
1505
|
: undefined,
|
|
1324
1506
|
statusCode: response.raw.status,
|
|
1507
|
+
etag: getEtag(response.raw),
|
|
1325
1508
|
};
|
|
1326
1509
|
}
|
|
1327
1510
|
catch {
|
|
1328
1511
|
// Some servers acknowledge creation with an empty or non-JSON body.
|
|
1329
|
-
return {
|
|
1512
|
+
return {
|
|
1513
|
+
success: true,
|
|
1514
|
+
data: undefined,
|
|
1515
|
+
statusCode: response.raw.status,
|
|
1516
|
+
etag: getEtag(response.raw),
|
|
1517
|
+
};
|
|
1330
1518
|
}
|
|
1331
1519
|
}
|
|
1332
1520
|
const result = await response.value();
|
|
@@ -1334,6 +1522,7 @@ export class AasRepositoryClient {
|
|
|
1334
1522
|
success: true,
|
|
1335
1523
|
data: result ? convertApiSubmodelElementToCoreSubmodelElement(result) : undefined,
|
|
1336
1524
|
statusCode: response.raw.status,
|
|
1525
|
+
etag: getEtag(response.raw),
|
|
1337
1526
|
};
|
|
1338
1527
|
}
|
|
1339
1528
|
catch (err) {
|
|
@@ -1342,6 +1531,7 @@ export class AasRepositoryClient {
|
|
|
1342
1531
|
success: false,
|
|
1343
1532
|
error: customError,
|
|
1344
1533
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1534
|
+
...getConditionalErrorFields(err),
|
|
1345
1535
|
};
|
|
1346
1536
|
}
|
|
1347
1537
|
}
|
|
@@ -1355,13 +1545,14 @@ export class AasRepositoryClient {
|
|
|
1355
1545
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1356
1546
|
* - submodelElement: SubmodelElement object
|
|
1357
1547
|
* - level?: Determines the structural depth of the respective resource content
|
|
1548
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1358
1549
|
*
|
|
1359
1550
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1360
1551
|
*/
|
|
1361
1552
|
async patchSubmodelElementValueByPathAasRepository(options) {
|
|
1362
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement, level } = options;
|
|
1553
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement, level, ifMatch } = options;
|
|
1363
1554
|
try {
|
|
1364
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1555
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1365
1556
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1366
1557
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1367
1558
|
const response = await apiInstance.patchSubmodelElementValueByPathAasRepositoryRaw({
|
|
@@ -1372,7 +1563,7 @@ export class AasRepositoryClient {
|
|
|
1372
1563
|
level: level,
|
|
1373
1564
|
});
|
|
1374
1565
|
const result = await response.value();
|
|
1375
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1566
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1376
1567
|
}
|
|
1377
1568
|
catch (err) {
|
|
1378
1569
|
const customError = await handleApiError(err);
|
|
@@ -1380,6 +1571,7 @@ export class AasRepositoryClient {
|
|
|
1380
1571
|
success: false,
|
|
1381
1572
|
error: customError,
|
|
1382
1573
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1574
|
+
...getConditionalErrorFields(err),
|
|
1383
1575
|
};
|
|
1384
1576
|
}
|
|
1385
1577
|
}
|
|
@@ -1391,13 +1583,14 @@ export class AasRepositoryClient {
|
|
|
1391
1583
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
1392
1584
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1393
1585
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1586
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1394
1587
|
*
|
|
1395
1588
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1396
1589
|
*/
|
|
1397
1590
|
async getSubmodelElementByPathMetadataAasRepository(options) {
|
|
1398
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
|
|
1591
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, ifNoneMatch } = options;
|
|
1399
1592
|
try {
|
|
1400
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1593
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1401
1594
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1402
1595
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1403
1596
|
const response = await apiInstance.getSubmodelElementByPathMetadataAasRepositoryRaw({
|
|
@@ -1406,14 +1599,19 @@ export class AasRepositoryClient {
|
|
|
1406
1599
|
idShortPath: idShortPath,
|
|
1407
1600
|
});
|
|
1408
1601
|
const result = await response.value();
|
|
1409
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1602
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1410
1603
|
}
|
|
1411
1604
|
catch (err) {
|
|
1605
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1606
|
+
if (notModified) {
|
|
1607
|
+
return notModified;
|
|
1608
|
+
}
|
|
1412
1609
|
const customError = await handleApiError(err);
|
|
1413
1610
|
return {
|
|
1414
1611
|
success: false,
|
|
1415
1612
|
error: customError,
|
|
1416
1613
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1614
|
+
...getConditionalErrorFields(err),
|
|
1417
1615
|
};
|
|
1418
1616
|
}
|
|
1419
1617
|
}
|
|
@@ -1426,13 +1624,14 @@ export class AasRepositoryClient {
|
|
|
1426
1624
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1427
1625
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1428
1626
|
* - submodelElementMetadata: The Submodel Element Metadata object
|
|
1627
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1429
1628
|
*
|
|
1430
1629
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1431
1630
|
*/
|
|
1432
1631
|
async patchSubmodelElementValueByPathMetadata(options) {
|
|
1433
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElementMetadata } = options;
|
|
1632
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElementMetadata, ifMatch } = options;
|
|
1434
1633
|
try {
|
|
1435
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1634
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1436
1635
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1437
1636
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1438
1637
|
const response = await apiInstance.patchSubmodelElementValueByPathMetadataRaw({
|
|
@@ -1442,7 +1641,7 @@ export class AasRepositoryClient {
|
|
|
1442
1641
|
submodelElementMetadata: submodelElementMetadata,
|
|
1443
1642
|
});
|
|
1444
1643
|
const result = await response.value();
|
|
1445
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1644
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1446
1645
|
}
|
|
1447
1646
|
catch (err) {
|
|
1448
1647
|
const customError = await handleApiError(err);
|
|
@@ -1450,6 +1649,7 @@ export class AasRepositoryClient {
|
|
|
1450
1649
|
success: false,
|
|
1451
1650
|
error: customError,
|
|
1452
1651
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1652
|
+
...getConditionalErrorFields(err),
|
|
1453
1653
|
};
|
|
1454
1654
|
}
|
|
1455
1655
|
}
|
|
@@ -1463,13 +1663,14 @@ export class AasRepositoryClient {
|
|
|
1463
1663
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1464
1664
|
* - level?: Determines the structural depth of the respective resource content
|
|
1465
1665
|
* - extent?: Determines to which extent the resource is being serialized
|
|
1666
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1466
1667
|
*
|
|
1467
1668
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1468
1669
|
*/
|
|
1469
1670
|
async getSubmodelElementByPathValueOnlyAasRepository(options) {
|
|
1470
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, extent } = options;
|
|
1671
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, extent, ifNoneMatch } = options;
|
|
1471
1672
|
try {
|
|
1472
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1673
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1473
1674
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1474
1675
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1475
1676
|
const response = await apiInstance.getSubmodelElementByPathValueOnlyAasRepositoryRaw({
|
|
@@ -1480,14 +1681,19 @@ export class AasRepositoryClient {
|
|
|
1480
1681
|
extent: extent,
|
|
1481
1682
|
});
|
|
1482
1683
|
const result = await response.value();
|
|
1483
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1684
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1484
1685
|
}
|
|
1485
1686
|
catch (err) {
|
|
1687
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1688
|
+
if (notModified) {
|
|
1689
|
+
return notModified;
|
|
1690
|
+
}
|
|
1486
1691
|
const customError = await handleApiError(err);
|
|
1487
1692
|
return {
|
|
1488
1693
|
success: false,
|
|
1489
1694
|
error: customError,
|
|
1490
1695
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1696
|
+
...getConditionalErrorFields(err),
|
|
1491
1697
|
};
|
|
1492
1698
|
}
|
|
1493
1699
|
}
|
|
@@ -1501,13 +1707,14 @@ export class AasRepositoryClient {
|
|
|
1501
1707
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1502
1708
|
* - SubmodelElementValue: SubmodelElementValue object
|
|
1503
1709
|
* - level?: Determines the structural depth of the respective resource content
|
|
1710
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1504
1711
|
*
|
|
1505
1712
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1506
1713
|
*/
|
|
1507
1714
|
async patchSubmodelElementValueByPathValueOnly(options) {
|
|
1508
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElementValue, level } = options;
|
|
1715
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElementValue, level, ifMatch } = options;
|
|
1509
1716
|
try {
|
|
1510
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1717
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1511
1718
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1512
1719
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1513
1720
|
const response = await apiInstance.patchSubmodelElementValueByPathValueOnlyRaw({
|
|
@@ -1518,7 +1725,7 @@ export class AasRepositoryClient {
|
|
|
1518
1725
|
level: level,
|
|
1519
1726
|
});
|
|
1520
1727
|
const result = await response.value();
|
|
1521
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1728
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1522
1729
|
}
|
|
1523
1730
|
catch (err) {
|
|
1524
1731
|
const customError = await handleApiError(err);
|
|
@@ -1526,6 +1733,7 @@ export class AasRepositoryClient {
|
|
|
1526
1733
|
success: false,
|
|
1527
1734
|
error: customError,
|
|
1528
1735
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1736
|
+
...getConditionalErrorFields(err),
|
|
1529
1737
|
};
|
|
1530
1738
|
}
|
|
1531
1739
|
}
|
|
@@ -1538,13 +1746,14 @@ export class AasRepositoryClient {
|
|
|
1538
1746
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1539
1747
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1540
1748
|
* - level?: Determines the structural depth of the respective resource content
|
|
1749
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1541
1750
|
*
|
|
1542
1751
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1543
1752
|
*/
|
|
1544
1753
|
async getSubmodelElementByPathReferenceAasRepository(options) {
|
|
1545
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level } = options;
|
|
1754
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, ifNoneMatch } = options;
|
|
1546
1755
|
try {
|
|
1547
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1756
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1548
1757
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1549
1758
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1550
1759
|
const response = await apiInstance.getSubmodelElementByPathReferenceAasRepositoryRaw({
|
|
@@ -1554,14 +1763,24 @@ export class AasRepositoryClient {
|
|
|
1554
1763
|
level: level,
|
|
1555
1764
|
});
|
|
1556
1765
|
const result = await response.value();
|
|
1557
|
-
return {
|
|
1766
|
+
return {
|
|
1767
|
+
success: true,
|
|
1768
|
+
data: convertApiReferenceToCoreReference(result),
|
|
1769
|
+
statusCode: response.raw.status,
|
|
1770
|
+
etag: getEtag(response.raw),
|
|
1771
|
+
};
|
|
1558
1772
|
}
|
|
1559
1773
|
catch (err) {
|
|
1774
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1775
|
+
if (notModified) {
|
|
1776
|
+
return notModified;
|
|
1777
|
+
}
|
|
1560
1778
|
const customError = await handleApiError(err);
|
|
1561
1779
|
return {
|
|
1562
1780
|
success: false,
|
|
1563
1781
|
error: customError,
|
|
1564
1782
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1783
|
+
...getConditionalErrorFields(err),
|
|
1565
1784
|
};
|
|
1566
1785
|
}
|
|
1567
1786
|
}
|
|
@@ -1574,13 +1793,14 @@ export class AasRepositoryClient {
|
|
|
1574
1793
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1575
1794
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1576
1795
|
* - level?: Determines the structural depth of the respective resource content
|
|
1796
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1577
1797
|
*
|
|
1578
1798
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1579
1799
|
*/
|
|
1580
1800
|
async getSubmodelElementByPathPathAasRepository(options) {
|
|
1581
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level } = options;
|
|
1801
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, ifNoneMatch } = options;
|
|
1582
1802
|
try {
|
|
1583
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1803
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1584
1804
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1585
1805
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1586
1806
|
const response = await apiInstance.getSubmodelElementByPathPathAasRepositoryRaw({
|
|
@@ -1590,14 +1810,19 @@ export class AasRepositoryClient {
|
|
|
1590
1810
|
level: level,
|
|
1591
1811
|
});
|
|
1592
1812
|
const result = await response.value();
|
|
1593
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1813
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1594
1814
|
}
|
|
1595
1815
|
catch (err) {
|
|
1816
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1817
|
+
if (notModified) {
|
|
1818
|
+
return notModified;
|
|
1819
|
+
}
|
|
1596
1820
|
const customError = await handleApiError(err);
|
|
1597
1821
|
return {
|
|
1598
1822
|
success: false,
|
|
1599
1823
|
error: customError,
|
|
1600
1824
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1825
|
+
...getConditionalErrorFields(err),
|
|
1601
1826
|
};
|
|
1602
1827
|
}
|
|
1603
1828
|
}
|
|
@@ -1609,13 +1834,14 @@ export class AasRepositoryClient {
|
|
|
1609
1834
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
1610
1835
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1611
1836
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1837
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
|
|
1612
1838
|
*
|
|
1613
1839
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1614
1840
|
*/
|
|
1615
1841
|
async getFileByPathAasRepository(options) {
|
|
1616
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
|
|
1842
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, ifNoneMatch } = options;
|
|
1617
1843
|
try {
|
|
1618
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1844
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
|
|
1619
1845
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1620
1846
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1621
1847
|
const response = await apiInstance.getFileByPathAasRepositoryRaw({
|
|
@@ -1624,14 +1850,19 @@ export class AasRepositoryClient {
|
|
|
1624
1850
|
idShortPath: idShortPath,
|
|
1625
1851
|
});
|
|
1626
1852
|
const result = await response.value();
|
|
1627
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1853
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1628
1854
|
}
|
|
1629
1855
|
catch (err) {
|
|
1856
|
+
const notModified = getNotModifiedResult(err, ifNoneMatch);
|
|
1857
|
+
if (notModified) {
|
|
1858
|
+
return notModified;
|
|
1859
|
+
}
|
|
1630
1860
|
const customError = await handleApiError(err);
|
|
1631
1861
|
return {
|
|
1632
1862
|
success: false,
|
|
1633
1863
|
error: customError,
|
|
1634
1864
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1865
|
+
...getConditionalErrorFields(err),
|
|
1635
1866
|
};
|
|
1636
1867
|
}
|
|
1637
1868
|
}
|
|
@@ -1645,13 +1876,15 @@ export class AasRepositoryClient {
|
|
|
1645
1876
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1646
1877
|
* - fileName: The name of the file
|
|
1647
1878
|
* - file: The file to upload
|
|
1879
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1880
|
+
* - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
|
|
1648
1881
|
*
|
|
1649
1882
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1650
1883
|
*/
|
|
1651
1884
|
async putFileByPathAasRepository(options) {
|
|
1652
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, fileName, file } = options;
|
|
1885
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, fileName, file, ifMatch, ifNoneMatch } = options;
|
|
1653
1886
|
try {
|
|
1654
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1887
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
|
|
1655
1888
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1656
1889
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1657
1890
|
const response = await apiInstance.putFileByPathAasRepositoryRaw({
|
|
@@ -1662,7 +1895,7 @@ export class AasRepositoryClient {
|
|
|
1662
1895
|
file: file,
|
|
1663
1896
|
});
|
|
1664
1897
|
const result = await response.value();
|
|
1665
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1898
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1666
1899
|
}
|
|
1667
1900
|
catch (err) {
|
|
1668
1901
|
const customError = await handleApiError(err);
|
|
@@ -1670,6 +1903,7 @@ export class AasRepositoryClient {
|
|
|
1670
1903
|
success: false,
|
|
1671
1904
|
error: customError,
|
|
1672
1905
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1906
|
+
...getConditionalErrorFields(err),
|
|
1673
1907
|
};
|
|
1674
1908
|
}
|
|
1675
1909
|
}
|
|
@@ -1681,13 +1915,14 @@ export class AasRepositoryClient {
|
|
|
1681
1915
|
* - aasIdentifier: The Asset Administration Shell’s unique id
|
|
1682
1916
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1683
1917
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1918
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1684
1919
|
*
|
|
1685
1920
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1686
1921
|
*/
|
|
1687
1922
|
async deleteFileByPathAasRepository(options) {
|
|
1688
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
|
|
1923
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, ifMatch } = options;
|
|
1689
1924
|
try {
|
|
1690
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1925
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1691
1926
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1692
1927
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1693
1928
|
const response = await apiInstance.deleteFileByPathAasRepositoryRaw({
|
|
@@ -1696,7 +1931,7 @@ export class AasRepositoryClient {
|
|
|
1696
1931
|
idShortPath: idShortPath,
|
|
1697
1932
|
});
|
|
1698
1933
|
const result = await response.value();
|
|
1699
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1934
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1700
1935
|
}
|
|
1701
1936
|
catch (err) {
|
|
1702
1937
|
const customError = await handleApiError(err);
|
|
@@ -1704,6 +1939,7 @@ export class AasRepositoryClient {
|
|
|
1704
1939
|
success: false,
|
|
1705
1940
|
error: customError,
|
|
1706
1941
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1942
|
+
...getConditionalErrorFields(err),
|
|
1707
1943
|
};
|
|
1708
1944
|
}
|
|
1709
1945
|
}
|
|
@@ -1716,13 +1952,14 @@ export class AasRepositoryClient {
|
|
|
1716
1952
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1717
1953
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1718
1954
|
* - operationRequest: Operation request object
|
|
1955
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1719
1956
|
*
|
|
1720
1957
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1721
1958
|
*/
|
|
1722
1959
|
async invokeOperationAasRepository(options) {
|
|
1723
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest } = options;
|
|
1960
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
|
|
1724
1961
|
try {
|
|
1725
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
1962
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1726
1963
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1727
1964
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1728
1965
|
const response = await apiInstance.invokeOperationAasRepositoryRaw({
|
|
@@ -1732,7 +1969,7 @@ export class AasRepositoryClient {
|
|
|
1732
1969
|
operationRequest: operationRequest,
|
|
1733
1970
|
});
|
|
1734
1971
|
const result = await response.value();
|
|
1735
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
1972
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1736
1973
|
}
|
|
1737
1974
|
catch (err) {
|
|
1738
1975
|
const customError = await handleApiError(err);
|
|
@@ -1740,6 +1977,7 @@ export class AasRepositoryClient {
|
|
|
1740
1977
|
success: false,
|
|
1741
1978
|
error: customError,
|
|
1742
1979
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
1980
|
+
...getConditionalErrorFields(err),
|
|
1743
1981
|
};
|
|
1744
1982
|
}
|
|
1745
1983
|
}
|
|
@@ -1752,13 +1990,14 @@ export class AasRepositoryClient {
|
|
|
1752
1990
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1753
1991
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1754
1992
|
* - operationRequestValueOnly: OperationRequestValueOnly object
|
|
1993
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1755
1994
|
*
|
|
1756
1995
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1757
1996
|
*/
|
|
1758
1997
|
async invokeOperationValueOnlyAasRepository(options) {
|
|
1759
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
|
|
1998
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
1760
1999
|
try {
|
|
1761
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
2000
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1762
2001
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1763
2002
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1764
2003
|
const response = await apiInstance.invokeOperationValueOnlyAasRepositoryRaw({
|
|
@@ -1768,7 +2007,7 @@ export class AasRepositoryClient {
|
|
|
1768
2007
|
operationRequestValueOnly: operationRequestValueOnly,
|
|
1769
2008
|
});
|
|
1770
2009
|
const result = await response.value();
|
|
1771
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2010
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1772
2011
|
}
|
|
1773
2012
|
catch (err) {
|
|
1774
2013
|
const customError = await handleApiError(err);
|
|
@@ -1776,6 +2015,7 @@ export class AasRepositoryClient {
|
|
|
1776
2015
|
success: false,
|
|
1777
2016
|
error: customError,
|
|
1778
2017
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2018
|
+
...getConditionalErrorFields(err),
|
|
1779
2019
|
};
|
|
1780
2020
|
}
|
|
1781
2021
|
}
|
|
@@ -1788,13 +2028,14 @@ export class AasRepositoryClient {
|
|
|
1788
2028
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1789
2029
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1790
2030
|
* - operationRequest: OperationRequest object
|
|
2031
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1791
2032
|
*
|
|
1792
2033
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1793
2034
|
*/
|
|
1794
2035
|
async invokeOperationAsyncAasRepository(options) {
|
|
1795
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest } = options;
|
|
2036
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest, ifMatch } = options;
|
|
1796
2037
|
try {
|
|
1797
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
2038
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1798
2039
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1799
2040
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1800
2041
|
const response = await apiInstance.invokeOperationAsyncAasRepositoryRaw({
|
|
@@ -1804,7 +2045,7 @@ export class AasRepositoryClient {
|
|
|
1804
2045
|
operationRequest: operationRequest,
|
|
1805
2046
|
});
|
|
1806
2047
|
const result = await response.value();
|
|
1807
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2048
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1808
2049
|
}
|
|
1809
2050
|
catch (err) {
|
|
1810
2051
|
const customError = await handleApiError(err);
|
|
@@ -1812,6 +2053,7 @@ export class AasRepositoryClient {
|
|
|
1812
2053
|
success: false,
|
|
1813
2054
|
error: customError,
|
|
1814
2055
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2056
|
+
...getConditionalErrorFields(err),
|
|
1815
2057
|
};
|
|
1816
2058
|
}
|
|
1817
2059
|
}
|
|
@@ -1824,13 +2066,14 @@ export class AasRepositoryClient {
|
|
|
1824
2066
|
* - submodelIdentifier: The Submodel’s unique id
|
|
1825
2067
|
* - idShortPath: IdShort path to the submodel element (dot-separated)
|
|
1826
2068
|
* - operationRequestValueOnly: Operation request object
|
|
2069
|
+
* - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
|
|
1827
2070
|
*
|
|
1828
2071
|
* @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
|
|
1829
2072
|
*/
|
|
1830
2073
|
async invokeOperationAsyncValueOnlyAasRepository(options) {
|
|
1831
|
-
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
|
|
2074
|
+
const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly, ifMatch } = options;
|
|
1832
2075
|
try {
|
|
1833
|
-
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
|
|
2076
|
+
const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
|
|
1834
2077
|
const encodedAasIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(aasIdentifier, 'aasIdentifier'));
|
|
1835
2078
|
const encodedSubmodelIdentifier = base64Encode(AasRepositoryClient.requireIdentifier(submodelIdentifier, 'submodelIdentifier'));
|
|
1836
2079
|
const response = await apiInstance.invokeOperationAsyncValueOnlyAasRepositoryRaw({
|
|
@@ -1840,7 +2083,7 @@ export class AasRepositoryClient {
|
|
|
1840
2083
|
operationRequestValueOnly: operationRequestValueOnly,
|
|
1841
2084
|
});
|
|
1842
2085
|
const result = await response.value();
|
|
1843
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2086
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1844
2087
|
}
|
|
1845
2088
|
catch (err) {
|
|
1846
2089
|
const customError = await handleApiError(err);
|
|
@@ -1848,6 +2091,7 @@ export class AasRepositoryClient {
|
|
|
1848
2091
|
success: false,
|
|
1849
2092
|
error: customError,
|
|
1850
2093
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2094
|
+
...getConditionalErrorFields(err),
|
|
1851
2095
|
};
|
|
1852
2096
|
}
|
|
1853
2097
|
}
|
|
@@ -1877,7 +2121,7 @@ export class AasRepositoryClient {
|
|
|
1877
2121
|
handleId: encodedHandleId,
|
|
1878
2122
|
});
|
|
1879
2123
|
const result = await response.value();
|
|
1880
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2124
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1881
2125
|
}
|
|
1882
2126
|
catch (err) {
|
|
1883
2127
|
const customError = await handleApiError(err);
|
|
@@ -1885,6 +2129,7 @@ export class AasRepositoryClient {
|
|
|
1885
2129
|
success: false,
|
|
1886
2130
|
error: customError,
|
|
1887
2131
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2132
|
+
...getConditionalErrorFields(err),
|
|
1888
2133
|
};
|
|
1889
2134
|
}
|
|
1890
2135
|
}
|
|
@@ -1914,7 +2159,7 @@ export class AasRepositoryClient {
|
|
|
1914
2159
|
handleId: encodedHandleId,
|
|
1915
2160
|
});
|
|
1916
2161
|
const result = await response.value();
|
|
1917
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2162
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1918
2163
|
}
|
|
1919
2164
|
catch (err) {
|
|
1920
2165
|
const customError = await handleApiError(err);
|
|
@@ -1922,6 +2167,7 @@ export class AasRepositoryClient {
|
|
|
1922
2167
|
success: false,
|
|
1923
2168
|
error: customError,
|
|
1924
2169
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2170
|
+
...getConditionalErrorFields(err),
|
|
1925
2171
|
};
|
|
1926
2172
|
}
|
|
1927
2173
|
}
|
|
@@ -1951,7 +2197,7 @@ export class AasRepositoryClient {
|
|
|
1951
2197
|
handleId: encodedHandleId,
|
|
1952
2198
|
});
|
|
1953
2199
|
const result = await response.value();
|
|
1954
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2200
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1955
2201
|
}
|
|
1956
2202
|
catch (err) {
|
|
1957
2203
|
const customError = await handleApiError(err);
|
|
@@ -1959,6 +2205,7 @@ export class AasRepositoryClient {
|
|
|
1959
2205
|
success: false,
|
|
1960
2206
|
error: customError,
|
|
1961
2207
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2208
|
+
...getConditionalErrorFields(err),
|
|
1962
2209
|
};
|
|
1963
2210
|
}
|
|
1964
2211
|
}
|
|
@@ -1983,7 +2230,7 @@ export class AasRepositoryClient {
|
|
|
1983
2230
|
includeConceptDescriptions: includeConceptDescriptions,
|
|
1984
2231
|
});
|
|
1985
2232
|
const result = await response.value();
|
|
1986
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2233
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
1987
2234
|
}
|
|
1988
2235
|
catch (err) {
|
|
1989
2236
|
const customError = await handleApiError(err);
|
|
@@ -1991,6 +2238,7 @@ export class AasRepositoryClient {
|
|
|
1991
2238
|
success: false,
|
|
1992
2239
|
error: customError,
|
|
1993
2240
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2241
|
+
...getConditionalErrorFields(err),
|
|
1994
2242
|
};
|
|
1995
2243
|
}
|
|
1996
2244
|
}
|
|
@@ -2008,7 +2256,7 @@ export class AasRepositoryClient {
|
|
|
2008
2256
|
const apiInstance = new AasRepositoryService.DescriptionAPIApi(applyDefaults(configuration));
|
|
2009
2257
|
const response = await apiInstance.getSelfDescriptionRaw();
|
|
2010
2258
|
const result = await response.value();
|
|
2011
|
-
return { success: true, data: result, statusCode: response.raw.status };
|
|
2259
|
+
return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
|
|
2012
2260
|
}
|
|
2013
2261
|
catch (err) {
|
|
2014
2262
|
const customError = await handleApiError(err);
|
|
@@ -2016,6 +2264,7 @@ export class AasRepositoryClient {
|
|
|
2016
2264
|
success: false,
|
|
2017
2265
|
error: customError,
|
|
2018
2266
|
statusCode: AasRepositoryClient.extractStatusCode(err, customError),
|
|
2267
|
+
...getConditionalErrorFields(err),
|
|
2019
2268
|
};
|
|
2020
2269
|
}
|
|
2021
2270
|
}
|