o
    ÌÄ.jÄ  ã                   @  sD   d Z ddlmZ ddlmZ 		dddd„Zddd„Zddd„ZdS )uz  
JMAP Calendar method builders and response parsers.

These are pure functions â€” no HTTP, no state. They build the request
tuples that go into a ``methodCalls`` list, and parse the corresponding
``methodResponses`` entries.

Method shapes follow RFC 8620 Â§3.3 (get), Â§3.4 (changes), Â§3.5 (set); Calendar-specific
properties are defined in the JMAP Calendars specification.
é    )Úannotations)ÚJMAPCalendarNÚ
account_idÚstrÚidsúlist[str] | NoneÚ
propertiesÚreturnÚtuplec                 C  s$   | |dœ}|dur||d< d|dfS )a…  Build a ``Calendar/get`` method call tuple.

    Args:
        account_id: The JMAP accountId to query.
        ids: List of calendar IDs to fetch, or ``None`` to fetch all.
        properties: List of property names to return, or ``None`` for all.

    Returns:
        A 3-tuple ``("Calendar/get", arguments_dict, call_id)`` suitable
        for inclusion in a ``methodCalls`` list.
    )Ú	accountIdr   Nr   zCalendar/getz	cal-get-0© )r   r   r   Úargsr   r   úR/home/thesage/.local/lib/python3.10/site-packages/caldav/jmap/_methods/calendar.pyÚbuild_calendar_get   s   

r   Úresponse_argsÚdictúlist[JMAPCalendar]c                 C  s   dd„ |   dg ¡D ƒS )aj  Parse the arguments dict from a ``Calendar/get`` method response.

    Args:
        response_args: The second element of a ``methodResponses`` entry
            whose method name is ``"Calendar/get"``.

    Returns:
        List of :class:`~caldav.jmap.objects.calendar.JMAPCalendar` objects.
        Returns an empty list if ``"list"`` is absent or empty.
    c                 S  s   g | ]}t  |¡‘qS r   )r   Ú	from_jmap)Ú.0Úitemr   r   r   Ú
<listcomp>2   s    z&parse_calendar_get.<locals>.<listcomp>Úlist)Úget)r   r   r   r   Úparse_calendar_get'   s   r   Úsince_statec                 C  s   d| |dœdfS )a<  Build a ``Calendar/changes`` method call tuple.

    Args:
        account_id: The JMAP accountId to query.
        since_state: The ``state`` string from a previous ``Calendar/get``
            or ``Calendar/changes`` response.

    Returns:
        A 3-tuple ``("Calendar/changes", arguments_dict, call_id)``.
    zCalendar/changes)r   Ú
sinceStatezcal-changes-0r   )r   r   r   r   r   Úbuild_calendar_changes5   s   ýr   )NN)r   r   r   r   r   r   r	   r
   )r   r   r	   r   )r   r   r   r   r	   r
   )Ú__doc__Ú
__future__r   Úcaldav.jmap.objects.calendarr   r   r   r   r   r   r   r   Ú<module>   s    ý
