aas_client3_2.submodel_repository

Implement the operations of the Submodel Repository API.

Every public function implements exactly one operation of the specification. The private functions _build_* and _parse_* build the request and parse the response of the operation. They do no I/O, and constitute a semi-public interface for the testing client, which is released in lockstep with this client.

aas_client3_2.submodel_repository.get_all_submodels(server: Server, *, semantic_id: Reference | None = None, id_short: str | None = None, created_from: datetime | None = None, updated_from: datetime | None = None, limit: int | None = None, cursor: str | None = None, level: Level | None = None, extent: Extent | None = None) → GetSubmodelsResult[source]

List a page of the submodels in the repository.

Parameters:
  • server – where to send the request

  • semantic_id – if set, only the submodels with this semantic ID or supplemental semantic ID

  • id_short – if set, only the submodels with this ID-short

  • created_from – if set, only the submodels created at or after this time

  • updated_from – if set, only the submodels updated at or after this time

  • limit – maximum number of the submodels in the page

  • cursor – where to continue the listing from

  • level – depth of the returned submodels

  • extent – whether to include the values of blobs

Returns:

a page of the submodels

Implements:
  • GetAllSubmodels – GET /submodels

aas_client3_2.submodel_repository.post_submodel(server: Server, submodel: Submodel) → Submodel[source]

Create a new submodel in the repository.

Parameters:
  • server – where to send the request

  • submodel – the submodel to be created

Returns:

the created submodel, as stored by the server

Implements:
  • PostSubmodel – POST /submodels

aas_client3_2.submodel_repository.get_all_submodels_metadata(server: Server, *, semantic_id: Reference | None = None, id_short: str | None = None, created_from: datetime | None = None, updated_from: datetime | None = None, limit: int | None = None, cursor: str | None = None) → GetSubmodelsMetadataResult[source]

List a page of the metadata of the submodels in the repository.

Parameters:
  • server – where to send the request

  • semantic_id – if set, only the submodels with this semantic ID or supplemental semantic ID

  • id_short – if set, only the submodels with this ID-short

  • created_from – if set, only the submodels created at or after this time

  • updated_from – if set, only the submodels updated at or after this time

  • limit – maximum number of the submodels in the page

  • cursor – where to continue the listing from

Returns:

a page of the metadata of the submodels

Implements:
  • GetAllSubmodels-Metadata – GET /submodels/$metadata

aas_client3_2.submodel_repository.get_all_submodels_reference(server: Server, *, semantic_id: Reference | None = None, id_short: str | None = None, created_from: datetime | None = None, updated_from: datetime | None = None, limit: int | None = None, cursor: str | None = None) → GetReferencesResult[source]

List a page of the references to the submodels in the repository.

This is not to be confused with aas_client3_2.aas_repository.get_all_submodel_references(), which lists the submodel references of an Asset Administration Shell.

The deprecated query parameter level is omitted, since it allows only the value core.

Parameters:
  • server – where to send the request

  • semantic_id – if set, only the submodels with this semantic ID or supplemental semantic ID

  • id_short – if set, only the submodels with this ID-short

  • created_from – if set, only the submodels created at or after this time

  • updated_from – if set, only the submodels updated at or after this time

  • limit – maximum number of the references in the page

  • cursor – where to continue the listing from

Returns:

a page of the references

Implements:
  • GetAllSubmodels-Reference – GET /submodels/$reference

aas_client3_2.submodel_repository.get_all_submodels_value_only(server: Server, *, semantic_id: Reference | None = None, id_short: str | None = None, created_from: datetime | None = None, updated_from: datetime | None = None, limit: int | None = None, cursor: str | None = None, level: Level | None = None, extent: Extent | None = None) → GetSubmodelsValueResult[source]

List a page of the values of the submodels in the repository.

Each item of the page is the ValueOnly serialization of a submodel, a JSON object keyed by the ID-shorts of its elements. The ValueOnly serialization carries no identifier, so the items can not be told apart by the submodels they belong to. Filter by id_short or semantic_id to narrow the page down.

