o
    ,Âif7
  ã                   @   sˆ   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 er:d d	lmZ G d
d„ de
ƒZdS )é    )ÚTYPE_CHECKINGÚCallable)ÚSelf)ÚClientCredential)ÚUserCredential)ÚClientObject)Ú
EntityPath)ÚDeleteEntityQuery)ÚUpdateEntityQuery)ÚClientContextc                       sr   e Zd ZdZddd„Zddd„Zd	d
„ Zdd„ Zdd„ Ze	dd„ ƒZ
e	dd„ ƒZe	dd„ ƒZd‡ fdd„	Z‡  ZS )ÚEntityzSharePoint specific entityé   c                 C   ó   | j  |¡ | S )zHandles throttling requests.)ÚcontextÚ$execute_query_with_incremental_retry)ÚselfÚ	max_retry© r   úT/var/www/html/corbot_env/lib/python3.10/site-packages/office365/sharepoint/entity.pyr      s   z+Entity.execute_query_with_incremental_retryéd   Nc                 C   s   | j  ||¡S )z0Construct and submit to a server a batch request)r   Úexecute_batch)r   Úitems_per_batchÚsuccess_callbackr   r   r   r      s   zEntity.execute_batchc                 C   r   )ú )r   Úwith_credentials)r   Úcredentialsr   r   r   r      s   zEntity.with_credentialsc                 C   s    t | ƒ}| j |¡ |  ¡  | S )z1The recommended way to delete a SharePoint entity)r	   r   Ú	add_queryÚremove_from_parent_collection)r   Úqryr   r   r   Údelete_object#   s   zEntity.delete_objectc                 G   s   t | ƒ}| j |¡ | S )z1The recommended way to update a SharePoint entity)r
   r   r   )r   Úargsr   r   r   r   Úupdate*   s   zEntity.updatec                 C   s   | j S ©N)Ú_context©r   r   r   r   r   0   s   zEntity.contextc                 C   s&   | j d u rd dt| ƒjg¡| _ | j S )NÚ.ÚSP)Ú_entity_type_nameÚjoinÚtypeÚ__name__r$   r   r   r   Úentity_type_name5   s   
zEntity.entity_type_namec                 C   s   dS )NÚIdr   r$   r   r   r   Úproperty_ref_name;   s   zEntity.property_ref_nameTc                    sX   t t| ƒ |||¡ || jkr*| jd u r$| jr!t|| jjƒ| _| S 	 | S | j |¡ | S r"   )	Úsuperr   Úset_propertyr-   Úresource_pathÚparent_collectionr   Ú_resource_pathÚpatch)r   ÚnameÚvalueÚpersist_changes©Ú	__class__r   r   r/   ?   s   

ÿýÿzEntity.set_property)r   )r   N)T)r*   Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r!   Úpropertyr   r+   r-   r/   Ú__classcell__r   r   r7   r   r      s    




r   N)Útypingr   r   Útyping_extensionsr   Ú(office365.runtime.auth.client_credentialr   Ú&office365.runtime.auth.user_credentialr   Úoffice365.runtime.client_objectr   Ú!office365.runtime.paths.v3.entityr   Ú'office365.runtime.queries.delete_entityr	   Ú'office365.runtime.queries.update_entityr
   Ú#office365.sharepoint.client_contextr   r   r   r   r   r   Ú<module>   s    