Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

384 ngsi ld support for entity creation and update with keyvalues format #394

13 changes: 8 additions & 5 deletions filip/clients/ngsi_ld/cb.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,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 @@ -236,7 +239,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 @@ -423,7 +426,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 @@ -524,7 +527,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 @@ -851,7 +854,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