Ë
    daºiÇ ã                   ó¤   — d dl 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 j                  e«      Z G d	„ d
e«      Z G d„ de«      Zy)é    N)ÚEnum)ÚOptional)Ú
deprecated)Ú	HTTPError)ÚCloudé   )ÚBitbucketBasec                   ó   — e Zd ZdZdZdZdZy)ÚMergeStrategyzA
    Merge strategies used by the merge_pull_request method.
    Úmerge_commitÚsquashÚfast_forwardN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚMERGE_COMMITÚSQUASHÚFAST_FORWARD© ó    úT/var/www/timesheet/venv/lib/python3.12/site-packages/atlassian/bitbucket/__init__.pyr   r      s   „ ñð "€LØ€FØ!�Lr   r   c                   ó²	  ‡ — e Zd Zˆ fd„Zd„ Zd÷d„Zdød„Zdùd„Zd„ Zd„ Z	d	„ Z
død
„Zdúd„Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd÷d„Zdûd„Zdùd„Zdüd„Zdûd„Zd„ Z d „ Z!d!„ Z"d"„ Z#d#„ Z$dýd$„Z%dýd%„Z&dþd&„Z'd'„ Z(dþd(„Z)d)„ Z*d*„ Z+d+„ Z,d,„ Z-dþd-„Z.d.„ Z/d/„ Z0d0„ Z1d1„ Z2d2„ Z3d3„ Z4dþd4„Z5d5„ Z6d6„ Z7d7„ Z8d8„ Z9d9„ Z:d÷d:„Z;d;„ Z<d<„ Z=d=„ Z>d>„ Z?d?„ Z@dùd@„ZAdûdA„ZBdÿdB„ZCdC„ ZD�d dE„ZEdûdF„ZFdG„ ZGdH„ ZHdI„ ZIdJ„ ZJdK„ ZKdL„ ZLdM„ ZMdN„ ZNdþdO„ZOdP„ ZPdþdQ„ZQdR„ ZRdS„ ZSdT„ ZTdþdU„ZUdV„ ZVdW„ ZWdX„ ZXdY„ ZYdZ„ ZZd[„ Z[d\„ Z\d]„ Z]d^„ Z^dùd_„Z_d÷d`„Z`	 	 	 	 	 	 	 �dda„Zadb„ Zbdc„ Zcdd„ Zddüde„Zed÷df„Zfd÷dg„Zg	 	 	 	 �ddh„Zhd÷di„Zi	 d÷dj„Zjdk„ Zkdl„ Zl	 	 	 dþdm„Zmdn„ Zndo„ Zodp„ Zpdq„ Zq	 	 �ddr„Zr	 d÷ds„Zsdt„ Ztdu„ Zudv„ Zvdw„ Zwdx„ Zxdy„ Zydz„ Zzd{„ Z{	 �dd|„Z|d}„ Z}	 	 �dd~„Z~d„ Zd€„ Z€d�„ Z� e‚d‚dƒ¬„«      d…„ «       Zƒd†„ Z„d‡„ Z…	 	 dùdˆ„Z†	 	 dùd‰„Z‡	 	 dùdŠ„Zˆd‹„ Z‰	 	 dùdŒ„ZŠd�e‹dŽe‹d�eŒd�e‹d‘e‹d’e�eŽ   fd“„Z�	 	 	 	 	 	 	 �dd”„Z�d•„ Z‘d–„ Z’	 d÷d—„Z“d˜„ Z”d™„ Z•dš„ Z– e‚d›dœ¬„«      d�„ «       Z—dž„ Z˜d’e‹fdŸ„Z™d�e‹dŽe‹d�eŒd eŽd¡e‹d’eŽfd¢„Zšd�e‹dŽe‹d�eŒd’e�eŽ   fd£„Z›d¤„ Zœd¥„ Z�d¦„ Zžd§„ ZŸd¨„ Z d©„ Z¡dª„ Z¢dûd«„Z£d¬„ Z¤dDe¥�jL                  dfd­„Z§d®„ Z¨d¯„ Z©d°„ Zªdþd±„Z«d²„ Z¬d³„ Z­dûd´„Z®	 	 	 	 	 	 	 	 	 	 	 	 �ddµ„Z¯�dd¶„Z°�dd·„Z±	 	 dûd¸„Z²d÷d¹„Z³dº„ Z´d»„ Zµ	 	 dùd¼„Z¶d½„ Z·d¾„ Z¸d¿„ Z¹dÀ„ ZºdÁ„ Z»dÂ„ Z¼	 	 	 	 �d	dÃ„Z½dûdÄ„Z¾dûdÅ„Z¿	 	 	 dúdÆ„ZÀ	 	 	 	 	 	 	 	 	 	 �d
dÇ„ZÁd÷dÈ„ZÂd÷dÉ„ZÃd÷dÊ„ZÄdË„ ZÅdÌ„ ZÆdÍ„ ZÇdÎ„ ZÈdÏ„ ZÉdÐ„ ZÊdÑ„ ZËdÒ„ ZÌ�ddÓ„ZÍdÔ„ ZÎ�ddÕ„ZÏdÖ„ ZÐd×„ ZÑdØ„ ZÒdÙ„ ZÓd÷dÚ„ZÔdÛ„ ZÕdÜ„ ZÖdÝ„ Z×dÞ„ ZØ	 	 	 	 	 	 �ddß„ZÙ e‚dàdá¬„«      �ddâ„«       ZÚ e‚dàdá¬„«      �ddã„«       ZÛ e‚dàdá¬„«      	 	 	 �ddä„«       ZÜ e‚dàdá¬„«      då„ «       ZÝ e‚dàdá¬„«      dæ„ «       ZÞ e‚dàdá¬„«      dç„ «       Zß e‚dàdá¬„«      dè„ «       Zà e‚dàdá¬„«      dé„ «       Zá e‚dàdá¬„«      	 	 	 �ddê„«       Zâ e‚dàdá¬„«      dûdë„«       Zã e‚dàdá¬„«      dì„ «       Zä e‚dàdá¬„«      dí„ «       Zå e‚dàdá¬„«      dî„ «       Zæ e‚dàdá¬„«      	 	 	 	 	 	 �ddï„«       Zç e‚dàdá¬„«      �ddð„«       Zè e‚dàdá¬„«      dñ„ «       Zé e‚dàdá¬„«      dò„ «       Zê e‚dàdá¬„«      dó„ «       Zë e‚dàdá¬„«      �ddô„«       Zì e‚dàdá¬„«      dõ„ «       Zí e‚dàdá¬„«      dö„ «       Zîˆ xZïS (  Ú	Bitbucketc                 ó”   •— d|vr	d|v rd|d<   d|vrd|v r|d   rdnd|d<   d|v rd|v rdnd	|d
<   t        t        | �
  |g|¢­i |¤Ž y )NÚcloudzbitbucket.orgTÚapi_versionú2.0ú1.0zapi.bitbucket.orgÚ zrest/apiÚapi_root)Úsuperr   Ú__init__)ÚselfÚurlÚargsÚkwargsÚ	__class__s       €r   r#   zBitbucket.__init__   sq   ø€ Ø˜&Ñ  o¸Ñ&<Ø"ˆF�7‰OØ Ñ&Ø-4¸Ñ->À6È'Â?¡EÐX]ˆF�=Ñ!Ø�fÑØ':¸cÑ'A¡ÀzˆF�:ÑäŒi˜Ñ'¨Ð=¨dÒ=°fÓ=r   c                 óJ   — | j                  d«      }| j                  ||¬«      S )z§
        Preview generated HTML for the given markdown content.
        Only authenticated users may call this resource.
        :param data:
        :return:
        zmarkup/preview©Údata©Úresource_urlÚpost)r$   r+   r%   s      r   Úmarkup_previewzBitbucket.markup_preview%   s(   € ð ×ÑÐ 0Ó1ˆØ�y‰y˜ 4ˆyÓ(Ð(r   Nc                 ó(   — | j                  d|¬«      S )NÚadmin©r   ©r-   )r$   r   s     r   Ú
_url_adminzBitbucket._url_admin4   s   € Ø× Ñ  °kÐ ÓBÐBr   c                 ó|   — | j                  dd¬«      }i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )a|  
        Get list of bitbucket groups.
        Use 'group_filter' for get specific group or get all group if necessary.

        :param group_filter: str - groupname
        :param limit: int - paginated limit to retrieve
        :param start: int - paginated point to start retrieving
        :return: The collection as JSON with all relevant information about the group
        Úgroupsr   r2   ÚfilterÚlimitÚstart©Úparams)r-   Ú
_get_paged)r$   Úgroup_filterr8   r9   r%   r;   s         r   Ú
get_groupszBitbucket.get_groups7   sV   € ð ×Ñ °eÐÓ<ˆØˆÙØ+ˆF�8ÑÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c                 ó|   — | j                  «       › d�}i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )z©
        Get group of members
        :param group: The group name to query
        :param start:
        :param limit:
        :return: A list of group members
        z/groups/more-membersr9   r8   Úcontextr:   ©r4   r<   )r$   Úgroupr9   r8   r%   r;   s         r   Úgroup_memberszBitbucket.group_membersK   sV   € ð —‘Ó"Ð#Ð#7Ð8ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ %ˆF�9ÑØ�‰˜s¨6ˆÓ2Ð2r   c           	   #   óH  K  — | j                  «       D ]†  }t        j                  d|j                  d«      |j                  d«      «       |j                  d«      |j                  d«      | j	                  |d   «      D �cg c]  }|d   |d   dœ‘Œ c}dœ–— Œˆ yc c}w ­w)	z¬
        Get the list of project administrators

        :return: A generator object containing a map with the project_key, project_name and project_administrators
        zProcessing project: %s - %sÚkeyÚnameÚemailAddressÚdisplayName)ÚemailrF   )Úproject_keyÚproject_nameÚproject_administratorsN)Úproject_listÚlogÚinfoÚgetÚ,project_users_with_administrator_permissions)r$   ÚprojectÚxs      r   Úall_project_administratorsz$Bitbucket.all_project_administrators^   s¢   è ø€ ð ×(Ñ(Ó*ò 		ˆGÜ�H‰HÐ2°G·K±KÀÓ4FÈÏÉÐTZÓH[Ô\à&Ÿ{™{¨5Ó1Ø '§¡¨FÓ 3ð "×NÑNÈwÐW\É~Ó^ö+àð   Ñ/¸¸=Ñ9IÓJò+ñó ñ		ùò
+ùs   ‚A?B"ÂB
ÂB"c                 óL   — | j                  ddd¬«      }| j                  |«      S )za
        Rebuild the bundled Elasticsearch indexes for Bitbucket Server
        :return:
        Úsyncúrest/indexingÚlatest©r!   r   r,   ©r$   r%   s     r   ÚreindexzBitbucket.reindexo   s)   € ð
 ×Ñ °ÈhÐÓWˆØ�y‰y˜‹~Ðr   c                 óL   — | j                  ddd¬«      }| j                  |«      S )z:
        Check reindexing status
        :return:
        ÚstatusrW   rX   rY   ©r-   rP   rZ   s     r   Úcheck_reindexing_statusz!Bitbucket.check_reindexing_statusw   s*   € ð
 ×Ñ °?ÐPXÐÓYˆØ�x‰x˜‹}Ðr   c                 ó|   — | j                  dd¬«      }i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )a•  
        Get list of bitbucket users.
        Use 'user_filter' for get specific users or get all users if necessary.
        :param user_filter: str - username, displayname or email
        :param limit: int - paginated limit to retrieve
        :param start: int - paginated point to start retreiving
        :return: The collection as JSON with all relevant information about the licensed user
        Úusersr   r2   r7   r8   r9   r:   r^   )r$   Úuser_filterr8   r9   r%   r;   s         r   Ú	get_userszBitbucket.get_users   sV   € ð ×Ñ °UÐÓ;ˆØˆÙØ*ˆF�8ÑÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�x‰x˜ FˆxÓ+Ð+r   c                 ó€   — | j                  d¬«      › d�}i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )aC  
        The authenticated user must have the LICENSED_USER permission to call this resource.
        :param user_filter: if specified only users with usernames, display name or email addresses
            containing the supplied string will be returned
        :param limit:
        :param start:
        :return:
        r   r2   z/usersr8   r9   r7   r:   rA   )r$   rb   r9   r8   r%   r;   s         r   Úget_users_infozBitbucket.get_users_info’   sY   € ð —‘¨U�Ó3Ð4°FÐ;ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ*ˆF�8ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 óJ   — | j                  «       › d�}| j                  |«      S )a  
        Retrieves details about the current license, as well as the current status of the system with
        regard to the installed license. The status includes the current number of users applied
        toward the license limit, as well as any status messages about the license (warnings about expiry
        or user counts exceeding license limits).
        The authenticated user must have ADMIN permission. Unauthenticated users, and non-administrators,
        are not permitted to access license details.
        :return:
        z/license)r4   rP   rZ   s     r   Úget_current_licensezBitbucket.get_current_license¥   s&   € ð —‘Ó"Ð# 8Ð,ˆØ�x‰x˜‹}Ðr   c                 ó(   — | j                  «       › d�S )Nz/mail-server©r4   ©r$   s    r   Ú_url_mail_serverzBitbucket._url_mail_server²   s   € Ø—/‘/Ó#Ð$ LÐ1Ð1r   c                 óD   — | j                  «       }| j                  |«      S )z¥
        Retrieves the current mail configuration.
        The authenticated user must have the SYS_ADMIN permission to call this resource.
        :return:
        )rk   rP   rZ   s     r   Úget_mail_configurationz Bitbucket.get_mail_configurationµ   s    € ð ×#Ñ#Ó%ˆØ�x‰x˜‹}Ðr   c                 ó(   — | j                  «       › d�S )Nz/sender-address)rk   rj   s    r   Ú_url_mail_server_sender_addressz)Bitbucket._url_mail_server_sender_address¾   s   € Ø×'Ñ'Ó)Ð*¨/Ð:Ð:r   c                 óD   — | j                  «       }| j                  |«      S )zE
        Retrieves the server email address
        :return:
        )ro   rP   rZ   s     r   Úget_mail_sender_addressz!Bitbucket.get_mail_sender_addressÁ   s    € ð
 ×2Ñ2Ó4ˆØ�x‰x˜‹}Ðr   c                 óD   — | j                  «       }| j                  |«      S )z˜
        Clears the server email address.
        The authenticated user must have the ADMIN permission to call this resource.
        :return:
        )ro   ÚdeleterZ   s     r   Úremove_mail_sender_addressz$Bitbucket.remove_mail_sender_addressÉ   s!   € ð ×2Ñ2Ó4ˆØ�{‰{˜3ÓÐr   c                 óJ   — | j                  dd¬«      }| j                  |«      S )zA
        Retrieve ssh settings for user
        :return:
        Úsettingszrest/ssh©r!   r^   rZ   s     r   Úget_ssh_settingszBitbucket.get_ssh_settingsÒ   s'   € ð
 ×Ñ 
°ZÐÓ@ˆØ�x‰x˜‹}Ðr   c                 óN   — | j                  d«      }|s| j                  d«      }|S )z§
        Get health status
        https://confluence.atlassian.com/jirakb/how-to-retrieve-health-check-results-using-rest-api-867195158.html
        :return:
        zrest/troubleshooting/1.0/check/z"rest/supportHealthCheck/1.0/check/©rP   )r$   Úresponses     r   Úhealth_checkzBitbucket.health_checkÚ   s*   € ð —8‘8Ð=Ó>ˆÙà—x‘xÐ DÓEˆHØˆr   c                 óP   — | j                  d|› �d¬«      }| j                  |«      S )zv
        To get the build statuses associated with a commit.
        :commit: str- commit id
        :return:
        zcommits/zrest/build-statusrw   r^   )r$   Úcommitr%   s      r   Úget_associated_build_statusesz'Bitbucket.get_associated_build_statusesç   s6   € ð ×ÑØ�v�hÐØ(ð  ó 
ˆð �x‰x˜‹}Ðr   c                 ó(   — | j                  «       › d�S )Nz/bannerri   rj   s    r   Ú_url_announcement_bannerz"Bitbucket._url_announcement_banneró   s   € Ø—/‘/Ó#Ð$ GÐ,Ð,r   c                 óD   — | j                  «       }| j                  |«      S ©zk
        Gets the announcement banner, if one exists and is available to the user
        :return:
        )r�   rP   rZ   s     r   Úget_announcement_bannerz!Bitbucket.get_announcement_bannerö   s    € ð
 ×+Ñ+Ó-ˆØ�x‰x˜‹}Ðr   c                 óH   — | j                  «       }| j                  ||¬«      S )a~  
        Sets the announcement banner with the provided JSON.
        Only users authenticated as Admins may call this resource
        :param body
            {
                "id": "https://docs.atlassian.com/jira/REST/schema/rest-announcement-banner#",
                "title": "Rest Announcement Banner",
                "type": "object"
            }
        :return:
        r*   )r�   Úput)r$   Úbodyr%   s      r   Úset_announcement_bannerz!Bitbucket.set_announcement_bannerþ   s%   € ð ×+Ñ+Ó-ˆØ�x‰x˜ $ˆxÓ'Ð'r   c                 óD   — | j                  «       }| j                  |«      S rƒ   )r�   rs   rZ   s     r   Údelete_announcement_bannerz$Bitbucket.delete_announcement_banner  s!   € ð
 ×+Ñ+Ó-ˆØ�{‰{˜3ÓÐr   c                 ó¼   — | j                  dd| j                  d¬«      j                  d   }d|› �}dt        |d«      i}| j	                  ||| j                  ¬	«      S )
zˆ
        Provide plugin path for upload into BitBucket e.g. useful for auto deploy
        :param plugin_path:
        :return:
        ÚGETzrest/plugins/1.0/T)ÚmethodÚpathÚheadersÚtrailingz	upm-tokenzrest/plugins/1.0/?token=ÚpluginÚrb©Úfilesr�   )ÚrequestÚno_check_headersr�   Úopenr.   )r$   Úplugin_pathÚ	upm_tokenr%   r”   s        r   Úupload_pluginzBitbucket.upload_plugin  sq   € ð —L‘LØØ$Ø×)Ñ)Øð	 !ó 
÷
 ‰'�+ñˆ	ð )¨¨Ð4ˆØœ4 ¨TÓ2Ð3ˆØ�y‰y˜ E°4×3HÑ3HˆyÓIÐIr   c                 ó¨   — d|› �}|r|› d|› �}| j                  |dd¬«      }| j                  |«      }|j                  d«      j                  d«      S )a‡  
        Get a list of categories assigned to a project or repository.
        :param project_key: The project key as shown in URL.
        :param repository_slug: The repository as shown in URL (optional).
        :return: If 'repository_slug', returns the list with categories of the repository,
        otherwise, returns the list with the categories of the project 'project_key'
        zproject/z/repository/zrest/categoriesrX   rY   ÚresultÚ
