Skip to content

Commit

Permalink
Merge pull request #394 from RWTH-EBC/384-NGSI-LD-support-for-entity-…
Browse files Browse the repository at this point in the history
…creation-and-update-with-keyvalues-format

384 ngsi ld support for entity creation and update with keyvalues format
  • Loading branch information
djs0109 authored Feb 25, 2025
2 parents d3dd546 + 9574828 commit 3c32f7d
Show file tree
Hide file tree
Showing 2 changed files with 927 additions and 5 deletions.
13 changes: 8 additions & 5 deletions filip/clients/ngsi_ld/cb.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ def get_statistics(self) -> Dict:
raise

def post_entity(
self, entity: ContextLDEntity, append: bool = False, update: bool = False
self,
entity: Union[ContextLDEntity,ContextLDEntityKeyValues],
append: bool = False,
update: bool = False
):
"""
Function registers an Object with the NGSI-LD Context Broker,
Expand Down Expand Up @@ -237,7 +240,7 @@ def post_entity(
self.log_error(err=err, msg=msg)
raise

def override_entities(self, entities: List[ContextLDEntity]):
def override_entities(self, entities: List[Union[ContextLDEntity,ContextLDEntityKeyValues]]):
"""
Function to create or override existing entites with the NGSI-LD Context Broker.
The batch operation with Upsert will be used.
Expand Down Expand Up @@ -429,7 +432,7 @@ def get_entity_list(
raise

def replace_existing_attributes_of_entity(
self, entity: ContextLDEntity, append: bool = False
self, entity: Union[ContextLDEntity,ContextLDEntityKeyValues], append: bool = False
):
"""
The attributes previously existing in the entity are removed and
Expand Down Expand Up @@ -530,7 +533,7 @@ def update_entity_attribute(
raise

def append_entity_attributes(
self, entity: ContextLDEntity, options: Optional[str] = None
self, entity: Union[ContextLDEntity,ContextLDEntityKeyValues], options: Optional[str] = None
):
"""
Append new Entity attributes to an existing Entity within an NGSI-LD system
Expand Down Expand Up @@ -857,7 +860,7 @@ def handle_multi_status_response(self, res: requests.Response):
def entity_batch_operation(
self,
*,
entities: List[ContextLDEntity],
entities: List[Union[ContextLDEntity,ContextLDEntityKeyValues]],
action_type: Union[ActionTypeLD, str],
options: Literal["noOverwrite", "replace", "update"] = None,
) -> None:
Expand Down
Loading

0 comments on commit 3c32f7d

Please sign in to comment.