o
    i                    @   s  d dl 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
 ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z  ddl!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z. ddl/m0Z0 ddl1m2Z2 ddl3m4Z4 ddl5m6Z6 ddl7m8Z8 ddl9m:Z: e ;e j<dZ=G d d! d!Z>G d"d# d#Z?dS )$    N)JSONDecodeError   )ApiError)AsyncClientWrapperSyncClientWrapper)AsyncHttpResponseHttpResponse)jsonable_encoder)RequestOptions)'convert_and_respect_annotation_metadata)construct_type)BadRequestError)ClientClosedRequestError)ForbiddenError)GatewayTimeoutError)InternalServerError)InvalidTokenError)NotFoundError)NotImplementedError)ServiceUnavailableError)TooManyRequestsError)UnauthorizedError)UnprocessableEntityError)CreateConnectorOAuth)CreateConnectorResponse)CreateConnectorServiceAuth)DeleteConnectorResponse)GetConnectorResponse)ListConnectorsResponse)OAuthAuthorizeResponse)UpdateConnectorResponse.c                   @     e Zd ZdefddZdddddeje deje deje d	e	e
 fd
dZeeeeeedddededeje dejeje  deje deje deje deje deje d	e	e fddZdddedeje d	e	e fddZdddedeje d	e	e fddZeeeeeeedddedeje deje dejeje  deje deje deje deje deje d	e	e fddZddd ded!eje deje d	e	e fd"d#ZdS )$RawConnectorsClientclient_wrapperc                C   
   || _ d S N_client_wrapperselfr#    r*   b/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/cohere/connectors/raw_client.py__init__'      
zRawConnectorsClient.__init__Nlimitoffsetrequest_optionsr/   r0   r1   returnc             	   C   s  | j jjdd||d|d}zd|j  krdk r0n ntttt| d}t	||dW S |jd	krPt
t|jttjtj ttjtj | dd
|jdkrptt|jttjtj ttjtj | dd
|jdkrtt|jttjtj ttjtj | dd
|jdkrtt|jttjtj ttjtj | dd
|jdkrtt|jttjtj ttjtj | dd
|jdkrtt|jttjtj ttjtj | dd
|jdkrtt|jttjtj ttjtj | dd
|jdkr2tt|jttjtj ttjtj | dd
|jdkrStt|jttjtj ttjtj | dd
|jdkrttt|jttjtj ttjtj | dd
|jdkrtt|jttjtj ttjtj | dd
|jdkrtt|jttjtj ttjtj | dd
| }W n ty   t|jt|j|jdw t|jt|j|d)a  
        Returns a list of connectors ordered by descending creation date (newer first). See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.

        Parameters
        ----------
        limit : typing.Optional[float]
            Maximum number of connectors to return [0, 100].

        offset : typing.Optional[float]
            Number of connectors to skip before returning results [0, inf].

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[ListConnectorsResponse]
            OK
        v1/connectorsGETr/   r0   methodparamsr1      ,  type_object_responsedata  headersbody                      status_coderC   rD   )r'   httpx_clientrequestrQ   typingcastr   r   jsonr   r   dictrC   OptionalAnyr   r   r   r   r   r   r   r   r   r   r   r   r   textr)   r/   r0   r1   	_response_data_response_jsonr*   r*   r+   list*   s6  	









































zRawConnectorsClient.listdescriptionexcludesoauthactivecontinue_on_failureservice_authr1   nameurlra   rb   rc   rd   re   rf   c       	         C   s  | j jjdd||||t|tdd||t|tdddddi|	td}
zd	|
j  kr/d
k rDn nt	t
tt
|
 d}t|
|dW S |
jdkrdtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkr&tt|
jt	tjtj ttjtj |
 dd|
jdkrGtt|
jt	tjtj ttjtj |
 dd|
jdkrhtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
 }W n ty   t|
jt|
j|
j dw t|
jt|
j|d)a  
        Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information.

        Parameters
        ----------
        name : str
            A human-readable name for the connector.

        url : str
            The URL of the connector that will be used to search for documents.

        description : typing.Optional[str]
            A description of the connector.

        excludes : typing.Optional[typing.Sequence[str]]
            A list of fields to exclude from the prompt (fields remain in the document).

        oauth : typing.Optional[CreateConnectorOAuth]
            The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.

        active : typing.Optional[bool]
            Whether the connector is active or not.

        continue_on_failure : typing.Optional[bool]
            Whether a chat request should continue or not if the request to this connector fails.

        service_auth : typing.Optional[CreateConnectorServiceAuth]
            The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[CreateConnectorResponse]
            OK
        r3   POSTwriter=   
