"""
 cellpointapi

 This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
"""
from __future__ import annotations

from typing import Union

from apimatic_core.adapters.request_adapter import (
    to_unified_request,
    to_unified_request_async,
)
from apimatic_core.adapters.types.django_request_like import (
    DjangoRequestLike,
)
from apimatic_core.adapters.types.flask_request_like import (
    FlaskRequestLike,
)
from apimatic_core.adapters.types.starlette_request_like import (
    StarletteRequestLike,
)

from cellpointapi.http.request import Request


def to_core_request(request: Union[FlaskRequestLike, DjangoRequestLike]) -> Request:
    """
     Convert a synchronous Flask or Django request into a core `Request`.

    :param request: A request object compatible with Flask or Django frameworks.
    :type request: Union[FlaskRequestLike, DjangoRequestLike]

    :return: A framework-agnostic `Request` object representing the HTTP request.
    :rtype: Request
    """
    return to_unified_request(request)

async def to_core_request_async(
    request: Union[StarletteRequestLike, FlaskRequestLike, DjangoRequestLike],
) -> Request:
    """
     Convert an async Starlette (used in FastApi framework), Flask, or Django request
    into a core `Request`

    :param request: A request object compatible with FastApi, Flask, or Django
                    frameworks.
    :type request: Union[StarletteRequestLike, FlaskRequestLike, DjangoRequestLike]

    :return: A framework-agnostic `Request` object representing the HTTP request.
    :rtype: Request
    """
    return await to_unified_request_async(request)
