basyx-typescript-sdk 2.2.5 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import type { ApiResult } from '../models/api';
1
+ import type { ApiResult, ConditionalApiResult } from '../models/api';
2
2
  import { AasxFileService } from '../generated';
3
3
  import { Configuration } from '../generated/runtime';
4
4
  export declare class AasxFileClient {
@@ -47,13 +47,15 @@ export declare class AasxFileClient {
47
47
  * @param options Object containing:
48
48
  * - configuration: The http request options
49
49
  * - packageId: The package Id (UTF8-BASE64-URL-encoded)
50
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
50
51
  *
51
52
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
52
53
  */
53
- getAASXByPackageId(options: {
54
+ getAASXByPackageId<IfNoneMatch extends string | undefined = undefined>(options: {
54
55
  configuration: Configuration;
55
56
  packageId: string;
56
- }): Promise<ApiResult<Blob, AasxFileService.Result>>;
57
+ ifNoneMatch?: IfNoneMatch;
58
+ }): Promise<ConditionalApiResult<Blob, AasxFileService.Result, IfNoneMatch>>;
57
59
  /**
58
60
  * Updates the AASX package at the server
59
61
  *
@@ -63,6 +65,8 @@ export declare class AasxFileClient {
63
65
  * - aasIds?: A list of Asset Administration Shells' unique ids
64
66
  * - file: The file to upload
65
67
  * - fileName: The name of the file
68
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
69
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
66
70
  *
67
71
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
68
72
  */
@@ -72,6 +76,8 @@ export declare class AasxFileClient {
72
76
  aasIds?: string[];
73
77
  file: Blob;
74
78
  fileName: string;
79
+ ifMatch?: string;
80
+ ifNoneMatch?: string;
75
81
  }): Promise<ApiResult<void, AasxFileService.Result>>;
76
82
  /**
77
83
  * Deletes a specific AASX package from the server
@@ -79,12 +85,14 @@ export declare class AasxFileClient {
79
85
  * @param options Object containing:
80
86
  * - configuration: The http request options.
81
87
  * - packageId: The package Id (UTF8-BASE64-URL-encoded)
88
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
82
89
  *
83
90
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
84
91
  */
85
92
  deleteAASXByPackageId(options: {
86
93
  configuration: Configuration;
87
94
  packageId: string;
95
+ ifMatch?: string;
88
96
  }): Promise<ApiResult<void, AasxFileService.Result>>;
89
97
  /**
90
98
  * Returns the self-describing information of a network resource (ServiceDescription)
@@ -2,6 +2,7 @@ import { AasxFileService } from '../generated';
2
2
  import { RequiredError } from '../generated/runtime';
3
3
  import { applyDefaults } from '../lib/apiConfig';
4
4
  import { base64Encode } from '../lib/base64Url';
5
+ import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
5
6
  import { handleApiError } from '../lib/errorHandler';
6
7
  export class AasxFileClient {
7
8
  static requireIdentifier(value, field) {
@@ -53,6 +54,7 @@ export class AasxFileClient {
53
54
  success: true,
54
55
  data: { pagedResult, result },
55
56
  statusCode: response.raw.status,
57
+ etag: getEtag(response.raw),
56
58
  };
57
59
  }
58
60
  catch (err) {
@@ -61,6 +63,7 @@ export class AasxFileClient {
61
63
  success: false,
62
64
  error: customError,
63
65
  statusCode: AasxFileClient.extractStatusCode(err, customError),
66
+ ...getConditionalErrorFields(err),
64
67
  };
65
68
  }
66
69
  }
@@ -85,7 +88,7 @@ export class AasxFileClient {
85
88
  fileName: fileName,
86
89
  });
87
90
  const result = await response.value();
88
- return { success: true, data: result, statusCode: response.raw.status };
91
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
89
92
  }
90
93
  catch (err) {
91
94
  const customError = await handleApiError(err);
@@ -93,6 +96,7 @@ export class AasxFileClient {
93
96
  success: false,
94
97
  error: customError,
95
98
  statusCode: AasxFileClient.extractStatusCode(err, customError),
99
+ ...getConditionalErrorFields(err),
96
100
  };
97
101
  }
98
102
  }
@@ -102,26 +106,32 @@ export class AasxFileClient {
102
106
  * @param options Object containing:
103
107
  * - configuration: The http request options
104
108
  * - packageId: The package Id (UTF8-BASE64-URL-encoded)
109
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
105
110
  *
106
111
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
107
112
  */
108
113
  async getAASXByPackageId(options) {
109
- const { configuration, packageId } = options;
114
+ const { configuration, packageId, ifNoneMatch } = options;
110
115
  try {
111
- const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
116
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration, { ifNoneMatch }));
112
117
  const encodedPackageId = base64Encode(AasxFileClient.requireIdentifier(packageId, 'packageId'));
113
118
  const response = await apiInstance.getAASXByPackageIdRaw({
114
119
  packageId: encodedPackageId,
115
120
  });
116
121
  const result = await response.value();
117
- return { success: true, data: result, statusCode: response.raw.status };
122
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
118
123
  }