Parameters:
  • server – where to send the request

  • semantic_id – if set, only the submodels with this semantic ID or supplemental semantic ID

  • id_short – if set, only the submodels with this ID-short

  • created_from – if set, only the submodels created at or after this time

  • updated_from – if set, only the submodels updated at or after this time

  • limit – maximum number of the submodels in the page

  • cursor – where to continue the listing from

  • level – depth of the returned values

  • extent – whether to include the values of blobs

Returns:

a page of the values of the submodels

Implements:
  • GetAllSubmodels-ValueOnly – GET /submodels/$value

aas_client3_2.submodel_repository.get_all_submodels_path(server: Server, *, semantic_id: Reference | None = None, id_short: str | None = None, created_from: datetime | None = None, updated_from: datetime | None = None, limit: int | None = None, cursor: str | None = None, level: Level | None = None) → GetPathItemsResult[source]

List a page of the ID-short paths of the elements of the submodels in the repository.

Part 2 gives a single flat page of paths for all the matching submodels. The paths are relative to their submodels, and carry no identifier, so the paths of different submodels can not be told apart. Filter by id_short or semantic_id to narrow the page down, or use get_submodel_by_id_path() for a single submodel. The limit applies to the paths, not to the submodels.

Parameters:
  • server – where to send the request

  • semantic_id – if set, only the submodels with this semantic ID or supplemental semantic ID

  • id_short – if set, only the submodels with this ID-short

  • created_from – if set, only the submodels created at or after this time

  • updated_from – if set, only the submodels updated at or after this time

  • limit – maximum number of the paths in the page

  • cursor – where to continue the listing from

  • level – depth of the returned paths

Returns:

a page of the paths

Implements:
  • GetAllSubmodels-Path – GET /submodels/$path

aas_client3_2.submodel_repository.get_submodel_by_id(server: Server, submodel_identifier: str, *, level: Level | None = None, extent: Extent | None = None) → Submodel[source]

Get the submodel with the given identifier.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • level – depth of the returned submodel

  • extent – whether to include the values of blobs

Returns:

the submodel

Implements:
  • GetSubmodelById – GET /submodels/{submodelIdentifier}

aas_client3_2.submodel_repository.put_submodel_by_id(server: Server, submodel_identifier: str, submodel: Submodel) → None[source]

Create or replace the submodel with the given identifier.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • submodel – the submodel to be stored

Implements:
  • PutSubmodelById – PUT /submodels/{submodelIdentifier}

aas_client3_2.submodel_repository.patch_submodel_by_id(server: Server, submodel_identifier: str, submodel: Submodel) → None[source]

Update the existing submodel with the given identifier.

Part 2 replaces the elements of the stored submodel one by one with the elements of submodel, which must all exist on the server.

The query parameter level is omitted, since it allows only the value core.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • submodel – the submodel with the updates

Implements:
  • PatchSubmodelById – PATCH /submodels/{submodelIdentifier}

aas_client3_2.submodel_repository.delete_submodel_by_id(server: Server, submodel_identifier: str) → None[source]

Delete the submodel with the given identifier.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

Implements:
  • DeleteSubmodelById – DELETE /submodels/{submodelIdentifier}

aas_client3_2.submodel_repository.get_submodel_by_id_metadata(server: Server, submodel_identifier: str) → SubmodelMetadata[source]

Get the metadata of the submodel with the given identifier.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

Returns:

the metadata of the submodel

Implements:
  • GetSubmodelById-Metadata – GET /submodels/{submodelIdentifier}/$metadata

aas_client3_2.submodel_repository.patch_submodel_by_id_metadata(server: Server, submodel_identifier: str, submodel_metadata: SubmodelMetadata) → None[source]

Update the metadata of the submodel with the given identifier.

The submodel elements remain unchanged.