annotation	directionrg   ra   rh   rb   rc   rd   re   rf   content-typeapplication/jsonr7   rV   rC   r1   omitr9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )!r'   rR   rS   r   r   r   OMITrQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r)   rg   rh   ra   rb   rc   rd   re   rf   r1   r\   r]   r^   r*   r*   r+   create   sP  2








































zRawConnectorsClient.creater1   idc             	   C     | j jjdt| d|d}zd|j  krdk r1n ntttt|	 d}t
||dW S |jdkrQtt|jttjtj ttjtj |	 dd	|jd
krqtt|jttjtj ttjtj |	 dd	|jdkrtt|jttjtj ttjtj |	 dd	|jdkrtt|jttjtj ttjtj |	 dd	|jdkrtt|jttjtj ttjtj |	 dd	|jdkrtt|jttjtj ttjtj |	 dd	|jdkrtt|jttjtj ttjtj |	 dd	|jdkr3tt|jttjtj ttjtj |	 dd	|jdkrTtt|jttjtj ttjtj |	 dd	|jdkrutt|jttjtj ttjtj |	 dd	|jdkrtt|jttjtj ttjtj |	 dd	|jdkrtt|jttjtj ttjtj |	 dd	|	 }W n ty   t|jt|j|jdw t|jt|j|d)a  
        Retrieve a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[GetConnectorResponse]
            OK
        v1/connectors/r4   r7   r1   r9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )r'   rR   rS   r	   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r)   rw   r1   r\   r]   r^   r*   r*   r+   get  0  









































zRawConnectorsClient.getc             	   C   rx   )a  
        Delete a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to delete.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[DeleteConnectorResponse]
            OK
        ry   DELETErz   r9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )r'   rR   rS   r	   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r{   r*   r*   r+   deleteg  r}   zRawConnectorsClient.deleterg   rh   rb   rc   rd   re   rf   r1   c                C   s  | j jjdt| d|||t|tdd||t|tdddddi|	td}
zd	|
j  kr3d
k rHn nt	
ttt|
 d}t|
|dW S |
jdkrhtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkr	tt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkr*tt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrKtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrltt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
 }W n ty   t |
jt|
j|
j!dw t |
jt|
j|d)a  
        Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to update.

        name : typing.Optional[str]
            A human-readable name for the connector.

        url : typing.Optional[str]
            The URL of the connector that will be used to search for documents.

        excludes : typing.Optional[typing.Sequence[str]]
            A list of fields to exclude from the prompt (fields remain in the document).

        oauth : typing.Optional[CreateConnectorOAuth]
            The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.

        active : typing.Optional[bool]

        continue_on_failure : typing.Optional[bool]

        service_auth : typing.Optional[CreateConnectorServiceAuth]
            The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[UpdateConnectorResponse]
            OK
        ry   PATCHrj   rk   rg   rh   rb   rc   rd   re   rf   ro   rp   rq   r9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )"r'   rR   rS   r	   r   r   r   rs   rQ   rT   rU   r    r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r)   rw   rg   rh   rb   rc   rd   re   rf   r1   r\   r]   r^   r*   r*   r+   update  sN  0








































zRawConnectorsClient.updateafter_token_redirectr1   r   c             	   C   s  | j jjdt| ddd|i|d}zd|j  kr dk r5n ntttt|	 d}t
||d	W S |jd
krUtt|jttjtj ttjtj |	 dd|jdkrutt|jttjtj ttjtj |	 dd|jdkrtt|jttjtj ttjtj |	 dd|jdkrtt|jttjtj ttjtj |	 dd|jdkrtt|jttjtj ttjtj |	 dd|jdkrtt|jttjtj ttjtj |	 dd|jdkrtt|jttjtj ttjtj |	 dd|jdkr7tt|jttjtj ttjtj |	 dd|jdkrXtt|jttjtj ttjtj |	 dd|jdkrytt|jttjtj ttjtj |	 dd|jdkrtt|jttjtj ttjtj |	 dd|jdkrtt|jttjtj ttjtj |	 dd|	 }W n ty   t|jt|j|jdw t|jt|j|d)av  
        Authorize the connector with the given ID for the connector oauth app.  See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to authorize.

        after_token_redirect : typing.Optional[str]
            The URL to redirect to after the connector has been authorized.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        HttpResponse[OAuthAuthorizeResponse]
            OK
        ry   /oauth/authorizeri   r   r6   r9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )r'   rR   rS   r	   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r)   rw   r   r1   r\   r]   r^   r*   r*   r+   o_auth_authorize  s4  









