119
124
  catch (err) {
125
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
126
+ if (notModified) {
127
+ return notModified;
128
+ }
120
129
  const customError = await handleApiError(err);
121
130
  return {
122
131
  success: false,
123
132
  error: customError,
124
133
  statusCode: AasxFileClient.extractStatusCode(err, customError),
134
+ ...getConditionalErrorFields(err),
125
135
  };
126
136
  }
127
137
  }
@@ -134,13 +144,15 @@ export class AasxFileClient {
134
144
  * - aasIds?: A list of Asset Administration Shells' unique ids
135
145
  * - file: The file to upload
136
146
  * - fileName: The name of the file
147
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
148
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
137
149
  *
138
150
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
139
151
  */
140
152
  async putAASXByPackageId(options) {
141
- const { configuration, packageId, aasIds, file, fileName } = options;
153
+ const { configuration, packageId, aasIds, file, fileName, ifMatch, ifNoneMatch } = options;
142
154
  try {
143
- const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
155
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
144
156
  const encodedPackageId = base64Encode(AasxFileClient.requireIdentifier(packageId, 'packageId'));
145
157
  const response = await apiInstance.putAASXByPackageIdRaw({
146
158
  packageId: encodedPackageId,
@@ -149,7 +161,7 @@ export class AasxFileClient {
149
161
  fileName: fileName,
150
162
  });
151
163
  const result = await response.value();
152
- return { success: true, data: result, statusCode: response.raw.status };
164
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
153
165
  }
154
166
  catch (err) {
155
167
  const customError = await handleApiError(err);
@@ -157,6 +169,7 @@ export class AasxFileClient {
157
169
  success: false,
158
170
  error: customError,
159
171
  statusCode: AasxFileClient.extractStatusCode(err, customError),
172
+ ...getConditionalErrorFields(err),
160
173
  };
161
174
  }
162
175
  }
@@ -166,19 +179,20 @@ export class AasxFileClient {
166
179
  * @param options Object containing:
167
180
  * - configuration: The http request options.
168
181
  * - packageId: The package Id (UTF8-BASE64-URL-encoded)
182
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
169
183
  *
170
184
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
171
185
  */
172
186
  async deleteAASXByPackageId(options) {
173
- const { configuration, packageId } = options;
187
+ const { configuration, packageId, ifMatch } = options;
174
188
  try {
175
- const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration));
189
+ const apiInstance = new AasxFileService.AASXFileServerAPIApi(applyDefaults(configuration, { ifMatch }));
176
190
  const encodedPackageId = base64Encode(AasxFileClient.requireIdentifier(packageId, 'packageId'));
177
191
  const response = await apiInstance.deleteAASXByPackageIdRaw({
178
192
  packageId: encodedPackageId,
179
193
  });
180
194
  const result = await response.value();
181
- return { success: true, data: result, statusCode: response.raw.status };
195
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
182
196
  }
183
197
  catch (err) {
184
198
  const customError = await handleApiError(err);
@@ -186,6 +200,7 @@ export class AasxFileClient {
186
200
  success: false,
187
201
  error: customError,
188
202
  statusCode: AasxFileClient.extractStatusCode(err, customError),
203
+ ...getConditionalErrorFields(err),
189
204
  };
190
205
  }
191
206
  }
@@ -203,7 +218,7 @@ export class AasxFileClient {
203
218
  const apiInstance = new AasxFileService.DescriptionAPIApi(applyDefaults(configuration));
204
219
  const response = await apiInstance.getSelfDescriptionRaw();
205
220
  const result = await response.value();
206
- return { success: true, data: result, statusCode: response.raw.status };
221
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
207
222
  }
208
223
  catch (err) {
209
224
  const customError = await handleApiError(err);
@@ -211,6 +226,7 @@ export class AasxFileClient {
211
226
  success: false,
212
227
  error: customError,
213
228
  statusCode: AasxFileClient.extractStatusCode(err, customError),
229
+ ...getConditionalErrorFields(err),
214
230
  };
215
231
  }
216
232
  }