categoriesr^   )r$   rJ   Úrepository_slugr%   r+   s        r   Úget_categorieszBitbucket.get_categories%  sc   € ð ˜˜Ð&ˆÙØ�E˜ oÐ%6Ð7ˆCØ×Ñ Ð.?ÈXÐÓVˆØ�x‰x˜‹}ˆØ�x‰x˜Ó!×%Ñ% lÓ3Ð3r   c                 ó(   — | j                  d||«      S )NÚprojectsr3   )r$   r!   r   s      r   Ú_url_projectszBitbucket._url_projects8  s   € Ø× Ñ  ¨X°{ÓCÐCr   c                 óh   — | j                  «       }i }|r||d<   |r||d<   | j                  ||¬«      S )zO
        Provide the project list

        :return: A list of projects
        r9   r8   r:   )r¢   r<   )r$   r9   r8   r%   r;   s        r   rM   zBitbucket.project_list;  sB   € ð × Ñ Ó"ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c                 óT   — | j                  «       }|||dœ}| j                  ||¬«      S )zÏ
        Create project
        :param key: The project key
        :param name: The project name
        :param description: The project description

        :return: The value of the post request.
        )rE   rF   Údescriptionr*   )r¢   r.   )r$   rE   rF   r¥   r%   r+   s         r   Úcreate_projectzBitbucket.create_projectI  s1   € ð × Ñ Ó"ˆØ D¸ÑEˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 ó0   — | j                  ||«      › d|› �S ©Nú/)r¢   ©r$   rJ   r!   r   s       r   Ú_url_projectzBitbucket._url_projectZ  s!   € Ø×$Ñ$ X¨{Ó;Ð<¸A¸k¸]ÐKÐKr   c                 óN   — | j                  |«      }| j                  |«      xs i S )z[
        Provide project info
        :param key: The project key
        :return:
        ©r«   rP   )r$   rE   r%   s      r   rR   zBitbucket.project]  s'   € ð ×Ñ Ó$ˆØ�x‰x˜‹}Ò" Ð"r   c                 ó’   — d}	 | j                  |«       d}|S # t        $ r$}|j                  j                  dv r	 Y d}~|S d}~ww xY w)a  
        Check if project with the provided project key exists and available.
        :param project_key: Key of the project where to check for repository.
        :return: False is requested repository doesn't exist in the project or not accessible to the requestor
        FT©i‘  i”  N)rR   r   r{   Ústatus_code)r$   rJ   ÚexistsÚes       r   Úproject_existszBitbucket.project_existsf  sS   € ð ˆð	Ø�L‰L˜Ô%ØˆFð ˆøô ò 	Ø�z‰z×%Ñ%¨Ñ3ØûØˆûð	ús   „ ™	A¢AÁAc                 óJ   — | j                  |«      }| j                  ||¬«      S )zs
        Update project
        :param key: The project key
        :return: The value of the put request.
        r*   )r«   r†   )r$   rE   r;   r%   s       r   Úupdate_projectzBitbucket.update_projectu  s'   € ð ×Ñ Ó$ˆØ�x‰x˜ &ˆxÓ)Ð)r   c                 ó*   — | j                  |«      › d�S )Nz/avatar.png©r«   ©r$   rJ   s     r   Ú_url_project_avatarzBitbucket._url_project_avatar~  s   € Ø×#Ñ# KÓ0Ð1°Ð=Ð=r   c                 óŠ   — || j                  |«      | j                  |«      | j                  |«      | j                  |«      dœS )z~
        Get a project summary
        :param key: The project key

        :return: Map with the project information
        )rE   r+   ra   r6   Úavatar)rR   Úproject_usersÚproject_groupsÚproject_avatar)r$   rE   s     r   Úproject_summaryzBitbucket.project_summary�  sG   € ð Ø—L‘L Ó%Ø×'Ñ'¨Ó,Ø×)Ñ)¨#Ó.Ø×)Ñ)¨#Ó.ñ
ð 	
r   c                 óŠ   — | j                  |«      }t        | j                  «      }||d<   d|d<   | j                  |d|¬«      S )z¤
        Get project avatar
        :param key: The project key
        :param content_type: The content type to get

        :return: Value of get request
        ÚAcceptúno-checkúX-Atlassian-TokenT)Únot_json_responser�   )r¹   ÚdictÚdefault_headersrP   )r$   rE   Úcontent_typer%   r�   s        r   r¾   zBitbucket.project_avatar�  sN   € ð ×&Ñ& sÓ+ˆÜ�t×+Ñ+Ó,ˆØ(ˆ�ÑØ'1ˆÐ#Ñ$à�x‰x˜¨t¸WˆxÓEÐEr   c                 ób   — | j                  |«      }ddi}dd||fi}| j                  |||¬«      S )zÉ
        Set project avatar
        :param key: The Project key
        :param icon: The icon file
        :param content_type: The content type of icon

        :return: Value of post request
        rÃ   rÂ   r»   z
avatar.pngr“   )r¹   r.   )r$   rE   ÚiconrÇ   r%   r�   r”   s          r   Úset_project_avatarzBitbucket.set_project_avatarŸ  sD   € ð ×&Ñ& sÓ+ˆØ&¨
Ð3ˆØ˜L¨$°Ð=Ð>ˆØ�y‰y˜ E°7ˆyÓ;Ð;r   c                 ó‚   — | j                  |d¬«      › d�}i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )zñ
        Get SSH access keys added to the project
        :param start:
        :param limit:
        :param key: The project key
        :param filter_str:  OPTIONAL: users filter string
        :return: The list of SSH access keys
        ú	rest/keysrw   ú/sshr9   r8   r7   r:   )r«   r<   ©r$   rE   r9   r8   Ú
filter_strr%   r;   s          r   Úproject_keyszBitbucket.project_keys­  s^   € ð ×"Ñ" 3°Ð"Ó=Ð>¸dÐCˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ)ˆF�8ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 ó*   — | j                  |«      › d�S ©Nz/permissions/usersr·   r¸   s     r   Ú_url_project_userszBitbucket._url_project_usersÀ  s   € Ø×#Ñ# KÓ0Ð1Ð1CÐDÐDr   c                 óx   — | j                  |«      }i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )zë
        Get users with permission in project
        :param key: The project key
        :param filter_str:  OPTIONAL: users filter string
        :param start:
        :param limit:
        :return: The list of project users
        r9   r8   r7   r:   )rÓ   r<   rÎ   s          r   r¼   zBitbucket.project_usersÃ  sQ   € ð ×%Ñ% cÓ*ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ)ˆF�8ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 óÞ   — | j                  |«      D �cg c]  }|d   dk(  sŒ|d   ‘Œ }}| j                  |«      D ])  }| j                  |«      D ]  }|j                  |«       Œ Œ+ |S c c}w )zŒ
        Get project administrators for project
        :param key: The project key
        :return: List of project administrators
        Ú
permissionÚPROJECT_ADMINÚuser)r¼   Ú-project_groups_with_administrator_permissionsrC   Úappend)r$   rE   rØ   rL   rB   s        r   rQ   z6Bitbucket.project_users_with_administrator_permissionsÖ  sŒ   € ð &*×%7Ñ%7¸Ó%<ö"
Ø!ÀÀ\Ñ@RÐVeÓ@eˆD�‹Lð"
Ðð "
ð ×GÑGÈÓLò 	4ˆEØ×*Ñ*¨5Ó1ò 4�Ø&×-Ñ-¨dÕ3ñ4ð	4ð &Ð%ùò"
s
   ”A*¢A*c                 óT   — | j                  |«      }||dœ}| j                  ||¬«      S )a-  
        Grant the specified project permission to a specific user
        :param project_key: The project key
        :param username: username to be granted
        :param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
        :return:
        ©rÖ   rF   r:   )rÓ   r†   )r$   rJ   ÚusernamerÖ   r%   r;   s         r   Úproject_grant_user_permissionsz(Bitbucket.project_grant_user_permissionsä  s1   € ð ×%Ñ% kÓ2ˆØ *°HÑ=ˆØ�x‰x˜ FˆxÓ+Ð+r   c                 óR   — | j                  |«      }d|i}| j                  ||¬«      S )aÍ  
        Revoke all permissions for the specified project for a user.
        The authenticated user must have PROJECT_ADMIN permission for
        the specified project or a higher global permission to call this resource.
        In addition, a user may not revoke their own project permissions if they do not have a higher global permission.
        :param project_key: The project key
        :param username: username to be granted
        :return:
        rF   r:   )rÓ   rs   )r$   rJ   rÝ   r%   r;   s        r   Úproject_remove_user_permissionsz)Bitbucket.project_remove_user_permissionsð  s1   € ð ×%Ñ% kÓ2ˆØ˜(Ð#ˆØ�{‰{˜3 vˆ{Ó.Ð.r   c                 ó*   — | j                  |«      › d�S ©Nz/permissions/groupsr·   r¸   s     r   Ú_url_project_groupszBitbucket._url_project_groupsþ  s   € Ø×#Ñ# KÓ0Ð1Ð1DÐEÐEr   c                 óx   — | j                  |«      }i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )zÔ
        Get Project Groups
        :param limit:
        :param limit:
        :param start:
        :param key: The project key
        :param filter_str: OPTIONAL: group filter string
        :return:
        r9   r8   r7   r:   )rã   r<   rÎ   s          r   r½   zBitbucket.project_groups  sQ   € ð ×&Ñ& sÓ+ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ)ˆF�8ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 óT   — | j                  |«      }||dœ}| j                  ||¬«      S )a-  
        Grant the specified project permission to a specific group
        :param project_key: The project key
        :param group_name: group to be granted
        :param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
        :return:
        rÜ   r:   )rã   r†   )r$   rJ   Ú
group_namerÖ   r%   r;   s         r   Úproject_grant_group_permissionsz)Bitbucket.project_grant_group_permissions  s1   € ð ×&Ñ& {Ó3ˆØ *°JÑ?ˆØ�x‰x˜ FˆxÓ+Ð+r   c                 óR   — | j                  |«      }d|i}| j                  ||¬«      S )aÊ  
        Revoke all permissions for the specified project for a group.
        The authenticated user must have PROJECT_ADMIN permission for the specified project
        or a higher global permission to call this resource.
        In addition, a user may not revoke a group's permissions
        if it will reduce their own permission level.
        :param project_key: The project key
        :param groupname: group to be granted
        :return:
        rF   r:   )rã   rs   )r$   rJ   Ú	groupnamer%   r;   s        r   Ú project_remove_group_permissionsz*Bitbucket.project_remove_group_permissions!  s1   € ð ×&Ñ& {Ó3ˆØ˜)Ð$ˆØ�{‰{˜3 vˆ{Ó.Ð.r   c                 óR   — | j                  |«      › d|› d�}| j                  |«      S )a  
        Check if the specified permission is the default permission for a given project
        :param project_key: The project key
        :param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
        :return:
        ú/permissions/ú/allr­   ©r$   rJ   rÖ   r%   s       r   Úproject_default_permissionsz%Bitbucket.project_default_permissions0  s0   € ð ×"Ñ" ;Ó/Ð0°¸j¸\ÈÐNˆØ�x‰x˜‹}Ðr   c                 óZ   — | j                  |«      › d|› d�}| j                  |ddi¬«      S )a  
        Grant the specified project permission to all users for a given project
        :param project_key: The project key
        :param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
        :return:
        rì   rí   ÚallowTr:   ©r«   r.   rî   s       r   Ú!project_grant_default_permissionsz+Bitbucket.project_grant_default_permissions:  s9   € ð ×"Ñ" ;Ó/Ð0°¸j¸\ÈÐNˆØ�y‰y˜ g¨t _ˆyÓ5Ð5r   c                 óZ   — | j                  |«      › d|› d�}| j                  |ddi¬«      S )a  
        Revoke the specified project permission for all users for a given project
        :param project_key: The project key
        :param permission: the project permissions available are 'PROJECT_ADMIN', 'PROJECT_WRITE' and 'PROJECT_READ'
        :return:
        rì   rí   rñ   Fr:   rò   rî   s       r   Ú"project_remove_default_permissionsz,Bitbucket.project_remove_default_permissionsD  s:   € ð ×"Ñ" ;Ó/Ð0°¸j¸\ÈÐNˆØ�y‰y˜ g¨uÐ%5ˆyÓ6Ð6r   c                 ó*   — | j                  |«      › d�S ©Nz/settings/hooksr·   r¸   s     r   Ú_url_project_repo_hook_settingsz)Bitbucket._url_project_repo_hook_settingsN  s   € Ø×#Ñ# KÓ0Ð1°ÐAÐAr   c                 óv   — | j                  |«      }i }|r||d<   |r||d<   |r||d<   | j                  ||«      S )aà  
        Get all repository hooks for a given project
        :param project_key: The project key
        :param start:
        :param limit: OPTIONAL: The limit of the number of changes to return, this may be restricted by
                fixed system limits. Default by built-in method: None
        :param filter_type: OPTIONAL: PRE_RECEIVE|POST_RECEIVE if present,
                                    controls how repository hooks should be filtered.
        :return:
        Útyper9   r8   )rø   r<   )r$   rJ   r9   r8   Úfilter_typer%   r;   s          r   Úall_project_repo_hook_settingsz(Bitbucket.all_project_repo_hook_settingsQ  sN   € ð ×2Ñ2°;Ó?ˆØˆÙØ(ˆF�6‰NÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s FÓ+Ð+r   c                 óP   — | j                  |«      › d|› �}| j                  |«      S )zª
        Get a repository hook from a given project
        :param project_key: The project key
        :param hook_key: The repository hook key
        :return:
        r©   )rø   rP   ©r$   rJ   Úhook_keyr%   s       r   Úget_project_repo_hook_settingsz(Bitbucket.get_project_repo_hook_settingsf  s.   € ð ×5Ñ5°kÓBÐCÀ1ÀXÀJÐOˆØ�x‰x˜‹}Ðr   c                 óR   — | j                  |«      › d|› d�}| j                  |«      S )z¬
        Enable a repository hook for a given project
        :param project_key: The project key
        :param hook_key: The repository hook key
        :return:
        r©   ú/enabled)rø   r†   rþ   s       r   Ú!enable_project_repo_hook_settingsz+Bitbucket.enable_project_repo_hook_settingsp  s0   € ð ×5Ñ5°kÓBÐCÀ1ÀXÀJÈhÐWˆØ�x‰x˜‹}Ðr   c                 óR   — | j                  |«      › d|› d�}| j                  |«      S )z­
        Disable a repository hook for a given project
        :param project_key: The project key
        :param hook_key: The repository hook key
        :return:
        r©   r  )rø   rs   rþ   s       r   Ú"disable_project_repo_hook_settingsz,Bitbucket.disable_project_repo_hook_settingsz  s1   € ð ×5Ñ5°kÓBÐCÀ1ÀXÀJÈhÐWˆØ�{‰{˜3ÓÐr   c                 óH   — dj                  | j                  |dd¬«      «      S ©Nz{}/conditionsúrest/default-reviewersr   rY   ©Úformatr«   r¸   s     r   Ú_url_project_conditionsz!Bitbucket._url_project_conditions„  s1   € Ø×%Ñ%Ø×ÑØØ1Ø!ð ó ó
ð 	
r   c                 óN   — | j                  |«      }| j                  |«      xs i S )aZ  
        Request type: GET
        Return a page of defaults conditions with reviewers list that have been configured for this project.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264904368
        :projectKey: str
        :return:
        )r  rP   )r$   rJ   r%   s      r   Úget_project_conditionsz Bitbucket.get_project_conditions�  s'   € ð ×*Ñ*¨;Ó7ˆØ�x‰x˜‹}Ò" Ð"r   c                 ó`   — dj                  | j                  |dd¬«      «      }|�|d|› �z  }|S )Nz{}/conditionr  r   rY   r©   r	  ©r$   rJ   Úid_conditionr%   s       r   Ú_url_project_conditionz Bitbucket._url_project_condition™  sL   € Ø×#Ñ#Ø×ÑØØ1Ø!ð ó ó
ˆð Ð#Ø�Q�|�nÐ%Ñ%ˆCØˆ
r   c                 óP   — | j                  ||«      }| j                  |«      xs i S )a™  
        Request type: GET
        Return a specific condition with reviewers list that has been configured for this project.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264901504
        :projectKey: str - project key involved
        :idCondition: int - condition id involved
        :return:
        )r  rP   r  s       r   Úget_project_conditionzBitbucket.get_project_condition¥  s)   € ð ×)Ñ)¨+°|ÓDˆØ�x‰x˜‹}Ò" Ð"r   c                 óR   — | j                  |«      }| j                  ||¬«      xs i S )aÊ  
        Request type: POST
        Create a new condition for this project.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264893584
        :projectKey: str- project key involved
        :data: condition: dictionary object
        :example condition: '{"sourceMatcher":
                                {"id":"any",
                                "type":{"id":"ANY_REF"}},
                                "targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},
                                "reviewers":[{"id": 12}],"requiredApprovals":"0"
                            }'
        :return:
        r*   )r  r.   )r$   rJ   Ú	conditionr%   s       r   Úcreate_project_conditionz"Bitbucket.create_project_condition²  s,   € ð  ×)Ñ)¨+Ó6ˆØ�y‰y˜ 9ˆyÓ-Ò3°Ð3r   c                 óT   — | j                  ||«      }| j                  ||¬«      xs i S )aû  
        Request type: PUT
        Update a new condition for this project.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264927632
        :projectKey: str- project key involved
        :idCondition: int - condition id involved
        :data: condition: dictionary object
        :example condition: '{"sourceMatcher":
                                {"id":"any",
                                "type":{"id":"ANY_REF"}},
                                "targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},
                                "reviewers":[{"id": 12}],"requiredApprovals":"0"
                            }'
        :return:
        r*   )r  r†   )r$   rJ   r  r  r%   s        r   Úupdate_project_conditionz"Bitbucket.update_project_conditionÅ  s.   € ð" ×)Ñ)¨+°|ÓDˆØ�x‰x˜ )ˆxÓ,Ò2°Ð2r   c                 óP   — | j                  ||«      }| j                  |«      xs i S )a…  
        Delete a specific condition for this repository slug inside project.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264896304
        Request type: DELETE
        :projectKey: str- project key involved
        :idCondition: int - condition id involved
        :return:
        )r  rs   r  s       r   Údelete_project_conditionz"Bitbucket.delete_project_conditionÙ  s*   € ð ×)Ñ)¨+°|ÓDˆØ�{‰{˜3ÓÒ% 2Ð%r   c                 ó\   — | j                   rt        d«      ‚| j                  |d¬«      › d�S ©Nú Not supported in Bitbucket Cloudz