The query parameter level is omitted, since it allows only the value core.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • submodel_metadata – the new metadata of the submodel

Implements:
  • PatchSubmodelById-Metadata – PATCH /submodels/{submodelIdentifier}/$metadata

aas_client3_2.submodel_repository.get_submodel_by_id_reference(server: Server, submodel_identifier: str) → Reference[source]

Get a reference to the submodel with the given identifier.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

Returns:

the reference to the submodel

Implements:
  • GetSubmodelById-Reference – GET /submodels/{submodelIdentifier}/$reference

aas_client3_2.submodel_repository.get_submodel_by_id_value_only(server: Server, submodel_identifier: str, *, level: Level | None = None, extent: Extent | None = None) → Mapping[str, Any][source]

Get the values of the submodel with the given identifier.

The values are in the ValueOnly serialization, a JSON object keyed by the ID-shorts of the submodel elements. They can not be parsed further without knowing the structure of the submodel, for example, from get_submodel_by_id_metadata(), since the same JSON can stand for different kinds of elements; for example, a range looks exactly like a collection with the properties min and max.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • level – depth of the returned values

  • extent – whether to include the values of blobs

Returns:

the values of the submodel

Implements:
  • GetSubmodelById-ValueOnly – GET /submodels/{submodelIdentifier}/$value

aas_client3_2.submodel_repository.patch_submodel_by_id_value_only(server: Server, submodel_identifier: str, submodel: Submodel) → None[source]

Update the values of the submodel with the given identifier.

The client sends only the values of submodel, in the ValueOnly serialization. Part 2 replaces the values of the stored elements one by one, and the elements must all exist on the server. Everything else, such as the semantic IDs, remains unchanged.

The query parameter level is omitted, since it allows only the value core.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • submodel – the submodel with the new values

Raises:

ValueError if a value of submodel can not be serialized, such as a property xs:int with the value "abc"

Implements:
  • PatchSubmodelById-ValueOnly – PATCH /submodels/{submodelIdentifier}/$value

aas_client3_2.submodel_repository.get_submodel_by_id_path(server: Server, submodel_identifier: str, *, level: Level | None = None) → List[str][source]

List the ID-short paths of the elements of the submodel.

The paths start at the top-level elements, such as Motor and Motor.Speed, since the submodel itself has no path. With level set to core, only the paths of the top-level elements are listed.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • level – depth of the returned paths

Returns:

the paths

Implements:
  • GetSubmodelById-Path – GET /submodels/{submodelIdentifier}/$path

aas_client3_2.submodel_repository.get_all_submodel_elements(server: Server, submodel_identifier: str, *, limit: int | None = None, cursor: str | None = None, level: Level | None = None, extent: Extent | None = None) → GetSubmodelElementsResult[source]

List a page of the top-level submodel elements of the submodel.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • limit – maximum number of the submodel elements in the page

  • cursor – where to continue the listing from

  • level – depth of the returned submodel elements

  • extent – whether to include the values of blobs

Returns:

a page of the submodel elements

Implements:
  • GetAllSubmodelElements_SubmodelRepository – GET /submodels/{submodelIdentifier}/submodel-elements

aas_client3_2.submodel_repository.post_submodel_element(server: Server, submodel_identifier: str, submodel_element: SubmodelElement) → SubmodelElement[source]

Add a new top-level submodel element to the submodel.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • submodel_element – the submodel element to be created

Returns:

the created submodel element, as stored by the server

Implements:
  • PostSubmodelElement_SubmodelRepo – POST /submodels/{submodelIdentifier}/submodel-elements

aas_client3_2.submodel_repository.get_all_submodel_elements_metadata(server: Server, submodel_identifier: str, *, limit: int | None = None, cursor: str | None = None) → GetSubmodelElementsMetadataResult[source]

List a page of the metadata of the top-level submodel elements of the submodel.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • limit – maximum number of the submodel elements in the page

  • cursor – where to continue the listing from

