
    _OgE                         S r SSKrSSKrSSKJr  SSKJr  Sr\rSS0r " S	 S
\R                  5      r
 " S S\R                  5      r\4S jr\4S jrg)zqModule containing helpers for dealing with GitHub Apps.

https://developer.github.com/apps/building-github-apps/
    N   )models)usersiX  Accept/application/vnd.github.machine-man-preview+jsonc                   ,    \ rS rSrSrSS0rS rS rSrg)	App   aN  An object representing a GitHub App.

.. versionadded:: 1.2.0

.. seealso::

    `GitHub Apps`_
        Documentation for Apps on GitHub

    `GitHub Apps API Documentation`_
        API documentation of what's available about an App.

This object has the following attributes:

.. attribute:: created_at

    A :class:`~datetime.datetime` object representing the day and time
    the App was created.

.. attribute:: description

    The description of the App provided by the owner.

.. attribute:: events

    An array of the event types an App receives

.. attribute:: external_url

    The URL provided for the App by the owner.

.. attribute:: html_url

    The HTML URL provided for the App by the owner.

.. attribute:: id

    The unique identifier for the App. This is useful in cases where you
    may want to authenticate either as an App or as a specific
    installation of an App.

.. attribute:: name

    The display name of the App that the user sees.

.. attribute:: node_id

    A base64-encoded blob returned by the GitHub API for who knows what
    reason.

.. attribute:: owner

    A :class:`~github3.users.ShortUser` object representing the GitHub
    user who owns the App.

.. attribute:: permissions

    A dictionary describing the permissions the App has

.. attribute:: slug

    A short string used to identify the App

.. attribute:: updated_at

    A :class:`~datetime.datetime` object representing the day and time
    the App was last updated.

.. _GitHub Apps:
    https://developer.github.com/apps/
.. _GitHub Apps API Documentation:
    https://developer.github.com/v3/apps/
r   r   c                    U R                  US   5      U l        US   U l        US   U l        US   U l        US   U l        US   U l        US   U l        US   U l        [        R                  " US	   U 5      U l        US
   U l        US   U l        U R                  US   5      U l        U R                  SU R                  5      =U l        U l        g )N
created_atdescriptionexternal_urleventshtml_urlidnamenode_idownerpermissionsslug
updated_atapps)	_strptimer   r   r   r   r   r   r   r   r   	ShortUserr   r   r   r   
_build_url_apiurlselfjsons     Q/Users/admin/workspace/ai/Jarvis/env/lib/python3.13/site-packages/github3/apps.py_update_attributesApp._update_attributesb   s    ..l);<. 08nZ(t*L	I__T']D9
.L	..l);<#vtyyAA	DH    c                 N    SU R                    S[        U R                  5       S3$ )Nz<App ["z" by z]>)r   strr   )r   s    r!   _repr	App._reprq   s$    5TZZ(9<<r$   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   N)	__name__
__module____qualname____firstlineno____doc__CUSTOM_HEADERSr"   r'   __static_attributes__ r$   r!   r	   r	      s#    HV 	CNB=r$   r	   c                       \ rS rSrSrS rSrg)Installationu   a  An installation of a GitHub App either on a User or Org.

.. versionadded:: 1.2.0

This has the following attributes:

.. attribute:: access_tokens_url
.. attribute:: account
.. attribute:: app_id
.. attribute:: created_at
.. attribute:: events
.. attribute:: html_url
.. attribute:: id
.. attribute:: permissions
.. attribute:: repositories_url
.. attribute:: repository_selection
.. attribute:: single_file_name
.. attribute:: target_id
.. attribute:: target_type
.. attribute:: updated_at
c                 X   US   U l         US   U l        US   U l        U R                  US   5      U l        US   U l        US   U l        US   U l        US   U l        US	   U l	        US
   U l
        US   U l        US   U l        US   U l        U R                  US   5      U l        g )Naccess_tokens_urlaccountapp_idr   r   r   r   r   repositories_urlrepository_selectionsingle_file_name	target_idtarget_typer   )r5   r6   r7   r   r   r   r   r   r   r8   r9   r:   r;   r<   r   r   s     r!   r"   Installation._update_attributes   s    !%&9!:I8n..l);<8nZ(t*. $%7 8$()?$@! $%7 8k*...l);<r$   )r5   r6   r7   r   r   r   r   r   r8   r9   r:   r;   r<   r   N)r)   r*   r+   r,   r-   r"   r/   r0   r$   r!   r2   r2   u   s    ,=r$   r2   c                     [        U [        5      (       d  [        S5      e[        [        R                  " 5       5      n[
        R                  " X3U-   US.U SS9nU$ )a  Create an encrypted token for the specified App.

:param bytes private_key_pem:
    The bytes of the private key for this GitHub Application.
:param int app_id:
    The integer identifier for this GitHub Application.
:param int expire_in:
    The length in seconds for this token to be valid for.
    Default: 600 seconds (10 minutes)
:returns:
    Serialized encrypted token.
:rtype:
    text
z/"private_key_pem" parameter must be byte-string)iatexpissRS256)payloadkey	algorithm)
isinstancebytes
ValueErrorinttimejwtencode)private_key_pemr7   	expire_innowtokens        r!   create_tokenrQ      sT     ou--JKK
diik
CJJ)OFCE
 Lr$   c                 V    [        XU5      nSSU 30nUR                  [        5        U$ )a  Create an encrypted token for the specified App.

:param bytes private_key_pem:
    The bytes of the private key for this GitHub Application.
:param int app_id:
    The integer identifier for this GitHub Application.
:param int expire_in:
    The length in seconds for this token to be valid for.
    Default: 600 seconds (10 minutes)
:returns:
    Dictionary of headers for retrieving a token from a JWT.
:rtype:
    dict
AuthorizationzBearer )rQ   updateAPP_PREVIEW_HEADERS)rM   r7   rN   	jwt_tokenheaderss        r!   create_jwt_headersrX      s3    " _i@I') 56GNN&'Nr$   )r-   rJ   rK    r   r   TEN_MINUTES_AS_SECONDSDEFAULT_JWT_TOKEN_EXPIRATIONrU   
GitHubCorer	   r2   rQ   rX   r0   r$   r!   <module>r]      sp     
    5 ? 
_=&

 _=D%=6$$ %=P 5K 6 (Dr$   