rest/auditrw   z/events)r   Ú	Exceptionr«   r¸   s     r   Ú_url_project_audit_logz Bitbucket._url_project_audit_logæ  s3   € Ø�:Š:ÜÐ>Ó?Ð?à×#Ñ# K¸,Ð#ÓGÐHÈÐPÐPr   c                 ój   — | j                  |«      }i }|r||d<   |r||d<   | j                  ||¬«      S )z»
        Get the audit log of the project
        :param start:
        :param limit:
        :param project_key: The project key
        :return: List of events of the audit log
        r9   r8   r:   )r  r<   ©r$   rJ   r9   r8   r%   r;   s         r   Úget_project_audit_logzBitbucket.get_project_audit_logì  sD   € ð ×)Ñ)¨+Ó6ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c                 ó.   — | j                  |||«      › d�S )Nz/reposr·   rª   s       r   Ú
_url_reposzBitbucket._url_reposü  s   € Ø×#Ñ# K°¸;ÓGÐHÈÐOÐOr   c                 ój   — | j                  |«      }i }|r||d<   |r||d<   | j                  ||¬«      S )zž
        Get repositories list from project

        :param project_key: The project key
        :param start:
        :param limit:
        :return:
        r9   r8   r:   )r$  r<   r!  s         r   Ú	repo_listzBitbucket.repo_listÿ  sB   € ð �o‰o˜kÓ*ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c                 ó(   — | j                  |d¬«      S )ze
        Get all repositories list from project
        :param project_key:
        :return:
        N)r8   )r&  r¸   s     r   Úrepo_all_listzBitbucket.repo_all_list  s   € ð �~‰~˜k°ˆ~Ó6Ð6r   Fc                 óX   — | j                  |«      }|d||dœ}| j                  ||¬«      S )a®  Create a new repository.

        Requires an existing project in which this repository will be created. The only parameters which will be used
        are name and scmId.

        The authenticated user must have PROJECT_ADMIN permission for the context project to call this resource.

        :param project_key: The project matching the projectKey supplied in the resource path as shown in URL.
        :type project_key: str
        :param repository_slug: Name of repository to create (i.e. "My repo").
        :param forkable: Set the repository to be forkable or not.
        :type forkable: bool
        :param is_private: Set the repository to be private or not.
        :type is_private: bool
        :return:
            201 - application/json (repository)
            400 - application/json (errors)
            401 - application/json (errors)
            409 - application/json (errors)
        :rtype: requests.Response
        Úgit)rF   ÚscmIdÚforkableÚ
is_privater*   )r$  r.   )r$   rJ   rž   r,  r-  r%   r+   s          r   Úcreate_repozBitbucket.create_repo  s:   € ð, �o‰o˜kÓ*ˆà#ØØ Ø$ñ	
ˆð �y‰y˜ 4ˆyÓ(Ð(r   c                 ó2   — | j                  |||«      › d|› �S r¨   )r$  )r$   rJ   Úrepor!   r   s        r   Ú	_url_repozBitbucket._url_repo;  s!   € Ø—/‘/ +¨x¸ÓEÐFÀaÈÀvÐNÐNr   c                 ón   — dj                  | j                  ||dd¬«      ¬«      }| j                  |«      S )zk
        Reindex repo
        :param project_key:
        :param repository_slug:
        :return:
        z{urlRepo}/syncrW   r   rY   )ÚurlRepo)r
  r1  r.   ©r$   rJ   rž   r%   s       r   Úreindex_repozBitbucket.reindex_repo>  sF   € ð ×%Ñ%Ø—N‘NØØØ(Ø!ð	 #ó ð &ó 
ˆð �y‰y˜‹~Ðr   c                 óR   — | j                  ||d¬«      › d�}| j                  |«      S )aë  
        Reindex all the Jira issues related to this repository_slug, including branches and pull requests.
        This automatically happens as part of an upgrade, and calling this manually should only be required
        if something unforeseen happens and the index becomes out of sync.
        The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
        :param project_key:
        :param repository_slug:
        :return:
        zrest/jira-devrw   z/reindex©r1  r.   r4  s       r   Úreindex_repo_dev_panelz Bitbucket.reindex_repo_dev_panelO  s/   € ð —‘ ¨_À�ÓWÐXÐX`ÐaˆØ�y‰y˜‹~Ðr   c                 óH   — | j                  ||«      }| j                  |«      S )aG  
        Get a specific repository from a project. This operates based on slug not name which may
        be confusing to some users.
        :param project_key: Key of the project you wish to look in.
        :param repository_slug: url-compatible repository identifier
        :return: Dictionary of request response
        )r1  rP   r4  s       r   Úget_repozBitbucket.get_repo\  s"   € ð �n‰n˜[¨/Ó:ˆØ�x‰x˜‹}Ðr   c                 ó”   — d}	 | j                  ||«       d}|S # t        $ r$}|j                  j                  dv r	 Y d}~|S d}~ww xY w)ak  
        Check if given combination of project and repository exists and available.
        :param project_key: Key of the project where to check for repository.
        :param repository_slug: url-compatible repository identifier to look for.
        :return: False is requested repository doesn't exist in the project or not accessible to the requestor
        FTr¯   N)r:  r   r{   r°   )r$   rJ   rž   r±   r²   s        r   Úrepo_existszBitbucket.repo_existsg  sU   € ð ˆð	Ø�M‰M˜+ Ô7ØˆFð ˆøô ò 	Ø�z‰z×%Ñ%¨Ñ3ØûØˆûð	ús   „ š	A£AÁAc                 óL   — | j                  ||«      }| j                  ||¬«      S )a>  
        Update a repository in a project. This operates based on slug not name which may
        be confusing to some users.
        :param project_key: Key of the project you wish to look in.
        :param repository_slug: url-compatible repository identifier
        :return: The value of the put request.
        r*   )r1  r†   )r$   rJ   rž   r;   r%   s        r   Úupdate_repozBitbucket.update_repow  s'   € ð �n‰n˜[¨/Ó:ˆØ�x‰x˜ &ˆxÓ)Ð)r   c                 óH   — | j                  ||«      }| j                  |«      S )aJ  
        Delete a specific repository from a project. This operates based on slug not name which may
        be confusing to some users.
        :param project_key: Key of the project you wish to look in.
        :param repository_slug: url-compatible repository identifier
        :return: Dictionary of request response
        )r1  rs   r4  s       r   Údelete_repozBitbucket.delete_repo‚  s#   € ð �n‰n˜[¨/Ó:ˆØ�{‰{˜3ÓÐr   c                 ól   — | j                  ||«      }i }|�||d<   d|i|d<   | j                  ||¬«      S )z®
        Forks a repository within the same project.
        :param project_key:
        :param repository_slug:
        :param new_repository_slug:
        :return:
        rF   rE   rR   r*   r7  )r$   rJ   rž   Únew_repository_slugr%   r‡   s         r   Úfork_repositoryzBitbucket.fork_repository�  sI   € ð �n‰n˜[¨/Ó:ˆØˆØÐ*Ø.ˆD�‰LØ$ kÐ2ˆD�‰OØ�y‰y˜ 4ˆyÓ(Ð(r   c                 óp   — | j                  ||«      }i }|�|�||d<   d|i|d<   | j                  ||¬«      S )a+  
        Forks a repository to a separate project.
        :param project_key: Origin Project Key
        :param repository_slug: Origin repository slug
        :param new_project_key: Project Key of target project
        :param new_repository_slug: Target Repository slug
        :return:
        rF   rE   rR   r*   r7  )r$   rJ   rž   Únew_project_keyrB  r%   r‡   s          r   Úfork_repository_new_projectz%Bitbucket.fork_repository_new_projectœ  sN   € ð �n‰n˜[¨/Ó:ˆØˆØÐ*¨Ð/JØ.ˆD�‰LØ$ oÐ6ˆD�‰OØ�y‰y˜ 4ˆyÓ(Ð(r   c                 ó„   — | j                  ||d¬«      › d�}i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )a  
        Get SSH access keys added to the repository
        :param start:
        :param limit:
        :param project_key: The project key
        :param repo_key: The repository key
        :param filter_str:  OPTIONAL: users filter string
        :return:
        rÌ   rw   rÍ   r9   r8   r7   r:   ©r1  r<   ©r$   rJ   Úrepo_keyr9   r8   rÏ   r%   r;   s           r   Ú	repo_keyszBitbucket.repo_keys²  s]   € ð —‘ ¨XÀ�ÓLÐMÈTÐRˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ)ˆF�8ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 ó,   — | j                  ||«      › d�S rÒ   ©r1  ©r$   rJ   r0  s      r   Ú_url_repo_userszBitbucket._url_repo_usersÆ  s   € Ø—.‘. ¨dÓ3Ð4Ð4FÐGÐGr   c                 óz   — | j                  ||«      }i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )a  
        Get users with permission in repository
        :param start:
        :param limit:
        :param project_key: The project key
        :param repo_key: The repository key
        :param filter_str:  OPTIONAL: Users filter string
        :return:
        r9   r8   r7   r:   )rO  r<   rI  s           r   Ú
repo_userszBitbucket.repo_usersÉ  sS   € ð ×"Ñ" ;°Ó9ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ)ˆF�8ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 óV   — | j                  ||«      }||dœ}| j                  ||¬«      S )a]  
        Grant the specified repository permission to a specific user
        :param project_key: The project key
        :param repo_key: The repository key (slug)
        :param username: username to be granted
        :param permission: the repository permissions available are 'REPO_ADMIN', 'REPO_WRITE' and 'REPO_READ'
        :return:
        rÜ   r:   )rO  r†   )r$   rJ   rJ  rÝ   rÖ   r%   r;   s          r   Úrepo_grant_user_permissionsz%Bitbucket.repo_grant_user_permissionsÝ  s3   € ð ×"Ñ" ;°Ó9ˆØ *°HÑ=ˆØ�x‰x˜ FˆxÓ+Ð+r   c                 óT   — | j                  ||«      }d|i}| j                  ||¬«      S )a$  
        Revoke all permissions for the specified repository for a user.
        The authenticated user must have REPO_ADMIN permission for the specified repository
        or a higher project or global permission to call this resource.
        In addition, a user may not revoke their own repository permissions
        if they do not have a higher project or global permission.
        :param project_key: The project key
        :param repo_key: The repository key (slug)
        :param username: username to be granted
        :return:
        rF   r:   )rO  rs   )r$   rJ   rJ  rÝ   r%   r;   s         r   Úrepo_remove_user_permissionsz&Bitbucket.repo_remove_user_permissionsê  s3   € ð ×"Ñ" ;°Ó9ˆØ˜(Ð#ˆØ�{‰{˜3 vˆ{Ó.Ð.r   c                 ó,   — | j                  ||«      › d�S râ   rM  rN  s      r   Ú_url_repo_groupszBitbucket._url_repo_groupsú  s   € Ø—.‘. ¨dÓ3Ð4Ð4GÐHÐHr   c                 óz   — | j                  ||«      }i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )zõ
        Get repository Groups
        :param start:
        :param limit:
        :param project_key: The project key
        :param repo_key: The repository key
        :param filter_str: OPTIONAL: group filter string
        :return:
        r9   r8   r7   r:   )rW  r<   rI  s           r   Úrepo_groupszBitbucket.repo_groupsý  sS   € ð ×#Ñ# K°Ó:ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ)ˆF�8ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 óh   — | j                  |«      D �cg c]  }|d   dk(  sŒ|d   d   ‘Œ c}S c c}w )zX
        Get groups with admin permissions
        :param key:
        :return:
        rÖ   r×   rB   rF   )r½   )r$   rE   rB   s      r   rÙ   z7Bitbucket.project_groups_with_administrator_permissions  s;   € ð 59×4GÑ4GÈÓ4LÖw¨5ÐPUÐVbÑPcÐgvÓPv��g‘˜vÓ&ÒwÐwùÒws   ”/¢
/c                 ó’  — g }| j                  ||«      D ]  }|d   dk(  sŒ|j                  |«       Œ | j                  ||«      D ])  }| j                  |«      D ]  }|j                  |«       Œ Œ+ | j	                  |«      D ]  }|j                  |«       Œ t        |D �ci c]  }|d   |“Œ
 c}j                  «       «      S c c}w )zÃ
        Get repository administrators for repository
        :param project_key: The project key
        :param repo_key: The repository key
        :return: List of repo administrators
        rÖ   Ú
REPO_ADMINÚid)rQ  rÚ   Ú*repo_groups_with_administrator_permissionsrC   rQ   ÚlistÚvalues)r$   rJ   rJ  Úrepo_administratorsrØ   rB   s         r   Ú)repo_users_with_administrator_permissionsz3Bitbucket.repo_users_with_administrator_permissions  sÞ   € ð !ÐØ—O‘O K°Ó:ò 	1ˆDØ�LÑ! \Ó1Ø#×*Ñ*¨4Õ0ð	1ð ×DÑDÀ[ÐRZÓ[ò 	1ˆEØ×*Ñ*¨5Ó1ò 1�Ø#×*Ñ*¨4Õ0ñ1ð	1ð ×EÑEÀkÓRò 	-ˆDØ×&Ñ& tÕ,ð	-ô Ð2EÖF¨$�T˜$‘Z Ñ%ÒF×MÑMÓOÓPÐPùÒFs   Â"Cc                 óê   — g }| j                  ||«      D ]"  }|d   dk(  sŒ|j                  |d   d   «       Œ$ | j                  |«      D ]  }|j                  |«       Œ t        t	        |«      «      S )zy
        Get groups with admin permissions
        :param project_key:
        :param repo_key:
        :return:
        rÖ   r\  rB   rF   )rY  rÚ   rÙ   r_  Úset)r$   rJ   rJ  Úrepo_group_administratorsrB   s        r   r^  z4Bitbucket.repo_groups_with_administrator_permissions,  s‰   € ð %'Ð!Ø×%Ñ% k°8Ó<ò 	IˆEØ�\Ñ" lÓ2Ø)×0Ñ0°°w±ÀÑ1GÕHð	Ið ×GÑGÈÓTò 	4ˆEØ%×,Ñ,¨UÕ3ð	4ô ”CÐ1Ó2Ó3Ð3r   c                 óV   — | j                  ||«      }||dœ}| j                  ||¬«      S )a²  
        Grant the specified repository permission to a specific group
        Promote or demote a group's permission level for the specified repository. Available repository permissions are:
            REPO_READ
            REPO_WRITE
            REPO_ADMIN
        See the Bitbucket Server documentation for a detailed explanation of what each permission entails.
        The authenticated user must have REPO_ADMIN permission for the specified repository or a higher project
        or global permission to call this resource.
        In addition, a user may not demote a group's permission level
        if their own permission level would be reduced as a result.
        :param project_key: The project key
        :param repo_key: The repository key (slug)
        :param groupname: group to be granted
        :param permission: the repository permissions available are 'REPO_ADMIN', 'REPO_WRITE' and 'REPO_READ'
        :return:
        rÜ   r:   )rW  r†   ©r$   rJ   rJ  ré   rÖ   r%   r;   s          r   Úrepo_grant_group_permissionsz&Bitbucket.repo_grant_group_permissions<  s3   € ð$ ×#Ñ# K°Ó:ˆØ *°IÑ>ˆØ�x‰x˜ FˆxÓ+Ð+r   c                 ób   — | j                  ||«      }d|i}|r||d<   | j                  ||¬«      S )ar  
        Revoke all permissions for the specified repository for a group.
        The authenticated user must have REPO_ADMIN permission for the specified repository
        or a higher project or global permission to call this resource.
        In addition, a user may not revoke a group's permissions if it will reduce their own permission level.
        :param project_key: The project key
        :param repo_key: The repository key (slug)
        :param groupname: group to be granted
        :param permission: the repository permissions available are 'REPO_ADMIN', 'REPO_WRITE' and 'REPO_READ'
        :return:
        rF   rÖ   r:   )rW  rs   rg  s          r   Úrepo_remove_group_permissionsz'Bitbucket.repo_remove_group_permissionsR  s@   € ð ×#Ñ# K°Ó:ˆØ˜)Ð$ˆÙØ#-ˆF�<Ñ Ø�{‰{˜3 vˆ{Ó.Ð.r   c                 óZ   — | j                   rt        d«      ‚| j                  ||«      › d�S )Nr  z/labels©r   r  r1  ©r$   rJ   rž   s      r   Ú_url_repo_labelszBitbucket._url_repo_labelsd  s.   € Ø�:Š:ÜÐ>Ó?Ð?à—.‘. ¨oÓ>Ð?¸wÐGÐGr   c                 óH   — | j                  ||«      }| j                  |«      S )aj  
        Get labels for a specific repository from a project. This operates based on slug not name which may
        be confusing to some users. (BitBucket Server only)
        :param project_key: Key of the project you wish to look in.
        :param repository_slug: url-compatible repository identifier
        :return: Dictionary of request response
        )rn  rP   r4  s       r   Úget_repo_labelszBitbucket.get_repo_labelsj  s$   € ð ×#Ñ# K°ÓAˆØ�x‰x˜‹}Ðr   c                 óT   — | j                  ||«      }d|i}| j                  ||¬«      S )aƒ  
        Sets a label on a repository. (BitBucket Server only)
        The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
        :param project_key: Key of the project you wish to look in.
        :param repository_slug: url-compatible repository identifier
        :param label_name: label name to apply
        :return:
        rF   r*   )rn  r.   )r$   rJ   rž   Ú
label_namer%   r+   s         r   Úset_repo_labelzBitbucket.set_repo_labelu  s3   € ð ×#Ñ# K°ÓAˆØ˜
Ð#ˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 ó^   — | j                   rt        d«      ‚| j                  ||d¬«      › d�S r  rl  rm  s      r   Ú_url_repo_audit_logzBitbucket._url_repo_audit_log‚  s3   € Ø�:Š:ÜÐ>Ó?Ð?à—.‘. ¨oÈ�.ÓUÐVÐV]Ð^Ð^r   c                 ól   — | j                  ||«      }i }|r||d<   |r||d<   | j                  ||¬«      S )a  
        Get the audit log of the repository
        :param start:
        :param limit:
        :param project_key: Key of the project you wish to look in.
        :param repository_slug: url-compatible repository identifier
        :return: List of events of the audit log
        r9   r8   r:   )ru  r<   )r$   rJ   rž   r9   r8   r%   r;   s          r   Úget_repo_audit_logzBitbucket.get_repo_audit_logˆ  sF   € ð ×&Ñ& {°OÓDˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c                 ó0   — | j                  |||¬«      › d�S )Nrw   z	/branchesrM  ©r$   rJ   rž   r!   s       r   Ú_url_repo_brancheszBitbucket._url_repo_branches™  s    € Ø—.‘. ¨oÈ�.ÓQÐRÐR[Ð\Ð\r   c
                 óª   — | j                  ||«      }
i }|r||d<   |r||d<   |r||d<   |r||d<   |r||d<   ||d<   |	|d<   | j                  |
|¬«      S )	a�  
        Retrieve the branches matching the supplied filterText param.
        The authenticated user must have REPO_READ permission for the specified repository to call this resource.
        :param start:
        :param project_key:
        :param repository_slug:
        :param base: base branch/tag to compare each branch to (for the metadata providers that uses that information)
        :param filter:
        :param limit: OPTIONAL: The limit of the number of branches to return, this may be restricted by
                    fixed system limits. Default by built-in method: None
        :param details: whether to retrieve plugin-provided metadata about each branch
        :param order_by: OPTIONAL: ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated)
        :param boost_matches: Controls whether exact and prefix matches will be boosted to the top
        :return:
        r9   r8   Ú
filterTextÚbaseÚorderByÚdetailsÚboostMatchesr:   )rz  r<   )r$   rJ   rž   r}  r7   r9   r8   r  Úorder_byÚboost_matchesr%   r;   s               r   Úget_brancheszBitbucket.get_branchesœ  s€   € ð6 ×%Ñ% k°?ÓCˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ#)ˆF�<Ñ ÙØ!ˆF�6‰NÙØ (ˆF�9ÑØ#ˆˆyÑØ!.ˆˆ~ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 ó,   — | j                  ||«      › d�S )Nz/default)rz  rm  s      r   Ú_url_repo_default_branchez#Bitbucket._url_repo_default_brancheÇ  s   € Ø×)Ñ)¨+°ÓGÐHÈÐQÐQr   c                 óH   — | j                  ||«      }| j                  |«      S )a  
        Get the default branch of the repository.
        The authenticated user must have REPO_READ permission for the specified repository to call this resource.
        :param project_key: The project key
        :param repository_slug: The repository key
        :return:
        )r…  rP   r4  s       r   Úget_default_branchzBitbucket.get_default_branchÊ  s$   € ð ×,Ñ,¨[¸/ÓJˆØ�x‰x˜‹}Ðr   c                 óT   — | j                  ||«      }d|i}| j                  ||¬«      S )af  
        Update the default branch of a repository.
        The authenticated user must have REPO_ADMIN permission for the specified repository to call this resource.
        :param project_key: The project key
        :param repository_slug: The repository key (slug)
        :param ref_branch_name: ref name like refs/heads/master
        :return:
        r]  r*   )r…  r†   )r$   rJ   rž   Úref_branch_namer%   r+   s         r   Úset_default_branchzBitbucket.set_default_branchÕ  s3   € ð ×,Ñ,¨[¸/ÓJˆØ�oÐ&ˆØ�x‰x˜ $ˆxÓ'Ð'r   c                 óX   — | j                  ||«      }|||dœ}| j                  ||¬«      S )aX  Creates a branch using the information provided in the request.

        The authenticated user must have REPO_WRITE permission for the context repository to call this resource.

        :param project_key: The project matching the projectKey supplied in the resource path as shown in URL.
        :type project_key: str
        :param repository_slug: Name of repository where branch is created (i.e. "my_repo").
        :param name: Name of branch to create (i.e. "my_branch").
        :type name: str
        :param start_point: Name of branch to branch from.
        :type start_point: str
        :param message: Branch message.
        :type message: str
        :return:
            200 - application/json (repository)
            401 - application/json (errors)
            404 - application/json (errors)
        :rtype: requests.Response
        )rF   Ú
startPointÚmessager*   )rz  r.   )r$   rJ   rž   rF   Ústart_pointr�  r%   r+   s           r   Úcreate_branchzBitbucket.create_branchâ  s5   € ð( ×%Ñ% k°?ÓCˆØ¨KÀGÑLˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 óx   — | j                  ||d¬«      }dt        |«      i}|r||d<   | j                  ||¬«      S )zÂ
        Delete branch from related repo
        :param self:
        :param project_key:
        :param repository_slug:
        :param name:
        :param end_point:
        :return:
        úrest/branch-utilsrw   rF   ÚendPointr*   )rz  Ústrrs   )r$   rJ   rž   rF   Ú	end_pointr%   r+   s          r   Údelete_branchzBitbucket.delete_branchú  sJ   € ð ×%Ñ% k°?ÐM`Ð%ÓaˆØœ˜D›	Ð"ˆÙØ(ˆD�ÑØ�{‰{˜3 Tˆ{Ó*Ð*r   c                 óv   — | j                   r| j                  |||¬«      › d�S | j                  |||¬«      › d�S )Nrw   z