z$RawConnectorsClient.o_auth_authorize)__name__
__module____qualname__r   r,   rT   rX   floatr
   r   r   r_   rs   strSequencer   boolr   r   ru   r   r|   r   r   r    r   r   r   r*   r*   r*   r+   r"   &       
 <	

 ^
 -
 0	

 ^r"   c                   @   r!   )$AsyncRawConnectorsClientr#   c                C   r$   r%   r&   r(   r*   r*   r+   r,     r-   z!AsyncRawConnectorsClient.__init__Nr.   r/   r0   r1   r2   c             	      s  | j jjdd||d|dI dH }zd|j  krdk r4n ntttt| d}t	||d	W S |jd
krTt
t|jttjtj ttjtj | dd|jdkrttt|jttjtj ttjtj | dd|jdkrtt|jttjtj ttjtj | dd|jdkrtt|jttjtj ttjtj | dd|jdkrtt|jttjtj ttjtj | dd|jdkrtt|jttjtj ttjtj | dd|jdkrtt|jttjtj ttjtj | dd|jdkr6tt|jttjtj ttjtj | dd|jdkrWtt|jttjtj ttjtj | dd|jdkrxtt|jttjtj ttjtj | dd|jdkrtt|jttjtj ttjtj | dd|jdkrtt|jttjtj ttjtj | dd| }W n ty   t|jt|j|jdw t|jt|j|d)a  
        Returns a list of connectors ordered by descending creation date (newer first). See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.

        Parameters
        ----------
        limit : typing.Optional[float]
            Maximum number of connectors to return [0, 100].

        offset : typing.Optional[float]
            Number of connectors to skip before returning results [0, inf].

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[ListConnectorsResponse]
            OK
        r3   r4   r5   r6   Nr9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )r'   rR   rS   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r[   r*   r*   r+   r_     s8  	









