@@ -1,5 +1,5 @@
1
1
  import type { ConceptDescription } from '@aas-core-works/aas-core3.1-typescript/types';
2
- import type { ApiResult } from '../models/api';
2
+ import type { ApiResult, ConditionalApiResult } from '../models/api';
3
3
  import { ConceptDescriptionRepositoryService } from '../generated';
4
4
  import { Configuration } from '../generated/runtime';
5
5
  export declare class ConceptDescriptionRepositoryClient {
@@ -11,25 +11,29 @@ export declare class ConceptDescriptionRepositoryClient {
11
11
  * @param options Object containing:
12
12
  * - configuration: The http request options
13
13
  * - cdIdentifier: The Concept Description’s unique id
14
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
14
15
  *
15
16
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
16
17
  */
17
- getConceptDescriptionById(options: {
18
+ getConceptDescriptionById<IfNoneMatch extends string | undefined = undefined>(options: {
18
19
  configuration: Configuration;
19
20
  cdIdentifier: string;
20
- }): Promise<ApiResult<ConceptDescription, ConceptDescriptionRepositoryService.Result>>;
21
+ ifNoneMatch?: IfNoneMatch;
22
+ }): Promise<ConditionalApiResult<ConceptDescription, ConceptDescriptionRepositoryService.Result, IfNoneMatch>>;
21
23
  /**
22
24
  * Deletes a Concept Description
23
25
  *
24
26
  * @param options Object containing:
25
27
  * - configuration: The http request options
26
28
  * - cdIdentifier: The Concept Description’s unique id
29
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
27
30
  *
28
31
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
29
32
  */
30
33
  deleteConceptDescriptionById(options: {
31
34
  configuration: Configuration;
32
35
  cdIdentifier: string;
36
+ ifMatch?: string;
33
37
  }): Promise<ApiResult<void, ConceptDescriptionRepositoryService.Result>>;
34
38
  /**
35
39
  * Updates an existing Concept Description
@@ -38,6 +42,8 @@ export declare class ConceptDescriptionRepositoryClient {
38
42
  * - configuration: The http request options
39
43
  * - cdIdentifier: The Concept Description’s unique id
40
44
  * - conceptDescription: Concept Description object
45
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
46
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
41
47
  *
42
48
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
43
49
  */
@@ -45,6 +51,8 @@ export declare class ConceptDescriptionRepositoryClient {
45
51
  configuration: Configuration;
46
52
  cdIdentifier: string;
47
53
  conceptDescription: ConceptDescription;
54
+ ifMatch?: string;
55
+ ifNoneMatch?: string;
48
56
  }): Promise<ApiResult<ConceptDescription | void, ConceptDescriptionRepositoryService.Result>>;
49
57
  /**
50
58
  * Returns all Concept Descriptions
@@ -2,6 +2,7 @@ import { ConceptDescriptionRepositoryService } from '../generated'; // Updated i
2
2
  import { RequiredError } from '../generated/runtime';
3
3
  import { applyDefaults } from '../lib/apiConfig';
4
4
  import { base64Encode } from '../lib/base64Url';
5
+ import { getConditionalErrorFields, getEtag, getNotModifiedResult } from '../lib/conditionalRequests';
5
6
  import { convertApiCDToCoreCD, convertCoreCDToApiCD } from '../lib/convertConceptDescriptionTypes';
6
7
  import { handleApiError } from '../lib/errorHandler';
7
8
  export class ConceptDescriptionRepositoryClient {
@@ -32,26 +33,37 @@ export class ConceptDescriptionRepositoryClient {
32
33
  * @param options Object containing:
33
34
  * - configuration: The http request options
34
35
  * - cdIdentifier: The Concept Description’s unique id
36
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
35
37
  *
36
38
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
37
39
  */
38
40
  async getConceptDescriptionById(options) {
39
- const { configuration, cdIdentifier } = options;
41
+ const { configuration, cdIdentifier, ifNoneMatch } = options;
40
42
  try {
41
- const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
43
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration, { ifNoneMatch }));
42
44
  const encodedCdIdentifier = base64Encode(ConceptDescriptionRepositoryClient.requireIdentifier(cdIdentifier, 'cdIdentifier'));
43
45
  const response = await apiInstance.getConceptDescriptionByIdRaw({
44
46
  cdIdentifier: encodedCdIdentifier,
45
47
  });
46
48
  const result = await response.value();
47
- return { success: true, data: convertApiCDToCoreCD(result), statusCode: response.raw.status };
49
+ return {
50
+ success: true,
51
+ data: convertApiCDToCoreCD(result),
52
+ statusCode: response.raw.status,
53
+ etag: getEtag(response.raw),
54
+ };
48
55
  }
