
    ,Of`                     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)Variablec                       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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)OrganizationVariablez
    This class represents a org level GitHub variable.

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

    returnNc                     t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        t         | _        y )N)r   _name_created_at_updated_at_visibility_selected_repositories_selected_repositories_url_urlselfs    ;lib/python3.12/site-packages/github/OrganizationVariable.py_initAttributesz$OrganizationVariable._initAttributes,   s8    %+
0606+1LR#:@'$*	    c                 d    | j                  | j                         | j                  j                  S )z
        :type: string
        )_completeIfNotSetr   valuer   s    r   
visibilityzOrganizationVariable.visibility5   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*OrganizationVariable.selected_repositories=   s.    OO++11$
 	
r   r   r   c                     t        |t              sJ |       t        |t              sJ |       | j                  ||d}| j                  j	                  d| j
                   d| j                   |      \  }}}|dk(  S )a'  
        :calls: `PATCH /orgs/{org}/actions/variables/{variable_name} <https://docs.github.com/en/rest/reference/actions/variables#update-an-organization-variable>`_
        :param variable_name: string
        :param value: string
        :param visibility: string
        :rtype: bool
        )namer   r   PATCHz/actions/variables/)input   )
isinstancestrr%   r"   requestJsonurl)r   r   r   patch_parametersstatus_s         r   editzOrganizationVariable.editG   s     %%,u,%*c*6J6* II$,
 22xxj+DII;7" 3 
1
 }r   repoc                     | j                   dk7  ry| j                  j                  d| j                  j                   d|j
                          y)z
        :calls: 'PUT {org_url}/actions/variables/{variable_name} <https://docs.github.com/en/rest/actions/variables#add-selected-repository-to-an-organization-secret>`_
        :param repo: github.Repository.Repository
        :rtype: bool
        selectedFPUT/Tr   r"   requestJsonAndCheckr   r   idr   r1   s     r   add_repozOrganizationVariable.add_repoc   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/variables/{variable_name} <https://docs.github.com/en/rest/actions/variables#add-selected-repository-to-an-organization-secret>`_
        :param repo: github.Repository.Repository
        :rtype: bool
        r3   FDELETEr5   Tr6   r9   s     r   remove_repoz OrganizationVariable.remove_repon   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_urlr,   )_makeStringAttributer   _makeDatetimeAttributer   r   r   r   r   )r   r>   s     r   _useAttributesz#OrganizationVariable._useAttributesy   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)all)__name__
__module____qualname____doc__r   propertyr*   r   r   r	   r#   boolr0   r:   r=   r   r   rE    r   r   r   r   #   s    + &C & & 
}Z'@ 
 
    
	8	Z 	D 		
 	t 	Ec3h ED Er   r   N)r   typingr   r   github.GithubObjectr   r   github.PaginatedListr   github.Repositoryr	   github.Variabler
   r   rM   r   r   <module>rS      s)   4   1 . ( $bE8 bEr   