"""ows-sound-recordings connections.""" import config from src.common.connectors import ows_sound_recordings def touch_sound_recordings(resource_id, resource_type, modified_before, limit): """Touch batch of OrchardSoundRecordings to force re-compile. Args: resource_id (int): Unique id of object resource_type (str): Type of object modified_before (str): datetime isoformat limit (int): max number records to modify Returns: int: number of OSR nodes modified """ response = ows_sound_recordings.call( 'PATCH', '/sound_recordings/touch', config.APPLICATION_NAME, config.ENVIRONMENT, extra_args={ 'json': { 'resource_id': resource_id, 'resource_type': resource_type.lower(), 'modified_before': modified_before, 'limit': limit } }, retry_codes=[ 408, 502, 503, 504 ] ) return response.json()['nodes_updated']