49
56
  catch (err) {
57
+ const notModified = getNotModifiedResult(err, ifNoneMatch);
58
+ if (notModified) {
59
+ return notModified;
60
+ }
50
61
  const customError = await handleApiError(err);
51
62
  return {
52
63
  success: false,
53
64
  error: customError,
54
65
  statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
66
+ ...getConditionalErrorFields(err),
55
67
  };
56
68
  }
57
69
  }
@@ -61,19 +73,20 @@ export class ConceptDescriptionRepositoryClient {
61
73
  * @param options Object containing:
62
74
  * - configuration: The http request options
63
75
  * - cdIdentifier: The Concept Description’s unique id
76
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
64
77
  *
65
78
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
66
79
  */
67
80
  async deleteConceptDescriptionById(options) {
68
- const { configuration, cdIdentifier } = options;
81
+ const { configuration, cdIdentifier, ifMatch } = options;
69
82
  try {
70
- const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
83
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration, { ifMatch }));
71
84
  const encodedCdIdentifier = base64Encode(ConceptDescriptionRepositoryClient.requireIdentifier(cdIdentifier, 'cdIdentifier'));
72
85
  const response = await apiInstance.deleteConceptDescriptionByIdRaw({
73
86
  cdIdentifier: encodedCdIdentifier,
74
87
  });
75
88
  const result = await response.value();
76
- return { success: true, data: result, statusCode: response.raw.status };
89
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
77
90
  }
78
91
  catch (err) {
79
92
  const customError = await handleApiError(err);
@@ -81,6 +94,7 @@ export class ConceptDescriptionRepositoryClient {
81
94
  success: false,
82
95
  error: customError,
83
96
  statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
97
+ ...getConditionalErrorFields(err),
84
98
  };
85
99
  }
86
100
  }