/refs/tagsz/tags)r   r1  ry  s       r   Ú_url_repo_tagszBitbucket._url_repo_tags
  sE   € Ø�:Š:Ø—n‘n [°/ÈH�nÓUÐVÐV`ÐaÐaà—n‘n [°/ÈH�nÓUÐVÐV[Ð\Ð\r   c                 óˆ   — | j                  ||«      }i }|r||d<   |r||d<   |r||d<   |r||d<   | j                  ||¬«      S )aQ  
        Retrieve the tags matching the supplied filterText param.
        The authenticated user must have REPO_READ permission for the context repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param filter:
        :param start:
        :param limit: OPTIONAL: The limit of the number of tags to return, this may be restricted by
                fixed system limits. Default by built-in method: 1000
        :param order_by: OPTIONAL: ordering of refs either ALPHABETICAL (by name) or MODIFICATION (last updated)
        :return:
        r9   r8   r|  r~  r:   )r—  r<   )	r$   rJ   rž   r7   r8   r�  r9   r%   r;   s	            r   Úget_tagszBitbucket.get_tags  s`   € ð* ×!Ñ! +¨Ó?ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ#)ˆF�<Ñ ÙØ (ˆF�9ÑØ�‰˜s¨6ˆÓ2Ð2r   c                 óx   — | j                  ||«      }|�| j                  |› d|› �«      S | j                  |«      S )aw  
        Retrieve a tag in the specified repository.
        The authenticated user must have REPO_READ permission for the context repository to call this resource.
        Search uri is api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags/{name:.*}
        :param project_key:
        :param repository_slug:
        :param tag_name: OPTIONAL:
        :return:
        r©   )r—  rP   r<   ©r$   rJ   rž   Útag_namer%   s        r   Úget_project_tagszBitbucket.get_project_tags1  sE   € ð ×!Ñ! +¨Ó?ˆØÐØ—8‘8˜s˜e 1 X JÐ/Ó0Ð0à�‰˜sÓ#Ð#r   c                 ód   — | j                  ||«      }||dœ}|�||d<   | j                  ||¬«      S )a“  
        Creates a tag using the information provided in the {@link RestCreateTagRequest request}
        The authenticated user must have REPO_WRITE permission for the context repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param tag_name:
        :param commit_revision: commit hash
        :param description: OPTIONAL:
        :return:
        )rF   rŒ  r�  r*   )r—  r.   )r$   rJ   rž   rœ  Úcommit_revisionr¥   r%   r‡   s           r   Úset_tagzBitbucket.set_tagA  sG   € ð$ ×!Ñ! +¨Ó?ˆàØ)ñ
ˆð Ð"Ø)ˆD�‰Oà�y‰y˜ 4ˆyÓ(Ð(r   c                 óV   — | j                  ||d¬«      › d|› �}| j                  |«      S )aA  
        Creates a tag using the information provided in the {@link RestCreateTagRequest request}
        The authenticated user must have REPO_WRITE permission for the context repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param tag_name:
        :return:
        zrest/gitrw   r©   )r—  rs   r›  s        r   Ú
delete_tagzBitbucket.delete_tag]  s9   € ð ×$Ñ$ [°/ÈJÐ$ÓWÐXÐXYÐZbÐYcÐdˆØ�{‰{˜3ÓÐr   c                 ó,   — | j                  ||«      › d�S r÷   rM  rm  s      r   Ú_url_repo_hook_settingsz!Bitbucket._url_repo_hook_settingsi  s   € Ø—.‘. ¨oÓ>Ð?¸ÐOÐOr   c                 óx   — | j                  ||«      }i }|r||d<   |r||d<   |r||d<   | j                  ||«      S )a  
        Get all repository hooks for a given repo
        :param project_key: The project key
        :param repository_slug: The repository key
        :param start:
        :param limit: OPTIONAL: The limit of the number of changes to return, this may be restricted by
                fixed system limits. Default by built-in method: None
        :param filter_type: OPTIONAL: PRE_RECEIVE|POST_RECEIVE if present,
                                    controls how repository hooks should be filtered.
        :return:
        rú   r9   r8   )r¤  r<   )r$   rJ   rž   r9   r8   rû   r%   r;   s           r   Úall_repo_hook_settingsz Bitbucket.all_repo_hook_settingsl  sP   € ð& ×*Ñ*¨;¸ÓHˆØˆÙØ(ˆF�6‰NÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s FÓ+Ð+r   c                 óR   — | j                  ||«      › d|› �}| j                  |«      S )zÚ
        Get a repository hook from a given repo
        :param project_key: The project key
        :param repository_slug: The repository key
        :param hook_key: The repository hook key
        :return:
        r©   )r¤  rP   ©r$   rJ   rž   rÿ   r%   s        r   Úget_repo_hook_settingsz Bitbucket.get_repo_hook_settings‰  s0   € ð ×-Ñ-¨k¸?ÓKÐLÈAÈhÈZÐXˆØ�x‰x˜‹}Ðr   c                 óT   — | j                  ||«      › d|› d�}| j                  |«      S )zÜ
        Enable a repository hook for a given repo
        :param project_key: The project key
        :param repository_slug: The repository key
        :param hook_key: The repository hook key
        :return:
        r©   r  )r¤  r†   r¨  s        r   Úenable_repo_hook_settingsz#Bitbucket.enable_repo_hook_settings”  s3   € ð ×-Ñ-¨k¸?ÓKÐLÈAÈhÈZÐW_Ð`ˆØ�x‰x˜‹}Ðr   c                 óT   — | j                  ||«      › d|› d�}| j                  |«      S )zÝ
        Disable a repository hook for a given repo
        :param project_key: The project key
        :param repository_slug: The repository key
        :param hook_key: The repository hook key
        :return:
        r©   r  )r¤  rs   r¨  s        r   Údisable_repo_hook_settingsz$Bitbucket.disable_repo_hook_settingsŸ  s4   € ð ×-Ñ-¨k¸?ÓKÐLÈAÈhÈZÐW_Ð`ˆØ�{‰{˜3ÓÐr   c                 ó,   — | j                  ||«      › d�S )Nz	/webhooksrM  rm  s      r   Ú_url_webhookszBitbucket._url_webhooksª  s   € Ø—.‘. ¨oÓ>Ð?¸yÐIÐIr   c                 ól   — | j                  ||«      }i }|r||d<   |r||d<   | j                  ||¬«      S )zÓ
        Get webhooks
        :param project_key:
        :param repository_slug:
        :param event: OPTIONAL: defaults to None
        :param statistics: OPTIONAL: defaults to False
        :return:
        ÚeventÚ
statisticsr:   )r¯  r<   )r$   rJ   rž   r±  r²  r%   r;   s          r   Úget_webhookszBitbucket.get_webhooks­  sG   € ð × Ñ  ¨oÓ>ˆØˆÙØ#ˆF�7‰OÙØ#-ˆF�<Ñ Ø�‰˜s¨6ˆÓ2Ð2r   c                 ól   — | j                  ||«      }||||dœ}	|rd|i|	d<   | j                  ||	¬«      S )a„  Creates a webhook using the information provided in the request.

        The authenticated user must have REPO_ADMIN permission for the context repository to call this resource.

        :param project_key: The project matching the projectKey supplied in the resource path as shown in URL.
        :param repository_slug:
        :param name: Name of webhook to create.
        :param events: List of event. (i.e. ["repo:refs_changed", "pr:merged", "pr:opened"])
        :param webhook_url:
        :param active:
        :param secret: The string is used to verify data integrity between Bitbucket and your endpoint.
        :return:
        )rF   Úeventsr%   ÚactiveÚsecretÚconfigurationr*   )r¯  r.   )
r$   rJ   rž   rF   rµ  Úwebhook_urlr¶  r·  r%   r‡   s
             r   Úcreate_webhookzBitbucket.create_webhookÄ  sP   € ð. × Ñ  ¨oÓ>ˆàØØØñ	
ˆñ Ø%-¨vÐ$6ˆD�Ñ!Ø�y‰y˜ 4ˆyÓ(Ð(r   c                 ó0   — | j                  ||«      › d|› �S r¨   )r¯  )r$   rJ   rž   Ú
webhook_ids       r   Ú_url_webhookzBitbucket._url_webhookæ  s!   € Ø×$Ñ$ [°/ÓBÐCÀ1ÀZÀLÐQÐQr   c                 óJ   — | j                  |||«      }| j                  |«      S )a*  
        Retrieve a webhook.
        The authenticated user must have REPO_ADMIN permission for the context repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param webhook_id: the ID of the webhook within the repository
        :return:
        )r½  rP   ©r$   rJ   rž   r¼  r%   s        r   Úget_webhookzBitbucket.get_webhooké  s&   € ð ×Ñ ¨_¸jÓIˆØ�x‰x˜‹}Ðr   c                 óN   — | j                  |||«      }| j                  ||¬«      S )a(  
        Update a webhook.
        The authenticated user must have REPO_ADMIN permission for the context repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param webhook_id: the ID of the webhook within the repository
        :return:
        r*   )r½  r†   )r$   rJ   rž   r¼  r;   r%   s         r   Úupdate_webhookzBitbucket.update_webhookõ  s+   € ð ×Ñ ¨_¸jÓIˆØ�x‰x˜ &ˆxÓ)Ð)r   c                 óJ   — | j                  |||«      }| j                  |«      S )a(  
        Delete a webhook.
        The authenticated user must have REPO_ADMIN permission for the context repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param webhook_id: the ID of the webhook within the repository
        :return:
        )r½  rs   r¿  s        r   Údelete_webhookzBitbucket.delete_webhook  s'   € ð ×Ñ ¨_¸jÓIˆØ�{‰{˜3ÓÐr   c                 ó,   — | j                  ||«      › d�S )Nz/settings/pull-requestsrM  rm  s      r   Ú_url_pull_request_settingsz$Bitbucket._url_pull_request_settings  s   € Ø—.‘. ¨oÓ>Ð?Ð?VÐWÐWr   c                 óH   — | j                  ||«      }| j                  |«      S )zy
        Get pull request settings.
        :param project_key:
        :param repository_slug:
        :return:
        )rÆ  rP   r4  s       r   Úget_pull_request_settingsz#Bitbucket.get_pull_request_settings  s$   € ð ×-Ñ-¨k¸?ÓKˆØ�x‰x˜‹}Ðr   c                 óL   — | j                  ||«      }| j                  ||¬«      S )z˜
        Set pull request settings.
        :param project_key:
        :param repository_slug:
        :param data: json body
        :return:
        r*   )rÆ  r.   ©r$   rJ   rž   r+   r%   s        r   Úset_pull_request_settingsz#Bitbucket.set_pull_request_settings  s)   € ð ×-Ñ-¨k¸?ÓKˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 ót   — | j                   r| j                  d|› d|› d�«      S | j                  ||«      › d�S )Nzrepositories/r©   z/pullrequestsú/pull-requests)r   r-   r1  rm  s      r   Ú_url_pull_requestszBitbucket._url_pull_requests%  sD   € Ø�:Š:Ø×$Ñ$ }°[°MÀÀ?ÐBSÐS`Ð%aÓbÐbà—n‘n [°/ÓBÐCÀ>ÐRÐRr   c	                 ó¤   — | j                  ||«      }	i }
|r||
d<   |r||
d<   |r||
d<   |r||
d<   |r||
d<   |r||
d<   | j                  |	|
¬«      S )a!  
        Get pull requests
        :param project_key:
        :param repository_slug:
        :param state:
        :param order: OPTIONAL: defaults to NEWEST the order to return pull requests in, either OLDEST
                                (as in: "oldest first") or NEWEST.
        :param limit:
        :param start:
        :param at:
        :param filter_text: (optional) If specified, only pull requests where the title or description
                            contains the supplied string will be returned.
        :return:
        Ústater8   r9   ÚorderÚatr|  r:   )rÎ  r<   )r$   rJ   rž   rÐ  rÑ  r8   r9   rÒ  Úfilter_textr%   r;   s              r   Úget_pull_requestszBitbucket.get_pull_requests+  sw   € ð" ×%Ñ% k°?ÓCˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØˆF�4‰LÙØ#.ˆF�<Ñ Ø�‰˜s¨6ˆÓ2Ð2r   c                 óÒ   — dj                  | j                  ||dd¬«      «      }| j                  ||«      d   }| j                  ||«      d   }	|||	|dœ}
| j                  ||
¬«      S )aÝ  
        Get required reviewers for PR creation
        :param source_project: the project that the PR source is from
        :param source_repo: the repository that the PR source is from
        :param source_branch: the branch name of the PR
        :param dest_project: the project that the PR destination is from
        :param dest_repo: the repository that the PR destination is from
        :param dest_branch: where the PR is being merged into
        :return:
        z{}/reviewersr  r   rY   r]  )ÚsourceRepoIdÚsourceRefIdÚtargetRepoIdÚtargetRefIdr:   )r
  r1  r:  rP   )r$   Úsource_projectÚsource_repoÚdest_projectÚ	dest_repoÚsource_branchÚdest_branchr%   Úsource_repo_idÚdest_repo_idr;   s              r   Ú'get_required_reviewers_for_pull_requestz1Bitbucket.get_required_reviewers_for_pull_requestL  s…   € ð ×#Ñ#Ø�N‰NØØØ1Ø!ð	 ó ó
