basyx-typescript-sdk 0.2.1 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/README.md +5 -3
  2. package/bundle/index.js +17522 -841
  3. package/bundle/index.js.map +1 -1
  4. package/dist/clients/AasDiscoveryClient.d.ts +67 -0
  5. package/dist/clients/AasDiscoveryClient.js +115 -0
  6. package/dist/clients/AasRegistryClient.d.ts +163 -0
  7. package/dist/clients/AasRegistryClient.js +287 -0
  8. package/dist/clients/AasRepositoryClient.d.ts +790 -103
  9. package/dist/clients/AasRepositoryClient.js +1323 -211
  10. package/dist/clients/AasxFileClient.d.ts +81 -0
  11. package/dist/clients/AasxFileClient.js +148 -0
  12. package/dist/clients/ConceptDescriptionRepositoryClient.d.ts +83 -0
  13. package/dist/clients/ConceptDescriptionRepositoryClient.js +143 -0
  14. package/dist/clients/SubmodelRegistryClient.d.ts +77 -0
  15. package/dist/clients/SubmodelRegistryClient.js +138 -0
  16. package/dist/clients/SubmodelRepositoryClient.d.ts +354 -0
  17. package/dist/clients/SubmodelRepositoryClient.js +585 -0
  18. package/dist/clients/index.d.ts +6 -0
  19. package/dist/clients/index.js +6 -0
  20. package/dist/generated/AasDiscoveryService/apis/AssetAdministrationShellBasicDiscoveryAPIApi.d.ts +80 -0
  21. package/dist/generated/AasDiscoveryService/apis/AssetAdministrationShellBasicDiscoveryAPIApi.js +156 -0
  22. package/dist/generated/AasDiscoveryService/apis/DescriptionAPIApi.d.ts +26 -0
  23. package/dist/generated/AasDiscoveryService/apis/DescriptionAPIApi.js +40 -0
  24. package/dist/generated/AasDiscoveryService/apis/index.d.ts +2 -0
  25. package/dist/generated/AasDiscoveryService/apis/index.js +4 -0
  26. package/dist/generated/AasDiscoveryService/index.d.ts +3 -0
  27. package/dist/generated/AasDiscoveryService/index.js +5 -0
  28. package/dist/generated/AasDiscoveryService/models/index.d.ts +297 -0
  29. package/dist/generated/AasDiscoveryService/models/index.js +48 -0
  30. package/dist/generated/AasDiscoveryService/runtime.d.ts +181 -0
  31. package/dist/generated/AasDiscoveryService/runtime.js +326 -0
  32. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.d.ts +139 -0
  33. package/dist/generated/AasRegistryService/apis/AssetAdministrationShellRegistryAPIApi.js +312 -0
  34. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
  35. package/dist/generated/AasRegistryService/apis/DescriptionAPIApi.js +40 -0
  36. package/dist/generated/AasRegistryService/apis/index.d.ts +2 -0
  37. package/dist/generated/AasRegistryService/apis/index.js +4 -0
  38. package/dist/generated/AasRegistryService/index.d.ts +3 -0
  39. package/dist/generated/AasRegistryService/index.js +5 -0
  40. package/dist/generated/AasRegistryService/models/index.d.ts +1070 -0
  41. package/dist/generated/AasRegistryService/models/index.js +151 -0
  42. package/dist/generated/AasRegistryService/runtime.d.ts +181 -0
  43. package/dist/generated/AasRegistryService/runtime.js +326 -0
  44. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.d.ts +870 -0
  45. package/dist/generated/AasRepositoryService/apis/AssetAdministrationShellRepositoryAPIApi.js +1842 -0
  46. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  47. package/dist/generated/AasRepositoryService/apis/DescriptionAPIApi.js +40 -0
  48. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  49. package/dist/generated/AasRepositoryService/apis/SerializationAPIApi.js +49 -0
  50. package/dist/generated/AasRepositoryService/apis/index.d.ts +3 -0
  51. package/dist/generated/AasRepositoryService/apis/index.js +5 -0
  52. package/dist/generated/AasRepositoryService/index.d.ts +3 -0
  53. package/dist/generated/AasRepositoryService/index.js +5 -0
  54. package/dist/generated/AasRepositoryService/models/index.d.ts +4585 -0
  55. package/dist/generated/AasRepositoryService/models/index.js +221 -0
  56. package/dist/generated/AasRepositoryService/runtime.d.ts +181 -0
  57. package/dist/generated/AasRepositoryService/runtime.js +326 -0
  58. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.d.ts +78 -0
  59. package/dist/generated/AasxFileService/apis/AASXFileServerAPIApi.js +184 -0
  60. package/dist/generated/AasxFileService/apis/index.d.ts +1 -0
  61. package/dist/generated/AasxFileService/apis/index.js +3 -0
  62. package/dist/generated/AasxFileService/index.d.ts +3 -0
  63. package/dist/generated/AasxFileService/index.js +5 -0
  64. package/dist/generated/AasxFileService/models/index.d.ts +80 -0
  65. package/dist/generated/AasxFileService/models/index.js +10 -0
  66. package/dist/generated/AasxFileService/runtime.d.ts +181 -0
  67. package/dist/generated/AasxFileService/runtime.js +326 -0
  68. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.d.ts +78 -0
  69. package/dist/generated/ConceptDescriptionRepositoryService/apis/ConceptDescriptionRepositoryAPIApi.js +164 -0
  70. package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  71. package/dist/generated/ConceptDescriptionRepositoryService/apis/DescriptionAPIApi.js +40 -0
  72. package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  73. package/dist/generated/ConceptDescriptionRepositoryService/apis/SerializationAPIApi.js +49 -0
  74. package/dist/generated/ConceptDescriptionRepositoryService/apis/index.d.ts +3 -0
  75. package/dist/generated/ConceptDescriptionRepositoryService/apis/index.js +5 -0
  76. package/dist/generated/ConceptDescriptionRepositoryService/index.d.ts +3 -0
  77. package/dist/generated/ConceptDescriptionRepositoryService/index.js +5 -0
  78. package/dist/generated/ConceptDescriptionRepositoryService/models/index.d.ts +2869 -0
  79. package/dist/generated/ConceptDescriptionRepositoryService/models/index.js +209 -0
  80. package/dist/generated/ConceptDescriptionRepositoryService/runtime.d.ts +181 -0
  81. package/dist/generated/ConceptDescriptionRepositoryService/runtime.js +326 -0
  82. package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.d.ts +26 -0
  83. package/dist/generated/SubmodelRegistryService/apis/DescriptionAPIApi.js +40 -0
  84. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.d.ts +75 -0
  85. package/dist/generated/SubmodelRegistryService/apis/SubmodelRegistryAPIApi.js +155 -0
  86. package/dist/generated/SubmodelRegistryService/apis/index.d.ts +2 -0
  87. package/dist/generated/SubmodelRegistryService/apis/index.js +4 -0
  88. package/dist/generated/SubmodelRegistryService/index.d.ts +3 -0
  89. package/dist/generated/SubmodelRegistryService/index.js +5 -0
  90. package/dist/generated/SubmodelRegistryService/models/index.d.ts +924 -0
  91. package/dist/generated/SubmodelRegistryService/models/index.js +141 -0
  92. package/dist/generated/SubmodelRegistryService/runtime.d.ts +181 -0
  93. package/dist/generated/SubmodelRegistryService/runtime.js +326 -0
  94. package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.d.ts +26 -0
  95. package/dist/generated/SubmodelRepositoryService/apis/DescriptionAPIApi.js +40 -0
  96. package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.d.ts +30 -0
  97. package/dist/generated/SubmodelRepositoryService/apis/SerializationAPIApi.js +49 -0
  98. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.d.ts +802 -0
  99. package/dist/generated/SubmodelRepositoryService/apis/SubmodelRepositoryAPIApi.js +1572 -0
  100. package/dist/generated/SubmodelRepositoryService/apis/index.d.ts +3 -0
  101. package/dist/generated/SubmodelRepositoryService/apis/index.js +5 -0
  102. package/dist/generated/SubmodelRepositoryService/index.d.ts +3 -0
  103. package/dist/generated/SubmodelRepositoryService/index.js +5 -0
  104. package/dist/generated/SubmodelRepositoryService/models/index.d.ts +4623 -0
  105. package/dist/generated/SubmodelRepositoryService/models/index.js +221 -0
  106. package/dist/generated/SubmodelRepositoryService/runtime.d.ts +181 -0
  107. package/dist/generated/SubmodelRepositoryService/runtime.js +326 -0
  108. package/dist/generated/index.d.ts +8 -2
  109. package/dist/generated/index.js +8 -3
  110. package/dist/index.d.ts +1 -1
  111. package/dist/index.js +1 -1
  112. package/dist/lib/apiConfig.d.ts +2 -0
  113. package/dist/lib/apiConfig.js +41 -0
  114. package/dist/lib/base64Url.js +4 -0
  115. package/dist/lib/convertAasDescriptorTypes.d.ts +34 -0
  116. package/dist/lib/convertAasDescriptorTypes.js +76 -0
  117. package/dist/lib/convertAasDiscoveryTypes.d.ts +18 -0
  118. package/dist/lib/convertAasDiscoveryTypes.js +39 -0
  119. package/dist/lib/convertAasTypes.d.ts +7 -7
  120. package/dist/lib/convertAasTypes.js +5 -0
  121. package/dist/lib/convertConceptDescriptionTypes.d.ts +18 -0
  122. package/dist/lib/convertConceptDescriptionTypes.js +39 -0
  123. package/dist/lib/convertSubmodelTypes.d.ts +34 -0
  124. package/dist/lib/convertSubmodelTypes.js +69 -0
  125. package/dist/lib/descriptorJsonization.d.ts +12 -0
  126. package/dist/lib/descriptorJsonization.js +172 -0
  127. package/dist/lib/errorHandler.d.ts +9 -0
  128. package/dist/lib/errorHandler.js +113 -0
  129. package/dist/models/Descriptors.d.ts +51 -0
  130. package/dist/models/Descriptors.js +56 -0
  131. package/dist/models/index.d.ts +0 -1
  132. package/dist/models/index.js +0 -1
  133. package/dist/utils/DescriptorUtils.d.ts +9 -0
  134. package/dist/utils/DescriptorUtils.js +37 -0
  135. package/dist/utils/KeyTypesUtil.d.ts +24 -0
  136. package/dist/utils/KeyTypesUtil.js +55 -0
  137. package/dist/utils/MultiLanguagePropertyUtils.d.ts +24 -0
  138. package/dist/utils/MultiLanguagePropertyUtils.js +46 -0
  139. package/dist/utils/ReferableUtils.d.ts +69 -0
  140. package/dist/utils/ReferableUtils.js +220 -0
  141. package/dist/utils/ReferenceUtil.d.ts +9 -0
  142. package/dist/utils/ReferenceUtil.js +22 -0
  143. package/dist/utils/SemanticIdUtils.d.ts +119 -0
  144. package/dist/utils/SemanticIdUtils.js +363 -0
  145. package/package.json +14 -11
  146. package/dist/generated/schemas.gen.d.ts +0 -2357
  147. package/dist/generated/schemas.gen.js +0 -2789
  148. package/dist/generated/sdk.gen.d.ts +0 -822
  149. package/dist/generated/sdk.gen.js +0 -2225
  150. package/dist/generated/types.gen.d.ts +0 -10829
  151. package/dist/generated/types.gen.js +0 -2
  152. package/dist/lib/createAasRepoClient.d.ts +0 -9
  153. package/dist/lib/createAasRepoClient.js +0 -15
  154. package/dist/models/aas-repository.d.ts +0 -65
  155. package/dist/models/aas-repository.js +0 -1