Returns:

a page of the metadata of the submodel elements

Implements:
  • GetAllSubmodelElements-Metadata_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/$metadata

aas_client3_2.submodel_repository.get_all_submodel_elements_value_only(server: Server, submodel_identifier: str, *, limit: int | None = None, cursor: str | None = None, level: Level | None = None, extent: Extent | None = None) → GetSubmodelElementsValueResult[source]

List a page of the values of the top-level submodel elements of the submodel.

Each item of the page is a JSON object with a single key, the ID-short of the element, whose value is the ValueOnly serialization of the element. Unlike the OpenAPI, which types the page as a single JSON object, aas-core3.2 follows Eclipse BaSyx Go components and the prose of Part 2 here.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • limit – maximum number of the submodel elements in the page

  • cursor – where to continue the listing from

  • level – depth of the returned values

  • extent – whether to include the values of blobs

Returns:

a page of the values of the submodel elements

Implements:
  • GetAllSubmodelElements-ValueOnly_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/$value

aas_client3_2.submodel_repository.get_all_submodel_elements_reference(server: Server, submodel_identifier: str, *, limit: int | None = None, cursor: str | None = None) → GetReferencesResult[source]

List a page of the references to the top-level submodel elements of the submodel.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • limit – maximum number of the references in the page

  • cursor – where to continue the listing from

Returns:

a page of the references

Implements:
  • GetAllSubmodelElements-Reference_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/$reference

aas_client3_2.submodel_repository.get_all_submodel_elements_path(server: Server, submodel_identifier: str, *, limit: int | None = None, cursor: str | None = None, level: Level | None = None) → GetPathItemsResult[source]

List a page of the ID-short paths of the elements of the submodel.

The limit applies to the paths, not to the top-level elements.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • limit – maximum number of the paths in the page

  • cursor – where to continue the listing from

  • level – depth of the returned paths

Returns:

a page of the paths

Implements:
  • GetAllSubmodelElements-Path_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/$path

aas_client3_2.submodel_repository.get_submodel_element_by_path(server: Server, submodel_identifier: str, id_short_path: str, *, level: Level | None = None, extent: Extent | None = None) → SubmodelElement[source]

Get the submodel element at the given ID-short path.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element, such as Motor.Speed

  • level – depth of the returned element

  • extent – whether to include the values of blobs

Returns:

the submodel element

Implements:
  • GetSubmodelElementByPath_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}

aas_client3_2.submodel_repository.post_submodel_element_by_path(server: Server, submodel_identifier: str, id_short_path: str, submodel_element: SubmodelElement) → SubmodelElement[source]

Add a new submodel element as a child of the element at the given ID-short path.

The element at id_short_path must be able to hold children, such as a submodel element collection, a submodel element list or an entity.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the parent element

  • submodel_element – the submodel element to be created

Returns:

the created submodel element, as stored by the server

Implements:
  • PostSubmodelElementByPath_SubmodelRepo – POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}

aas_client3_2.submodel_repository.put_submodel_element_by_path(server: Server, submodel_identifier: str, id_short_path: str, submodel_element: SubmodelElement) → None[source]

Create or replace the submodel element at the given ID-short path.

The query parameter level is omitted, since it allows only the value deep.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element

  • submodel_element – the submodel element to be stored

Implements:
  • PutSubmodelElementByPath_SubmodelRepo – PUT /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}

aas_client3_2.submodel_repository.patch_submodel_element_by_path(server: Server, submodel_identifier: str, id_short_path: str, submodel_element: SubmodelElement) → None[source]

Update the existing submodel element at the given ID-short path.

Part 2 replaces the stored element and its children one by one with submodel_element and its children, which must all exist on the server.

The query parameter level is omitted, since it allows only the value core.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element

  • submodel_element – the submodel element with the updates

Implements:
  • PatchSubmodelElementByPath_SubmodelRepo – PATCH /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}

