def _register(self, object_type=None, template_attribute=None, secret=None, credential=None): operation = Operation(OperationEnum.REGISTER) if object_type is None: raise ValueError('object_type cannot be None') req_pl = register.RegisterRequestPayload( object_type=object_type, template_attribute=template_attribute, secret=secret) batch_item = messages.RequestBatchItem(operation=operation, request_payload=req_pl) message = self._build_request_message(credential, [batch_item]) self._send_message(message) message = messages.ResponseMessage() data = self._receive_message() message.read(data) batch_items = message.batch_items batch_item = batch_items[0] payload = batch_item.response_payload if payload is None: payload_unique_identifier = None payload_template_attribute = None else: payload_unique_identifier = payload.unique_identifier payload_template_attribute = payload.template_attribute result = RegisterResult(batch_item.result_status, batch_item.result_reason, batch_item.result_message, payload_unique_identifier, payload_template_attribute) return result
def _create_register_payload(self): return register.RegisterRequestPayload()