basyx-typescript-sdk 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,157 +1,227 @@
1
1
  import type { AssetAdministrationShell, AssetInformation, Reference } from '@aas-core-works/aas-core3.0-typescript/types';
2
- import { AasIdentifierOptions, DeleteSubmodelReferenceByIdOptions, GetAllAssetAdministrationShellsOptions, GetAllAssetAdministrationShellsResponse, GetAllSubmodelReferencesOptions, GetAllSubmodelReferencesResponse, PostAssetAdministrationShellOptions, PostSubmodelReferenceOptions, PutAssetAdministrationShellOptions, PutAssetInformationOptions, PutThumbnailOptions } from '../models/aas-repository';
2
+ import type { ApiResult } from '../models/api';
3
+ import type { AssetId } from '../models/AssetId';
4
+ import * as AasRepository from '../generated';
3
5
  export declare class AasRepositoryClient {
4
6
  /**
5
- * Returns all Asset Administration Shells
6
- *
7
- * @function getAllAssetAdministrationShells
8
- * @param {GetAllAssetAdministrationShellsOptions} options - Options object.
9
- * @param {string} options.baseUrl - The API base URL
10
- * @param {Headers} [options.headers] - Request headers
11
- * @param {string[]} [options.assetIds] - A list of specific Asset identifiers. Every single value asset identifier is a base64-url-encoded
12
- * @param {string} [options.idShort] - The Asset Administration Shell's IdShort
13
- * @param {number} [options.limit] - The maximum number of elements in the response array
14
- * @param {string} [options.cursor] - A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
15
- * @returns {Promise<GetAllAssetAdministrationShellsResponse>} Requested Asset Administration Shells
7
+ * Returns all Asset Administration Shells.
8
+ *
9
+ * @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
16
+ *
17
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
16
18
  */
17
- getAllAssetAdministrationShells({ baseUrl, headers, assetIds, idShort, limit, cursor, }: GetAllAssetAdministrationShellsOptions): Promise<GetAllAssetAdministrationShellsResponse>;
19
+ getAllAssetAdministrationShells(options: {
20
+ baseUrl: string;
21
+ headers?: Headers;
22
+ assetIds?: AssetId[];
23
+ idShort?: string;
24
+ limit?: number;
25
+ cursor?: string;
26
+ }): Promise<ApiResult<{
27
+ pagedResult: AasRepository.PagedResultPagingMetadata | undefined;
28
+ result: AssetAdministrationShell[];
29
+ }, AasRepository.GetAllAssetAdministrationShellsError | Error>>;
18
30
  /**
19
- * Creates a new Asset Administration Shell
20
- *
21
- * @function postAssetAdministrationShell
22
- * @param {PostAssetAdministrationShellOptions} options - Options object.
23
- * @param {string} options.baseUrl - The API base URL
24
- * @param {AssetAdministrationShell} options.assetAdministrationShell - Asset Administration Shell object
25
- * @param {Headers} [options.headers] - Request headers
26
- * @returns {Promise<AssetAdministrationShell>} Asset Administration Shell created successfully
31
+ * Creates a new Asset Administration Shell.
32
+ *
33
+ * @param options Object containing:
34
+ * - baseUrl: The API base URL
35
+ * - assetAdministrationShell: The AAS to create
36
+ * - headers?: Optional request headers
37
+ *
38
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
27
39
  */
28
- postAssetAdministrationShell({ baseUrl, assetAdministrationShell, headers, }: PostAssetAdministrationShellOptions): Promise<AssetAdministrationShell>;
40
+ postAssetAdministrationShell(options: {
41
+ baseUrl: string;
42
+ headers?: Headers;
43
+ assetAdministrationShell: AssetAdministrationShell;
44
+ }): Promise<ApiResult<AssetAdministrationShell, AasRepository.PostAssetAdministrationShellError | Error>>;
29
45
  /**
30
- * Deletes an Asset Administration Shell
31
- *
32
- * @function deleteAssetAdministrationShellById
33
- * @param {AasIdentifierOptions} options - Options object.
34
- * @param {string} options.baseUrl - The API base URL
35
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
36
- * @param {Headers} [options.headers] - Request headers
37
- * @returns {Promise<void>} Asset Administration Shell deleted successfully
46
+ * Deletes an Asset Administration Shell by its unique identifier.
47
+ *
48
+ * @param options Object containing:
49
+ * - baseUrl: The API base URL
50
+ * - aasIdentifier: The unique ID for the AAS
51
+ * - headers?: Optional request headers
52
+ *
53
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
38
54
  */
39
- deleteAssetAdministrationShellById({ baseUrl, aasIdentifier, headers }: AasIdentifierOptions): Promise<void>;
55
+ deleteAssetAdministrationShellById(options: {
56
+ baseUrl: string;
57
+ aasIdentifier: string;
58
+ headers?: Headers;
59
+ }): Promise<ApiResult<AasRepository.DeleteAssetAdministrationShellByIdResponse, AasRepository.DeleteAssetAdministrationShellByIdError | Error>>;
40
60
  /**
41
- * Returns a specific Asset Administration Shell
42
- *
43
- * @function getAssetAdministrationShellById
44
- * @param {AasIdentifierOptions} options - Options object.
45
- * @param {string} options.baseUrl - The API base URL
46
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
47
- * @param {Headers} [options.headers] - Request headers
48
- * @returns {Promise<AssetAdministrationShell>} Requested Asset Administration Shell
61
+ * Returns a specific Asset Administration Shell by its unique identifier.
62
+ *
63
+ * @param options Object containing:
64
+ * - baseUrl: The API base URL
65
+ * - aasIdentifier: The unique ID
66
+ * - headers?: Optional request headers
67
+ *
68
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
49
69
  */
50
- getAssetAdministrationShellById({ baseUrl, aasIdentifier, headers, }: AasIdentifierOptions): Promise<AssetAdministrationShell>;
70
+ getAssetAdministrationShellById(options: {
71
+ baseUrl: string;
72
+ aasIdentifier: string;
73
+ headers?: Headers;
74
+ }): Promise<ApiResult<AssetAdministrationShell, AasRepository.GetAssetAdministrationShellByIdError | Error>>;
51
75
  /**
52
- * Updates an existing Asset Administration Shell
53
- *
54
- * @function putAssetAdministrationShellById
55
- * @param {PutAssetAdministrationShellOptions} options - Options object.
56
- * @param {string} options.baseUrl - The API base URL
57
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
58
- * @param {AssetAdministrationShell} options.assetAdministrationShell - Asset Administration Shell object
59
- * @param {Headers} [options.headers] - Request headers
60
- * @returns {Promise<void>} Asset Administration Shell updated successfully
76
+ * Updates an existing Asset Administration Shell by ID (PUT).
77
+ *
78
+ * @param options Object containing:
79
+ * - baseUrl: The API base URL
80
+ * - aasIdentifier: The unique ID
81
+ * - assetAdministrationShell: The updated AAS object
82
+ * - headers?: Optional request headers
83
+ *
84
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
61
85
  */
62
- putAssetAdministrationShellById({ baseUrl, aasIdentifier, assetAdministrationShell, headers, }: PutAssetAdministrationShellOptions): Promise<void>;
86
+ putAssetAdministrationShellById(options: {
87
+ baseUrl: string;
88
+ aasIdentifier: string;
89
+ assetAdministrationShell: AssetAdministrationShell;
90
+ headers?: Headers;
91
+ }): Promise<ApiResult<AasRepository.PutAssetAdministrationShellByIdResponse, AasRepository.PutAssetAdministrationShellByIdError | Error>>;
63
92
  /**
64
- * Returns the Asset Information
65
- *
66
- * @function getAssetInformation
67
- * @param {AasIdentifierOptions} options - Options object.
68
- * @param {string} options.baseUrl - The API base URL
69
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
70
- * @param {Headers} [options.headers] - Request headers
71
- * @returns {Promise<AssetInformation>} Requested Asset Information
93
+ * Returns the AssetInformation for the given AAS.
94
+ *
95
+ * @param options Object containing:
96
+ * - baseUrl: The API base URL
97
+ * - aasIdentifier: The unique ID
98
+ * - headers?: Optional request headers
99
+ *
100
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
72
101
  */
73
- getAssetInformation({ baseUrl, aasIdentifier, headers }: AasIdentifierOptions): Promise<AssetInformation>;
102
+ getAssetInformation(options: {
103
+ baseUrl: string;
104
+ aasIdentifier: string;
105
+ headers?: Headers;
106
+ }): Promise<ApiResult<AssetInformation, AasRepository.GetAssetInformationAasRepositoryError | Error>>;
74
107
  /**
75
- * Updates the Asset Information
76
- *
77
- * @function putAssetInformation
78
- * @param {PutAssetInformationOptions} options - Options object.
79
- * @param {string} options.baseUrl - The API base URL
80
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
81
- * @param {AssetInformation} options.assetInformation - Asset Information object
82
- * @param {Headers} [options.headers] - Request headers
83
- * @returns {Promise<void>} Asset Information updated successfully
108
+ * Updates the AssetInformation for the given AAS.
109
+ *
110
+ * @param options Object containing:
111
+ * - baseUrl: The API base URL
112
+ * - aasIdentifier: The unique ID
113
+ * - assetInformation: The updated AssetInformation object
114
+ * - headers?: Optional request headers
115
+ *
116
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
84
117
  */
85
- putAssetInformation({ baseUrl, aasIdentifier, assetInformation, headers, }: PutAssetInformationOptions): Promise<void>;
118
+ putAssetInformation(options: {
119
+ baseUrl: string;
120
+ aasIdentifier: string;
121
+ assetInformation: AssetInformation;
122
+ headers?: Headers;
123
+ }): Promise<ApiResult<AasRepository.PutAssetInformationAasRepositoryResponse, AasRepository.PutAssetInformationAasRepositoryError | Error>>;
86
124
  /**
87
- * Deletes the Thumbnail
88
- *
89
- * @function deleteThumbnail
90
- * @param {AasIdentifierOptions} options - Options object.
91
- * @param {string} options.baseUrl - The API base URL
92
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
93
- * @param {Headers} [options.headers] - Request headers
94
- * @returns {Promise<void>} Thumbnail deletion successful
125
+ * Deletes the Thumbnail associated with the given AAS.
126
+ *
127
+ * @param options Object containing:
128
+ * - baseUrl: The API base URL
129
+ * - aasIdentifier: The unique ID
130
+ * - headers?: Optional request headers
131
+ *
132
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
95
133
  */
96
- deleteThumbnail({ baseUrl, aasIdentifier, headers }: AasIdentifierOptions): Promise<void>;
134
+ deleteThumbnail(options: {
135
+ baseUrl: string;
136
+ aasIdentifier: string;
137
+ headers?: Headers;
138
+ }): Promise<ApiResult<AasRepository.DeleteThumbnailAasRepositoryResponses, AasRepository.DeleteThumbnailAasRepositoryError | Error>>;
97
139
  /**
98
- * Returns the Thumbnail
99
- *
100
- * @function getThumbnail
101
- * @param {AasIdentifierOptions} options - Options object.
102
- * @param {string} options.baseUrl - The API base URL
103
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
104
- * @param {Headers} [options.headers] - Request headers
105
- * @returns {Promise<Blob | File>} The thumbnail of the Asset Information.
140
+ * Returns the Thumbnail associated with an AAS, if any.
141
+ *
142
+ * @param options Object containing:
143
+ * - baseUrl: The API base URL
144
+ * - aasIdentifier: The unique ID
145
+ * - headers?: Optional request headers
146
+ *
147
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
106
148
  */
107
- getThumbnail({ baseUrl, aasIdentifier, headers }: AasIdentifierOptions): Promise<Blob | File>;
149
+ getThumbnail(options: {
150
+ baseUrl: string;
151
+ aasIdentifier: string;
152
+ headers?: Headers;
153
+ }): Promise<ApiResult<Blob | File, AasRepository.GetThumbnailAasRepositoryError | Error>>;
108
154
  /**
109
- * Updates the Thumbnail
110
- *
111
- * @function putThumbnail
112
- * @param {PutThumbnailOptions} options - Options object.
113
- * @param {string} options.baseUrl - The API base URL
114
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
115
- * @param {AssetinformationThumbnailBody} options.thumbnail - Thumbnail to upload
116
- * @param {Headers} [options.headers] - Request headers
117
- * @returns {Promise<void>} Thumbnail updated successfully
155
+ * Updates (or creates) the Thumbnail for the given AAS.
156
+ *
157
+ * @param options Object containing:
158
+ * - baseUrl: The API base URL
159
+ * - aasIdentifier: The unique ID
160
+ * - thumbnail: The thumbnail data to upload
161
+ * - headers?: Optional request headers
162
+ *
163
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
118
164
  */
119
- putThumbnail({ baseUrl, aasIdentifier, thumbnail, headers }: PutThumbnailOptions): Promise<void>;
165
+ putThumbnail(options: {
166
+ baseUrl: string;
167
+ aasIdentifier: string;
168
+ thumbnail: AasRepository.AssetinformationThumbnailBody;
169
+ headers?: Headers;
170
+ }): Promise<ApiResult<AasRepository.PutThumbnailAasRepositoryResponse, AasRepository.PutThumbnailAasRepositoryError | Error>>;
120
171
  /**
121
- * Returns all submodel references
122
- *
123
- * @function getAllSubmodelReferences
124
- * @param {GetAllSubmodelReferencesOptions} options - Options object.
125
- * @param {string} options.baseUrl - The API base URL
126
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
127
- * @param {Headers} [options.headers] - Request headers
128
- * @param {number} [options.limit] - The maximum number of elements in the response array
129
- * @param {string} [options.cursor] - A server-generated identifier retrieved from pagingMetadata that specifies from which position the result listing should continue
130
- * @returns {Promise<GetAllSubmodelReferencesResponse>} Requested submodel references
172
+ * Returns all submodel references for the given AAS.
173
+ *
174
+ * @param options Object containing:
175
+ * - baseUrl: The API base URL
176
+ * - aasIdentifier: The unique ID
177
+ * - headers?: Optional request headers
178
+ * - limit?: Max number of elements
179
+ * - cursor?: Paging cursor
180
+ *
181
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
131
182
  */
132
- getAllSubmodelReferences({ baseUrl, aasIdentifier, headers, limit, cursor, }: GetAllSubmodelReferencesOptions): Promise<GetAllSubmodelReferencesResponse>;
183
+ getAllSubmodelReferences(options: {
184
+ baseUrl: string;
185
+ aasIdentifier: string;
186
+ headers?: Headers;
187
+ limit?: number;
188
+ cursor?: string;
189
+ }): Promise<ApiResult<{
190
+ pagedResult: AasRepository.PagedResultPagingMetadata | undefined;
191
+ result: Reference[];
192
+ }, AasRepository.GetAllSubmodelReferencesAasRepositoryError | Error>>;
133
193
  /**
134
- * Creates a submodel reference at the Asset Administration Shell
135
- *
136
- * @function postSubmodelReference
137
- * @param {PostSubmodelReferenceOptions} options - Options object.
138
- * @param {string} options.baseUrl - The API base URL
139
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
140
- * @param {Reference} options.submodelReference - Reference to the Submodel
141
- * @param {Headers} [options.headers] - Request headers
142
- * @returns {Promise<Reference>} Submodel reference created successfully
194
+ * Creates a submodel reference at the given AAS.
195
+ *
196
+ * @param options Object containing:
197
+ * - baseUrl: The API base URL
198
+ * - aasIdentifier: The unique ID of the AAS
199
+ * - submodelReference: The Reference to the submodel
200
+ * - headers?: Optional request headers
201
+ *
202
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
143
203
  */
144
- postSubmodelReference({ baseUrl, aasIdentifier, submodelReference, headers, }: PostSubmodelReferenceOptions): Promise<Reference>;
204
+ postSubmodelReference(options: {
205
+ baseUrl: string;
206
+ aasIdentifier: string;
207
+ submodelReference: Reference;
208
+ headers?: Headers;
209
+ }): Promise<ApiResult<Reference, AasRepository.PostSubmodelReferenceAasRepositoryError | Error>>;
145
210
  /**
146
- * Deletes the submodel reference from the Asset Administration Shell. Does not delete the submodel itself!
147
- *
148
- * @function deleteSubmodelReferenceById
149
- * @param {DeleteSubmodelReferenceByIdOptions} options - Options object.
150
- * @param {string} options.baseUrl - The API base URL
151
- * @param {string} options.aasIdentifier - The Asset Administration Shell's unique id
152
- * @param {string} options.submodelIdentifier - The Submodel's unique id
153
- * @param {Headers} [options.headers] - Request headers
154
- * @returns {Promise<void>} Submodel reference deleted successfully
211
+ * Deletes a submodel reference from the given AAS (does not delete the submodel itself).
212
+ *
213
+ * @param options Object containing:
214
+ * - baseUrl: The API base URL
215
+ * - aasIdentifier: Unique ID of the AAS
216
+ * - submodelIdentifier: The submodel's unique ID
217
+ * - headers?: Optional request headers
218
+ *
219
+ * @returns Either `{ success: true; data: ... }` or `{ success: false; error: ... }`.
155
220
  */
156
- deleteSubmodelReferenceById({ baseUrl, aasIdentifier, submodelIdentifier, headers, }: DeleteSubmodelReferenceByIdOptions): Promise<void>;
221
+ deleteSubmodelReferenceById(options: {
222
+ baseUrl: string;
223
+ aasIdentifier: string;
224
+ submodelIdentifier: string;
225
+ headers?: Headers;
226
+ }): Promise<ApiResult<AasRepository.DeleteSubmodelReferenceByIdAasRepositoryResponse, AasRepository.DeleteSubmodelReferenceByIdAasRepositoryError | Error>>;
157
227
  }