def list_datasets(socrata_client, domain):
    """List all datasets on a portal using the Socrata API"""
    all_metadata = socrata_client.datasets(domains=[domain], only=['dataset'])
    key_fields = []
    for dataset in all_metadata:
        key_fields.append({'Name': dataset['resource']['name'], 'Category':
            dataset['classification'].get('domain_category'), 'ID': dataset
            ['resource']['id'], 'URL': dataset['permalink']})
    return sorted(key_fields, key=lambda _: _['Name'].lower())