aas_client3_2.submodel_repository.delete_submodel_element_by_path(server: Server, submodel_identifier: str, id_short_path: str) → None[source]

Delete the submodel element at the given ID-short path.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element

Implements:
  • DeleteSubmodelElementByPath_SubmodelRepo – DELETE /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}

aas_client3_2.submodel_repository.get_submodel_element_by_path_metadata(server: Server, submodel_identifier: str, id_short_path: str) → SubmodelElementMetadata[source]

Get the metadata of the submodel element at the given ID-short path.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element, such as Motor.Speed

Returns:

the metadata of the submodel element

Implements:
  • GetSubmodelElementByPath-Metadata_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$metadata

aas_client3_2.submodel_repository.patch_submodel_element_by_path_metadata(server: Server, submodel_identifier: str, id_short_path: str, submodel_element_metadata: SubmodelElementMetadata) → None[source]

Update the metadata of the submodel element at the given ID-short path.

The value of the element remains unchanged.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element

  • submodel_element_metadata – the new metadata of the submodel element

Implements:
  • PatchSubmodelElementByPath-Metadata_SubmodelRepo – PATCH /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$metadata

aas_client3_2.submodel_repository.get_submodel_element_by_path_value_only(server: Server, submodel_identifier: str, id_short_path: str, *, level: Level | None = None, extent: Extent | None = None) → None | bool | int | float | str | Sequence[Any] | Mapping[str, Any][source]

Get the value of the submodel element at the given ID-short path.

The value is in the ValueOnly serialization, without the ID-short of the element; for example, 5 for a property xs:int, or {"min": 1, "max": 5} for a range. The value can not be parsed further without knowing the kind of the element, since the ValueOnly serialization drops the model types; for example, the range above looks exactly like a collection with the properties min and max. If you know the kind, you can parse some kinds with aas-core3.2, for example, a range with aas_core3_2.jsonization.range_value_from_jsonable().

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element, such as Motor.Speed

  • level – depth of the returned value

  • extent – whether to include the values of blobs

Returns:

the value of the submodel element

Implements:
  • GetSubmodelElementByPath-ValueOnly_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$value

aas_client3_2.submodel_repository.patch_submodel_element_by_path_value_only(server: Server, submodel_identifier: str, id_short_path: str, submodel_element: SubmodelElement) → None[source]

Update the value of the submodel element at the given ID-short path.

The client sends only the value of submodel_element, in the ValueOnly serialization. Part 2 replaces the value of the stored element, and of its children one by one, which must all exist on the server. Everything else, such as the semantic ID, remains unchanged.

The query parameter level is omitted, since it allows only the value core.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element

  • submodel_element – the submodel element with the new value

Raises:

ValueError if submodel_element is an operation or a capability, which have no value, or if its value can not be serialized, such as a property xs:int with the value "abc"

Implements:
  • PatchSubmodelElementByPath-ValueOnly_SubmodelRepo – PATCH /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$value

aas_client3_2.submodel_repository.get_submodel_element_by_path_reference(server: Server, submodel_identifier: str, id_short_path: str) → Reference[source]

Get a reference to the submodel element at the given ID-short path.

The reference is a model reference with a key for the submodel, followed by a key for each element along the path. The key of an element in a list holds its index, such as 0.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element, such as Motor.Speed

Returns:

the reference to the submodel element

Implements:
  • GetSubmodelElementByPath-Reference_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$reference

aas_client3_2.submodel_repository.get_submodel_element_by_path_path(server: Server, submodel_identifier: str, id_short_path: str, *, level: Level | None = None) → List[str][source]

List the ID-short paths of the submodel element and of its descendants.

The paths include the path of the element itself. With level set to core, only the paths of the element and of its direct children are listed.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the element, such as Motor.Speed

  • level – depth of the returned paths

Returns:

the paths

Implements:
  • GetSubmodelElementByPath-Path_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$path

