# Path: redcap/request.py
# class FileUpload(TypedDict):
# class _RCRequest:
#     def __init__(
#         self,
#         url: str,
#         payload: Dict[str, Any],
#         config: _ContentConfig,
#         session=_session,
#     ):
#     def _get_format_key(
#         payload: Dict[str, Any]
#     ) -> Optional[Literal["json", "csv", "xml"]]:
#     def get_content(
#         response: Response,
#         format_type: None,
#         return_empty_json: Literal[True],
#         return_bytes: Literal[False],
#     ) -> EmptyJson:
#     def get_content(
#         response: Response,
#         format_type: None,
#         return_empty_json: Literal[False],
#         return_bytes: Literal[True],
#     ) -> bytes:
#     def get_content(
#         response: Response,
#         format_type: Literal["json"],
#         return_empty_json: Literal[False],
#         return_bytes: Literal[False],
#     ) -> Union[Json, Dict[str, str]]:
#     def get_content(
#         response: Response,
#         format_type: Literal["csv", "xml"],
#         return_empty_json: Literal[False],
#         return_bytes: Literal[False],
#     ) -> str:
#     def get_content(
#         response: Response,
#         format_type: Optional[Literal["json", "csv", "xml"]],
#         return_empty_json: bool,
#         return_bytes: bool,
#     ):
#     def execute(
#         self,
#         verify_ssl: Union[bool, str],
#         return_headers: Literal[True],
#         file: Optional[FileUpload],
#     ) -> Tuple[Union[Json, str, bytes], dict]:
#     def execute(
#         self,
#         verify_ssl: Union[bool, str],
#         return_headers: Literal[False],
#         file: Optional[FileUpload],
#     ) -> Union[List[Dict[str, Any]], str, bytes]:
#     def execute(
#         self,
#         verify_ssl: Union[bool, str],
#         return_headers: bool,
#         file: Optional[FileUpload],
#     ):


import json
    import pandas as pd
        import pandas as pd
from typing import (
    Any,
    Dict,
    List,
    Optional,
    overload,
    Tuple,
    TYPE_CHECKING,
    Union,
)
from io import StringIO
from typing_extensions import Literal
from redcap.request import (
    _ContentConfig,
    _RCRequest,
    RedcapError,
    FileUpload,
    Json,
    EmptyJson,
)
        from pandas.errors import EmptyDataError
            to_import.to_csv(buf, **csv_kwargs)
            payload["data"] = buf.getvalue()
            buf.close()
            import_format = "csv"
        elif import_format == "json":
            payload["data"] = json.dumps(to_import, separators=(",", ":"))
        else:
            # don't do anything to csv/xml
            payload["data"] = to_import

        payload["format"] = import_format
        return payload

    @overload
    def _return_data(
        self,
        response: Json,
        content: Literal[
            "exportFieldNames",
            "formEventMapping",
            "metadata",
            "participantList",
            "project",
            "record",
            "report",
            "user",
        ],
        format_type: Literal["json"],
        df_kwargs: None,
        record_type: Literal["flat", "eav"] = "flat",

# Path: redcap/request.py
# class FileUpload(TypedDict):
# class _RCRequest:
#     def __init__(
#         self,
#         url: str,
#         payload: Dict[str, Any],
#         config: _ContentConfig,
#         session=_session,
#     ):
#     def _get_format_key(
#         payload: Dict[str, Any]
#     ) -> Optional[Literal["json", "csv", "xml"]]:
#     def get_content(
#         response: Response,
#         format_type: None,
#         return_empty_json: Literal[True],
#         return_bytes: Literal[False],
#     ) -> EmptyJson:
#     def get_content(
#         response: Response,
#         format_type: None,
#         return_empty_json: Literal[False],
#         return_bytes: Literal[True],
#     ) -> bytes:
#     def get_content(
#         response: Response,
#         format_type: Literal["json"],
#         return_empty_json: Literal[False],
#         return_bytes: Literal[False],
#     ) -> Union[Json, Dict[str, str]]:
#     def get_content(
#         response: Response,
#         format_type: Literal["csv", "xml"],
#         return_empty_json: Literal[False],
#         return_bytes: Literal[False],
#     ) -> str:
#     def get_content(
#         response: Response,
#         format_type: Optional[Literal["json", "csv", "xml"]],
#         return_empty_json: bool,
#         return_bytes: bool,
#     ):
#     def execute(
#         self,
#         verify_ssl: Union[bool, str],
#         return_headers: Literal[True],
#         file: Optional[FileUpload],
#     ) -> Tuple[Union[Json, str, bytes], dict]:
#     def execute(
#         self,
#         verify_ssl: Union[bool, str],
#         return_headers: Literal[False],
#         file: Optional[FileUpload],
#     ) -> Union[List[Dict[str, Any]], str, bytes]:
#     def execute(
#         self,
#         verify_ssl: Union[bool, str],
#         return_headers: bool,
#         file: Optional[FileUpload],
#     ):


# Path: redcap/methods/base.py
import json
    import pandas as pd
        import pandas as pd
from typing import (
    Any,
    Dict,
    List,
    Optional,
    overload,
    Tuple,
    TYPE_CHECKING,
    Union,
)
from io import StringIO
from typing_extensions import Literal
from redcap.request import (
    _ContentConfig,
    _RCRequest,
    RedcapError,
    FileUpload,
    Json,
    EmptyJson,
)
        from pandas.errors import EmptyDataError

            to_import.to_csv(buf, **csv_kwargs)
            payload["data"] = buf.getvalue()
            buf.close()
            import_format = "csv"
        elif import_format == "json":
            payload["data"] = json.dumps(to_import, separators=(",", ":"))
        else:
            # don't do anything to csv/xml
            payload["data"] = to_import

        payload["format"] = import_format
        return payload

    @overload
    def _return_data(
        self,
        response: Json,
        content: Literal[
            "exportFieldNames",
            "formEventMapping",
            "metadata",
            "participantList",
            "project",
            "record",
            "report",
            "user",
        ],
        format_type: Literal["json"],
        df_kwargs: None,
        record_type: Literal["flat", "eav"] = "flat",

    ) -> Json: