
    i@b                         d Z ddlmZ ddlmZmZ ddlmZ ddlm	Z	m
Z
 ddlmZ ddlmZ dd	lmZmZmZ  G d
 de      Zy)zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )BaseSDK    )modelsutils)HookContext)OptionalNullableUNSET)get_security_from_env)unmarshal_json_response)AnyMappingOptionalc                      e Zd ZdZedddddedeej                     de	e   de	e
   de	eeef      d	ej                  fd
Zedddddedeej                     de	e   de	e
   de	eeef      d	ej                  fdZedddddededej                   dedej"                  deej                     de	e   de	e
   de	eeef      d	ej$                  fdZedddddededej                   dedej"                  deej                     de	e   de	e
   de	eeef      d	ej$                  fdZedddddedededej"                  deej                     de	e   de	e
   de	eeef      d	ej$                  fdZedddddedededej"                  deej                     de	e   de	e
   de	eeef      d	ej$                  fdZy)Accessesz2(beta) Libraries API - manage access to a library.N)retries
server_url
timeout_mshttp_headers
library_idr   r   r   r   returnc                   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  |      }| j                  dd|||ddddd|| j                   j                  |	      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t        j                        r|g d
f}
| j                  t        | j                   |xs ddg t        | j                   j                  t        j                              |	g d|
      }d}t        j                   |dd      rt#        t        j$                  |      S t        j                   |dd      r0t#        t        j&                  |      }t        j(                  ||      t        j                   |dd      r,t        j*                  |      }t        j,                  d||      t        j                   |dd      r,t        j*                  |      }t        j,                  d||      t        j,                  d|      a  List all of the access to this library.

        Given a library, list all of the Entity that have access and to what level.

        :param library_id:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        N)r   GET /v1/libraries/{library_id}/shareFT
user-agentapplication/json)methodpathbase_urlurl_variablesrequestrequest_body_requiredrequest_has_path_paramsrequest_has_query_paramsuser_agent_headeraccept_header_valuer   securityr   429500502503504 libraries_share_list_v1configr   operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr!   error_status_codesretry_config200r6   r7   *API error occurredr8   Unexpected response received)sdk_configurationr   _get_urlr   LibrariesShareListV1Request_build_requestr'   r	   r<   
isinstancer   RetryConfig
do_requestr   r
   Securitymatch_responser   ListSharingOutHTTPValidationErrorDataHTTPValidationErrorstream_to_textSDKErrorselfr   r   r   r   r   r   r    r!   reqr<   http_resresponse_datahttp_res_texts                 P/var/www/html/eduruby.in/venv/lib/python3.12/site-packages/mistralai/accesses.pylistzAccesses.list   s-   & //::J!!H}}X}=H44!
 !!3'"'$(%)* 2%++44! " 
  e%%22%?00==gu001#%HIL?? --!R6  5**33V__! 4% # 
 "%1CD*6+@+@(KK%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGG    c                  K   d}d}|| j                   j                  }||}n| j                  ||      }t        j                  |      }| j                  dd|||ddddd|| j                   j                  |	      }	|t        k(  r2| j                   j                  t        ur| j                   j                  }d}
t        |t        j                        r|g d
f}
| j                  t        | j                   |xs ddg t        | j                   j                  t        j                              |	g d|
       d{   }d}t        j                   |dd      rt#        t        j$                  |      S t        j                   |dd      r0t#        t        j&                  |      }t        j(                  ||      t        j                   |dd      r4t        j*                  |       d{   }t        j,                  d||      t        j                   |dd      r4t        j*                  |       d{   }t        j,                  d||      t        j,                  d|      7 +7 7 6wr   )rA   r   rB   r   rC   _build_request_asyncr'   r	   r<   rE   r   rF   do_request_asyncr   r
   rH   rI   r   rJ   rK   rL   stream_to_text_asyncrN   rO   s                 rU   
list_asynczAccesses.list_asynch   sQ    & //::J!!H}}X}=H44!
 ''3'"'$(%)* 2%++44! ( 
  e%%22%?00==gu001#%HIL.. --!R6  5**33V__! 4% / 
 
 "%1CD*6+@+@(KK%1CD3..M ,,]HEE%5"'"<"<X"FFM//"6-PP%5"'"<"<X"FFM//"6-PPoo<hGG=
0 G Gs8   D;I/=I(>B-I/+I+,A
I/6I-72I/+I/-I/org_idlevelshare_with_uuidshare_with_typec       	            d}
d}|| j                   j                  }||}
n| j                  |
|      }
t        j                  |t        j
                  ||||            | j                  dd|
|ddddd|	| j                   j                  fd	|
      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g df}| j                  t        | j                   |
xs ddg t        | j                   j                  t        j                               |g d|      }d}t        j"                  |dd      rt%        t        j&                  |      S t        j"                  |dd      r0t%        t        j(                  |      }t        j*                  ||      t        j"                  |dd      r,t        j,                  |      }t        j.                  d||      t        j"                  |dd      r,t        j,                  |      }t        j.                  d||      t        j.                  d|      )j  Create or update an access level.

        Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.

        :param library_id:
        :param org_id:
        :param level:
        :param share_with_uuid: The id of the entity (user, workspace or organization) to share with
        :param share_with_type: The type of entity, used to share a library.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr]   r^   r_   r`   r   
sharing_inPUTr   Tr   r   c                  f    t        j                   j                  dddt        j                        S NFjsonr   serialize_request_bodyre   r   	SharingInr!   s   rU   <lambda>z+Accesses.update_or_create.<locals>.<lambda>   )    (D(D""E5&&:J:J) rW   r   r   r   r    r!   r"   r#   r$   r%   r&   r   r'   get_serialized_bodyr   r(   r.   libraries_share_create_v1r0   r5   r9   r=   r6   r7   r>   r?   r8   r@   )rA   r   rB   r   LibrariesShareCreateV1Requestrl   rD   r'   r	   r<   rE   r   rF   rG   r   r
   rH   rI   r   
SharingOutrK   rL   rM   rN   rP   r   r]   r^   r_   r`   r   r   r   r   r   r    rQ   r<   rR   rS   rT   r!   s                    @rU   update_or_createzAccesses.update_or_create   sO   6 //::J!!H}}X}=H66!'' / /	
 !!3'"&$(%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? --!R8  5**33V__! 4% # 
 "%1CD*6+<+<hGG%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGGrW   c       	           K   d}
d}|| j                   j                  }||}
n| j                  |
|      }
t        j                  |t        j
                  ||||            | j                  dd|
|ddddd|	| j                   j                  fd	|
      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g df}| j                  t        | j                   |
xs ddg t        | j                   j                  t        j                               |g d|       d{   }d}t        j"                  |dd      rt%        t        j&                  |      S t        j"                  |dd      r0t%        t        j(                  |      }t        j*                  ||      t        j"                  |dd      r4t        j,                  |       d{   }t        j.                  d||      t        j"                  |dd      r4t        j,                  |       d{   }t        j.                  d||      t        j.                  d|      7 +7 7 6w)rb   Nrc   rd   rf   r   Tr   r   c                  f    t        j                   j                  dddt        j                        S rh   rj   rm   s   rU   rn   z1Accesses.update_or_create_async.<locals>.<lambda>g  ro   rW   rp   r(   r.   rr   r0   r5   r9   r=   r6   r7   r>   r?   r8   r@   )rA   r   rB   r   rs   rl   rY   r'   r	   r<   rE   r   rF   rZ   r   r
   rH   rI   r   rt   rK   rL   r[   rN   ru   s                    @rU   update_or_create_asynczAccesses.update_or_create_async+  ss    6 //::J!!H}}X}=H66!'' / /	
 ''3'"&$(%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. --!R8  5**33V__! 4% / 
 
 "%1CD*6+<+<hGG%1CD3..M ,,]HEE%5"'"<"<X"FFM//"6-PP%5"'"<"<X"FFM//"6-PPoo<hGG=
0 G Gs8   EJJB-JJ	A
JJ
2JJ
Jc                   d}	d}
|| j                   j                  }||}	n| j                  |	|
      }	t        j                  |t        j
                  |||            | j                  dd|	|