@@ -1,411 +1,1523 @@
1
- import * as AasRepository from '../generated';
1
+ import { AasRepositoryService } from '../generated';
2
+ import { applyDefaults } from '../lib/apiConfig';
2
3
  import { base64Encode } from '../lib/base64Url';
3
4
  import { convertApiAasToCoreAas, convertApiAssetInformationToCoreAssetInformation, convertApiReferenceToCoreReference, convertCoreAasToApiAas, convertCoreAssetInformationToApiAssetInformation, convertCoreReferenceToApiReference, } from '../lib/convertAasTypes';
4
- import { createCustomClient } from '../lib/createAasRepoClient';
5
+ import { convertApiSubmodelElementToCoreSubmodelElement, convertApiSubmodelToCoreSubmodel, convertCoreSubmodelElementToApiSubmodelElement, convertCoreSubmodelToApiSubmodel, } from '../lib/convertSubmodelTypes';
6
+ import { handleApiError } from '../lib/errorHandler';
5
7
  export class AasRepositoryClient {
6
8
  /**
7
- * Returns all Asset Administration Shells.
9
+ * Returns all Asset Administration Shells
8
10
  *
9
11
  * @param options Object containing:
10
- * - baseUrl: The API base URL
11
- * - headers?: Optional Request headers
12
- * - assetIds?: A list of asset identifiers
13
- * - idShort?: The AAS's idShort
14
- * - limit?: Max number of elements to return
15
- * - cursor?: A paging cursor from previous responses
12
+ * - configuration: The http request options
13
+ * - assetIds?: A list of specific Asset identifiers
14
+ * - idShort?: The Asset Administration Shell’s IdShort
15
+ * - limit?: The maximum number of elements in the response array
16
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
16
17
  *
17
18
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
18
19
  */
19
20
  async getAllAssetAdministrationShells(options) {
20
- const { baseUrl, headers, assetIds, idShort, limit, cursor } = options;
21
+ const { configuration, assetIds, idShort, limit, cursor } = options;
21
22
  try {
22
- const client = createCustomClient(baseUrl, headers);
23
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
23
24
  const encodedAssetIds = assetIds?.map((id) => base64Encode(JSON.stringify(id)));
24
- const { data, error } = await AasRepository.getAllAssetAdministrationShells({
25
- client,
26
- query: { assetIds: encodedAssetIds, idShort, limit, cursor },
27
- });
28
- if (error) {
29
- return { success: false, error };
30
- }
31
- const shells = (data.result ?? []).map(convertApiAasToCoreAas);
25
+ const result = await apiInstance.getAllAssetAdministrationShells({
26
+ assetIds: encodedAssetIds,
27
+ idShort: idShort,
28
+ limit: limit,
29
+ cursor: cursor,
30
+ });
31
+ const shells = (result.result ?? []).map(convertApiAasToCoreAas);
32
32
  return {
33
33
  success: true,
34
- data: {
35
- pagedResult: data.paging_metadata,
36
- result: shells,
37
- },
34
+ data: { pagedResult: result.pagingMetadata, result: shells },
38
35
  };
39
36
  }
40
37
  catch (err) {
41
- return {
42
- success: false,
43
- error: err instanceof Error ? err : new Error(String(err)),
44
- };
38
+ const customError = await handleApiError(err);
39
+ return { success: false, error: customError };
45
40
  }
46
41
  }
47
42
  /**
48
- * Creates a new Asset Administration Shell.
43
+ * Creates a new Asset Administration Shell
49
44
  *
50
45
  * @param options Object containing:
51
- * - baseUrl: The API base URL
52
- * - assetAdministrationShell: The AAS to create
53
- * - headers?: Optional request headers
46
+ * - configuration: The http request options.
47
+ * - assetAdministrationShell: Asset Administration Shell object
54
48
  *
55
49
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
56
50
  */
57
51
  async postAssetAdministrationShell(options) {
58
- const { baseUrl, assetAdministrationShell, headers } = options;
52
+ const { configuration, assetAdministrationShell } = options;
59
53
  try {
60
- const client = createCustomClient(baseUrl, headers);
61
- const { data, error } = await AasRepository.postAssetAdministrationShell({
62
- client,
63
- body: convertCoreAasToApiAas(assetAdministrationShell),
54
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
55
+ const result = await apiInstance.postAssetAdministrationShell({
56
+ assetAdministrationShell: convertCoreAasToApiAas(assetAdministrationShell),
64
57
  });
65
- if (error) {
66
- return { success: false, error };
67
- }
68
- return { success: true, data: convertApiAasToCoreAas(data) };
58
+ return { success: true, data: convertApiAasToCoreAas(result) };
69
59
  }
70
60
  catch (err) {
71
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
61
+ const customError = await handleApiError(err);
62
+ return { success: false, error: customError };
72
63
  }
73
64
  }
74
65
  /**
75
- * Deletes an Asset Administration Shell by its unique identifier.
66
+ * Deletes an Asset Administration Shell
76
67
  *
77
68
  * @param options Object containing:
78
- * - baseUrl: The API base URL
79
- * - aasIdentifier: The unique ID for the AAS
80
- * - headers?: Optional request headers
69
+ * - configuration: The http request options
70
+ * - aasIdentifier: The Asset Administration Shell’s unique id
81
71
  *
82
72
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
83
73
  */
84
74
  async deleteAssetAdministrationShellById(options) {
85
- const { baseUrl, aasIdentifier, headers } = options;
75
+ const { configuration, aasIdentifier } = options;
86
76
  try {
87
- const client = createCustomClient(baseUrl, headers);
77
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
88
78
  const encodedAasIdentifier = base64Encode(aasIdentifier);
89
- const { data, error } = await AasRepository.deleteAssetAdministrationShellById({
90
- client,
91
- path: { aasIdentifier: encodedAasIdentifier },
79
+ const result = await apiInstance.deleteAssetAdministrationShellById({
80
+ aasIdentifier: encodedAasIdentifier,
92
81
  });
93
- if (error) {
94
- return { success: false, error };
95
- }
96
- return { success: true, data };
82
+ return { success: true, data: result };
97
83
  }
98
84
  catch (err) {
99
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
85
+ const customError = await handleApiError(err);
86
+ return { success: false, error: customError };
100
87
  }
101
88
  }
102
89
  /**
103
- * Returns a specific Asset Administration Shell by its unique identifier.
90
+ * Returns a specific Asset Administration Shell
104
91
  *
105
92
  * @param options Object containing:
106
- * - baseUrl: The API base URL
107
- * - aasIdentifier: The unique ID
108
- * - headers?: Optional request headers
93
+ * - configuration: The http request options
94
+ * - aasIdentifier: The Asset Administration Shell’s unique id
109
95
  *
110
96
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
111
97
  */
112
98
  async getAssetAdministrationShellById(options) {
113
- const { baseUrl, aasIdentifier, headers } = options;
99
+ const { configuration, aasIdentifier } = options;
114
100
  try {
115
- const client = createCustomClient(baseUrl, headers);
101
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
116
102
  const encodedAasIdentifier = base64Encode(aasIdentifier);
117
- const { data, error } = await AasRepository.getAssetAdministrationShellById({
118
- client,
119
- path: { aasIdentifier: encodedAasIdentifier },
103
+ const result = await apiInstance.getAssetAdministrationShellById({
104
+ aasIdentifier: encodedAasIdentifier,
120
105
  });
121
- if (error) {
122
- return { success: false, error };
123
- }
124
- return { success: true, data: convertApiAasToCoreAas(data) };
106
+ return { success: true, data: convertApiAasToCoreAas(result) };
125
107
  }
126
108
  catch (err) {
127
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
109
+ const customError = await handleApiError(err);
110
+ return { success: false, error: customError };
128
111
  }
129
112
  }
130
113
  /**
131
- * Updates an existing Asset Administration Shell by ID (PUT).
114
+ * Updates an existing Asset Administration Shell
132
115
  *
133
116
  * @param options Object containing:
134
- * - baseUrl: The API base URL
135
- * - aasIdentifier: The unique ID
136
- * - assetAdministrationShell: The updated AAS object
137
- * - headers?: Optional request headers
117
+ * - configuration: The http request options
118
+ * - aasIdentifier: The Asset Administration Shell’s unique id
119
+ * - assetAdministrationShell: Asset Administration Shell object
138
120
  *
139
121
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
140
122
  */
141
123
  async putAssetAdministrationShellById(options) {
142
- const { baseUrl, aasIdentifier, assetAdministrationShell, headers } = options;
124
+ const { configuration, aasIdentifier, assetAdministrationShell } = options;
143
125
  try {
144
- const client = createCustomClient(baseUrl, headers);
126
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
145
127
  const encodedAasIdentifier = base64Encode(aasIdentifier);
146
- const { data, error } = await AasRepository.putAssetAdministrationShellById({
147
- client,
148
- path: { aasIdentifier: encodedAasIdentifier },
149
- body: convertCoreAasToApiAas(assetAdministrationShell),
128
+ const result = await apiInstance.putAssetAdministrationShellById({
129
+ aasIdentifier: encodedAasIdentifier,
130
+ assetAdministrationShell: convertCoreAasToApiAas(assetAdministrationShell),
150
131
  });
151
- if (error) {
152
- return { success: false, error };
153
- }
154
- return { success: true, data };
132
+ return { success: true, data: result ? convertApiAasToCoreAas(result) : undefined };
155
133
  }
156
134
  catch (err) {
157
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
135
+ const customError = await handleApiError(err);
136
+ return { success: false, error: customError };
158
137
  }
159
138
  }
160
139
  /**
161
- * Returns the AssetInformation for the given AAS.
140
+ * Returns the Asset Information
162
141
  *
163
142
  * @param options Object containing:
164
- * - baseUrl: The API base URL
165
- * - aasIdentifier: The unique ID
166
- * - headers?: Optional request headers
143
+ * - configuration: The http request options
144
+ * - aasIdentifier: The Asset Administration Shell’s unique id
167
145
  *
168
146
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
169
147
  */
170
148
  async getAssetInformation(options) {
171
- const { baseUrl, aasIdentifier, headers } = options;
149
+ const { configuration, aasIdentifier } = options;
172
150
  try {
173
- const client = createCustomClient(baseUrl, headers);
151
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
174
152
  const encodedAasIdentifier = base64Encode(aasIdentifier);
175
- const { data, error } = await AasRepository.getAssetInformationAasRepository({
176
- client,
177
- path: { aasIdentifier: encodedAasIdentifier },
153
+ const result = await apiInstance.getAssetInformationAasRepository({
154
+ aasIdentifier: encodedAasIdentifier,
178
155
  });
179
- if (error) {
180
- return { success: false, error };
181
- }
182
156
  return {
183
157
  success: true,
184
- data: convertApiAssetInformationToCoreAssetInformation(data),
158
+ data: convertApiAssetInformationToCoreAssetInformation(result),
185
159
  };
186
160
  }
187
161
  catch (err) {
188
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
162
+ const customError = await handleApiError(err);
163
+ return { success: false, error: customError };
189
164
  }
190
165
  }
191
166
  /**
192
- * Updates the AssetInformation for the given AAS.
167
+ * Updates the Asset Information
193
168
  *
194
169
  * @param options Object containing:
195
- * - baseUrl: The API base URL
196
- * - aasIdentifier: The unique ID
197
- * - assetInformation: The updated AssetInformation object
198
- * - headers?: Optional request headers
170
+ * - configuration: The http request options
171
+ * - aasIdentifier: The Asset Administration Shell’s unique id
172
+ * - assetInformation: Asset Information object
199
173
  *
200
174
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
201
175
  */
202
176
  async putAssetInformation(options) {
203
- const { baseUrl, aasIdentifier, assetInformation, headers } = options;
177
+ const { configuration, aasIdentifier, assetInformation } = options;
204
178
  try {
205
- const client = createCustomClient(baseUrl, headers);
179
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
206
180
  const encodedAasIdentifier = base64Encode(aasIdentifier);
207
- const { data, error } = await AasRepository.putAssetInformationAasRepository({
208
- client,
209
- path: { aasIdentifier: encodedAasIdentifier },
210
- body: convertCoreAssetInformationToApiAssetInformation(assetInformation),
181
+ const result = await apiInstance.putAssetInformationAasRepository({
182
+ aasIdentifier: encodedAasIdentifier,
183
+ assetInformation: convertCoreAssetInformationToApiAssetInformation(assetInformation),
211
184
  });
212
- if (error) {
213
- return { success: false, error };
214
- }
215
- return { success: true, data };
185
+ return { success: true, data: result };
216
186
  }
217
187
  catch (err) {
218
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
188
+ const customError = await handleApiError(err);
189
+ return { success: false, error: customError };
219
190
  }
220
191
  }
221
192
  /**
222
- * Deletes the Thumbnail associated with the given AAS.
193
+ * Deletes the Thumbnail associated with the given AAS
223
194
  *
224
195
  * @param options Object containing:
225
- * - baseUrl: The API base URL
226
- * - aasIdentifier: The unique ID
227
- * - headers?: Optional request headers
196
+ * - configuration: The http request options
197
+ * - aasIdentifier: The Asset Administration Shell’s unique id
228
198
  *
229
199
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
230
200
  */
231
201
  async deleteThumbnail(options) {
232
- const { baseUrl, aasIdentifier, headers } = options;
202
+ const { configuration, aasIdentifier } = options;
233
203
  try {
234
- const client = createCustomClient(baseUrl, headers);
204
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
235
205
  const encodedAasIdentifier = base64Encode(aasIdentifier);
236
- const { data, error } = await AasRepository.deleteThumbnailAasRepository({
237
- client,
238
- path: { aasIdentifier: encodedAasIdentifier },
206
+ const result = await apiInstance.deleteThumbnailAasRepository({
207
+ aasIdentifier: encodedAasIdentifier,
239
208
  });
240
- if (error) {
241
- return { success: false, error };
242
- }
243
- return {
244
- success: true,
245
- data: data,
246
- };
209
+ return { success: true, data: result };
247
210
  }
248
211
  catch (err) {
249
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
212
+ const customError = await handleApiError(err);
213
+ return { success: false, error: customError };
250
214
  }
251
215
  }
252
216
  /**
253
- * Returns the Thumbnail associated with an AAS, if any.
217
+ * Returns the Thumbnail associated with an AAS, if any
254
218
  *
255
219
  * @param options Object containing:
256
- * - baseUrl: The API base URL
257
- * - aasIdentifier: The unique ID
258
- * - headers?: Optional request headers
220
+ * - configuration: The http request options
221
+ * - aasIdentifier: The Asset Administration Shell’s unique id
259
222
  *
260
223
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
261
224
  */
262
225
  async getThumbnail(options) {
263
- const { baseUrl, aasIdentifier, headers } = options;
226
+ const { configuration, aasIdentifier } = options;
264
227
  try {
265
- const client = createCustomClient(baseUrl, headers);
228
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
266
229
  const encodedAasIdentifier = base64Encode(aasIdentifier);
267
- const { data, error } = await AasRepository.getThumbnailAasRepository({
268
- client,
269
- path: { aasIdentifier: encodedAasIdentifier },
230
+ const result = await apiInstance.getThumbnailAasRepository({
231
+ aasIdentifier: encodedAasIdentifier,
270
232
  });
271
- if (error) {
272
- return { success: false, error };
273
- }
274
- return { success: true, data };
233
+ return { success: true, data: result };
275
234
  }
276
235
  catch (err) {
277
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
236
+ const customError = await handleApiError(err);
237
+ return { success: false, error: customError };
278
238
  }
279
239
  }
280
240
  /**
281
- * Updates (or creates) the Thumbnail for the given AAS.
241
+ * Updates (or creates) the Thumbnail for the given AAS
282
242
  *
283
243
  * @param options Object containing:
284
- * - baseUrl: The API base URL
285
- * - aasIdentifier: The unique ID
286
- * - thumbnail: The thumbnail data to upload
287
- * - headers?: Optional request headers
244
+ * - configuration: The http request options
245
+ * - aasIdentifier: The Asset Administration Shell’s unique id
246
+ * - fileName: The name of the file
247
+ * - file: The file to upload
288
248
  *
289
249
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
290
250
  */
291
251
  async putThumbnail(options) {
292
- const { baseUrl, aasIdentifier, thumbnail, headers } = options;
252
+ const { configuration, aasIdentifier, fileName, file } = options;
293
253
  try {
294
- const client = createCustomClient(baseUrl, headers);
254
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
295
255
  const encodedAasIdentifier = base64Encode(aasIdentifier);
296
- const { data, error } = await AasRepository.putThumbnailAasRepository({
297
- client,
298
- path: { aasIdentifier: encodedAasIdentifier },
299
- body: thumbnail,
256
+ const result = await apiInstance.putThumbnailAasRepository({
257
+ aasIdentifier: encodedAasIdentifier,
258
+ fileName: fileName,
259
+ file: file,
300
260
  });
301
- if (error) {
302
- return { success: false, error };
303
- }
304
- return { success: true, data };
261
+ return { success: true, data: result };
305
262
  }
306
263
  catch (err) {
307
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
264
+ const customError = await handleApiError(err);
265
+ return { success: false, error: customError };
308
266
  }
309
267
  }
310
268
  /**
311
- * Returns all submodel references for the given AAS.
269
+ * Returns all submodel references
312
270
  *
313
271
  * @param options Object containing:
314
- * - baseUrl: The API base URL
315
- * - aasIdentifier: The unique ID
316
- * - headers?: Optional request headers
317
- * - limit?: Max number of elements
318
- * - cursor?: Paging cursor
272
+ * - configuration: The http request options
273
+ * - aasIdentifier: The Asset Administration Shell’s unique id
274
+ * - limit?: The maximum number of elements in the response array
275
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
319
276
  *
320
277
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
321
278
  */
322
279
  async getAllSubmodelReferences(options) {
323
- const { baseUrl, aasIdentifier, headers, limit, cursor } = options;
280
+ const { configuration, aasIdentifier, limit, cursor } = options;
324
281
  try {
325
- const client = createCustomClient(baseUrl, headers);
282
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
326
283
  const encodedAasIdentifier = base64Encode(aasIdentifier);
327
- const { data, error } = await AasRepository.getAllSubmodelReferencesAasRepository({
328
- client,
329
- path: { aasIdentifier: encodedAasIdentifier },
330
- query: { limit, cursor },
284
+ const result = await apiInstance.getAllSubmodelReferencesAasRepository({
285
+ aasIdentifier: encodedAasIdentifier,
286
+ limit: limit,
287
+ cursor: cursor,
331
288
  });
332
- if (error) {
333
- return { success: false, error };
334
- }
335
- const submodelReferences = (data.result ?? []).map(convertApiReferenceToCoreReference);
289
+ const submodelReferences = (result.result ?? []).map(convertApiReferenceToCoreReference);
336
290
  return {
337
291
  success: true,
338
292
  data: {
339
- pagedResult: data.paging_metadata,
293
+ pagedResult: result.pagingMetadata,
340
294
  result: submodelReferences,
341
295
  },
342
296
  };
343
297
  }
344
298
  catch (err) {
345
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
299
+ const customError = await handleApiError(err);
300
+ return { success: false, error: customError };
346
301
  }
347
302
  }
348
303
  /**
349
- * Creates a submodel reference at the given AAS.
304
+ * Creates a submodel reference at the Asset Administration Shell
350
305
  *
351
306
  * @param options Object containing:
352
- * - baseUrl: The API base URL
353
- * - aasIdentifier: The unique ID of the AAS
354
- * - submodelReference: The Reference to the submodel
355
- * - headers?: Optional request headers
307
+ * - configuration: The http request options
308
+ * - aasIdentifier: The Asset Administration Shell’s unique id
309
+ * - submodelReference: Reference to the Submodel
356
310
  *
357
311
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
358
312
  */
359
313
  async postSubmodelReference(options) {
360
- const { baseUrl, aasIdentifier, submodelReference, headers } = options;
314
+ const { configuration, aasIdentifier, submodelReference } = options;
361
315
  try {
362
- const client = createCustomClient(baseUrl, headers);
316
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
363
317
  const encodedAasIdentifier = base64Encode(aasIdentifier);
364
- const { data, error } = await AasRepository.postSubmodelReferenceAasRepository({
365
- client,
366
- path: { aasIdentifier: encodedAasIdentifier },
367
- body: convertCoreReferenceToApiReference(submodelReference),
318
+ const result = await apiInstance.postSubmodelReferenceAasRepository({
319
+ aasIdentifier: encodedAasIdentifier,
320
+ reference: convertCoreReferenceToApiReference(submodelReference),
368
321
  });
369
- if (error) {
370
- return { success: false, error };
371
- }
372
- return { success: true, data: convertApiReferenceToCoreReference(data) };
322
+ return { success: true, data: convertApiReferenceToCoreReference(result) };
373
323
  }
374
324
  catch (err) {
375
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
325
+ const customError = await handleApiError(err);
326
+ return { success: false, error: customError };
376
327
  }
377
328
  }
378
329
  /**
379
330
  * Deletes a submodel reference from the given AAS (does not delete the submodel itself).
380
331
  *
381
332
  * @param options Object containing:
382
- * - baseUrl: The API base URL
333
+ * - configuration: The http request options
383
334
  * - aasIdentifier: Unique ID of the AAS
384
335
  * - submodelIdentifier: The submodel's unique ID
385
- * - headers?: Optional request headers
386
336
  *
387
337
  * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
388
338
  */
389
339
  async deleteSubmodelReferenceById(options) {
390
- const { baseUrl, aasIdentifier, submodelIdentifier, headers } = options;
340
+ const { configuration, aasIdentifier, submodelIdentifier } = options;
391
341
  try {
392
- const client = createCustomClient(baseUrl, headers);
342
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
393
343
  const encodedAasIdentifier = base64Encode(aasIdentifier);
394
344
  const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
395
- const { data, error } = await AasRepository.deleteSubmodelReferenceByIdAasRepository({
396
- client,
397
- path: {
398
- aasIdentifier: encodedAasIdentifier,
399
- submodelIdentifier: encodedSubmodelIdentifier,
400
- },
345
+ const result = await apiInstance.deleteSubmodelReferenceAasRepository({
346
+ aasIdentifier: encodedAasIdentifier,
347
+ submodelIdentifier: encodedSubmodelIdentifier,
348
+ });
349
+ return { success: true, data: result };
350
+ }
351
+ catch (err) {
352
+ const customError = await handleApiError(err);
353
+ return { success: false, error: customError };
354
+ }
355
+ }
356
+ /**
357
+ * Returns the Submodel
358
+ *
359
+ * @param options Object containing:
360
+ * - configuration: The http request options
361
+ * - aasIdentifier: The Asset Administration Shell’s unique id
362
+ * - submodelIdentifier: The submodel's unique ID
363
+ * - level?: Determines the structural depth of the respective resource content
364
+ * - extent?: Determines to which extent the resource is being serialized
365
+ *
366
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
367
+ */
368
+ async getSubmodelByIdAasRepository(options) {
369
+ const { configuration, aasIdentifier, submodelIdentifier, level, extent } = options;
370
+ try {
371
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
372
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
373
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
374
+ const result = await apiInstance.getSubmodelByIdAasRepository({
375
+ aasIdentifier: encodedAasIdentifier,
376
+ submodelIdentifier: encodedSubmodelIdentifier,
377
+ level: level,
378
+ extent: extent,
379
+ });
380
+ return { success: true, data: convertApiSubmodelToCoreSubmodel(result) };
381
+ }
382
+ catch (err) {
383
+ const customError = await handleApiError(err);
384
+ return { success: false, error: customError };
385
+ }
386
+ }
387
+ /**
388
+ * Creates or updates the Submodel
389
+ *
390
+ * @param options Object containing:
391
+ * - configuration: The http request options
392
+ * - aasIdentifier: The Asset Administration Shell’s unique id
393
+ * - submodelIdentifier: The Submodel’s unique id
394
+ * - submodel: Submodel object
395
+ *
396
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
397
+ */
398
+ async putSubmodelByIdAasRepository(options) {
399
+ const { configuration, aasIdentifier, submodelIdentifier, submodel } = options;
400
+ try {
401
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
402
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
403
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
404
+ const result = await apiInstance.putSubmodelByIdAasRepository({
405
+ aasIdentifier: encodedAasIdentifier,
406
+ submodelIdentifier: encodedSubmodelIdentifier,
407
+ submodel: convertCoreSubmodelToApiSubmodel(submodel),
408
+ });
409
+ return { success: true, data: result ? convertApiReferenceToCoreReference(result) : undefined };
410
+ }
411
+ catch (err) {
412
+ const customError = await handleApiError(err);
413
+ return { success: false, error: customError };
414
+ }
415
+ }
416
+ /**
417
+ * Deletes the submodel from the Asset Administration Shell and the Repository.
418
+ *
419
+ * @param options Object containing:
420
+ * - configuration: The http request options
421
+ * - aasIdentifier: The Asset Administration Shell’s unique id
422
+ * - submodelIdentifier: The Submodel’s unique id
423
+ *
424
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
425
+ */
426
+ async deleteSubmodelByIdAasRepository(options) {
427
+ const { configuration, aasIdentifier, submodelIdentifier } = options;
428
+ try {
429
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
430
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
431
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
432
+ const result = await apiInstance.deleteSubmodelByIdAasRepository({
433
+ aasIdentifier: encodedAasIdentifier,
434
+ submodelIdentifier: encodedSubmodelIdentifier,
435
+ });
436
+ return { success: true, data: result };
437
+ }
438
+ catch (err) {
439
+ const customError = await handleApiError(err);
440
+ return { success: false, error: customError };
441
+ }
442
+ }
443
+ /**
444
+ * Updates the Submodel
445
+ *
446
+ * @param options Object containing:
447
+ * - configuration: The http request options
448
+ * - aasIdentifier: The Asset Administration Shell’s unique id
449
+ * - submodelIdentifier: The Submodel’s unique id
450
+ * - submodel: Submodel object
451
+ * - level?: Determines the structural depth of the respective resource content
452
+ *
453
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
454
+ */
455
+ async patchSubmodelAasRepository(options) {
456
+ const { configuration, aasIdentifier, submodelIdentifier, submodel, level } = options;
457
+ try {
458
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
459
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
460
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
461
+ const result = await apiInstance.patchSubmodelAasRepository({
462
+ aasIdentifier: encodedAasIdentifier,
463
+ submodelIdentifier: encodedSubmodelIdentifier,
464
+ submodel: convertCoreSubmodelToApiSubmodel(submodel),
465
+ level: level,
466
+ });
467
+ return { success: true, data: result };
468
+ }
469
+ catch (err) {
470
+ const customError = await handleApiError(err);
471
+ return { success: false, error: customError };
472
+ }
473
+ }
474
+ /**
475
+ * Returns the Submodel's metadata elements
476
+ *
477
+ * @param options Object containing:
478
+ * - configuration: The http request options
479
+ * - aasIdentifier: The Asset Administration Shell’s unique id
480
+ * - submodelIdentifier: The Submodel’s unique id
481
+ *
482
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
483
+ */
484
+ async getSubmodelByIdMetadataAasRepository(options) {
485
+ const { configuration, aasIdentifier, submodelIdentifier } = options;
486
+ try {
487
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
488
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
489
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
490
+ const result = await apiInstance.getSubmodelByIdMetadataAasRepository({
491
+ aasIdentifier: encodedAasIdentifier,
492
+ submodelIdentifier: encodedSubmodelIdentifier,
493
+ });
494
+ return { success: true, data: result };
495
+ }
496
+ catch (err) {
497
+ const customError = await handleApiError(err);
498
+ return { success: false, error: customError };
499
+ }
500
+ }
501
+ /**
502
+ * Updates the metadata attributes of the Submodel
503
+ *
504
+ * @param options Object containing:
505
+ * - configuration: The http request options
506
+ * - aasIdentifier: The Asset Administration Shell’s unique id
507
+ * - submodelIdentifier: The Submodel’s unique id
508
+ * - submodelMetadata: The Submodel Metadata object
509
+ *
510
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
511
+ */
512
+ async patchSubmodelByIdMetadataAasRepository(options) {
513
+ const { configuration, aasIdentifier, submodelIdentifier, submodelMetadata } = options;
514
+ try {
515
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
516
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
517
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
518
+ const result = await apiInstance.patchSubmodelByIdMetadataAasRepository({
519
+ aasIdentifier: encodedAasIdentifier,
520
+ submodelIdentifier: encodedSubmodelIdentifier,
521
+ submodelMetadata: submodelMetadata,
522
+ });
523
+ return { success: true, data: result };
524
+ }
525
+ catch (err) {
526
+ const customError = await handleApiError(err);
527
+ return { success: false, error: customError };
528
+ }
529
+ }
530
+ /**
531
+ * Returns the Submodel's ValueOnly representation
532
+ *
533
+ * @param options Object containing:
534
+ * - configuration: The http request options
535
+ * - aasIdentifier: The Asset Administration Shell’s unique id
536
+ * - submodelIdentifier: The Submodel’s unique id
537
+ * - level?: Determines the structural depth of the respective resource content
538
+ * - extent?: Determines to which extent the resource is being serialized
539
+ *
540
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
541
+ */
542
+ async getSubmodelByIdValueOnlyAasRepository(options) {
543
+ const { configuration, aasIdentifier, submodelIdentifier, level, extent } = options;
544
+ try {
545
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
546
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
547
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
548
+ const result = await apiInstance.getSubmodelByIdValueOnlyAasRepository({
549
+ aasIdentifier: encodedAasIdentifier,
550
+ submodelIdentifier: encodedSubmodelIdentifier,
551
+ level: level,
552
+ extent: extent,
553
+ });
554
+ return { success: true, data: result };
555
+ }
556
+ catch (err) {
557
+ const customError = await handleApiError(err);
558
+ return { success: false, error: customError };
559
+ }
560
+ }
561
+ /**
562
+ * Updates the values of the Submodel
563
+ *
564
+ * @param options Object containing:
565
+ * - configuration: The http request options
566
+ * - aasIdentifier: The Asset Administration Shell’s unique id
567
+ * - submodelIdentifier: The Submodel’s unique id
568
+ * - level?: Determines the structural depth of the respective resource content
569
+ *
570
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
571
+ */
572
+ async patchSubmodelByIdValueOnlyAasRepository(options) {
573
+ const { configuration, aasIdentifier, submodelIdentifier, body, level } = options;
574
+ try {
575
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
576
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
577
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
578
+ const result = await apiInstance.patchSubmodelByIdValueOnlyAasRepository({
579
+ aasIdentifier: encodedAasIdentifier,
580
+ submodelIdentifier: encodedSubmodelIdentifier,
581
+ body: body,
582
+ level: level,
583
+ });
584
+ return { success: true, data: result };
585
+ }
586
+ catch (err) {
587
+ const customError = await handleApiError(err);
588
+ return { success: false, error: customError };
589
+ }
590
+ }
591
+ /**
592
+ * Returns the Submodel as a Reference
593
+ *
594
+ * @param options Object containing:
595
+ * - configuration: The http request options
596
+ * - aasIdentifier: The Asset Administration Shell’s unique id
597
+ * - submodelIdentifier: The submodel's unique ID
598
+ *
599
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
600
+ */
601
+ async getSubmodelByIdReferenceAasRepository(options) {
602
+ const { configuration, aasIdentifier, submodelIdentifier } = options;
603
+ try {
604
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
605
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
606
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
607
+ const result = await apiInstance.getSubmodelByIdReferenceAasRepository({
608
+ aasIdentifier: encodedAasIdentifier,
609
+ submodelIdentifier: encodedSubmodelIdentifier,
610
+ });
611
+ return { success: true, data: convertApiReferenceToCoreReference(result) };
612
+ }
613
+ catch (err) {
614
+ const customError = await handleApiError(err);
615
+ return { success: false, error: customError };
616
+ }
617
+ }
618
+ /**
619
+ * Returns the elements of this submodel in path notation.
620
+ *
621
+ * @param options Object containing:
622
+ * - configuration: The http request options
623
+ * - aasIdentifier: The Asset Administration Shell’s unique id
624
+ * - submodelIdentifier: The submodel's unique ID
625
+ * - level?: Determines the structural depth of the respective resource content
626
+ *
627
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
628
+ */
629
+ async getSubmodelByIdPathAasRepository(options) {
630
+ const { configuration, aasIdentifier, submodelIdentifier, level } = options;
631
+ try {
632
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
633
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
634
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
635
+ const result = await apiInstance.getSubmodelByIdPathAasRepository({
636
+ aasIdentifier: encodedAasIdentifier,
637
+ submodelIdentifier: encodedSubmodelIdentifier,
638
+ level: level,
639
+ });
640
+ return { success: true, data: result };
641
+ }
642
+ catch (err) {
643
+ const customError = await handleApiError(err);
644
+ return { success: false, error: customError };
645
+ }
646
+ }
647
+ /**
648
+ * Returns all submodel elements including their hierarchy
649
+ *
650
+ * @param options Object containing:
651
+ * - configuration: The http request options
652
+ * - aasIdentifier: The Asset Administration Shell’s unique id
653
+ * - submodelIdentifier: The Submodel’s unique id
654
+ * - limit?: The maximum number of elements in the response array
655
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
656
+ * - level?: Determines the structural depth of the respective resource content
657
+ * - extent?: Determines to which extent the resource is being serialized
658
+ *
659
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
660
+ */
661
+ async getAllSubmodelElementsAasRepository(options) {
662
+ const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, extent } = options;
663
+ try {
664
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
665
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
666
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
667
+ const result = await apiInstance.getAllSubmodelElementsAasRepository({
668
+ aasIdentifier: encodedAasIdentifier,
669
+ submodelIdentifier: encodedSubmodelIdentifier,
670
+ limit: limit,
671
+ cursor: cursor,
672
+ level: level,
673
+ extent: extent,
674
+ });
675
+ const submodelElements = (result.result ?? []).map(convertApiSubmodelElementToCoreSubmodelElement);
676
+ return {
677
+ success: true,
678
+ data: { pagedResult: result.pagingMetadata, result: submodelElements },
679
+ };
680
+ }
681
+ catch (err) {
682
+ const customError = await handleApiError(err);
683
+ return { success: false, error: customError };
684
+ }
685
+ }
686
+ /**
687
+ * Creates a new submodel element
688
+ *
689
+ * @param options Object containing:
690
+ * - configuration: The http request options
691
+ * - aasIdentifier: The Asset Administration Shell’s unique id
692
+ * - submodelIdentifier: The Submodel’s unique id
693
+ * - submodelElement: The Submodel Element object
694
+ *
695
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
696
+ */
697
+ async postSubmodelElementAasRepository(options) {
698
+ const { configuration, aasIdentifier, submodelIdentifier, submodelElement } = options;
699
+ try {
700
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
701
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
702
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
703
+ const result = await apiInstance.postSubmodelElementAasRepository({
704
+ aasIdentifier: encodedAasIdentifier,
705
+ submodelIdentifier: encodedSubmodelIdentifier,
706
+ submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
707
+ });
708
+ return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
709
+ }
710
+ catch (err) {
711
+ const customError = await handleApiError(err);
712
+ return { success: false, error: customError };
713
+ }
714
+ }
715
+ /**
716
+ * Returns all submodel elements including their hierarchy
717
+ *
718
+ * @param options Object containing:
719
+ * - configuration: The http request options
720
+ * - aasIdentifier: The Asset Administration Shell’s unique id
721
+ * - submodelIdentifier: The Submodel’s unique id
722
+ * - limit?: The maximum number of elements in the response array
723
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
724
+ *
725
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
726
+ */
727
+ async getAllSubmodelElementsMetadataAasRepository(options) {
728
+ const { configuration, aasIdentifier, submodelIdentifier, limit, cursor } = options;
729
+ try {
730
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
731
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
732
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
733
+ const result = await apiInstance.getAllSubmodelElementsMetadataAasRepository({
734
+ aasIdentifier: encodedAasIdentifier,
735
+ submodelIdentifier: encodedSubmodelIdentifier,
736
+ limit: limit,
737
+ cursor: cursor,
738
+ });
739
+ //const submodelElements = (result.result ?? []).map(convertApiSubmodelElementToCoreSubmodelElement);
740
+ const submodelElementsMetadata = result.result ?? [];
741
+ return {
742
+ success: true,
743
+ data: { pagedResult: result.pagingMetadata, result: submodelElementsMetadata },
744
+ };
745
+ }
746
+ catch (err) {
747
+ const customError = await handleApiError(err);
748
+ return { success: false, error: customError };
749
+ }
750
+ }
751
+ /**
752
+ * Returns all submodel elements including their hierarchy in the ValueOnly representation
753
+ *
754
+ * @param options Object containing:
755
+ * - configuration: The http request options
756
+ * - aasIdentifier: The Asset Administration Shell’s unique id
757
+ * - submodelIdentifier: The Submodel’s unique id
758
+ * - limit?: The maximum number of elements in the response array
759
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
760
+ * - level?: Determines the structural depth of the respective resource content
761
+ *
762
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
763
+ */
764
+ async getAllSubmodelElementsValueOnlyAasRepository(options) {
765
+ const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level } = options;
766
+ try {
767
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
768
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
769
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
770
+ const result = await apiInstance.getAllSubmodelElementsValueOnlyAasRepository({
771
+ aasIdentifier: encodedAasIdentifier,
772
+ submodelIdentifier: encodedSubmodelIdentifier,
773
+ limit: limit,
774
+ cursor: cursor,
775
+ level: level,
776
+ });
777
+ //const submodelElementsValue = (result.result ?? []).map(convertApiSubmodelElementToCoreSubmodelElement);
778
+ const submodelElementValues = result.result ?? [];
779
+ return {
780
+ success: true,
781
+ data: { pagedResult: result.pagingMetadata, result: submodelElementValues },
782
+ };
783
+ }
784
+ catch (err) {
785
+ const customError = await handleApiError(err);
786
+ return { success: false, error: customError };
787
+ }
788
+ }
789
+ /**
790
+ * Returns all submodel elements as a list of References
791
+ *
792
+ * @param options Object containing:
793
+ * - configuration: The http request options
794
+ * - aasIdentifier: The Asset Administration Shell’s unique id
795
+ * - submodelIdentifier: The Submodel’s unique id
796
+ * - limit?: The maximum number of elements in the response array
797
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
798
+ * - level?: Determines the structural depth of the respective resource content
799
+ *
800
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
801
+ */
802
+ async getAllSubmodelElementsReferenceAasRepository(options) {
803
+ const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level } = options;
804
+ try {
805
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
806
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
807
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
808
+ const result = await apiInstance.getAllSubmodelElementsReferenceAasRepository({
809
+ aasIdentifier: encodedAasIdentifier,
810
+ submodelIdentifier: encodedSubmodelIdentifier,
811
+ limit: limit,
812
+ cursor: cursor,
813
+ level: level,
814
+ });
815
+ const submodelElementReferences = (result.result ?? []).map(convertApiReferenceToCoreReference);
816
+ return {
817
+ success: true,
818
+ data: { pagedResult: result.pagingMetadata, result: submodelElementReferences },
819
+ };
820
+ }
821
+ catch (err) {
822
+ const customError = await handleApiError(err);
823
+ return { success: false, error: customError };
824
+ }
825
+ }
826
+ /**
827
+ * Returns all submodel elements including their hierarchy
828
+ *
829
+ * @param options Object containing:
830
+ * - configuration: The http request options
831
+ * - aasIdentifier: The Asset Administration Shell’s unique id
832
+ * - submodelIdentifier: The Submodel’s unique id
833
+ * - limit?: The maximum number of elements in the response array
834
+ * - cursor?: A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
835
+ * - level?: Determines the structural depth of the respective resource content
836
+ * - extent?: Determines to which extent the resource is being serialized
837
+ *
838
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
839
+ */
840
+ async getAllSubmodelElementsPathAasRepository(options) {
841
+ const { configuration, aasIdentifier, submodelIdentifier, limit, cursor, level, extent } = options;
842
+ try {
843
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
844
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
845
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
846
+ const result = await apiInstance.getAllSubmodelElementsPathAasRepository({
847
+ aasIdentifier: encodedAasIdentifier,
848
+ submodelIdentifier: encodedSubmodelIdentifier,
849
+ limit: limit,
850
+ cursor: cursor,
851
+ level: level,
852
+ extent: extent,
853
+ });
854
+ //const submodelElements = (result.result ?? []).map(convertApiSubmodelElementToCoreSubmodelElement);
855
+ const submodelElements = result.result ?? [];
856
+ return {
857
+ success: true,
858
+ data: { pagedResult: result.pagingMetadata, result: submodelElements },
859
+ };
860
+ }
861
+ catch (err) {
862
+ const customError = await handleApiError(err);
863
+ return { success: false, error: customError };
864
+ }
865
+ }
866
+ /**
867
+ * Returns a specific submodel element from the Submodel at a specified path
868
+ *
869
+ * @param options Object containing:
870
+ * - configuration: The http request options
871
+ * - aasIdentifier: The Asset Administration Shell’s unique id
872
+ * - submodelIdentifier: The Submodel’s unique id
873
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
874
+ * - level?: Determines the structural depth of the respective resource content
875
+ * - extent?: Determines to which extent the resource is being serialized
876
+ *
877
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
878
+ */
879
+ async getSubmodelElementByPathAasRepository(options) {
880
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, extent } = options;
881
+ try {
882
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
883
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
884
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
885
+ const result = await apiInstance.getSubmodelElementByPathAasRepository({
886
+ aasIdentifier: encodedAasIdentifier,
887
+ submodelIdentifier: encodedSubmodelIdentifier,
888
+ idShortPath: idShortPath,
889
+ level: level,
890
+ extent: extent,
891
+ });
892
+ return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
893
+ }
894
+ catch (err) {
895
+ const customError = await handleApiError(err);
896
+ return { success: false, error: customError };
897
+ }
898
+ }
899
+ /**
900
+ * Creates a new submodel element at a specified path within submodel elements hierarchy
901
+ *
902
+ * @param options Object containing:
903
+ * - configuration: The http request options.
904
+ * - aasIdentifier: The Asset Administration Shell’s unique id
905
+ * - submodelIdentifier: The Submodel’s unique id
906
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
907
+ * - submodelElement: SubmodelElement object
908
+ *
909
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
910
+ */
911
+ async postSubmodelElementByPathAasRepository(options) {
912
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement } = options;
913
+ try {
914
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
915
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
916
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
917
+ const result = await apiInstance.postSubmodelElementByPathAasRepository({
918
+ aasIdentifier: encodedAasIdentifier,
919
+ submodelIdentifier: encodedSubmodelIdentifier,
920
+ idShortPath: idShortPath,
921
+ submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
922
+ });
923
+ console.log('created element at specified path:', result);
924
+ return { success: true, data: convertApiSubmodelElementToCoreSubmodelElement(result) };
925
+ }
926
+ catch (err) {
927
+ const customError = await handleApiError(err);
928
+ return { success: false, error: customError };
929
+ }
930
+ }
931
+ /**
932
+ * Deletes a submodel element at a specified path within the submodel elements hierarchy
933
+ *
934
+ * @param options Object containing:
935
+ * - configuration: The http request options.
936
+ * - aasIdentifier: The Asset Administration Shell’s unique id
937
+ * - submodelIdentifier: The Submodel’s unique id
938
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
939
+ *
940
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
941
+ */
942
+ async deleteSubmodelElementByPathAasRepository(options) {
943
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
944
+ try {
945
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
946
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
947
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
948
+ const result = await apiInstance.deleteSubmodelElementByPathAasRepository({
949
+ aasIdentifier: encodedAasIdentifier,
950
+ submodelIdentifier: encodedSubmodelIdentifier,
951
+ idShortPath: idShortPath,
952
+ });
953
+ return { success: true, data: result };
954
+ }
955
+ catch (err) {
956
+ const customError = await handleApiError(err);
957
+ return { success: false, error: customError };
958
+ }
959
+ }
960
+ /**
961
+ * Updates an existing submodel element at a specified path within submodel elements hierarchy
962
+ *
963
+ * @param options Object containing:
964
+ * - configuration: The http request options
965
+ * - aasIdentifier: The Asset Administration Shell’s unique id
966
+ * - submodelIdentifier: The Submodel’s unique id
967
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
968
+ * - submodelElement: SubmodelElement object
969
+ *
970
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
971
+ */
972
+ async putSubmodelElementByPathAasRepository(options) {
973
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement } = options;
974
+ try {
975
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
976
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
977
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
978
+ const result = await apiInstance.putSubmodelElementByPathAasRepository({
979
+ aasIdentifier: encodedAasIdentifier,
980
+ submodelIdentifier: encodedSubmodelIdentifier,
981
+ idShortPath: idShortPath,
982
+ submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
983
+ });
984
+ return { success: true, data: result ? convertApiSubmodelElementToCoreSubmodelElement(result) : undefined };
985
+ }
986
+ catch (err) {
987
+ const customError = await handleApiError(err);
988
+ return { success: false, error: customError };
989
+ }
990
+ }
991
+ /**
992
+ * Updates an existing submodel element value at a specified path within submodel elements hierarchy
993
+ *
994
+ * @param options Object containing:
995
+ * - configuration: The http request options
996
+ * - aasIdentifier: The Asset Administration Shell’s unique id
997
+ * - submodelIdentifier: The Submodel’s unique id
998
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
999
+ * - submodelElement: SubmodelElement object
1000
+ * - level?: Determines the structural depth of the respective resource content
1001
+ *
1002
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1003
+ */
1004
+ async patchSubmodelElementValueByPathAasRepository(options) {
1005
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElement, level } = options;
1006
+ try {
1007
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1008
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1009
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1010
+ const result = await apiInstance.patchSubmodelElementValueByPathAasRepository({
1011
+ aasIdentifier: encodedAasIdentifier,
1012
+ submodelIdentifier: encodedSubmodelIdentifier,
1013
+ idShortPath: idShortPath,
1014
+ submodelElement: convertCoreSubmodelElementToApiSubmodelElement(submodelElement),
1015
+ level: level,
1016
+ });
1017
+ return { success: true, data: result };
1018
+ }
1019
+ catch (err) {
1020
+ const customError = await handleApiError(err);
1021
+ return { success: false, error: customError };
1022
+ }
1023
+ }
1024
+ /**
1025
+ * Returns the metadata attributes of a specific submodel element from the Submodel at a specified path
1026
+ *
1027
+ * @param options Object containing:
1028
+ * - configuration: The http request options
1029
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1030
+ * - submodelIdentifier: The Submodel’s unique id
1031
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1032
+ *
1033
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1034
+ */
1035
+ async getSubmodelElementByPathMetadataAasRepository(options) {
1036
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
1037
+ try {
1038
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1039
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1040
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1041
+ const result = await apiInstance.getSubmodelElementByPathMetadataAasRepository({
1042
+ aasIdentifier: encodedAasIdentifier,
1043
+ submodelIdentifier: encodedSubmodelIdentifier,
1044
+ idShortPath: idShortPath,
1045
+ });
1046
+ return { success: true, data: result };
1047
+ }
1048
+ catch (err) {
1049
+ const customError = await handleApiError(err);
1050
+ return { success: false, error: customError };
1051
+ }
1052
+ }
1053
+ /**
1054
+ * Updates the metadata attributes of an existing submodel element value at a specified path within submodel elements hierarchy
1055
+ *
1056
+ * @param options Object containing:
1057
+ * - configuration: The http request options
1058
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1059
+ * - submodelIdentifier: The Submodel’s unique id
1060
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1061
+ * - submodelElementMetadata: The Submodel Element Metadata object
1062
+ *
1063
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1064
+ */
1065
+ async patchSubmodelElementValueByPathMetadata(options) {
1066
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElementMetadata } = options;
1067
+ try {
1068
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1069
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1070
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1071
+ const result = await apiInstance.patchSubmodelElementValueByPathMetadata({
1072
+ aasIdentifier: encodedAasIdentifier,
1073
+ submodelIdentifier: encodedSubmodelIdentifier,
1074
+ idShortPath: idShortPath,
1075
+ submodelElementMetadata: submodelElementMetadata,
1076
+ });
1077
+ return { success: true, data: result };
1078
+ }
1079
+ catch (err) {
1080
+ const customError = await handleApiError(err);
1081
+ return { success: false, error: customError };
1082
+ }
1083
+ }
1084
+ /**
1085
+ * Returns a specific submodel element from the Submodel at a specified path in the ValueOnly representation
1086
+ *
1087
+ * @param options Object containing:
1088
+ * - configuration: The http request options
1089
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1090
+ * - submodelIdentifier: The Submodel’s unique id
1091
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1092
+ * - level?: Determines the structural depth of the respective resource content
1093
+ * - extent?: Determines to which extent the resource is being serialized
1094
+ *
1095
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1096
+ */
1097
+ async getSubmodelElementByPathValueOnlyAasRepository(options) {
1098
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level, extent } = options;
1099
+ try {
1100
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1101
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1102
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1103
+ const result = await apiInstance.getSubmodelElementByPathValueOnlyAasRepository({
1104
+ aasIdentifier: encodedAasIdentifier,
1105
+ submodelIdentifier: encodedSubmodelIdentifier,
1106
+ idShortPath: idShortPath,
1107
+ level: level,
1108
+ extent: extent,
1109
+ });
1110
+ return { success: true, data: result };
1111
+ }
1112
+ catch (err) {
1113
+ const customError = await handleApiError(err);
1114
+ return { success: false, error: customError };
1115
+ }
1116
+ }
1117
+ /**
1118
+ * Updates the value of an existing submodel element value at a specified path within submodel elements hierarchy
1119
+ *
1120
+ * @param options Object containing:
1121
+ * - configuration: The http request options
1122
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1123
+ * - submodelIdentifier: The Submodel’s unique id
1124
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1125
+ * - SubmodelElementValue: SubmodelElementValue object
1126
+ * - level?: Determines the structural depth of the respective resource content
1127
+ *
1128
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1129
+ */
1130
+ async patchSubmodelElementValueByPathValueOnly(options) {
1131
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, submodelElementValue, level } = options;
1132
+ try {
1133
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1134
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1135
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1136
+ const result = await apiInstance.patchSubmodelElementValueByPathValueOnly({
1137
+ aasIdentifier: encodedAasIdentifier,
1138
+ submodelIdentifier: encodedSubmodelIdentifier,
1139
+ idShortPath: idShortPath,
1140
+ submodelElementValue: submodelElementValue,
1141
+ level: level,
1142
+ });
1143
+ return { success: true, data: result };
1144
+ }
1145
+ catch (err) {
1146
+ const customError = await handleApiError(err);
1147
+ return { success: false, error: customError };
1148
+ }
1149
+ }
1150
+ /**
1151
+ * Returns the Reference of a specific submodel element from the Submodel at a specified path
1152
+ *
1153
+ * @param options Object containing:
1154
+ * - configuration: The http request options
1155
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1156
+ * - submodelIdentifier: The Submodel’s unique id
1157
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1158
+ * - level?: Determines the structural depth of the respective resource content
1159
+ *
1160
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1161
+ */
1162
+ async getSubmodelElementByPathReferenceAasRepository(options) {
1163
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level } = options;
1164
+ try {
1165
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1166
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1167
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1168
+ const result = await apiInstance.getSubmodelElementByPathReferenceAasRepository({
1169
+ aasIdentifier: encodedAasIdentifier,
1170
+ submodelIdentifier: encodedSubmodelIdentifier,
1171
+ idShortPath: idShortPath,
1172
+ level: level,
1173
+ });
1174
+ return { success: true, data: convertApiReferenceToCoreReference(result) };
1175
+ }
1176
+ catch (err) {
1177
+ const customError = await handleApiError(err);
1178
+ return { success: false, error: customError };
1179
+ }
1180
+ }
1181
+ /**
1182
+ * Returns a specific submodel element from the Submodel at a specified path in the Path notation
1183
+ *
1184
+ * @param options Object containing:
1185
+ * - configuration: The http request options
1186
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1187
+ * - submodelIdentifier: The Submodel’s unique id
1188
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1189
+ * - level?: Determines the structural depth of the respective resource content
1190
+ *
1191
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1192
+ */
1193
+ async getSubmodelElementByPathPathAasRepository(options) {
1194
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, level } = options;
1195
+ try {
1196
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1197
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1198
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1199
+ const result = await apiInstance.getSubmodelElementByPathPathAasRepository({
1200
+ aasIdentifier: encodedAasIdentifier,
1201
+ submodelIdentifier: encodedSubmodelIdentifier,
1202
+ idShortPath: idShortPath,
1203
+ level: level,
1204
+ });
1205
+ return { success: true, data: result };
1206
+ }
1207
+ catch (err) {
1208
+ const customError = await handleApiError(err);
1209
+ return { success: false, error: customError };
1210
+ }
1211
+ }
1212
+ /**
1213
+ * Downloads file content from a specific submodel element from the Submodel at a specified path
1214
+ *
1215
+ * @param options Object containing:
1216
+ * - configuration: The http request options
1217
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1218
+ * - submodelIdentifier: The Submodel’s unique id
1219
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1220
+ *
1221
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1222
+ */
1223
+ async getFileByPathAasRepository(options) {
1224
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
1225
+ try {
1226
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1227
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1228
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1229
+ const result = await apiInstance.getFileByPathAasRepository({
1230
+ aasIdentifier: encodedAasIdentifier,
1231
+ submodelIdentifier: encodedSubmodelIdentifier,
1232
+ idShortPath: idShortPath,
1233
+ });
1234
+ return { success: true, data: result };
1235
+ }
1236
+ catch (err) {
1237
+ const customError = await handleApiError(err);
1238
+ return { success: false, error: customError };
1239
+ }
1240
+ }
1241
+ /**
1242
+ * Uploads file content to an existing submodel element at a specified path within submodel elements hierarchy
1243
+ *
1244
+ * @param options Object containing:
1245
+ * - configuration: The http request options
1246
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1247
+ * - submodelIdentifier: The Submodel’s unique id
1248
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1249
+ * - fileName: The name of the file
1250
+ * - file: The file to upload
1251
+ *
1252
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1253
+ */
1254
+ async putFileByPathAasRepository(options) {
1255
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, fileName, file } = options;
1256
+ try {
1257
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1258
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1259
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1260
+ const result = await apiInstance.putFileByPathAasRepository({
1261
+ aasIdentifier: encodedAasIdentifier,
1262
+ submodelIdentifier: encodedSubmodelIdentifier,
1263
+ idShortPath: idShortPath,
1264
+ fileName: fileName,
1265
+ file: file,
1266
+ });
1267
+ return { success: true, data: result };
1268
+ }
1269
+ catch (err) {
1270
+ const customError = await handleApiError(err);
1271
+ return { success: false, error: customError };
1272
+ }
1273
+ }
1274
+ /**
1275
+ * Deletes file content of an existing submodel element at a specified path within submodel elements hierarchy
1276
+ *
1277
+ * @param options Object containing:
1278
+ * - configuration: The http request options.
1279
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1280
+ * - submodelIdentifier: The Submodel’s unique id
1281
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1282
+ *
1283
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1284
+ */
1285
+ async deleteFileByPathAasRepository(options) {
1286
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath } = options;
1287
+ try {
1288
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1289
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1290
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1291
+ const result = await apiInstance.deleteFileByPathAasRepository({
1292
+ aasIdentifier: encodedAasIdentifier,
1293
+ submodelIdentifier: encodedSubmodelIdentifier,
1294
+ idShortPath: idShortPath,
1295
+ });
1296
+ return { success: true, data: result };
1297
+ }
1298
+ catch (err) {
1299
+ const customError = await handleApiError(err);
1300
+ return { success: false, error: customError };
1301
+ }
1302
+ }
1303
+ /**
1304
+ * Synchronously invokes an Operation at a specified path
1305
+ *
1306
+ * @param options Object containing:
1307
+ * - configuration: The http request options.
1308
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1309
+ * - submodelIdentifier: The Submodel’s unique id
1310
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1311
+ * - operationRequest: Operation request object
1312
+ *
1313
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1314
+ */
1315
+ async invokeOperationAasRepository(options) {
1316
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest } = options;
1317
+ try {
1318
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1319
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1320
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1321
+ const result = await apiInstance.invokeOperationAasRepository({
1322
+ aasIdentifier: encodedAasIdentifier,
1323
+ submodelIdentifier: encodedSubmodelIdentifier,
1324
+ idShortPath: idShortPath,
1325
+ operationRequest: operationRequest,
1326
+ });
1327
+ return { success: true, data: result };
1328
+ }
1329
+ catch (err) {
1330
+ const customError = await handleApiError(err);
1331
+ return { success: false, error: customError };
1332
+ }
1333
+ }
1334
+ /**
1335
+ * Synchronously invokes an Operation at a specified path
1336
+ *
1337
+ * @param options Object containing:
1338
+ * - configuration: The http request options.
1339
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1340
+ * - submodelIdentifier: The Submodel’s unique id
1341
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1342
+ * - operationRequestValueOnly: OperationRequestValueOnly object
1343
+ *
1344
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1345
+ */
1346
+ async invokeOperationValueOnlyAasRepository(options) {
1347
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
1348
+ try {
1349
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1350
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1351
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1352
+ const result = await apiInstance.invokeOperationValueOnlyAasRepository({
1353
+ aasIdentifier: encodedAasIdentifier,
1354
+ submodelIdentifier: encodedSubmodelIdentifier,
1355
+ idShortPath: idShortPath,
1356
+ operationRequestValueOnly: operationRequestValueOnly,
1357
+ });
1358
+ return { success: true, data: result };
1359
+ }
1360
+ catch (err) {
1361
+ const customError = await handleApiError(err);
1362
+ return { success: false, error: customError };
1363
+ }
1364
+ }
1365
+ /**
1366
+ * Asynchronously invokes an Operation at a specified path
1367
+ *
1368
+ * @param options Object containing:
1369
+ * - configuration: The http request options.
1370
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1371
+ * - submodelIdentifier: The Submodel’s unique id
1372
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1373
+ * - operationRequest: OperationRequest object
1374
+ *
1375
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1376
+ */
1377
+ async invokeOperationAsyncAasRepository(options) {
1378
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequest } = options;
1379
+ try {
1380
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1381
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1382
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1383
+ const result = await apiInstance.invokeOperationAsyncAasRepository({
1384
+ aasIdentifier: encodedAasIdentifier,
1385
+ submodelIdentifier: encodedSubmodelIdentifier,
1386
+ idShortPath: idShortPath,
1387
+ operationRequest: operationRequest,
1388
+ });
1389
+ return { success: true, data: result };
1390
+ }
1391
+ catch (err) {
1392
+ const customError = await handleApiError(err);
1393
+ return { success: false, error: customError };
1394
+ }
1395
+ }
1396
+ /**
1397
+ * Asynchronously invokes an Operation at a specified path
1398
+ *
1399
+ * @param options Object containing:
1400
+ * - configuration: The http request options.
1401
+ * - aasIdentifier: The Asset Administration Shell’s unique id (UTF8-BASE64-URL-encoded)
1402
+ * - submodelIdentifier: The Submodel’s unique id
1403
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1404
+ * - operationRequestValueOnly: Operation request object
1405
+ *
1406
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1407
+ */
1408
+ async invokeOperationAsyncValueOnlyAasRepository(options) {
1409
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, operationRequestValueOnly } = options;
1410
+ try {
1411
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1412
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1413
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1414
+ const result = await apiInstance.invokeOperationAsyncValueOnlyAasRepository({
1415
+ aasIdentifier: encodedAasIdentifier,
1416
+ submodelIdentifier: encodedSubmodelIdentifier,
1417
+ idShortPath: idShortPath,
1418
+ operationRequestValueOnly: operationRequestValueOnly,
1419
+ });
1420
+ return { success: true, data: result };
1421
+ }
1422
+ catch (err) {
1423
+ const customError = await handleApiError(err);
1424
+ return { success: false, error: customError };
1425
+ }
1426
+ }
1427
+ /**
1428
+ * Returns the Operation status of an asynchronous invoked Operation
1429
+ *
1430
+ * @param options Object containing:
1431
+ * - configuration: The http request options
1432
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1433
+ * - submodelIdentifier: The Submodel’s unique id
1434
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1435
+ * - handleId: The returned handle id of an operation’s asynchronous invocation used to request the current state of the operation’s execution (UTF8-BASE64-URL-encoded)
1436
+ *
1437
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1438
+ */
1439
+ async getOperationAsyncStatusAasRepository(options) {
1440
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, handleId } = options;
1441
+ try {
1442
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1443
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1444
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1445
+ const encodedHandleId = base64Encode(handleId);
1446
+ const result = await apiInstance.getOperationAsyncStatusAasRepository({
1447
+ aasIdentifier: encodedAasIdentifier,
1448
+ submodelIdentifier: encodedSubmodelIdentifier,
1449
+ idShortPath: idShortPath,
1450
+ handleId: encodedHandleId,
1451
+ });
1452
+ return { success: true, data: result };
1453
+ }
1454
+ catch (err) {
1455
+ const customError = await handleApiError(err);
1456
+ return { success: false, error: customError };
1457
+ }
1458
+ }
1459
+ /**
1460
+ * Returns the Operation result of an asynchronous invoked Operation
1461
+ *
1462
+ * @param options Object containing:
1463
+ * - configuration: The http request options
1464
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1465
+ * - submodelIdentifier: The Submodel’s unique id
1466
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1467
+ * - handleId: The returned handle id of an operation’s asynchronous invocation used to request the current state of the operation’s execution (UTF8-BASE64-URL-encoded)
1468
+ *
1469
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1470
+ */
1471
+ async getOperationAsyncResultAasRepository(options) {
1472
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, handleId } = options;
1473
+ try {
1474
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1475
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1476
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1477
+ const encodedHandleId = base64Encode(handleId);
1478
+ const result = await apiInstance.getOperationAsyncResultAasRepository({
1479
+ aasIdentifier: encodedAasIdentifier,
1480
+ submodelIdentifier: encodedSubmodelIdentifier,
1481
+ idShortPath: idShortPath,
1482
+ handleId: encodedHandleId,
1483
+ });
1484
+ return { success: true, data: result };
1485
+ }
1486
+ catch (err) {
1487
+ const customError = await handleApiError(err);
1488
+ return { success: false, error: customError };
1489
+ }
1490
+ }
1491
+ /**
1492
+ * Returns the ValueOnly notation of the Operation result of an asynchronous invoked Operation
1493
+ *
1494
+ * @param options Object containing:
1495
+ * - configuration: The http request options
1496
+ * - aasIdentifier: The Asset Administration Shell’s unique id
1497
+ * - submodelIdentifier: The Submodel’s unique id
1498
+ * - idShortPath: IdShort path to the submodel element (dot-separated)
1499
+ * - handleId: The returned handle id of an operation’s asynchronous invocation used to request the current state of the operation’s execution (UTF8-BASE64-URL-encoded)
1500
+ *
1501
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
1502
+ */
1503
+ async getOperationAsyncResultValueOnlyAasRepository(options) {
1504
+ const { configuration, aasIdentifier, submodelIdentifier, idShortPath, handleId } = options;
1505
+ try {
1506
+ const apiInstance = new AasRepositoryService.AssetAdministrationShellRepositoryAPIApi(applyDefaults(configuration));
1507
+ const encodedAasIdentifier = base64Encode(aasIdentifier);
1508
+ const encodedSubmodelIdentifier = base64Encode(submodelIdentifier);
1509
+ const encodedHandleId = base64Encode(handleId);
1510
+ const result = await apiInstance.getOperationAsyncResultValueOnlyAasRepository({
1511
+ aasIdentifier: encodedAasIdentifier,
1512
+ submodelIdentifier: encodedSubmodelIdentifier,
1513
+ idShortPath: idShortPath,
1514
+ handleId: encodedHandleId,
401
1515
  });
402
- if (error) {
403
- return { success: false, error };
404
- }
405
- return { success: true, data };
1516
+ return { success: true, data: result };
406
1517
  }
407
1518
  catch (err) {
408
- return { success: false, error: err instanceof Error ? err : new Error(String(err)) };
1519
+ const customError = await handleApiError(err);
1520
+ return { success: false, error: customError };
409
1521
  }
410
1522
  }
411
1523
  }