@click.command()
@click.argument('campaign_id', type=str)
@click.option('--batch_no', 'batch_no', type=int)
@click.option('--namespace', type=str)
@click.option('--login_as', type=click.Choice(['client', 'user'], case_sensitive=False))
@click.option('--login_with_auth', type=str)
@click.option('--doc', type=bool)
def download(campaign_id: str, batch_no: Optional[int]=None, namespace: Optional[str]=None, login_as: Optional[str]=None, login_with_auth: Optional[str]=None, doc: Optional[bool]=None):
    if doc:
        click.echo(download_internal.__doc__)
        return
    x_additional_headers = None
    if login_with_auth:
        x_additional_headers = {'Authorization': login_with_auth}
    else:
        login_as_internal(login_as)
    (result, error) = download_internal(campaign_id=campaign_id, batch_no=batch_no, namespace=namespace, x_additional_headers=x_additional_headers)
    if error:
        raise Exception(f'download failed: {str(error)}')
    click.echo(yaml.safe_dump(to_dict(result), sort_keys=False))
@click.command()
@click.argument('campaign_id', type=str)
@click.option('--batch_no', 'batch_no', type=int)
@click.option('--namespace', type=str)
@click.option('--login_as', type=click.Choice(['client', 'user'], case_sensitive=False))
@click.option('--login_with_auth', type=str)
@click.option('--doc', type=bool)
def download(campaign_id: str, batch_no: Optional[int]=None, namespace: Optional[str]=None, login_as: Optional[str]=None, login_with_auth: Optional[str]=None, doc: Optional[bool]=None):
    if doc:
        click.echo(download_internal.__doc__)
        return
    x_additional_headers = None
    if login_with_auth:
        x_additional_headers = {'Authorization': login_with_auth}
    else:
        login_as_internal(login_as)
    (result, error) = download_internal(campaign_id=campaign_id, batch_no=batch_no, namespace=namespace, x_additional_headers=x_additional_headers)
    if error:
        raise Exception(f'download failed: {str(error)}')
    click.echo(yaml.safe_dump(to_dict(result), sort_keys=False))