ˆð Ÿ™ ~°{ÓCÀDÑIˆØ—}‘} \°9Ó=¸dÑCˆà*Ø(Ø(Ø&ñ	
ˆð �x‰x˜ FˆxÓ+Ð+r   c                 óH  ‡— |||||d|idœdœ|||d|idœdœg dœŠˆfd„}| j                   s*|
r(| j                  ||||||«      }|D ]  } ||d   «       Œ |	�8t        |	t        «      r	 ||	«       nt        |	t        «      r|	D ]
  } ||«       Œ | j                  ||‰«      S )aQ  
        Create a new pull request between two branches.
        The branches may be in the same repository_slug, or different ones.
        When using different repositories, they must still be in the same {@link Repository#getHierarchyId() hierarchy}.
        The authenticated user must have REPO_READ permission for the "from" and "to"repositories to call this resource.
        :param source_project: the project that the PR source is from
        :param source_repo: the repository that the PR source is from
        :param dest_project: the project that the PR destination is from
        :param dest_repo: the repository that the PR destination is from
        :param source_branch: the branch name of the PR
        :param destination_branch: where the PR is being merged into
        :param title: the title of the PR
        :param description: the description of what the PR does
        :param reviewers: the list of reviewers or a single reviewer of the PR
        :param include_required_reviewers: OPTIONAL defaults to False, include required reviewers for the PR
        :return:
        rE   )ÚslugrF   rR   )r]  Ú
repository)Útitler¥   ÚfromRefÚtoRefÚ	reviewersc                 ó:   •— dd| ii}‰d   j                  |«       y )NrØ   rF   ré  )rÚ   )Úreviewer_nameÚentryr‡   s     €r   Úadd_reviewerz1Bitbucket.open_pull_request.<locals>.add_reviewerŸ  s%   ø€ Ø˜f mÐ4Ð5ˆEØ�Ñ×$Ñ$ UÕ+r   rF   )r   râ  Ú
isinstancer“  r_  Úcreate_pull_request)r$   rÚ  rÛ  rÜ  rÝ  rÞ  Údestination_branchræ  r¥   ré  Úinclude_required_reviewersrí  Úrequired_reviewersÚrequired_reviewerÚreviewerr‡   s                  @r   Úopen_pull_requestzBitbucket.open_pull_requestk  sñ   ø€ ð> Ø&à#à'Ø'Ø % ~Ð6ññð )à%Ø%Ø % |Ð4ññð ñ'
ˆô,	,ð �zŠzÑ8Ø!%×!MÑ!MØ ¨\¸9ÀmÐUgó"Ðð &8ò 8Ð!ÙÐ.¨vÑ6Õ7ð8ð Ð Ü˜)¤SÔ)Ù˜YÕ'Ü˜I¤tÔ,Ø )ò +�HÙ  Õ*ð+ð ×'Ñ'¨°iÀÓFÐFr   c                 óL   — | j                  ||«      }| j                  ||¬«      S )zu
        :param project_key:
        :param repository_slug:
        :param data: json body
        :return:
        r*   )rÎ  r.   rÊ  s        r   rï  zBitbucket.create_pull_request³  s)   € ð ×%Ñ% k°?ÓCˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 ó0   — | j                  ||«      › d|› �S r¨   ©rÎ  ©r$   rJ   rž   Úpull_request_ids       r   Ú_url_pull_requestzBitbucket._url_pull_request½  s"   € Ø×)Ñ)¨+°ÓGÐHÈÈ/ÐIZÐ[Ð[r   c                 óJ   — | j                  |||«      }| j                  |«      S )aW  
        Retrieve a pull request.
        The authenticated user must have REPO_READ permission
        for the repository that this pull request targets to call this resource.
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :return:
        ©rû  rP   ©r$   rJ   rž   rú  r%   s        r   Úget_pull_requestzBitbucket.get_pull_requestÀ  s&   € ð ×$Ñ$ [°/À?ÓSˆØ�x‰x˜‹}Ðr   z1.15.1zUse get_pull_request())ÚversionÚreasonc                  ó   — y)zP
        Deprecated name since 1.15.1. Let's use the get_pull_request()
        Nr   )r$   r&   r'   s      r   Úget_pullrequestzBitbucket.get_pullrequestÍ  s   � r   c                 óN   — | j                  |||«      }| j                  ||¬«      S )au  
        Update a pull request.
        The authenticated user must have REPO_WRITE permission
        for the repository that this pull request targets to call this resource.
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :param data: json body
        :return:
        r*   )rû  r†   )r$   rJ   rž   rú  r+   r%   s         r   Úupdate_pull_requestzBitbucket.update_pull_requestÓ  s+   € ð ×$Ñ$ [°/À?ÓSˆØ�x‰x˜ $ˆxÓ'Ð'r   c                 óV   — | j                  |||«      }d|i}| j                  ||¬«      S )a0  
        Delete a pull request.

        :param project_key: the project key
        :param repository_slug: the repository slug
        :param pull_request_id: the ID of the pull request within the repository
        :param pull_request_version: the version of the pull request
        :return:
        r   r*   )rû  rs   )r$   rJ   rž   rú  Úpull_request_versionr%   r+   s          r   Údelete_pull_requestzBitbucket.delete_pull_requestâ  s6   € ð  ×$Ñ$ [°/À?ÓSˆØÐ/Ð0ˆØ�{‰{˜3 Tˆ{Ó*Ð*r   c                 ó¸   — | j                   r| j                  |||«      › d�}n| j                  |||«      › d�}i }|r||d<   |r||d<   | j                  ||«      S )zø
        Get pull requests activities
        :param limit:
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :param start:
        :return:
        z	/activityz/activitiesr9   r8   )r   rû  r<   ©r$   rJ   rž   rú  r9   r8   r%   r;   s           r   Úget_pull_requests_activitiesz&Bitbucket.get_pull_requests_activitiesö  ss   € ð" �:Š:Ø×+Ñ+¨K¸È/ÓZÐ[Ð[dÐe‰Cà×+Ñ+¨K¸È/ÓZÐ[Ð[fÐgˆCØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s FÓ+Ð+r   c                 ór   — | j                  |||«      › d�}i }|r||d<   |r||d<   | j                  ||«      S )zõ
        Get pull requests changes
        :param start:
        :param limit:
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :return:
        z/changesr9   r8   ©rû  r<   r
  s           r   Úget_pull_requests_changesz#Bitbucket.get_pull_requests_changes  sO   € ð" ×'Ñ'¨°_ÀoÓVÐWÐW_Ð`ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s FÓ+Ð+r   c                 ór   — | j                  |||«      › d�}i }|r||d<   |r||d<   | j                  ||«      S )a  
        Get pull requests commits
        :param start:
        :param limit:
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :start
        :limit
        :return:
        z/commitsr9   r8   r  r
  s           r   Úget_pull_requests_commitsz#Bitbucket.get_pull_requests_commits+  sO   € ð& ×'Ñ'¨°_ÀoÓVÐWÐW_Ð`ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s FÓ+Ð+r   c                 ó2   — | j                  ||«      › d|› d�S )Nr©   z/participantsrø  rù  s       r   Ú_url_pull_request_participantsz(Bitbucket._url_pull_request_participantsF  s%   € Ø×)Ñ)¨+°ÓGÐHÈÈ/ÐIZÐZgÐhÐhr   c                 ól   — | j                  |||«      }i }|r||d<   |r||d<   | j                  ||«      S )zÑ
        Get all participants of a pull request
        :param start:
        :param limit:
        :param project_key:
        :param repository_slug:
        :param pull_request_id:
        :return:
        r9   r8   )r  r<   r
  s           r   Úget_pull_requests_participantsz(Bitbucket.get_pull_requests_participantsI  sG   € ð" ×1Ñ1°+¸ÐP_Ó`ˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s FÓ+Ð+r   rJ   rž   rú  ÚrolerØ   Úreturnc                 ó\   — | j                  |||«      }|d|idœ}| j                  ||¬«      S )a`  
        Assign a role to a user for a pull request
        :param project_key: The project key
        :param repository_slug: The repository key
        :param pull_request_id: The pull request id
        :param role: The role to assign, currently it only accepts REVIEWER
        :param user: The user to assign the role to
        :return:
        rF   )r  rØ   r*   )r  r.   )r$   rJ   rž   rú  r  rØ   r%   r+   s           r   Ú$assign_pull_request_participant_rolez.Bitbucket.assign_pull_request_participant_roleb  s:   € ð ×1Ñ1°+¸ÐP_Ó`ˆØ v¨t nÑ5ˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 óÞ   — | j                   rt        d«      ‚| j                  d«      }i }	|r||	d<   |�||	d<   |�||	d<   |�||	d<   |�||	d<   |�||	d<   |�||	d	<   | j                  ||	¬
«      S )aŠ  
        Get all pull requests where the current authenticated user is
        involved as either a reviewer, author or a participant
        :param start:
        :param limit:
        :param closed_since: OPTIONAL, defaults to returning pull
                             requests regardless of closed since date. Permits
                             returning only pull requests with a closed timestamp set more
                             recently that (now - closedSince). Units are in seconds. So
                             for example if closed since 86400 is set only pull requests
                             closed in the previous 24 hours will be returned.
        :param role: OPTIONAL, defaults to returning pull requests for
                     any role. If a role is supplied only pull requests where the
                     authenticated user is a participant in the given role will be
                     returned. Either REVIEWER, AUTHOR or PARTICIPANT.
        :param participant_status: OPTIONAL, defaults to returning
                                   pull requests with any participant status. A comma separated
                                   list of participant status. That is, one or more of
                                   UNAPPROVED, NEEDS_WORK, or APPROVED.
        :param state: OPTIONAL, defaults to returning pull requests in
                      any state. If a state is supplied only pull requests in the
                      specified state will be returned. Either OPEN, DECLINED or
                      MERGED. Omit this parameter to return pull request in any
                      state.

        :param order: OPTIONAL, defaults to NEWEST, the order to
                      return pull requests in, either OLDEST (as in: "oldest
                      first"), NEWEST, PARTICIPANT_STATUS, or CLOSED_DATE. Where
                      CLOSED_DATE is specified and the result set includes pull
                      requests that are not in the closed state, these pull requests
                      will appear first in the result set, followed by most recently
                      closed pull requests.
        :return:
        r  zdashboard/pull-requestsr9   r8   ÚclosedSincer  ÚparticipantStatusrÐ  rÑ  r:   )r   r  r-   r<   )
r$   r9   r8   Úclosed_sincer  Úparticipant_statusrÐ  rÑ  r%   r;   s
             r   Úget_dashboard_pull_requestsz%Bitbucket.get_dashboard_pull_requestsr  sª   € ðX �:Š:ÜÐ>Ó?Ð?Ø×ÑÐ 9Ó:ˆØˆÙØ#ˆF�7‰OØÐØ#ˆF�7‰OØÐ#Ø$0ˆF�=Ñ!ØÐØ!ˆF�6‰NØÐ)Ø*<ˆFÐ&Ñ'ØÐØ#ˆF�7‰OØÐØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c                 óx   — | j                  |||«      › d|› �}|dk(  rdnd}d|i||dœ}| j                  ||«      S )ap  
        Change the current user's status for a pull request.
        Implicitly adds the user as a participant if they are not already.
        If the current user is the author, this method will fail.
        :param project_key
        :param repository_slug:
        :param pull_request_id:
        :param status:
        :param user_slug:
        :return:
        r©   ÚAPPROVEDTFrF   )rØ   Úapprovedr]   )r  r†   )	r$   rJ   rž   rú  r]   Ú	user_slugr%   r!  r+   s	            r   Úchange_reviewed_statusz Bitbucket.change_reviewed_status²  s^   € ð ×4Ñ4°[À/ÐSbÓcÐdÐdeÐfoÐepÐqˆØ! ZÒ/‘4°Uˆà˜YÐ'Ø Øñ
ˆð
 �x‰x˜˜TÓ"Ð"r   c                 ó2   — | j                  |||«      › d�}|S )Nz	/comments©rû  rþ  s        r   Ú_url_pull_request_commentsz$Bitbucket._url_pull_request_commentsÇ  s$   € Ø×'Ñ'¨°_ÀoÓVÐWÐW`ÐaˆØˆ
r   c                 óh   — | j                  |||«      }d|i}|rd|i|d<   | j                  ||¬«      S )a  
        Add comment into pull request
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :param text comment text
        :param parent_id parent comment id

        :return:
        Útextr]  Úparentr*   )r&  r.   )r$   rJ   rž   rú  r(  Ú	parent_idr%   r‡   s           r   Úadd_pull_request_commentz"Bitbucket.add_pull_request_commentË  sE   € ð$ ×-Ñ-¨k¸?ÈOÓ\ˆØ˜ˆ~ˆÙØ" IÐ.ˆD�‰NØ�y‰y˜ 4ˆyÓ(Ð(r   c                 ó6   — | j                  |||«      › d|› �}|S r¨   )r&  ©r$   rJ   rž   rú  Ú
comment_idr%   s         r   Ú_url_pull_request_commentz#Bitbucket._url_pull_request_commentã  s*   € Ø×0Ñ0°¸oÈÓ_Ð`Ð`aÐblÐamÐnˆØˆ
r   c                 óL   — | j                  ||||«      }| j                  |«      S )a�  
        Retrieves a pull request comment.
        The authenticated user must have REPO_READ permission
        for the repository that this pull request targets to call this resource.
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :param comment_id: the ID of the comment to retrieve
        :return:
        )r/  rP   r-  s         r   Úget_pull_request_commentz"Bitbucket.get_pull_request_commentç  s)   € ð ×,Ñ,¨[¸/È?Ð\fÓgˆØ�x‰x˜‹}Ðr   c                 óZ   — | j                  ||||«      }||dœ}| j                  ||¬«      S )a  
        Update the text of a comment.
        Only the user who created a comment may update it.

        Note: the supplied JSON object must contain a version
        that must match the server's version of the comment
        or the update will fail.
        )r   r(  r*   )r/  r†   )	r$   rJ   rž   rú  r.  ÚcommentÚcomment_versionr%   r+   s	            r   Úupdate_pull_request_commentz%Bitbucket.update_pull_request_commentõ  s8   € ð" ×,Ñ,¨[¸/È?Ð\fÓgˆØ*°GÑ<ˆØ�x‰x˜ $ˆxÓ'Ð'r   z2.4.2z!Use delete_pull_request_comment()c                 ó,   — | j                  |||||«      S )zO
        Deprecated name since 2.4.2. Let's use the get_pull_request()
        )Údelete_pull_request_comment)r$   rJ   rž   rú  r.  r4  s         r   Údelete_pull_reques_commentz$Bitbucket.delete_pull_reques_comment
  s&   € ð ×/Ñ/ØØØØØó
ð 	
r   c                 óX   — | j                  ||||«      }d|i}| j                  ||¬«      S )a
  
        Delete a comment.
        Only the repository admin or user who created a comment may update it.

        Note: the supplied JSON object must contain a version
        that must match the server's version of the comment
        or delete will fail.
        r   r:   )r/  rs   )r$   rJ   rž   rú  r.  r4  r%   r+   s           r   r7  z%Bitbucket.delete_pull_request_comment  s8   € ð  ×,Ñ,¨[¸/È?Ð\fÓgˆØ˜?Ð+ˆØ�{‰{˜3 tˆ{Ó,Ð,r   c                 ó2   — | j                  |||«      › d�}|S )Nz/blocker-commentsr%  rþ  s        r   Ú"_url_pull_request_blocker_commentsz,Bitbucket._url_pull_request_blocker_comments2  s$   € Ø×'Ñ'¨°_ÀoÓVÐWÐWhÐiˆØˆ
r   r(  Úseverityc                 óX   — | j                  |||«      }||dœ}| j                  ||¬«      S )aM  
        Add a comment to a pull request that blocks the merge
        :param project_key: The project key
        :param repository_slug: The repository key
        :param pull_request_id: The pull request id
        :param text: The text of the comment
        :param severity: The severity of the comment
        :return:
        )r(  r<  r*   )r;  r.   )r$   rJ   rž   rú  r(  r<  r%   r+   s           r   Ú add_pull_request_blocker_commentz*Bitbucket.add_pull_request_blocker_comment6  s6   € ð ×5Ñ5°kÀ?ÐTcÓdˆØ¨(Ñ3ˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 óJ   — | j                  |||«      }| j                  |«      S )zí
        Get all comments that block the merge of a pull request
        :param project_key: The project key
        :param repository_slug: The repository key
        :param pull_request_id: The pull request id
        :return:
        )r;  rP   rþ  s        r   Ú#search_pull_request_blocker_commentz-Bitbucket.search_pull_request_blocker_commentF  s'   € ð ×5Ñ5°kÀ?ÐTcÓdˆØ�x‰x˜‹}Ðr   c                 óz   — | j                  |||«      › d�}i }| j                  s||d<   | j                  ||¬«      S )aU  
        Decline a pull request.
        The authenticated user must have REPO_READ permission for the repository
        that this pull request targets to call this resource.

        :param project_key: PROJECT
        :param repository_slug: my_shiny_repo
        :param pr_id: 2341
        :param pr_version: 12
        :return:
        z/decliner   r:   )rû  r   r.   ©r$   rJ   rž   Úpr_idÚ
pr_versionr%   r;   s          r   Údecline_pull_requestzBitbucket.decline_pull_requestS  sI   € ð ×'Ñ'¨°_ÀeÓLÐMÈXÐVˆØˆØ�zŠzØ *ˆF�9ÑØ�y‰y˜ VˆyÓ,Ð,r   c                 ó~   — | j                   rt        d«      ‚| j                  |||«      › d�}| j                  |«      S )zÒ
        Get all tasks for the pull request
        :param project_key:
        :param repository_slug:
        :param pull_request_id: the ID of the pull request within the repository
        :return:
        r  z/tasks)r   r  rû  rP   rþ  s        r   Ú	get_taskszBitbucket.get_taskse  sB   € ð �:Š:ÜÐ>Ó?Ð?Ø×'Ñ'¨°_ÀoÓVÐWÐW]Ð^ˆØ�x‰x˜‹}Ðr   c                 óR   — | j                   rt        d«      ‚| j                  d«      S )Nr  Útasks)r   r  r-   rj   s    r   Ú