zAsyncRawConnectorsClient.listr`   rg   rh   ra   rb   rc   rd   re   rf   c       	            s  | j jjdd||||t|tdd||t|tdddddi|	tdI d	H }
zd
|
j  kr3dk rHn nt	t
tt
|
 d}t|
|dW S |
jdkrhtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkr	tt|
jt	tjtj ttjtj |
 dd|
jdkr*tt|
jt	tjtj ttjtj |
 dd|
jdkrKtt|
jt	tjtj ttjtj |
 dd|
jdkrltt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
jdkrtt|
jt	tjtj ttjtj |
 dd|
 }W n ty   t|
jt|
j|
j dw t|
jt|
j|d)a  
        Creates a new connector. The connector is tested during registration and will cancel registration when the test is unsuccessful. See ['Creating and Deploying a Connector'](https://docs.cohere.com/v1/docs/creating-and-deploying-a-connector) for more information.

        Parameters
        ----------
        name : str
            A human-readable name for the connector.

        url : str
            The URL of the connector that will be used to search for documents.

        description : typing.Optional[str]
            A description of the connector.

        excludes : typing.Optional[typing.Sequence[str]]
            A list of fields to exclude from the prompt (fields remain in the document).

        oauth : typing.Optional[CreateConnectorOAuth]
            The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.

        active : typing.Optional[bool]
            Whether the connector is active or not.

        continue_on_failure : typing.Optional[bool]
            Whether a chat request should continue or not if the request to this connector fails.

        service_auth : typing.Optional[CreateConnectorServiceAuth]
            The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[CreateConnectorResponse]
            OK
        r3   ri   rj   rk   rn   ro   rp   rq   Nr9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )!r'   rR   rS   r   r   r   rs   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   rt   r*   r*   r+   ru   [  sR  2








































zAsyncRawConnectorsClient.createrv   rw   c             	        | j jjdt| d|dI dH }zd|j  kr dk r5n ntttt|	 d}t
||dW S |jd	krUtt|jttjtj ttjtj |	 dd
|jdkrutt|jttjtj ttjtj |	 dd
|jdkrtt|jttjtj ttjtj |	 dd
|jdkrtt|jttjtj ttjtj |	 dd
|jdkrtt|jttjtj ttjtj |	 dd
|jdkrtt|jttjtj ttjtj |	 dd
|jdkrtt|jttjtj ttjtj |	 dd
|jdkr7tt|jttjtj ttjtj |	 dd
|jdkrXtt|jttjtj ttjtj |	 dd
|jdkrytt|jttjtj ttjtj |	 dd
|jdkrtt|jttjtj ttjtj |	 dd
|jdkrtt|jttjtj ttjtj |	 dd
|	 }W n ty   t|jt|j|jdw t|jt|j|d)a  
        Retrieve a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to retrieve.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[GetConnectorResponse]
            OK
        ry   r4   rz   Nr9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )r'   rR   rS   r	   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r{   r*   r*   r+   r|   7  2  









































zAsyncRawConnectorsClient.getc             	      r   )a  
        Delete a connector by ID. See ['Connectors'](https://docs.cohere.com/docs/connectors) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to delete.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[DeleteConnectorResponse]
            OK
        ry   r~   rz   Nr9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )r'   rR   rS   r	   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r{   r*   r*   r+   r     r   zAsyncRawConnectorsClient.deleter   c                   s  | j jjdt| d|||t|tdd||t|tdddddi|	tdI d	H }
zd
|
j  kr7dk rLn nt	
ttt|
 d}t|
|dW S |
jdkrltt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkr.tt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrOtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrptt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
jdkrtt|
jt	
t	jt	j tt	jt	j |
 dd|
 }W n ty   t |
jt|
j|
j!dw t |
jt|
j|d)a  
        Update a connector by ID. Omitted fields will not be updated. See ['Managing your Connector'](https://docs.cohere.com/docs/managing-your-connector) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to update.

        name : typing.Optional[str]
            A human-readable name for the connector.

        url : typing.Optional[str]
            The URL of the connector that will be used to search for documents.

        excludes : typing.Optional[typing.Sequence[str]]
            A list of fields to exclude from the prompt (fields remain in the document).

        oauth : typing.Optional[CreateConnectorOAuth]
            The OAuth 2.0 configuration for the connector. Cannot be specified if service_auth is specified.

        active : typing.Optional[bool]

        continue_on_failure : typing.Optional[bool]

        service_auth : typing.Optional[CreateConnectorServiceAuth]
            The service to service authentication configuration for the connector. Cannot be specified if oauth is specified.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[UpdateConnectorResponse]
            OK
        ry   r   rj   rk   r   ro   rp   rq   Nr9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )"r'   rR   rS   r	   r   r   r   rs   rQ   rT   rU   r    r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r   r*   r*   r+   r     sP  0








































zAsyncRawConnectorsClient.updater   r   c             	      s  | j jjdt| ddd|i|dI dH }zd|j  kr$dk r9n ntttt|	 d	}t
||d
W S |jdkrYtt|jttjtj ttjtj |	 d	d|jdkrytt|jttjtj ttjtj |	 d	d|jdkrtt|jttjtj ttjtj |	 d	d|jdkrtt|jttjtj ttjtj |	 d	d|jdkrtt|jttjtj ttjtj |	 d	d|jdkrtt|jttjtj ttjtj |	 d	d|jdkrtt|jttjtj ttjtj |	 d	d|jdkr;tt|jttjtj ttjtj |	 d	d|jdkr\tt|jttjtj ttjtj |	 d	d|jdkr}tt|jttjtj ttjtj |	 d	d|jdkrtt|jttjtj ttjtj |	 d	d|jdkrtt|jttjtj ttjtj |	 d	d|	 }W n ty   t|jt|j|jdw t|jt|j|d)a{  
        Authorize the connector with the given ID for the connector oauth app.  See ['Connector Authentication'](https://docs.cohere.com/docs/connector-authentication) for more information.

        Parameters
        ----------
        id : str
            The ID of the connector to authorize.

        after_token_redirect : typing.Optional[str]
            The URL to redirect to after the connector has been authorized.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        AsyncHttpResponse[OAuthAuthorizeResponse]
            OK
        ry   r   ri   r   r6   Nr9   r:   r;   r>   rA   rB   rE   rF   rG   rH   rI   rJ   rK   rL   rM   rN   rO   rP   )r'   rR   rS   r	   rQ   rT   rU   r   r   rV   r   r   rW   rC   rX   rY   r   r   r   r   r   r   r   r   r   r   r   r   r   rZ   r   r*   r*   r+   r   f  s6  









































z)AsyncRawConnectorsClient.o_auth_authorize)r   r   r   r   r,   rT   rX   r   r
   r   r   r_   rs   r   r   r   r   r   r   ru   r   r|   r   r   r    r   r   r   r*   r*   r*   r+   r     r   r   )@rT   json.decoderr   core.api_errorr   core.client_wrapperr   r   core.http_responser   r   core.jsonable_encoderr	   core.request_optionsr
   core.serializationr   core.unchecked_base_modelr   errors.bad_request_errorr   "errors.client_closed_request_errorr   errors.forbidden_errorr   errors.gateway_timeout_errorr   errors.internal_server_errorr   errors.invalid_token_errorr   errors.not_found_errorr   errors.not_implemented_errorr    errors.service_unavailable_errorr   errors.too_many_requests_errorr   errors.unauthorized_errorr   !errors.unprocessable_entity_errorr   types.create_connector_o_authr   types.create_connector_responser   #types.create_connector_service_authr   types.delete_connector_responser   types.get_connector_responser   types.list_connectors_responser   types.o_auth_authorize_responser   types.update_connector_responser    rU   rY   rs   r"   r   r*   r*   r*   r+   <module>   sR            