ddddd|| j                   j                  fd	|
      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g df}| j                  t        | j                   |	xs ddg t        | j                   j                  t        j                               |g d|      }d}t        j"                  |dd      rt%        t        j&                  |      S t        j"                  |dd      r0t%        t        j(                  |      }t        j*                  ||      t        j"                  |dd      r,t        j,                  |      }t        j.                  d||      t        j"                  |dd      r,t        j,                  |      }t        j.                  d||      t        j.                  d|      )  Delete an access level.

        Given a library id, you can delete the access level of an entity. An owner cannot delete it's own access. You have to be the owner of the library to delete an acces other than yours.

        :param library_id:
        :param org_id:
        :param share_with_uuid: The id of the entity (user, workspace or organization) to share with
        :param share_with_type: The type of entity, used to share a library.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr]   r_   r`   r   sharing_deleteDELETEr   Tr   r   c                  f    t        j                   j                  dddt        j                        S rh   r   rk   r~   r   SharingDeleterm   s   rU   rn   z!Accesses.delete.<locals>.<lambda>  )    (D(D&&uff>R>R) rW   rp   r(   r.   libraries_share_delete_v1r0   r5   r9   r=   r6   r7   r>   r?   r8   r@   )rA   r   rB   r   LibrariesShareDeleteV1Requestr   rD   r'   r	   r<   rE   r   rF   rG   r   r
   rH   rI   r   rt   rK   rL   rM   rN   rP   r   r]   r_   r`   r   r   r   r   r   r    rQ   r<   rR   rS   rT   r!   s                   @rU   deletezAccesses.delete  sL   2 //::J!!H}}X}=H66!!// / /
 !!3'"&$(%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? --!R8  5**33V__! 4% # 
 "%1CD*6+<+<hGG%1CD3..M ,,]HEE%5!00:M//"6-PP%5!00:M//"6-PPoo<hGGrW   c                  K   d}	d}
|| j                   j                  }||}	n| j                  |	|
      }	t        j                  |t        j
                  |||            | j                  dd|	|
ddddd|| j                   j                  fd	|
      }|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g df}| j                  t        | j                   |	xs ddg t        | j                   j                  t        j                               |g d|       d{   }d}t        j"                  |dd      rt%        t        j&                  |      S t        j"                  |dd      r0t%        t        j(                  |      }t        j*                  ||      t        j"                  |dd      r4t        j,                  |       d{   }t        j.                  d||      t        j"                  |dd      r4t        j,                  |       d{   }t        j.                  d||      t        j.                  d|      7 +7 7 6w)r{   Nr|   r}   r   r   Tr   r   c                  f    t        j                   j                  dddt        j                        S rh   r   rm   s   rU   rn   z'Accesses.delete_async.<locals>.<lambda>5  r   rW   rp   r(   r.   r   r0   r5   r9   r=   r6   r7   r>   r?   r8   r@   )rA   r   rB   r   r   r   rY   r'   r	   r<   rE   r   rF   rZ   r   r
   rH   rI   r   rt   rK   rL   r[   rN   r   s                   @rU   delete_asynczAccesses.delete_async  sp    2 //::J!!H}}X}=H66!!// / /
 ''3'"&$(%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. --!R8  5**33V__! 4% / 
 
 "%1CD*6+<+<hGG%1CD3..M ,,]HEE%5"'"<"<X"FFM//"6-PP%5"'"<"<X"FFM//"6-PPoo<hGG=
0 G Gs8   EJJB-JJA
JJ	2JJ	J)__name__
__module____qualname____doc__r	   strr   r   rF   r   intr   r   rJ   rV   r\   	ShareEnum
EntityTypert   rv   ry   r   r    rW   rU   r   r      s   = 8=$($(48WH WH "%"3"34	WH
 SMWH SMWH wsCx01WH 
		WHz 8=$($(48WH WH "%"3"34	WH
 SMWH SMWH wsCx01WH 
		WHB 8=$($(48hH hH 	hH
 hH hH  **hH "%"3"34hH SMhH SMhH wsCx01hH 
		hHd 8=$($(48hH hH 	hH
 hH hH  **hH "%"3"34hH SMhH SMhH wsCx01hH 
		hHb 8=$($(48eH eH 	eH
 eH  **eH "%"3"34eH SMeH SMeH wsCx01eH 
		eH\ 8=$($(48eH eH 	eH
 eH  **eH "%"3"34eH SMeH SMeH wsCx01eH 
		eHrW   r   N)r   basesdkr   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   mistralai.utilsr
   'mistralai.utils.unmarshal_json_responser   typingr   r   r   r   r   rW   rU   <module>r      s0    G  # ( 3 1 K ) )U	Hw U	HrW   