def _get_repeat_record_ids(payload_id: Optional[str], repeater_id: Optional[str], domain: str, use_sql: bool) -> List[str]:
    if ((not payload_id) and (not repeater_id)):
        return []
    if payload_id:
        if use_sql:
            records = get_sql_repeat_records_by_payload_id(domain, payload_id)
            return [r.id for r in records]
        else:
            return get_couch_repeat_record_ids_by_payload_id(domain, payload_id)
    elif use_sql:
        queryset = SQLRepeatRecord.objects.filter(domain=domain, repeater__repeater_id=repeater_id)
        return [r['id'] for r in queryset.values('id')]
    else:
        return list(iter_repeat_record_ids_by_repeater(domain, repeater_id))
def _get_repeat_record_ids(payload_id: Optional[str], repeater_id: Optional[str], domain: str, use_sql: bool) -> List[str]:
    if ((not payload_id) and (not repeater_id)):
        return []
    if payload_id:
        if use_sql:
            records = get_sql_repeat_records_by_payload_id(domain, payload_id)
            return [r.id for r in records]
        else:
            return get_couch_repeat_record_ids_by_payload_id(domain, payload_id)
    elif use_sql:
        queryset = SQLRepeatRecord.objects.filter(domain=domain, repeater__repeater_id=repeater_id)
        return [r['id'] for r in queryset.values('id')]
    else:
        return list(iter_repeat_record_ids_by_repeater(domain, repeater_id))