_url_taskszBitbucket._url_tasksr  s&   € Ø�:Š:ÜÐ>Ó?Ð?Ø× Ñ  Ó)Ð)r   c                 óX   — | j                  «       }|ddœ|dœ}| j                  ||¬«      S )zƒ
        Add task to the comment
        :param anchor: ID of the comment,
        :param text: task text
        :return:
        ÚCOMMENT)r]  rú   )Úanchorr(  r*   )rJ  r.   )r$   rM  r(  r%   r+   s        r   Úadd_taskzBitbucket.add_taskw  s2   € ð �o‰oÓˆØ!'°Ñ;ÀTÑJˆØ�y‰y˜ 4ˆyÓ(Ð(r   c                 ó,   — | j                  «       › d|› �S r¨   )rJ  )r$   Útask_ids     r   Ú	_url_taskzBitbucket._url_task‚  s   € Ø—/‘/Ó#Ð$ A g YÐ/Ð/r   c                 óF   — | j                  |«      }| j                  |«      S )zU
        Get task information by ID
        :param task_id:
        :return:
        )rQ  rP   ©r$   rP  r%   s      r   Úget_taskzBitbucket.get_task…  s    € ð �n‰n˜WÓ%ˆØ�x‰x˜‹}Ðr   c                 óF   — | j                  |«      }| j                  |«      S )zL
        Delete task by ID
        :param task_id:
        :return:
        )rQ  rs   rS  s      r   Údelete_taskzBitbucket.delete_taskŽ  s!   € ð �n‰n˜WÓ%ˆØ�{‰{˜3ÓÐr   c                 ón   — | j                  |«      }d|i}|r||d<   |r||d<   | j                  ||¬«      S )z¾
        Update task by ID. It is possible to update state and/or text of the task
        :param task_id:
        :param text:
        :param state: OPEN, RESOLVED
        :return:
        r]  r(  rÐ  r*   )rQ  r†   )r$   rP  r(  rÐ  r%   r+   s         r   Úupdate_taskzBitbucket.update_task—  sF   € ð �n‰n˜WÓ%ˆØ�gˆˆÙØˆD�‰LÙØ!ˆD�‰MØ�x‰x˜ $ˆxÓ'Ð'r   c                 óP   — | j                  |||«      › d�}| j                  |«      S )a  
        Test whether a pull request can be merged.
        A pull request may not be merged if:
        - there are conflicts that need to be manually resolved before merging; and/or
        - one or more merge checks have vetoed the merge.
        The authenticated user must have REPO_READ permission for the repository
        that this pull request targets to call this resource.

        :param project_key: PROJECT
        :param repository_slug: my_shiny_repo
        :param pr_id: 2341
        :return:
        ú/mergerý  )r$   rJ   rž   rC  r%   s        r   Úis_pull_request_can_be_mergedz'Bitbucket.is_pull_request_can_be_merged§  s.   € ð ×'Ñ'¨°_ÀeÓLÐMÈVÐTˆØ�x‰x˜‹}Ðr   c                 ó°   — | j                  |||«      › d�}i }	d||t        |«      j                  dœ}
| j                  s||	d<   | j	                  ||
|	¬«      S )aÚ  
        Merge pull request
        The authenticated user must have REPO_READ permission for the repository
        that this pull request targets to call this resource.

        :param project_key: PROJECT
        :param repository_slug: my_shiny_repo
        :param pr_id: 2341
        :param merge_message: "feat: add new file handler"
        :param pr_version:
        :param close_source_branch: True
        :param merge_strategy:  "squash"
        :return:
        rZ  Úpullrequest)rú   r�  Úclose_source_branchÚmerge_strategyr   )r+   r;   )rû  r   Úvaluer   r.   )r$   rJ   rž   rC  Úmerge_messager^  r_  rD  r%   r;   r+   s              r   Úmerge_pull_requestzBitbucket.merge_pull_request¸  sk   € ð0 ×'Ñ'¨°_ÀeÓLÐMÈVÐTˆØˆà!Ø$Ø#6Ü+¨NÓ;×AÑAñ	
ˆð �zŠzØ *ˆF�9ÑØ�y‰y˜ 4°ˆyÓ7Ð7r   c                 ó\   — | j                  |||«      › d�}d|i}| j                  ||¬«      S )a^  
        Re-open a declined pull request.
        The authenticated user must have REPO_READ permission for the repository
        that this pull request targets to call this resource.

        :param project_key: PROJECT
        :param repository_slug: my_shiny_repo
        :param pr_id: 2341
        :param pr_version: 12
        :return:
        z/reopenr   r:   )rû  r.   rB  s          r   Úreopen_pull_requestzBitbucket.reopen_pull_requestÜ  s=   € ð ×'Ñ'¨°_ÀeÓLÐMÈWÐUˆØ˜ZÐ(ˆØ�y‰y˜ VˆyÓ,Ð,r   c                  ó   — y)Nzinbox/pull-requestsr   rj   s    r   Ú_url_inbox_pull_requestsz"Bitbucket._url_inbox_pull_requestsì  s   € Ø$r   c                 óJ   — | j                  «       › d�}| j                  |«      S )Nz/count)rf  rP   rZ   s     r   Úcheck_inbox_pull_requests_countz)Bitbucket.check_inbox_pull_requests_countï  s&   € Ø×.Ñ.Ó0Ð1°Ð8ˆØ�x‰x˜‹}Ðr   c                 ól   — | j                  «       }d|i}|r||d<   |r||d<   | j                  ||¬«      S )z‚
        Get pull request in your inbox
        :param start:
        :param limit:
        :param role:
        :return:
        r9   r8   r  r:   )rf  r<   )r$   r9   r8   r  r%   r;   s         r   Úcheck_inbox_pull_requestsz#Bitbucket.check_inbox_pull_requestsó  sG   € ð ×+Ñ+Ó-ˆØ˜5Ð!ˆÙØ#ˆF�7‰OÙØ!ˆF�6‰NØ�‰˜s¨6ˆÓ2Ð2r   c                 ó0   — | j                  ||«      › d�}|S )Nz/comparerM  r4  s       r   Ú_url_repo_comparezBitbucket._url_repo_compare	  s   € Ø—‘ ¨_Ó=Ð>¸hÐGˆØˆ
r   c                 óœ   — | j                  ||«      › d|› �}i }|r||d<   |r||d<   | j                  ||¬«      xs i j                  d«      S )aX  
        Gets a diff of the changes available in the {@code from} commit but not in the {@code to} commit.
        If either the {@code from} or {@code to} commit are not specified,
        they will be replaced by the default branch of their containing repository.
        :param project_key:
        :param repository_slug:
        :param path:
        :param hash_oldest: the source commit (can be a partial/full commit ID or qualified/unqualified ref name)
        :param hash_newest: the target commit (can be a partial/full commit ID or qualified/unqualified ref name)
        :return:
        z/diff/ÚfromÚtor:   Údiffs)rl  rP   )r$   rJ   rž   rŽ   Úhash_oldestÚhash_newestr%   r;   s           r   Úget_diffzBitbucket.get_diff	  sb   € ð ×'Ñ'¨°_ÓEÐFÀfÈTÈFÐSˆØˆÙØ(ˆF�6‰NÙØ&ˆF�4‰LØ—‘˜ V�Ó,Ò2°×7Ñ7¸Ó@Ð@r   c                 óJ   — dj                  | j                  ||||¬«      «      S )Nz
{}/commitsrY   ©r
  r1  )r$   rJ   rž   r!   r   s        r   Ú_url_commitszBitbucket._url_commits	  s2   € Ø×"Ñ"Ø�N‰NØØØ!Ø'ð	 ó ó
ð 	
r   c                 ó$  — | j                  ||«      }d|i}|r||d<   |r||d<   |r||d<   |r||d<   |r||d<   |	r|	|d<   |
r|
|d<   |r||d	<   | j                  r|s|rt        d
«      ‚|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )aÈ  
        Get commit list from repo
        :param project_key:
        :param repository_slug:
        :param hash_oldest:
        :param hash_newest:
        :param merges: OPTIONAL: include|exclude|only if present, controls how merge commits should be filtered.
        :param follow_renames: OPTIONAL: if true, the commit history of the specified file will be followed past renames
        :param ignore_missing: OPTIONAL: true to ignore missing commits, false otherwise
        :param with_counts: OPTIONAL: optionally include the total number of commits and total number of unique authors
        :param avatar_size: OPTIONAL: if present the service adds avatar URLs for commit authors.
        :param avatar_scheme: OPTIONAL: the desired scheme for the avatar URL
        :param limit: OPTIONAL: The limit of the number of commits to return, this may be restricted by
               fixed system limits. Default by built-in method: None
        :param until: OPTIONAL: The commit ID or ref (inclusively) to retrieve commits before
        :param since: OPTIONAL: The commit ID or ref (exclusively) to retrieve commits after
        :param path: OPTIONAL: An optional path to filter commits by
        :return:
        ÚmergesÚsinceÚuntilÚfollowRenamesÚignoreMissingÚ
withCountsÚ
avatarSizeÚavatarSchemer8   r  rŽ   r:   )rv  r   r  r<   )r$   rJ   rž   rq  rr  Úfollow_renamesÚignore_missingrx  Úwith_countsÚavatar_sizeÚavatar_schemer8   rz  ry  rŽ   r%   r;   s                    r   Úget_commitszBitbucket.get_commits%	  sÔ   € ðH ×Ñ ¨_Ó=ˆØ˜FÐ#ˆÙØ)ˆF�7‰OÙØ)ˆF�7‰OÙØ&4ˆF�?Ñ#ÙØ&4ˆF�?Ñ#ÙØ#.ˆF�<Ñ ÙØ#.ˆF�<Ñ ÙØ%2ˆF�>Ñ"ÙØ#ˆF�7‰OØ�:Š:™5¡EÜÐ>Ó?Ð?ÙØ#ˆF�7‰OÙØ#ˆF�7‰OÙØ!ˆF�6‰NØ�‰˜s¨6ˆÓ2Ð2r   c                 óf   — | j                  |||¬«      }d|i}|r||d<   | j                  ||¬«      S )a  
        Get commit list from repo
        :param project_key:
        :param repository_slug:
        :param hash_newest:
        :param merges: OPTIONAL: include|exclude|only if present, controls how merge commits should be filtered.
        :param commit_id
        :return:
        )Ú	commit_idrx  rz  r:   )Ú_url_commit_crP   )r$   rJ   rž   rr  rx  r‡  r%   r;   s           r   Úget_commit_changeszBitbucket.get_commit_changese	  sD   € ð × Ñ  ¨oÈÐ ÓSˆØ˜FÐ#ˆÙØ)ˆF�7‰OØ�x‰x˜ FˆxÓ+Ð+r   c                 óL   — dj                  | j                  ||||¬«      |«      S )Nz{}/commits/{}/changesrY   ru  )r$   rJ   rž   r!   r   r‡  s         r   rˆ  zBitbucket._url_commit_cu	  s7   € Ø&×-Ñ-Ø�N‰NØØØ!Ø'ð	 ó ð ó
ð 	
r   c                 óL   — dj                  | j                  ||||¬«      |«      S )Nz{}/{}rY   )r
  rv  )r$   rJ   rž   r‡  r!   r   s         r   Ú_url_commitzBitbucket._url_commit€	  s9   € ð �~‰~Ø×ÑØØØ!Ø'ð	 ó ð ó
ð 	
r   c                 ó`   — | j                  |||«      }i }|r||d<   | j                  ||¬«      S )aþ  
        Retrieve a single commit identified by its ID>. In general, that ID is a SHA1.
        From 2.11, ref names like "refs/heads/master" are no longer accepted by this resource.
        The authenticated user must have REPO_READ permission for the specified repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param commit: the commit ID to retrieve
        :param path :OPTIONAL an optional path to filter the commit by.
                        If supplied the details returned may not be for the specified commit.
                        Instead, starting from the specified commit, they will be the details for the first commit
                        affecting the specified path.
        :return:
        rŽ   r:   )rŒ  rP   )r$   rJ   rž   r~   rŽ   r%   r;   s          r   Úget_commit_infozBitbucket.get_commit_info’	  s<   € ð ×Ñ˜{¨O¸VÓDˆØˆÙØ!ˆF�6‰NØ�x‰x˜ FˆxÓ+Ð+r   c                 ó.   — | j                  |||«      › d�S )NrÍ  )rŒ  )r$   rJ   rž   r‡  s       r   Ú_url_commit_pull_requestsz#Bitbucket._url_commit_pull_requests§	  s   € Ø×"Ñ" ;°ÀÓKÐLÈNÐ[Ð[r   c                 óp   — | j                  |||«      }| j                  |«      xs i j                  d«      S )Nr`  )r�  rP   )r$   rJ   rž   r~   r%   s        r   Ú get_pull_requests_contain_commitz*Bitbucket.get_pull_requests_contain_commitª	  s4   € Ø×,Ñ,¨[¸/È6ÓRˆØ—‘˜“Ò# ×(Ñ(¨Ó2Ð2r   c                 óŽ   — | j                  ||«      › d�}i }|r||d<   |r||d<   |r||d<   |r||d<   | j                  ||¬«      S )ap  
        Get change log between 2 refs
        :param start:
        :param project_key:
        :param repository_slug:
        :param ref_from:
        :param ref_to:
        :param limit: OPTIONAL: The limit of the number of changes to return, this may be restricted by
                fixed system limits. Default by built-in method: None
        :return:
        z/compare/commitsrn  ro  r9   r8   r:   rH  )	r$   rJ   rž   Úref_fromÚref_tor9   r8   r%   r;   s	            r   Úget_changelogzBitbucket.get_changelog®	  se   € ð( —‘ ¨_Ó=Ð>Ð>NÐOˆØˆÙØ%ˆF�6‰NÙØ!ˆF�4‰LÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c           	      óN   — dj                  | j                  |||dd¬«      |«      S )Nz{}/reports/{}/annotationsúrest/insightsr   rY   ©r
  rŒ  ©r$   rJ   rž   r‡  Ú
report_keys        r   Ú_url_code_insights_annotationsz(Bitbucket._url_code_insights_annotationsÎ	  s<   € Ø*×1Ñ1Ø×ÑØØØØ(Ø!ð ó ð ó	
ð 		
r   c                 óX   — | j                  ||||«      }d|i}| j                  ||¬«      S )aM  
        Adds annotations to an existing insight report.
        For further information visit:
        https://docs.atlassian.com/bitbucket-server/rest/6.6.1/bitbucket-code-insights-rest.html
        :project_key: str
        :repository_slug: str
        :commit_id: str
        :report_key: str
        :annotations: list
        Úannotationsr*   )rœ  r.   )r$   rJ   rž   r‡  r›  rž  r%   r+   s           r   Ú'add_code_insights_annotations_to_reportz1Bitbucket.add_code_insights_annotations_to_reportÚ	  s9   € ð ×1Ñ1°+¸ÐPYÐ[eÓfˆØ˜{Ð+ˆØ�y‰y˜ 4ˆyÓ(Ð(r   c           	      óN   — dj                  | j                  |||dd¬«      |«      S )Nz{}/reports/{}r˜  r   rY   r™  rš  s        r   Ú_url_code_insights_reportz#Bitbucket._url_code_insights_reporté	  s<   € Ø×%Ñ%Ø×ÑØØØØ(Ø!ð ó ð ó	
ð 		
r   c                 óL   — | j                  ||||«      }| j                  |«      S )z¥
        Retrieve the specified code-insights report.
        :projectKey: str
        :repositorySlug: str
        :commit_id: str
        :report_key: str
        )r¡  rP   ©r$   rJ   rž   r‡  r›  r%   s         r   Úget_code_insights_reportz"Bitbucket.get_code_insights_reportõ	  s)   € ð ×,Ñ,¨[¸/È9ÐV`ÓaˆØ�x‰x˜‹}Ðr   c                 óL   — | j                  ||||«      }| j                  |«      S )zØ
        Delete a report for the given commit. Also deletes any annotations associated with this report.
        :projectKey: str
        :repositorySlug: str
        :commit_id: str
        :report_key: str
        )r¡  rs   r£  s         r   Údelete_code_insights_reportz%Bitbucket.delete_code_insights_report 
  s*   € ð ×,Ñ,¨[¸/È9ÐV`ÓaˆØ�{‰{˜3ÓÐr   c                 óz   — | j                  ||||«      }d|i}|j                  |«       | j                  ||¬«      S )aU  
        Create a new insight report, or replace the existing one
        if a report already exists for the given repository_slug, commit, and report key.
        A request to replace an existing report will be rejected
        if the authenticated user was not the creator of the specified report.
        For further information visit:
        https://docs.atlassian.com/bitbucket-server/rest/6.6.1/bitbucket-code-insights-rest.html
        :projectKey: str
        :repositorySlug: str
        :commitId: str
        :report_key: str
        :report_title: str
        :report_params:
        ræ  r*   )r¡  Úupdater†   )	r$   rJ   rž   r‡  r›  Úreport_titleÚreport_paramsr%   r+   s	            r   Úcreate_code_insights_reportz%Bitbucket.create_code_insights_report
  sD   € ð. ×,Ñ,¨[¸/È9ÐV`ÓaˆØ˜Ð&ˆØ�‰�MÔ"Ø�x‰x˜ $ˆxÓ'Ð'r   c                 ó°   — | j                  ||«      › d�}|r|› d|j                  d«      › �}i }|r||d<   |r||d<   |r||d<   | j                  ||¬«      S )aÂ  
        Retrieve a page of files from particular directory of a repository.
        The search is done recursively, so all files from any subdirectory of the specified directory will be returned.
        The authenticated user must have REPO_READ permission for the specified repository to call this resource.
        :param start:
        :param project_key:
        :param repository_slug:
        :param sub_folder: a sub folder in the target repository to list the files from.
        :param query: the commit ID or ref (e.g. a branch or tag) to list the files at.
                      If not specified the default branch will be used instead.
        :param limit: OPTIONAL
        :return:
        z/filesr©   rÒ  r9   r8   r:   )r1  Úlstripr<   )	r$   rJ   rž   Ú