aas_client3_2.submodel_repository.get_file_by_path(server: Server, submodel_identifier: str, id_short_path: str) → ContextManager[Download][source]

Download the content of the file element at the given ID-short path.

The content is streamed, so use the result as a context manager:

with submodel_repository.get_file_by_path(
    server, "urn:example:submodel:1", "Documentation.Manual"
) as download:
    with open("manual.pdf", "wb") as fid:
        download.write_to(fid)

The connection is released when the context is exited. If the file element refers to an external resource, the server may redirect to it; whether the redirect is followed is up to the transport.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the file element, such as Manual

Returns:

a context manager which gives the download

Raises:

MethodNotAllowed if the element is not a file element

Implements:
  • GetFileByPath_SubmodelRepo – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment

aas_client3_2.submodel_repository.put_file_by_path(server: Server, submodel_identifier: str, id_short_path: str, content: bytes | IO[bytes], *, file_name: str | None = None, content_type: str | None = None) → None[source]

Upload the content of the file element at the given ID-short path.

The content is either bytes, or a binary file object which is readable and seekable; it is read from its current position to its end, in chunks, so that a large file is never held in memory. The file object must not be modified during the upload.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the file element, such as Manual

  • content – content of the file

  • file_name – if set, the name of the file

  • content_type – if set, the content type of the file, such as application/pdf, otherwise application/octet-stream. The servers may take it as the new content type of the file element.

Raises:

TypeError before sending anything if the content is neither bytes nor a binary file object; ValueError before sending anything if the content can not be read again, or if the file name or the content type contain double quotes, backslashes or control characters; MethodNotAllowed if the element is not a file element

Implements:
  • PutFileByPath_SubmodelRepo – PUT /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment

aas_client3_2.submodel_repository.delete_file_by_path(server: Server, submodel_identifier: str, id_short_path: str) → None[source]

Delete the content of the file element at the given ID-short path.

The file element itself stays.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the file element, such as Manual

Implements:
  • DeleteFileByPath_SubmodelRepo – DELETE /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/attachment

aas_client3_2.submodel_repository.invoke_operation(server: Server, submodel_identifier: str, id_short_path: str, operation_request: OperationRequest) → OperationResult[source]

Invoke the operation at the given ID-short path, and wait for its result.

The connection stays open until the server has the result. Set client_timeout_duration of operation_request, such as PT30S, to tell the server how long the client waits; the timeout of the transport should be longer.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the operation, such as Control.Start

  • operation_request – the input and in-output arguments

Returns:

the result of the operation; check its execution_state and success, since a failed operation still gives a result

Raises:

MethodNotAllowed if the element is not an operation

Implements:
  • InvokeOperation_SubmodelRepo – POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke

aas_client3_2.submodel_repository.invoke_operation_value_only(server: Server, submodel_identifier: str, id_short_path: str, operation_request: OperationRequestValueOnly) → OperationResultValueOnly[source]

Invoke the operation with the arguments in Value-Only, and wait for its result.

The arguments map the ID-shorts of the variables to their values, such as {"speed": 5}; the numbers in the result are floats, as everywhere in Value-Only, since JSON knows a single numeric type. The value types of the variables tell which of the numbers are integers.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the operation, such as Control.Start

  • operation_request – the input and in-output arguments

Returns:

the result of the operation

Raises:

MethodNotAllowed if the element is not an operation

Implements:
  • InvokeOperation-ValueOnly_SubmodelRepository – POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value

aas_client3_2.submodel_repository.invoke_operation_async(server: Server, submodel_identifier: str, id_short_path: str, operation_request: OperationRequestAsync) → OperationHandle[source]

Start the operation at the given ID-short path on the server, and return at once.

Poll get_operation_async_status() with the handle until the operation is finished, and then fetch get_operation_async_result():

handle = submodel_repository.invoke_operation_async(
    server,
    "urn:example:submodel:1",
    "Control.Start",
    aas_types.OperationRequestAsync(client_timeout_duration="PT60S"),
)

