
    ,Of0                    z    d dl mZ d dlmZ d dlmZ d dlZd dlZd dlZd dl	m
Z
mZmZmZ d dlmZ  G d de      Zy)	    )annotations)datetime)AnyN)	AttributeCompletableGithubObjectNotSetOpt)PaginatedListc                     e Zd ZdZddZddZedd       Zedd       Zedd       Z	edd       Z
edd       Zedd	       Zedd
       Zedd       Zedd       Zedd       Zedd       Zedd       Zed d       Zed!d       Zedd       Zedd       Zd"dZd#dZeeeeef	 	 	 	 	 	 	 	 	 	 	 	 	 d$dZedd       Zd%dZy)&
Deploymentz
    This class represents Deployments.

    The reference can be found here
    https://docs.github.com/en/rest/reference/repos#deployments

    c                d   t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _	        t         | _
        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        y N)r   _id_ref_url_sha_task_payload_original_environment_environment_production_environment_transient_environment_description_creator_created_at_updated_at_statuses_url_repository_urlselfs    1lib/python3.12/site-packages/github/Deployment.py_initAttributeszDeployment._initAttributesB   s{    #)$*	$*	$*	%+
395;",28>$7=#,2?E067=-3/5    c                z    | j                  | j                  j                  | j                  j                  d      S )N)idurl)get__repr__r   valuer   r   s    r!   __repr__zDeployment.__repr__T   s(    txx~~diioo NOOr#   c                d    | j                  | j                         | j                  j                  S r   )_completeIfNotSetr   r(   r   s    r!   r%   zDeployment.idW   s"    txx(xx~~r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   refzDeployment.ref\   "    tyy)yyr#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   r&   zDeployment.urla   r.   r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   shazDeployment.shaf   r.   r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   taskzDeployment.taskk   s$    tzz*zzr#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   payloadzDeployment.payloadp   $    t}}-}}"""r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   original_environmentzDeployment.original_environmentu   s(    t99:))///r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   environmentzDeployment.environmentz   (    t001  &&&r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   production_environmentz!Deployment.production_environment   s(    t;;<++111r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   transient_environmentz Deployment.transient_environment   s(    t::;**000r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   descriptionzDeployment.description   r;   r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   creatorzDeployment.creator   r6   r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   
created_atzDeployment.created_at   (    t//0%%%r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   
updated_atzDeployment.updated_at   rF   r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   statuses_urlzDeployment.statuses_url   s(    t112!!'''r#   c                d    | j                  | j                         | j                  j                  S r   )r+   r   r(   r   s    r!   repository_urlzDeployment.repository_url   s(    t334##)))r#   c           	         t        t        j                  j                  | j                  | j                   ddd| j                         i      S )z
        :calls: `GET /repos/{owner}/deployments/{deployment_id}/statuses <https://docs.github.com/en/rest/reference/repos#list-deployments>`_
        	/statusesNAcceptheaders)r
   githubDeploymentStatus
_requesterr&   _get_accept_headerr   s    r!   get_statuseszDeployment.get_statuses   sI     ##44OOxxj	"t6689
 	
r#   c                
   t        |t              sJ |       | j                  j                  d| j                   d| d| j                         i      \  }}t        j                  j                  | j                  ||d      S )z
        :calls: `GET /repos/{owner}/deployments/{deployment_id}/statuses/{status_id}  <https://docs.github.com/en/rest/reference/repos#get-a-deployment>`_
        GETz
/statuses/rO   rP   T	completed)
isinstanceintrT   requestJsonAndCheckr&   rU   rR   rS   )r    id_rQ   datas       r!   
get_statuszDeployment.get_status   s     #s#(S(#;;xxj
3%(t6689 < 

 &&77RVbf7ggr#   c           	     v   t        |t              sJ |       |t        u st        |t              sJ |       |t        u st        |t              sJ |       |t        u st        |t              sJ |       |t        u st        |t              sJ |       |t        u st        |t              sJ |       t        j                  ||||||d      }| j
                  j                  d| j                   d|d| j                         i      \  }}	t        j                  j                  | j
                  ||	d      S )z
        :calls: `POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses <https://docs.github.com/en/rest/reference/repos#create-a-deployment-status>`_
        )state
target_urlrA   r:   environment_urlauto_inactivePOSTrN   rO   )inputrQ   TrY   )r[   strr   boolremove_unset_itemsrT   r]   r&   rU   rR   rS   )
r    rb   rc   rA   r:   rd   re   post_parametersrQ   r_   s
             r!   create_statuszDeployment.create_status   s8    %%,u,%V#z*c'BNJNBf$
;(DQkQDf$
;(DQkQD&(J,L]o]L&*]D*IX=XI 33(**#2!.	
 ;;xxj	"!t6689	 < 
 &&77RVbf7ggr#   c                     dj                  t        j                  j                  t        j                  j                  g      S )Nz, )joinrR   ConstsdeploymentEnhancementsPreview#deploymentStatusEnhancementsPreview r#   r!   rU   zDeployment._get_accept_header   s2    yy;;AA
 	
r#   c                   d|v r| j                  |d         | _        d|v r| j                  |d         | _        d|v r| j	                  |d         | _        d|v r| j                  |d         | _        d|v r| j	                  |d         | _        d|v r| j	                  |d         | _        d|v r| j	                  |d         | _	        d|v r| j                  |d         | _        d	|v r| j	                  |d	         | _        d
|v r| j	                  |d
         | _        d|v r| j	                  |d         | _        d|v r2| j                  t         j"                  j"                  |d         | _        d|v r| j'                  |d         | _        d|v r| j'                  |d         | _        d|v r| j	                  |d         | _        d|v r| j	                  |d         | _        y y )Nr%   r=   r-   r?   r&   r1   r3   r5   r8   r:   rA   rC   rE   rH   rJ   rL   )_makeIntAttributer   _makeBoolAttributer   _makeStringAttributer   r   r   r   r   _makeDictAttributer   r   r   r   _makeClassAttributerR   	NamedUserr   _makeDatetimeAttributer   r   r   r   )r    
attributess     r!   _useAttributeszDeployment._useAttributes   s   :--j.>?DH#z1+/+B+B:NfCg+hD(J11*U2CDDI"j0*.*A*A*MdBe*fD'J11*U2CDDIJ11*U2CDDIZ22:f3EFDJ
" 33Jy4IJDM!Z/)-)B)B:NdCe)fD&J& $ 9 9*]:S TDJ& $ 9 9*]:S TD
" 44V5E5E5O5OQ[\eQfgDM:%#:::l;STD:%#:::l;STDZ'!%!:!::n;U!VDz)#'#<#<ZHX=Y#ZD  *r#   N)returnNone)r}   rh   )r}   r\   )r}   dict[str, Any])r}   ri   )r}   zgithub.NamedUser.NamedUser)r}   r   )r}   zdatetime | None)r}   z7PaginatedList[github.DeploymentStatus.DeploymentStatus])r^   r\   r}   (github.DeploymentStatus.DeploymentStatus)rb   rh   rc   Opt[str]rA   r   r:   r   rd   r   re   z	Opt[bool]r}   r   )r{   r   r}   r~   )__name__
__module____qualname____doc__r"   r)   propertyr%   r-   r&   r1   r3   r5   r8   r:   r=   r?   rA   rC   rE   rH   rJ   rL   rV   r`   r   rl   staticmethodrU   r|   rr   r#   r!   r   r   9   s   6$P             # # 0 0 ' ' 2 2 1 1 ' ' # # & & & & ( ( * *


h  & & &$*#)$h$h $h 	$h
 $h "$h !$h 
2$hL 
 
 [r#   r   )
__future__r   r   typingr   github.ConstsrR   github.DeploymentStatusgithub.NamedUsergithub.GithubObjectr   r   r   r	   github.PaginatedListr
   r   rr   r#   r!   <module>r      s4   Z #      O O .U[( U[r#   