sub_folderÚqueryr9   r8   r%   r;   s	            r   Úget_file_listzBitbucket.get_file_list'
  sw   € ð, —‘ ¨_Ó=Ð>¸fÐEˆÙØ�E˜˜:×,Ñ,¨SÓ1Ð2Ð3ˆCØˆÙØ ˆF�4‰LÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�‰˜s¨6ˆÓ2Ð2r   c                 ó’   — | j                  ||«      › d|› �}i }|�||d<   |�||d<   | j                  }| j                  ||d|¬«      S )a4  
        Retrieve the raw content for a file path at a specified revision.
        The authenticated user must have REPO_READ permission for the specified repository to call this resource.
        :param project_key:
        :param repository_slug:
        :param filename:
        :param at: OPTIONAL ref string
        :param markup: if present or "true", triggers the raw content to be markup-rendered and returned as HTML;
            otherwise, if not specified, or any value other than "true" the content is streamed without markup.
        :return:
        z/raw/rÒ  ÚmarkupT)r;   rÄ   r�   )r1  Úform_token_headersrP   )	r$   rJ   rž   ÚfilenamerÒ  r²  r%   r;   r�   s	            r   Úget_content_of_filezBitbucket.get_content_of_fileI
  se   € ð —‘ ¨_Ó=Ð>¸eÀHÀ:ÐNˆØˆØˆ>ØˆF�4‰LØÐØ%ˆF�8ÑØ×)Ñ)ˆØ�x‰x˜ F¸dÈGˆxÓTÐTr   c                 ó†   — |€| j                  |dd¬«      }n| j                  ||dd¬«      }|› d|€d› �S t        |«      › �S )Nzrest/branch-permissionsr   rY   z/restrictions/r    )r«   r1  r“  )r$   rJ   Úpermission_idrž   r}  s        r   Ú_url_branches_permissionsz#Bitbucket._url_branches_permissions^
  sp   € ØÐ"Ø×$Ñ$ØØ2Ø!ð %ó ‰Dð —>‘>ØØØ2Ø!ð	 "ó ˆDð ��~¨MÐ,A bÐ%ZÐ[Ð[ÄsÈ=ÓGYÐ%ZÐ[Ð[r   c                 ón   — | j                  |||«      }i }|r||d<   |r||d<   | j                  ||¬«      S )zÓ
        Get branches permissions from a given repo
        :param project_key:
        :param permission_id:
        :param repository_slug:
        :param start:
        :param limit:
        :return:
        r8   r9   r:   )r¸  rP   )r$   rJ   r·  rž   r9   r8   r%   r;   s           r   Úget_branches_permissionsz"Bitbucket.get_branches_permissionso
  sH   € ð" ×,Ñ,¨[¸-ÈÓYˆØˆÙØ#ˆF�7‰OÙØ#ˆF�7‰OØ�x‰x˜ FˆxÓ+Ð+r   c                 ó  — | j                  ||¬«      }|€g }|€g }|	€g }	| j                  }|r| j                  }|}n,||||j                  «       |j	                  «       dœddœ|||	dœ}|
|dœ}| j                  ||||¬«      S )aø  
        Create a restriction for the supplied branch or set of branches to be applied to the given repository.
        Allows creating multiple restrictions at once.
        To use multiple restrictions you should format payload manually -
        see the bitbucket-branch-restrictions.py example.
        Reference: https://docs.atlassian.com/bitbucket-server/rest/6.8.0/bitbucket-ref-restriction-rest.html
        :param project_key:
        :param multiple_permissions:
        :param matcher_type:
        :param matcher_value:
        :param permission_type:
        :param repository_slug:
        :param except_users:
        :param except_groups:
        :param except_access_keys:
        :param start:
        :param limit:
        :return:
        )rJ   rž   )r]  rF   T)r]  Ú	displayIdrú   r¶  )rú   Úmatcherra   r6   Ú
accessKeys)r9   r8   )r+   r;   r�   )r¸  rÆ   Úbulk_headersÚupperÚ
capitalizer.   )r$   rJ   Úmultiple_permissionsÚmatcher_typeÚmatcher_valueÚpermission_typerž   Úexcept_usersÚexcept_groupsÚexcept_access_keysr9   r8   r%   r�   Úrestrictionr;   s                   r   Úset_branches_permissionsz"Bitbucket.set_branches_permissionsˆ
  sÂ   € ðB ×,Ñ,¸ÐVeÐ,ÓfˆØÐØˆLØÐ ØˆMØÐ%Ø!#ÐØ×&Ñ&ˆÙØ×'Ñ'ˆGØ.‰Kð (à'Ø!.à*×0Ñ0Ó2Ø ,× 7Ñ 7Ó 9ñð #ñð &Ø'Ø0ñˆKð !¨5Ñ1ˆØ�y‰y˜ ;°vÀwˆyÓOÐOr   c                 óJ   — | j                  |||«      }| j                  |«      S )a  
        Deletes a restriction as specified by a restriction id.
        The authenticated user must have REPO_ADMIN permission or higher to call this resource.

        :param project_key:
        :param repository_slug:
        :param permission_id:
        :return:
        )r¸  rs   ©r$   rJ   r·  rž   r%   s        r   Údelete_branch_permissionz"Bitbucket.delete_branch_permissionÇ
  s'   € ð ×,Ñ,¨[¸-ÈÓYˆØ�{‰{˜3ÓÐr   c                 óJ   — | j                  |||«      }| j                  |«      S )a  
        Returns a restriction as specified by a restriction id.
        The authenticated user must have REPO_ADMIN permission or higher to call this resource.

        :param project_key:
        :param repository_slug:
        :param permission_id:
        :return:
        ©r¸  r<   rÌ  s        r   Úget_branch_permissionzBitbucket.get_branch_permissionÔ
  s'   € ð ×,Ñ,¨[¸-ÈÓYˆØ�‰˜sÓ#Ð#r   c                 óJ   — | j                  |||«      }| j                  |«      S )z¦
        Get branches permissions from a given repo
        :param project_key:
        :param permission_id
        :param repository_slug:
        :return:
        rÏ  rÌ  s        r   Úall_branches_permissionsz"Bitbucket.all_branches_permissionsá
  s'   € ð ×,Ñ,¨[¸-ÈÓYˆØ�‰˜sÓ#Ð#r   c                 óJ   — dj                  | j                  ||dd¬«      «      S )Nz{}/branchmodel/configurationr‘  r   rY   ru  rm  s      r   Ú_url_branching_modelzBitbucket._url_branching_modelì
  s2   € Ø-×4Ñ4Ø�N‰NØØØ,Ø!ð	 ó ó
ð 	
r   c                 óH   — | j                  ||«      }| j                  |«      S )zr
        Get branching model
        :param project_key:
        :param repository_slug:
        :return:
        )rÔ  rP   r4  s       r   Úget_branching_modelzBitbucket.get_branching_modelö
  s$   € ð ×'Ñ'¨°_ÓEˆØ�x‰x˜‹}Ðr   c                 óL   — | j                  ||«      }| j                  ||¬«      S )z‡
        Set branching model
        :param project_key:
        :param repository_slug:
        :param data:
        :return:
        r*   )rÔ  r†   rÊ  s        r   Úset_branching_modelzBitbucket.set_branching_model   s)   € ð ×'Ñ'¨°_ÓEˆØ�x‰x˜ $ˆxÓ'Ð'r   c           	      óh   — dddœdddddœddd	d
dœdddddœdddddœgdœ}| j                  |||«      S )zž
        Enable branching model by setting it with default configuration
        :param project_key:
        :param repository_slug:
        :return:
        NT)ÚrefIdÚ
useDefaultÚBugfixÚBUGFIXzbugfix/)rH   Úenabledr]  ÚprefixÚFeatureÚFEATUREzfeature/ÚHotfixÚHOTFIXzhotfix/ÚReleaseÚRELEASEzrelease/)ÚdevelopmentÚtypes)rØ  )r$   rJ   rž   Údefault_model_datas       r   Úenable_branching_modelz Bitbucket.enable_branching_model  s}   € ð &*¸Ñ>ð $,Ø#Ø"Ø'ñ	ð $-Ø#Ø#Ø(ñ	ð $,Ø#Ø"Ø'ñ	ð $-Ø#Ø#Ø(ñ	ð'ñ
Ðð: ×'Ñ'¨°_ÐFXÓYÐYr   c                 óD   — | j                  | j                  ||«      «      S )zv
        Disable branching model
        :param project_key:
        :param repository_slug:
        :return:
        )rs   rÔ  rm  s      r   Údisable_branching_modelz!Bitbucket.disable_branching_model1  s    € ð �{‰{˜4×4Ñ4°[À/ÓRÓSÐSr   c                 ó0   — | j                  ||«      › d|› �S )Nz/browse/rM  )r$   rJ   rž   r´  s       r   Ú	_url_filezBitbucket._url_file:  s   € Ø—.‘. ¨oÓ>Ð?¸xÈÀzÐRÐRr   c                 ó`   — | j                  |||«      }|||dœ}| j                  ||ddi¬«      S )zß
        Upload new file for given branch.
        :param project_key:
        :param repository_slug:
        :param content:
        :param message:
        :param branch:
        :param filename
        :return:
        )Úcontentr�  ÚbranchrÁ   úapplication/jsonr“   ©rí  r†   )	r$   rJ   rž   rï  r�  rð  r´  r%   r+   s	            r   Úupload_filezBitbucket.upload_file=  s=   € ð �n‰n˜[¨/¸8ÓDˆØ"¨wÀ&ÑIˆØ�x‰x˜ 4°(Ð<NÐ1OˆxÓPÐPr   c                 ób   — | j                  |||«      }||||dœ}	| j                  ||	ddi¬«      S )a  
        Update existing file for given branch.
        :param project_key:
        :param repository_slug:
        :param content:
        :param message:
        :param branch:
        :param filename:
        :param source_commit_id:
        :return:
        )rï  r�  rð  ÚsourceCommitIdrÁ   rñ  r“   rò  )
r$   rJ   rž   rï  r�  rð  r´  Úsource_commit_idr%   r+   s
             r   Úupdate_filezBitbucket.update_fileL  sF   € ð* �n‰n˜[¨/¸8ÓDˆàØØØ.ñ	
ˆð �x‰x˜ 4°(Ð<NÐ1OˆxÓPÐPr   c                 óZ   — | j                  d|› d�«      }| j                  ||||dœ¬«      S )ze
        Search repositories for matching code
        :team: str
        :search_query: str
        zteams/z/search/code)Úsearch_queryÚpageÚpagelenr:   r^   )r$   Úteamrù  rú  r8   r%   s         r   Úsearch_codezBitbucket.search_codej  s@   € ð ×Ñ &¨¨¨lÐ ;Ó<ˆØ�x‰xØØ$0¸$È5ÑQð ó 
ð 	
r   c                 ó6   — d|› d|› d�}| j                  |«      S ©Nzrest/git-lfs/admin/projects/z/repos/r  rz   )r$   rJ   r0  r%   s       r   Úget_lfs_repo_statuszBitbucket.get_lfs_repo_statusv  s$   € Ø,¨[¨M¸ÀÀÀhÐOˆØ�x‰x˜‹}Ðr   c                 ó\   — d|› d|› d�}|r| j                  |«      S | j                  |«      S rÿ  )r†   rs   )r$   rJ   r0  Úenabler%   s        r   Úset_lfs_repo_statuszBitbucket.set_lfs_repo_statusz  s6   € Ø,¨[¨M¸ÀÀÀhÐOˆÙØ—8‘8˜C“=Ð à—;‘;˜sÓ#Ð#r   c                 óJ   — dj                  | j                  ||dd¬«      «      S r  ru  )r$   rJ   rJ  s      r   Ú_url_repo_conditionszBitbucket._url_repo_conditions�  s2   € Ø×%Ñ%Ø�N‰NØØØ1Ø!ð	 ó ó
ð 	
r   c                 óP   — | j                  ||«      }| j                  |«      xs i S )aà  
        Request type: GET
        Return a page of defaults conditions with reviewers list (type REPOSITORY or PROJECT)
        that have been configured for this repository slug inside project specified.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264928992
        :projectKey: str- project key involved
        :repoKey: str - repo key involved
        :return:
        )r  rP   )r$   rJ   rJ  r%   s       r   Úget_repo_conditionszBitbucket.get_repo_conditions‹  s)   € ð ×'Ñ'¨°XÓ>ˆØ�x‰x˜‹}Ò" Ð"r   c                 ób   — | j                  ||«      }d}|D ]  }|d   d   dk(  r||= |dz  }Œ |S )aä  
        Request type: GET
        Return a page of repository conditions (only type PROJECT) with reviewers list associated
        that have been configured for this repository slug inside project specified.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264928992
        :projectKey: str- project key involved
        :repoKey: str - repo key involved
        :return:
        r   Úscoperú   Ú
REPOSITORYr   ©r  ©r$   rJ   rJ  r{   Úcountr  s         r   Úget_repo_project_conditionsz%Bitbucket.get_repo_project_conditions™  sS   € ð ×+Ñ+¨K¸ÓBˆØˆØ!ò 	ˆIØ˜Ñ! &Ñ)¨\Ò9Ø˜U�OØ�Q‰J‰Eð	ð ˆr   c                 ób   — | j                  ||«      }d}|D ]  }|d   d   dk(  r||= |dz  }Œ |S )aç  
        Request type: GET
        Return a page of repository conditions (only type REPOSITORY) with reviewers list associated
        that have been configured for this repository slug inside project specified.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264928992
        :projectKey: str- project key involved
        :repoKey: str - repo key involved
        :return:
        r   r	  rú   ÚPROJECTr   r  r  s         r   Úget_repo_repo_conditionsz"Bitbucket.get_repo_repo_conditions¬  sS   € ð ×+Ñ+¨K¸ÓBˆØˆØ!ò 	ˆIØ˜Ñ! &Ñ)¨YÒ6Ø˜U�OØ�Q‰J‰Eð	ð ˆr   c                 ón   — dj                  | j                  ||dd¬«      |€d«      S t        |«      «      S )Nz{}/condition/{}r  r   rY   r    )r
  r1  r“  )r$   rJ   rJ  r  s       r   Ú_url_repo_conditionzBitbucket._url_repo_condition¿  sP   € Ø ×'Ñ'Ø�N‰NØØØ1Ø!ð	 ó ð Ð&ˆBó
ð 	
ô -0°Ó,=ó
ð 	
r   c                 óR   — | j                  |||«      }| j                  |«      xs i S )að  
        Request type: GET
        Return a specific condition with reviewers list
            that have been configured for this repository slug inside project specified.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264927632
        :projectKey: str- project key involved
        :repoKey: str - repo key involved
        :idCondition: int - condition id involved
        :return:
        )r  rP   ©r$   rJ   rJ  r  r%   s        r   Úget_repo_conditionzBitbucket.get_repo_conditionÊ  s+   € ð ×&Ñ& {°H¸lÓKˆØ�x‰x˜‹}Ò" Ð"r   c                 óT   — | j                  ||«      }| j                  ||¬«      xs i S )a  
        Request type: POST
        Create a new condition for this repository slug inside project specified.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264908128
        :projectKey: str- project key involved
        :repoKey: str - repo key involved
        :data: condition: dictionary object
        :example condition: '{"sourceMatcher":
                                {"id":"any",
                                "type":{"id":"ANY_REF"}},
                                "targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},
                                "reviewers":[{"id": 12}],"requiredApprovals":"0"
                            }'
        :return:
        r*   )r  r.   )r$   rJ   rJ  r  r%   s        r   Úcreate_repo_conditionzBitbucket.create_repo_conditionÙ  s.   € ð" ×&Ñ& {°HÓ=ˆØ�y‰y˜ 9ˆyÓ-Ò3°Ð3r   c                 óV   — | j                  |||«      }| j                  ||¬«      xs i S )aA  
        Request type: PUT
        Update a specific condition for this repository slug inside project.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm52264927632
        :projectKey: str- project key involved
        :repoKey: str - repo key involved
        :idCondition: int - condition id involved
        :data: condition: dictionary object
        :example condition: '{"sourceMatcher":
                                {"id":"any",
                                "type":{"id":"ANY_REF"}},
                                "targetMatcher":{"id":"refs/heads/master","type":{"id":"BRANCH"}},
                                "reviewers":[{"id": 12}],"requiredApprovals":"0"
                            }'
        :return:
        r*   )r  r†   )r$   rJ   rJ  r  r  r%   s         r   Úupdate_repo_conditionzBitbucket.update_repo_conditioní  s0   € ð$ ×&Ñ& {°H¸lÓKˆØ�x‰x˜ )ˆxÓ,Ò2°Ð2r   c                 óR   — | j                  |||«      }| j                  |«      xs i S )a®  
        Delete a specific condition for this repository slug inside project.
        For further information visit:
            https://docs.atlassian.com/bitbucket-server/rest/5.16.0/bitbucket-default-reviewers-rest.html#idm8287339888
        Request type: DELETE
        :projectKey: str- project key involved
        :repoKey: str - repo key involved
        :idCondition: int - condition id involved
        :return:
        )r  rs   r  s        r   Údelete_repo_conditionzBitbucket.delete_repo_condition  s,   € ð ×&Ñ& {°H¸lÓKˆØ�{‰{˜3ÓÒ% 2Ð%r   c
                 óú   — | j                  ||«      › d�}
i }|�||d<   |�||d<   |�||d<   |�||d<   |�||d<   dd	i}| j                  |
||d
¬«      }|j                  |	¬«      D ]  }|j                  |«       Œ y)aí  
        Downloads a repository archive.
        Note that the data is written to the specified file-like object,
        rather than simply being returned.
        For further information visit:
           https://docs.atlassian.com/bitbucket-server/rest/7.13.0/bitbucket-rest.html#idp199
        :param project_key:
        :param repository_slug:
        :param dest_fd: a file-like object to which the archive will be written
        :param at: string: Optional, the commit to download an archive of; if not supplied,
                         an archive of the default branch is downloaded
        :param filename: string: Optional, a filename to include the "Content-Disposition" header
        :param format: string: Optional, the format to stream the archive in; must be one of: zip, tar, tar.gz or tgz.
                    If not specified, then the archive will be in zip format.
        :param path: string: Optional, path to include in the streamed archive
        :param prefix: string: Optional, a prefix to apply to all entries in the streamed archive;
                    if the supplied prefix does not end with a trailing /, one will be added automatically
        :param chunk_size: int: Optional, download chunk size. Defeault is 128
        z/archiveNrÒ  r´  r
  rŽ   rß  rÁ   z*/*T)r;   r�   Úadvanced_mode)Ú
chunk_size)r1  rP   Úiter_contentÚwrite)r$   rJ   rž   Údest_fdrÒ  r´  r
  rŽ   rß  r  r%   r;   r�   r{   Úchunks                  r   Údownload_repo_archivezBitbucket.download_repo_archive  s·   € ð> —‘ ¨_Ó=Ð>¸hÐGˆØˆØˆ>ØˆF�4‰LØÐØ!)ˆF�:ÑØÐØ%ˆF�8ÑØÐØ!ˆF�6‰NØÐØ%ˆF�8ÑØ˜UÐ#ˆØ—8‘8˜C¨¸Èt�8ÓTˆØ×*Ñ*°jÐ*ÓAò 	!ˆEØ�M‰M˜%Õ ñ	!r   z2.0.2z<Use atlassian.bitbucket.cloud instead of atlassian.bitbucketc                 óæ   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j                  |||¬«      D �cg c]  }|j                  ‘Œ c}S c c}w )av  
        Get all repositories in a workspace.

        :param workspace:
        :param role: Filters the result based on the authenticated user's role on each repository.
                      One of: member, contributor, admin, owner
        :param query: Query string to narrow down the response.
        :param sort: Field by which the results should be sorted.
        )r  ÚqÚsort)r   r%   Ú_new_session_argsÚ
workspacesrP   ÚrepositoriesÚeachr+   )r$   Ú	workspacer  r¯  r'  Úrs         r   Úget_repositorieszBitbucket.get_repositories@  s]   € ô  ˜4Ÿ8™8Ñ> t×'=Ñ'=Ñ>ß‰ZŸ™˜I›ß‰\Ÿ$™$ D¨E¸˜$Ó=ö	
àð �F‹Fò
ð 	
ùò 
s   ÁA.c                 óD  — g }t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  |¬«      D ].  }|j                  |j                  «       t        |«      |k(  sŒ- |S  |S )a2  
        Get information about latest pipelines runs.

        :param workspace:
        :param repository_slug:
        :param sort_by:
        :param number: number of pipelines to fetch
        :param :sort_by: optional key to sort available pipelines for
        :return: List of pipeline data
        )r'  )r   r%   r(  r)  rP   r*  Ú	pipelinesr+  rÚ   r+   Úlen)r$   r,  rž   ÚnumberÚsort_byr`  Úps          r   Úget_pipelineszBitbucket.get_pipelinesU  s„   € ð ˆä�$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰Y—t‘t �tÓ)ò		ˆAð �M‰M˜!Ÿ&™&Ô!Ü�6‹{˜fÓ$Øàˆð	ð ˆr   c                 óò   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  |||¬«      j                  S )aÂ  
        Trigger a new pipeline. The following options are possible (1 and 2
        trigger the pipeline that the branch is associated with in the Pipelines
        configuration):
        1. Latest revision of a branch (specify ``branch``)
        2. Specific revision on a branch (additionally specify ``revision``)
        3. Specific pipeline (additionally specify ``name``)
        :return: the initiated pipeline; or error information
        )rð  r~   Úpattern)	r   r%   r(  r)  rP   r*  r0  Útriggerr+   )r$   r,  rž   rð  ÚrevisionrF   s         r   Útrigger_pipelinezBitbucket.trigger_pipelineq  sT   € ô, �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰Y—w‘w f°XÀt�wÓLß‰Tð	
