
    ZTh                        d dl mZ d dlmZ d dlmZmZmZmZm	Z	m
Z
mZmZmZmZmZmZmZ d dlmZmZmZmZmZmZmZ d dlmZ  e         G d dee      Zy)	    )annotations)!_sift_client_experimental_warning)	AssetsAPIAssetsAPIAsyncCalculatedChannelsAPICalculatedChannelsAPIAsyncChannelsAPIChannelsAPIAsyncIngestionAPIAsyncPingAPIPingAPIAsyncRulesAPIRulesAPIAsyncRunsAPIRunsAPIAsync)
GrpcClient
GrpcConfig
RestClient
RestConfigSiftConnectionConfigWithGrpcClientWithRestClient)	AsyncAPIsc                      e Zd ZU dZded<   	 ded<   	 ded<   	 ded	<   	 d
ed<   	 ded<   	 ded<   	 ded<   	 	 	 	 	 d	 	 	 	 	 	 	 ddZedd       Zedd       Zy)
SiftClienta  SiftClient is a high-level client for interacting with Sift's APIs.

    It provides both synchronous and asynchronous interfaces, strong type checking, and a Pythonic API design.

    !!! warning
        The Sift Client is experimental and is subject to change.

    Examples:
        from sift_client import SiftClient
        from datetime import datetime

        # Initialize with individual parameters
        client = SiftClient(
            api_key="your-api-key",
            grpc_url="your-sift-grpc-url",
            rest_url="your-sift-rest-url")

        # Or use a connection configuration to customize connection behavior
        connection_config = SiftConnectionConfig(
            grpc_config=GrpcConfig(),
            rest_config=RestConfig())

        sift = SiftClient(connection_config=connection_config)

        # Use the client to make requests
        response = sift.ping.ping()

        # Or asynchronously
        response = await sift.async_.ping.ping()
    r   pingr   assetsr   calculated_channelsr	   channelsr   	ingestionr   rulesr   runsr   async_Nc                   |r|r|s|st        d      |r3t        |j                               }t        |j	                               }n<|r/|r-|r+t        t        ||            }t        t        ||            }nt        d      t        j                  | |       t        j                  | |       t        |       | _        t        |       | _        t        |       | _        t!        |       | _        t%        |       | _        t)        |       | _        t-        |       | _        t1        t3        |       t5        |       t7        |       t9        |       t%        |       t;        |       t=        |             | _        y)av  Initialize the SiftClient with specific connection parameters or a connection_config.

        Args:
            api_key: The Sift API key for authentication.
            grpc_url: The Sift gRPC API URL.
            rest_url: The Sift REST API URL.
            connection_config: A SiftConnectionConfig object to configure the connection behavior of the SiftClient.
        zfEither api_key, grpc_url and rest_url or connection_config must be provided to establish a connection.zgInvalid connection configuration. Please provide api_key, grpc_uri and rest_uri or a connection_config.)grpc_client)rest_client)r   r   r   r   r    r!   r"   N) 
ValueErrorr   get_grpc_configr   get_rest_configr   r   r   __init__r   r   r   r   r   r   r   r	   r   r   r    r   r!   r   r"   r   r   r   r   r
   r   r   r#   )selfapi_keygrpc_urlrest_urlconnection_configr%   r&   s          W/home/www/backend.miabetepe.com/venv/lib/python3.12/site-packages/sift_client/client.pyr*   zSiftClient.__init__\   s=    H;Lx  $%6%F%F%HIK$%6%F%F%HIKh$Z'%BCK$Z'%BCKy  	+>+>DM	o#8#> #D)*40d^
DM	  d#!$' :4 @%d+'-%d#
    c                    | j                   S )zAThe gRPC client used by the SiftClient for making gRPC API calls.)_grpc_clientr+   s    r0   r%   zSiftClient.grpc_client           r1   c                    | j                   S )zAThe REST client used by the SiftClient for making REST API calls.)_rest_clientr4   s    r0   r&   zSiftClient.rest_client   r5   r1   )NNNN)r,   
str | Noner-   r8   r.   r8   r/   zSiftConnectionConfig | None)returnr   )r9   r   )	__name__
__module____qualname____doc____annotations__r*   propertyr%   r&    r1   r0   r   r   !   s    > MCE..RG  HOD
MCq ###9=3
3
 3
 	3

 73
j ! ! ! !r1   r   N)
__future__r   sift_client.errorsr   sift_client.resourcesr   r   r   r   r	   r
   r   r   r   r   r   r   r   sift_client.transportr   r   r   r   r   r   r   sift_client.util.utilr   r   r@   r1   r0   <module>rF      sK    " @      , ! #x!x!r1   