@@ -91,26 +105,29 @@ export class ConceptDescriptionRepositoryClient {
91
105
  * - configuration: The http request options
92
106
  * - cdIdentifier: The Concept Description’s unique id
93
107
  * - conceptDescription: Concept Description object
108
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
109
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
94
110
  *
95
111
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
96
112
  */
97
113
  async putConceptDescriptionById(options) {
98
- const { configuration, cdIdentifier, conceptDescription } = options;
114
+ const { configuration, cdIdentifier, conceptDescription, ifMatch, ifNoneMatch } = options;
99
115
  try {
100
- const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration));
116
+ const apiInstance = new ConceptDescriptionRepositoryService.ConceptDescriptionRepositoryAPIApi(applyDefaults(configuration, { ifMatch, ifNoneMatch }));
101
117
  const encodedCdIdentifier = base64Encode(ConceptDescriptionRepositoryClient.requireIdentifier(cdIdentifier, 'cdIdentifier'));
102
118
  const response = await apiInstance.putConceptDescriptionByIdRaw({
103
119
  cdIdentifier: encodedCdIdentifier,
104
120
  conceptDescription: convertCoreCDToApiCD(conceptDescription),
105
121
  });
106
122
  if (response.raw.status === 204) {
107
- return { success: true, data: undefined, statusCode: response.raw.status };
123
+ return { success: true, data: undefined, statusCode: response.raw.status, etag: getEtag(response.raw) };
108
124
  }
109
125
  const result = await response.value();
110
126
  return {
111
127
  success: true,
112
128
  data: result ? convertApiCDToCoreCD(result) : undefined,
113
129
  statusCode: response.raw.status,
130
+ etag: getEtag(response.raw),
114
131
  };
115
132
  }
116
133
  catch (err) {
@@ -119,6 +136,7 @@ export class ConceptDescriptionRepositoryClient {
119
136
  success: false,
120
137
  error: customError,
121
138
  statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
139
+ ...getConditionalErrorFields(err),
122
140
  };
123
141
  }
124
142
  }
@@ -155,6 +173,7 @@ export class ConceptDescriptionRepositoryClient {
155
173
  success: true,
156
174
  data: { pagedResult, result: conceptDescriptions },
157
175
  statusCode: response.raw.status,
176
+ etag: getEtag(response.raw),
158
177
  };
159
178
  }
160
179
  catch (err) {
@@ -163,6 +182,7 @@ export class ConceptDescriptionRepositoryClient {
163
182
  success: false,
164
183
  error: customError,
165
184
  statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
185
+ ...getConditionalErrorFields(err),
166
186
  };
167
187
  }
168
188
  }
@@ -183,7 +203,12 @@ export class ConceptDescriptionRepositoryClient {
183
203
  conceptDescription: convertCoreCDToApiCD(conceptDescription),
184
204
  });
185
205
  const result = await response.value();
186
- return { success: true, data: convertApiCDToCoreCD(result), statusCode: response.raw.status };
206
+ return {
207
+ success: true,
208
+ data: convertApiCDToCoreCD(result),
209
+ statusCode: response.raw.status,
210
+ etag: getEtag(response.raw),
211
+ };
187
212
  }
188
213
  catch (err) {
189
214
  const customError = await handleApiError(err);
@@ -191,6 +216,7 @@ export class ConceptDescriptionRepositoryClient {
191
216
  success: false,
192
217
  error: customError,
193
218
  statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
219
+ ...getConditionalErrorFields(err),
194
220
  };
195
221
  }
196
222
  }
@@ -215,7 +241,7 @@ export class ConceptDescriptionRepositoryClient {
215
241
  includeConceptDescriptions: includeConceptDescriptions,
216
242
  });
217
243
  const result = await response.value();
218
- return { success: true, data: result, statusCode: response.raw.status };
244
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
219
245
  }
220
246
  catch (err) {
221
247
  const customError = await handleApiError(err);
@@ -223,6 +249,7 @@ export class ConceptDescriptionRepositoryClient {
223
249
  success: false,
224
250
  error: customError,
225
251
  statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
252
+ ...getConditionalErrorFields(err),
226
253
  };
227
254
  }
228
255
  }
