(params, request_type='add')
| 1678 | |
| 1679 | |
| 1680 | def get_pb2_records_request(params, request_type='add'): |
| 1681 | # type: (KeeperParams, str) -> Union[record_pb2.RecordsUpdateRequest, record_pb2.RecordsAddRequest] |
| 1682 | rq_by_type = dict(add=record_pb2.RecordsAddRequest, update=record_pb2.RecordsUpdateRequest) |
| 1683 | new_rq_fn = rq_by_type.get(request_type.lower()) |
| 1684 | if not new_rq_fn: |
| 1685 | raise Exception(f'Request type [{request_type} is unrecognized. Valid choices are [add, update]') |
| 1686 | else: |
| 1687 | rq = new_rq_fn() |
| 1688 | rq.client_time = utils.current_milli_time() |
| 1689 | rq.security_data_key_type = get_security_data_key_type(params) |
| 1690 | return rq |
| 1691 | |
| 1692 | |
| 1693 | def get_records_add_request(params): # type: (KeeperParams) -> record_pb2.RecordsAddRequest |
no test coverage detected