r   c                 óì   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  S )zÚ
        Get information about the pipeline specified by ``uuid``.
        :param workspace:
        :param repository_slug:
        :param uuid: Pipeline identifier (with surrounding {}; NOT the build number)
        )r   r%   r(  r)  rP   r*  r0  r+   ©r$   r,  rž   Úuuids       r   Úget_pipelinezBitbucket.get_pipelineŽ  sM   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰Y—s‘s˜4“yß‰Tð	
r   c                 óô   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  «       S )a  
        Stop the pipeline specified by ``uuid``.
        :param workspace:
        :param repository_slug:
        :param uuid: Pipeline identifier (with surrounding {}; NOT the build number)

        See the documentation for the meaning of response status codes.
        )r   r%   r(  r)  rP   r*  r0  Ústopr<  s       r   Ústop_pipelinezBitbucket.stop_pipeline¡  sO   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰Y—s‘s˜4“yß‰T‹Vð	
r   c                 ó<  — g }t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  «       D ]  }|j                  |j                  «       Œ |S )zç
        Get information about the steps of the pipeline specified by ``uuid``.
        :param workspace:
        :param repository_slug:
        :param uuid: Pipeline identifier (with surrounding {}; NOT the build number)
        )
r   r%   r(  r)  rP   r*  r0  ÚstepsrÚ   r+   )r$   r,  rž   r=  r`  Úss         r   Úget_pipeline_stepszBitbucket.get_pipeline_steps¶  st   € ð ˆä�$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰Y—s‘s˜4“yß‰U‹Wò	"ˆAð �M‰M˜!Ÿ&™&Õ!ð	"ð ˆr   c                 ó
  — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  |«      j                  S )a4  
        Get information about a step of a pipeline, specified by respective UUIDs.
        :param workspace:
        :param repository_slug:
        :param pipeline_uuid: Pipeline identifier (with surrounding {}; NOT the build number)
        :param step_uuid: Step identifier (with surrounding {})
        )	r   r%   r(  r)  rP   r*  r0  Ústepr+   ©r$   r,  rž   Úpipeline_uuidÚ	step_uuids        r   Úget_pipeline_stepzBitbucket.get_pipeline_stepÍ  sW   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰Y—s‘s˜=Ó)ß‰T�)‹_ß‰Tð	
r   c                 ó  — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  |«      j                  «       S )aJ  
        Get log of a step of a pipeline, specified by respective UUIDs.
        :param workspace:
        :param repository_slug:
        :param pipeline_uuid: Pipeline identifier (with surrounding {}; NOT the build number)
        :param step_uuid: Step identifier (with surrounding {})
        :return: byte string log
        )	r   r%   r(  r)  rP   r*  r0  rG  rN   rH  s        r   Úget_pipeline_step_logzBitbucket.get_pipeline_step_logâ  sY   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰Y—s‘s˜=Ó)ß‰T�)‹_ß‰S‹Uð	
r   c                 óô   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  ||||¬«      j                  S )aF  
        Create a new issue in the issue tracker of the given repository.
        :param workspace:
        :param repository_slug:
        :param title:
        :param description:
        :param kind: one of: bug, enhancement, proposal, task
        :param priority: one of: trivial, minor, major, critical, blocker
        )ræ  r¥   ÚkindÚpriority)	r   r%   r(  r)  rP   r*  ÚissuesÚcreater+   )r$   r,  rž   ræ  r¥   rO  rP  s          r   Úcreate_issuezBitbucket.create_issueø  sa   € ô. �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰V—F‘FØØ'ØØ!ð	 ó ÷ ‰Tð	
r   c                 ó$  — g }t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  ||¬«      D ]  }|j                  |j                  «       Œ |S )a  
        Get information about the issues tracked in the given repository. By
        default, the issues are sorted by ID in descending order.
        :param workspace:
        :param repository_slug:
        :param sort_by: optional key to sort available issues for
        :param query: optional query to filter available issues for. See
          https://developer.atlassian.com/bitbucket/api/2/reference/meta/filtering
          for an overview

        :return: List of issues (direct, i.e. without the 'values' key)
        )r&  r'  )
r   r%   r(  r)  rP   r*  rQ  r+  rÚ   r+   )r$   r,  rž   r3  r¯  r`  r4  s          r   Ú
get_issueszBitbucket.get_issues  sr   € ð" ˆä�$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰V—D‘D˜5 w�DÓ/ò		"ˆAð �M‰M˜!Ÿ&™&Õ!ð	"ð ˆr   c                 óì   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  S )z4
        Get the issue specified by ``id``.
        )r   r%   r(  r)  rP   r*  rQ  r+   ©r$   r,  rž   r]  s       r   Ú	get_issuezBitbucket.get_issue7  sM   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰V—C‘C˜“Gß‰Tð	
r   c                 ó  —  t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  di |¤Žj                  S )zŠ
        Update the ``fields`` of the issue specified by ``id``.
        Consult the official API documentation for valid fields.
        r   )	r   r%   r(  r)  rP   r*  rQ  r¨  r+   ©r$   r,  rž   r]  Úfieldss        r   Úupdate_issuezBitbucket.update_issueG  se   € ðŒE�$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰V—C‘C˜“Gß‰Vñ	ð ñ	÷
 ‰Tð	
r   c                 óô   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  «       S )z7
        Delete the issue specified by ``id``.
        )r   r%   r(  r)  rP   r*  rQ  rs   rW  s       r   Údelete_issuezBitbucket.delete_issueY  sO   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß‰V—C‘C˜“Gß‰V‹Xð	
r   c
           	      óú   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  |||||||	¬«      j                  S )a  
        Add a new branch restriction.

        :param workspace:
        :param repository_slug:
        :param value:
        :param kind: One of require_tasks_to_be_completed, force, restrict_merges,
                      enforce_merge_checks, require_approvals_to_merge, delete,
                      require_all_dependencies_merged, push, require_passing_builds_to_merge,
                      reset_pullrequest_approvals_on_change, require_default_reviewer_approvals_to_merge
        :param branch_match_kind: branching_model or glob, if branching_model use
                      param branch_type otherwise branch_pattern.
        :param branch_pattern: A glob specifying the branch this restriction should
                      apply to (supports * as wildcard).
        :param branch_type: The branch type specifies the branches this restriction
                      should apply to. One of: feature, bugfix, release, hotfix, development, production.
        :param users: List of user objects that are excluded from the restriction.
                        Minimal: {"username": "<username>"}
        :param groups: List of group objects that are excluded from the restriction.
                        Minimal: {"owner": {"username": "<teamname>"}, "slug": "<groupslug>"}
        )Úbranch_match_kindÚbranch_patternÚbranch_typera   r6   r`  )	r   r%   r(  r)  rP   r*  Úbranch_restrictionsrR  r+   )
r$   r,  rž   rO  r`  ra  rb  ra   r6   r`  s
             r   Úadd_branch_restrictionz Bitbucket.add_branch_restrictioni  sl   € ôL �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß Ñ §¡ØØ"3Ø-Ø'ØØØð "(ó "÷ ‰Tð	
r   c                 óF  — g }t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  ||¬«      D ].  }|j                  |j                  «       t        |«      |k(  sŒ- |S  |S )z-
        Get all branch permissions.
        )rO  r7  )r   r%   r(  r)  rP   r*  rc  r+  rÚ   r+   r1  )r$   r,  rž   rO  r7  r2  r`  r4  s           r   Úget_branch_restrictionsz!Bitbucket.get_branch_restrictionsž  s‡   € ð ˆä�$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß Ñ §¡¨4¸ Ó!Aò		ˆAð �M‰M˜!Ÿ&™&Ô!Ü�6‹{˜fÓ$Øàˆð	ð ˆr   c                 ó  —  t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  di |¤Žj                  S )zŽ
        Update an existing branch restriction identified by ``id``.
        Consult the official API documentation for valid fields.
        r   )	r   r%   r(  r)  rP   r*  rc  r¨  r+   rZ  s        r   Úupdate_branch_restrictionz#Bitbucket.update_branch_restriction³  sf   € ðŒE�$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß Ñ §¡ R£ß‰Vñ	ð ñ	÷
 ‰Tð	
r   c                 óô   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  «       S )zM
        Delete an existing branch restriction identified by ``id``.
        )r   r%   r(  r)  rP   r*  rc  rs   rW  s       r   Údelete_branch_restrictionz#Bitbucket.delete_branch_restrictionÅ  sP   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ß Ñ §¡ R£ß‰V‹Xð	
r   c                 óì   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  |«      j                  S )a  
        Add user as default reviewer to the repository.
        Can safely be called multiple times with the same user, only adds once.

        :param workspace:
        :param repository_slug:
        :param user: The username or account UUID to add as default_reviewer.
        )	r   r%   r(  r)  rP   r*  Údefault_reviewersÚaddr+   ©r$   r,  rž   rØ   s       r   Úadd_default_reviewerzBitbucket.add_default_reviewerÕ  sN   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ßÑŸs™s 4›yß‰Tð	
r   c                 ó@  — g }t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j                  «       D ].  }|j                  |j                  «       t        |«      |k(  sŒ- |S  |S )z?
        Get all default reviewers for the repository.
        )r   r%   r(  r)  rP   r*  rl  r+  rÚ   r+   r1  )r$   r,  rž   r2  r`  r4  s         r   Úget_default_reviewerszBitbucket.get_default_reviewersê  s€   € ð ˆä�$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ßÑŸt™t›vò		ˆAð �M‰M˜!Ÿ&™&Ô!Ü�6‹{˜fÓ$Øàˆð	ð ˆr   c                 óÞ   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      	 €yy)zó
        Check if the user is a default reviewer of the repository.

        :param workspace:
        :param repository_slug:
        :param user: The username or account UUID to check.
        :return: True if present, False if not.
        FT)r   r%   r(  r)  rP   r*  rl  rn  s       r   Úis_default_reviewerzBitbucket.is_default_reviewerÿ  sT   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ßÑŸs™s 4›yØð	ð àr   c                 óô   — t        | j                  fi | j                  ¤Žj                  j	                  |«      j
                  j	                  |«      j                  j	                  |«      j                  «       S )zÒ
        Remove user as default reviewer from the repository.

        :param repository_slug:
        :param workspace:
        :param user: The username or account UUID to delete as default reviewer.
        )r   r%   r(  r)  rP   r*  rl  rs   rn  s       r   Údelete_default_reviewerz!Bitbucket.delete_default_reviewer  sP   € ô �$—(‘(Ñ5˜d×4Ñ4Ñ5ß‰ZŸ™˜I›ß‰\Ÿ#™#˜oÓ.ßÑŸs™s 4›yß‰V‹Xð	
r   )N)Né   r   )r   N)Nr   rv  )NN)r    )z	image/png)r   NN)r   rv  )FT)NNr   NTÚMODIFICATIONF)r    iè  Nr   )NF)ÚOPENÚnewestéd   r   NN)r   NNNNNN)NNFFÚincludeFNNNNNN)Nr{  N)NNN)NNr   N)
FNNNNNNNr   rv  )r   é
   )T)NNNNNé€   )r|  z-created_on)ÚmasterNN)r    ÚbugÚmajor)ÚglobÚ*NNNN)NNr|  )r|  )ðr   r   r   r#   r/   r4   r>   rC   rT   r[   r_   rc   re   rg   rk   rm   ro   rq   rt   rx   r|   r   r�   r„   rˆ   rŠ   rš   rŸ   r¢   rM   r¦   r«   rR   r³   rµ   r¹   r¿   r¾   rÊ   rÐ   rÓ   r¼   rQ   rÞ   rà   rã   r½   rç   rê   rï   ró   rõ   rø   rü   r   r  r  r  r  r  r  r  r  r  r  r"  r$  r&  r(  r.  r1  r5  r8  r:  r<  r>  r@  rC  rF  rK  rO  rQ  rS  rU  rW  rY  rÙ   rb  r^  rh  rj  rn  rp  rs  ru  rw  rz  rƒ  r…  r‡  rŠ  r�  r•  r—  r™  r�  r   r¢  r¤  r¦  r©  r«  r­  r¯  r³  rº  r½  rÀ  rÂ  rÄ  rÆ  rÈ  rË  rÎ  rÔ  râ  rõ  rï  rû  rÿ  r   r  r  r  r  r  r  r  r  r“  Úintr   rÅ   r  r  r#  r&  r+  r/  r1  r5  r8  r7  r;  r>  r@  rE  rG  rJ  rN  rQ  rT  rV  rX  r[  r   r   rb  rd  rf  rh  rj  rl  rs  rv  r…  r‰  rˆ  rŒ  rŽ  r�  r’  r–  rœ  rŸ  r¡  r¤  r¦  r«  r°  rµ  r¸  rº  rÊ  rÍ  rÐ  rÒ  rÔ  rÖ  rØ  ré  rë  rí  ró  r÷  rý  r   r  r  r  r  r  r  r  r  r  r  r$  r.  r5  r:  r>  rA  rE  rK  rM  rS  rU  rX  r\  r^  rd  rf  rh  rj  ro  rq  rs  ru  Ú__classcell__)r(   s   @r   r   r      sâ  ø„ ô>ò	)óCó3ó(3ò&ò"òó,ó&3ò&ò2òò;òò òòò
ò-òò(ò òJó 4ó&Dó3ó)ó"Lò#òò*ò>ò
óFó<ó3ò&Eó3ò&&ò
,ò/òFó3ò(
,ò/òò6ò7òBó,ò*òò ò
ò
#ó
ò#ò4ò&3ò(&òQó3ó Pó3ò"7ô)óFOòò"ò	òò 	*ò	 ò)ò)ó,3ò(Hó3ò(,ò/ò Ió3ò(xòQò&4ò ,ò,/ò$Hò	ò)ò_ó3ó"]ð ØØØØØØô)3òVRò	ò(ó)ó0+ó ]ð ØØØô3óB$ð, ó)ò8
 òPð ØØó,ò:	ò	ò	 òJð Øô3ð> ó )òDRò
ò
*ò
 òXòò	)òSð txô3òB,ðR Ø#(ôFGòP)ò\òñ ˜Ð)AÔBñó Cðò
(ò+ð2 Øó,ðB Øó,ð< Øó,ò6ið Øó,ð2)Øð)Ø14ð)ØGJð)ØRUð)Ø]`ð)à	�$‰ó)ð$ ØØØØØØô>3ò@#ò*ð ó)ò0òò(ñ* ˜Ð(KÔLñ
ó Mð
ò&-ð(Ðcfó ð)Øð)Ø14ð)ØGJð)ØRVð)Øbeð)à	ó)ð ØðØ14ðØGJðà	�$‰óò-ò$ò*ò
	)ò0òò ó(ò ð. "Ø$×1Ò1Øó"8òH-ò %òó3ò òAó(
ð ØØØØØØØØØØØô>3ô@,ô 	
ð  Øó
ó$,ò*\ò3ð Øó3ò@

ò)ò

ò	ò	 ò(ð@ ØØØô 3óDUó*\ð* ØØó,ð8 #ØØØØØØØØØô=Pó~ ó$ó	$ò
òò	(ò$ZòLTòSòQòQô<

òô$ò
ò#òò&ó&	
ò#ò4ò(3ò*&ð& ØØØØØô.!ñ` ØØMôó
ó	ð
ñ" ØØMôóó	ðñ0 ØØMôð ØØó
ó	ð
ñ2 ØØMôñ
ó	ð
ñ ØØMôñ
ó	ð
ñ" ØØMôñó	ðñ& ØØMôñ
ó	ð
ñ" ØØMôñ
ó	ð
ñ$ ØØMôð ØØó
ó	ð
ñ> ØØMôòó	ðñ0 ØØMôñ

ó	ð

ñ ØØMôñ
ó	ð
ñ ØØMôñ

ó	ð

ñ ØØMôð !ØØØØØó/
ó	ð/
ñb ØØMôóó	ðñ" ØØMôñ
ó	ð
ñ ØØMôñ

ó	ð

ñ ØØMôñ
ó	ð
ñ" ØØMôóó	ðñ" ØØMôñó	ðñ( ØØMôñ
ó	ô
r   r   )ÚloggingÚenumr   Útypingr   r   Úrequestsr   Úatlassian.bitbucket.cloudr   r}  r	   Ú	getLoggerr   rN   r   r   r   r   r   ú<module>r‹     sF   ðã Ý Ý å !Ý å +å à€g×Ñ˜Ó!€ô"�Dô "ôO8
�õ O8
r   