#
# This file was generated from the asynchronous client at doi.py by generate_synchronous_client.sh
# Do not edit this file directly, instead edit the original file and regenerate this file.
#


"""Resolve DOIs to URLs."""

from yarl import URL

from .connection import SyncConnection


def resolve_doi(connection: SyncConnection, doi: str) -> str:
    """Resolve a DOI to a record URL."""
    data = connection.get(url=URL(f"https://api.datacite.org/dois/{doi}"), result_class=dict)
    return data["data"]["attributes"]["url"]

