
    ZThN                        d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
mZ erd dlZ G d d      Z G d	 d
e      Z G d de      Zy)    )annotations)ABC)TYPE_CHECKING)
GrpcClient
GrpcConfig)
RestClient
RestConfigNc                  <    e Zd ZdZ	 	 d	 	 	 	 	 	 	 	 	 ddZd Zd Zy)SiftConnectionConfigzConfiguration for Grpc and Rest connections.

    This class provides a unified configuration for both gRPC and REST connections,
    allowing for consistent settings across different transport protocols.
    c                J    || _         || _        || _        || _        || _        y)ar  Initialize the connection configuration.

        Args:
            grpc_url: The URL for the gRPC service.
            rest_url: The URL for the REST service.
            api_key: The API key for authentication.
            use_ssl: Whether to use SSL/TLS for secure connections.
            cert_via_openssl: Whether to use OpenSSL for certificate validation.
        N)api_keygrpc_urlrest_urluse_sslcert_via_openssl)selfr   r   r   r   r   s         j/home/www/backend.miabetepe.com/venv/lib/python3.12/site-packages/sift_client/transport/base_connection.py__init__zSiftConnectionConfig.__init__   s(    "    0    c                p    t        | j                  | j                  | j                  | j                        S )zCreate and return a GrpcConfig with the current settings.

        Returns:
            A GrpcConfig object configured with this instance's settings.
        )urlr   r   r   )r   r   r   r   r   r   s    r   get_grpc_configz$SiftConnectionConfig.get_grpc_config+   s/     LLLL!22	
 	
r   c                p    t        | j                  | j                  | j                  | j                        S )zCreate and return a RestConfig with the current settings.

        Returns:
            A RestConfig object configured with this instance's settings.
        )base_urlr   r   r   )r	   r   r   r   r   r   s    r   get_rest_configz$SiftConnectionConfig.get_rest_config8   s/     ]]LLLL!22	
 	
r   N)FF)
r   strr   r   r   r   r   boolr   r   )__name__
__module____qualname____doc__r   r   r    r   r   r   r      sN     !&11 1 	1
 1 1.

r   r   c                  ,    e Zd ZU dZded<   ddZddZy)	WithGrpcClientzAbstract base class for classes that require a gRPC client.

    This class provides access to a gRPC client for making API calls.
    r   _grpc_clientc                    || _         y)zuInitialize with a gRPC client.

        Args:
            grpc_client: The gRPC client to use for API calls.
        N)r&   )r   grpc_clients     r   r   zWithGrpcClient.__init__N        (r   c                .    | j                   j                  S )zwGets the default asyncio loop used by the gRPC client.

        Returns:
            The default asyncio loop.
        )r&   default_loopr   s    r   get_asyncio_loopzWithGrpcClient.get_asyncio_loopV   s       ---r   N)r(   r   )returnzasyncio.AbstractEventLoop)r   r    r!   r"   __annotations__r   r,   r#   r   r   r%   r%   F   s    
 (.r   r%   c                  $    e Zd ZU dZded<   ddZy)WithRestClientzAbstract base class for classes that require a REST client.

    This class provides access to a REST client for making API calls.
    r   _rest_clientc                    || _         y)zuInitialize with a REST client.

        Args:
            rest_client: The REST client to use for API calls.
        N)r1   )r   rest_clients     r   r   zWithRestClient.__init__g   r)   r   N)r3   r   )r   r    r!   r"   r.   r   r#   r   r   r0   r0   _   s    
 (r   r0   )
__future__r   abcr   typingr   $sift_client.transport.grpc_transportr   r   $sift_client.transport.rest_transportr   r	   asyncior   r%   r0   r#   r   r   <module>r:      s=    "    G G6
 6
r.S .2(S (r   