@@ -240,7 +267,7 @@ export class ConceptDescriptionRepositoryClient {
240
267
  const apiInstance = new ConceptDescriptionRepositoryService.DescriptionAPIApi(applyDefaults(configuration));
241
268
  const response = await apiInstance.getSelfDescriptionRaw();
242
269
  const result = await response.value();
243
- return { success: true, data: result, statusCode: response.raw.status };
270
+ return { success: true, data: result, statusCode: response.raw.status, etag: getEtag(response.raw) };
244
271
  }
245
272
  catch (err) {
246
273
  const customError = await handleApiError(err);
@@ -248,6 +275,7 @@ export class ConceptDescriptionRepositoryClient {
248
275
  success: false,
249
276
  error: customError,
250
277
  statusCode: ConceptDescriptionRepositoryClient.extractStatusCode(err, customError),
278
+ ...getConditionalErrorFields(err),
251
279
  };
252
280
  }
253
281
  }
@@ -1,4 +1,4 @@
1
- import type { ApiResult } from '../models/api';
1
+ import type { ApiResult, ConditionalApiResult } from '../models/api';
2
2
  import { SubmodelRegistryService } from '../generated';
3
3
  import { Configuration } from '../generated/runtime';
4
4
  import { SubmodelDescriptor } from '../models/Descriptors';
@@ -42,12 +42,14 @@ export declare class SubmodelRegistryClient {
42
42
  * @param options Object containing:
43
43
  * - configuration: The http request options
44
44
  * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
45
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
45
46
  *
46
47
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
47
48
  */
48
49
  deleteSubmodelDescriptorById(options: {
49
50
  configuration: Configuration;
50
51
  submodelIdentifier: string;
52
+ ifMatch?: string;
51
53
  }): Promise<ApiResult<void, SubmodelRegistryService.Result>>;
52
54
  /**
53
55
  * Returns a specific Submodel Descriptor
@@ -55,13 +57,15 @@ export declare class SubmodelRegistryClient {
55
57
  * @param options Object containing:
56
58
  * - configuration: The http request options
57
59
  * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
60
+ * - ifNoneMatch?: Sent as `If-None-Match` header; returns `{ success: true; notModified: true }` without data if the representation still has this `etag`
58
61
  *
59
62
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
60
63
  */
61
- getSubmodelDescriptorById(options: {
64
+ getSubmodelDescriptorById<IfNoneMatch extends string | undefined = undefined>(options: {
62
65
  configuration: Configuration;
63
66
  submodelIdentifier: string;
64
- }): Promise<ApiResult<SubmodelDescriptor, SubmodelRegistryService.Result>>;
67
+ ifNoneMatch?: IfNoneMatch;
68
+ }): Promise<ConditionalApiResult<SubmodelDescriptor, SubmodelRegistryService.Result, IfNoneMatch>>;
65
69
  /**
66
70
  * Creates or updates an existing Submodel Descriptor
67
71
  *
@@ -69,6 +73,8 @@ export declare class SubmodelRegistryClient {
69
73
  * - configuration: The http request options
70
74
  * - submodelIdentifier: The Submodel’s unique id (UTF8-BASE64-URL-encoded)
71
75
  * - submodelDescriptor: Submodel Descriptor object
76
+ * - ifMatch?: Sent as `If-Match` header; the request fails with `preconditionFailed` if the resource has changed since the `etag` was issued
77
+ * - ifNoneMatch?: Sent as `If-None-Match` header; use `*` to only create the resource (fails with `preconditionFailed` if it exists)
72
78
  *
73
79
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
74
80
  */
@@ -76,6 +82,8 @@ export declare class SubmodelRegistryClient {
76
82
  configuration: Configuration;
77
83
  submodelIdentifier: string;
78
84
  submodelDescriptor: SubmodelDescriptor;
85
+ ifMatch?: string;
86
+ ifNoneMatch?: string;
79
87
  }): Promise<ApiResult<SubmodelDescriptor | void, SubmodelRegistryService.Result>>;
80
88
  /**
81
89
  * Returns the self-describing information of a network resource (ServiceDescription)