
    ,Ofo                     j    d dl m Z  d dlmZmZ d dlmZmZ d dlmZ d dl	m
Z
 d dlmZ  G d de      Zy	)
    )datetime)AnyDict)	AttributeNotSet)PaginatedList)
Repository)Secretc            	           e Zd ZdZddZedefd       Zedee	   fd       Z
	 	 ddeded	edefd
Zde	defdZde	defdZdeeef   ddfdZy)OrganizationSecretz
    This class represents a org level GitHub secret.

    The reference can be found here
    https://docs.github.com/en/rest/actions/secrets

    returnNc                     t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        y )N)r   _name_created_at_updated_at_visibility_selected_repositories_selected_repositories_url_urlselfs    9lib/python3.12/site-packages/github/OrganizationSecret.py_initAttributesz"OrganizationSecret._initAttributes-   s8    %+
0606+1LR#:@'$*	    c                 d    | j                  | j                         | j                  j                  S )z
        :type: string
        )_completeIfNotSetr   valuer   s    r   
visibilityzOrganizationSecret.visibility6   s*    
 	t//0%%%r   c                 f    t        t        | j                  | j                  j                  d d      S )Nrepositories)	list_item)r   r	   
_requesterr   r   r   s    r   selected_repositoriesz(OrganizationSecret.selected_repositories>   s.    OO++11$
 	
r   r   r   secret_typec                    t        |t              sJ |       t        |t              sJ |       |dv sJ d       | j                  ||d}| j                  j	                  d| j
                   d| d| j                   |      \  }}}|dk(  S )	aj  
        :calls: `PATCH /orgs/{org}/{secret_type}/secrets/{variable_name} <https://docs.github.com/en/rest/reference/actions/secrets#update-an-organization-variable>`_
        :param variable_name: string
        :param value: string
        :param visibility: string
        :param secret_type: string options actions or dependabot
        :rtype: bool
        )actions
dependabotz+secret_type should be actions or dependabot)namer   r   PATCH/z	/secrets/)input   )
isinstancestrr(   r"   requestJsonurl)r   r   r   r$   patch_parametersstatus_s          r   editzOrganizationSecret.editH   s     %%,u,%*c*6J6*77f9ff7 II$,
 22xxj+i		{;" 3 
1
 }r   repoc                     | j                   dk7  ry| j                  j                  d| j                  j                   d|j
                          y)z
        :calls: 'PUT {org_url}/actions/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret>`_
        :param repo: github.Repository.Repository
        :rtype: bool
        selectedFPUTr*   Tr   r"   requestJsonAndCheckr   r   idr   r5   s     r   add_repozOrganizationSecret.add_repog   sK     ??j(++Ed6U6U6[6[5\\]^b^e^e]f3ghr   c                     | j                   dk7  ry| j                  j                  d| j                  j                   d|j
                          y)z
        :calls: 'DELETE {org_url}/actions/secrets/{secret_name} <https://docs.github.com/en/rest/actions/secrets#add-selected-repository-to-an-organization-secret>`_
        :param repo: github.Repository.Repository
        :rtype: bool
        r7   FDELETEr*   Tr9   r<   s     r   remove_repozOrganizationSecret.remove_repor   sK     ??j(++H9X9X9^9^8__`aeahah`i6jkr   
attributesc                 b   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         | _        y y )Nr(   
created_at
updated_atr   selected_repositories_urlr0   )_makeStringAttributer   _makeDatetimeAttributer   r   r   r   r   )r   rA   s     r   _useAttributesz!OrganizationSecret._useAttributes}   s    Z22:f3EFDJ:%#:::l;STD:%#:::l;STD:%#88L9QRD&*4.2.G.G
SnHo.pD+J11*U2CDDI r   )r   N)allr&   )__name__
__module____qualname____doc__r   propertyr.   r   r   r	   r#   boolr4   r=   r@   r   r   rH    r   r   r   r   $   s    + &C & & 
}Z'@ 
 
  $	  	
 
>	Z 	D 		
 	t 	Ec3h ED Er   r   N)r   typingr   r   github.GithubObjectr   r   github.PaginatedListr   github.Repositoryr	   github.Secretr
   r   rP   r   r   <module>rV      s)   6   1 . (  eE eEr   