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