while True:
    status = submodel_repository.get_operation_async_status(
        server, "urn:example:submodel:1", "Control.Start", handle.handle_id
    )
    if status.execution_state not in (
        aas_types.ExecutionState.INITIATED,
        aas_types.ExecutionState.RUNNING,
    ):
        break
    time.sleep(1)

result = submodel_repository.get_operation_async_result(
    server, "urn:example:submodel:1", "Control.Start", handle.handle_id
)

Note that the server may accept an invocation which fails later. The failure then shows in the result.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the operation, such as Control.Start

  • operation_request – the arguments, and how long the client waits at most

Returns:

the handle of the invocation, as given in the header Location

Raises:

MethodNotAllowed if the element is not an operation

Implements:
  • InvokeOperationAsync_SubmodelRepository – POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async

aas_client3_2.submodel_repository.invoke_operation_async_value_only(server: Server, submodel_identifier: str, id_short_path: str, operation_request: OperationRequestAsyncValueOnly) → OperationHandle[source]

Start the operation with the arguments in Value-Only, and return at once.

See invoke_operation_async() for how to poll the status; fetch the result with get_operation_async_result_value_only().

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the operation, such as Control.Start

  • operation_request – the arguments, and how long the client waits at most

Returns:

the handle of the invocation, as given in the header Location

Implements:
  • InvokeOperationAsync-ValueOnly_SubmodelRepository – POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value

aas_client3_2.submodel_repository.get_operation_async_status(server: Server, submodel_identifier: str, id_short_path: str, handle_id: str) → BaseOperationResult[source]

Get the status of the asynchronous invocation with the given handle.

While the operation runs, the server gives the status. Once it is finished, the server redirects to the result. The transport usually follows the redirect (the one based on requests does); if not, the client follows it, but only to the origin of the server. Either way, the status is taken from the result, so its execution_state tells whether the operation completed, failed or timed out.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the operation, such as Control.Start

  • handle_id – handle as given by invoke_operation_async()

Returns:

the status of the invocation

Raises:

NotFound if there is no such invocation; UnexpectedResponse if the server redirects to another origin

Implements:
  • GetOperationAsyncStatus_SubmodelRepository – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/operation-status/{handleId}

aas_client3_2.submodel_repository.get_operation_async_result(server: Server, submodel_identifier: str, id_short_path: str, handle_id: str) → OperationResult[source]

Get the result of the finished asynchronous invocation with the given handle.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • id_short_path – ID-short path of the operation, such as Control.Start

  • handle_id – handle as given by invoke_operation_async()

Returns:

the result of the operation; a failed operation still gives a result, with execution_state set to Failed

Raises:

NotFound if there is no such invocation

Implements:
  • GetOperationAsyncResult_SubmodelRepository – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/operation-results/{handleId}

aas_client3_2.submodel_repository.get_operation_async_result_value_only(server: Server, submodel_identifier: str, id_short_path: str, handle_id: str) → OperationResultValueOnly[source]

Get the result of the finished asynchronous invocation in Value-Only.

Parameters:
Returns:

the result of the operation

Raises:

NotFound if there is no such invocation

Implements:
  • GetOperationAsyncResult-ValueOnly_SubmodelRepository – GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/operation-results/{handleId}/$value

aas_client3_2.submodel_repository.get_submodel_version_by_id_and_date(server: Server, submodel_identifier: str, *, date: datetime | None = None, level: Level | None = None, extent: Extent | None = None) → Submodel[source]

Get the version of the submodel which was valid at the given point in time.

The version is not the attribute version of the administrative information, but the state of the submodel as stored by the server; which changes make a new version is up to the server.

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

  • date – point in time with a time zone; if not set, the server gives the latest version

  • level – depth of the returned submodel

  • extent – whether to include the values of blobs

Returns:

the version of the submodel

Raises:

ValueError before sending anything if date has no time zone; NotFound if there was no such submodel at that point in time

Implements:
  • GetSubmodelVersionByIdAndDate – GET /submodels/{submodelIdentifier}/$history

aas_client3_2.submodel_repository.get_submodel_by_id_signed(server: Server, submodel_identifier: str) → str[source]

Get the submodel with the given identifier, signed by the server.

The submodel is the payload of a JSON Web Signature (JWS, RFC 7515), signed with RS256, with the certificate chain of the signing key in the header x5c. The client does not verify the signature, since only the users know which certificates they trust. Verify it with a JWS library, and parse the verified payload with aas_core3_2.jsonization.submodel_from_jsonable().

Parameters:
  • server – where to send the request

  • submodel_identifier – identifier of the submodel

Returns:

the JWS in the compact serialization

Implements:
  • GetSubmodelByIdSigned – GET /submodels/{submodelIdentifier}/$signed

aas_client3_2.submodel_repository.get_all_submodels_recent_changes(server: Server, *, semantic_id: Reference | None = None, id_short: str | None = None, created_from: datetime | None = None, updated_from: datetime | None = None, limit: int | None = None, cursor: str | None = None) → GetAllSubmodelsRecentChangesResult[source]

List a page of the changes of the submodels in the repository.

A change gives only the identifier of a submodel, its semantic IDs, and when the submodel was created and last updated, so that also a large number of changes can be listed; get the submodels themselves with get_submodel_by_id().

The filters are combined with “and”, except created_from and updated_from, which are combined with “or”: a submodel is listed if it was created at or after created_from, or updated at or after updated_from.

The operation is experimental in Part 2 V3.2.

The times are createdAt and updatedAt of the administrative information as the users wrote them. The server does not set them (see https://github.com/eclipse-basyx/basyx-go-components/issues/821), so a submodel without them is not listed.

Parameters:
  • server – where to send the request

  • semantic_id – if set, only the submodels with this semantic ID or supplemental semantic ID

  • id_short – if set, only the submodels with this ID-short

  • created_from – if set, the submodels created at or after this time

  • updated_from – if set, the submodels updated at or after this time

  • limit – maximum number of the changes in the page

  • cursor – where to continue the listing from

Returns:

a page of the changes

Raises:

ValueError before sending anything if a time has no time zone

Implements:
  • GetAllSubmodelsRecentChanges – GET /submodels/$recent-changes

aas_client3_2.submodel_repository.query_submodels(server: Server, query: Query, *, limit: int | None = None, cursor: str | None = None) → GetSubmodelsResult[source]

List a page of the submodels in the repository which match query.

The query must not select the identifiers ("$select": "id"); use query_submodel_ids() for that. Both functions implement the same operation, but give different results.

The filters of the query ($filters) may remove parts of the submodels, so the submodels in the page are not necessarily complete.

Parameters:
  • server – where to send the request

  • query – query in the AAS Query Language

  • limit – maximum number of the submodels in the page

  • cursor – where to continue the listing from

Returns:

a page of the matching submodels

Raises:

ValueError before sending anything if query selects the identifiers, or can not be serialized to JSON (e.g., a number literal is not finite)

Implements:
  • QuerySubmodels – POST /query/submodels

aas_client3_2.submodel_repository.query_submodel_ids(server: Server, query: Query, *, limit: int | None = None, cursor: str | None = None) → IdsResult[source]

List a page of the identifiers of the submodels which match query.

The query must select the identifiers ("$select": "id"); use query_submodels() for the full submodels. Both functions implement the same operation, but give different results.

Parameters:
  • server – where to send the request

  • query – query in the AAS Query Language

  • limit – maximum number of the identifiers in the page

  • cursor – where to continue the listing from

Returns:

a page of the identifiers of the matching submodels

Raises:

ValueError before sending anything if query does not select the identifiers, or can not be serialized to JSON (e.g., a number literal is not finite)

Implements:
  • QuerySubmodels – POST /query/submodels