Skip to content

Messages

Source code in src/cocalc_api/hub.py
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
class Messages:

    def __init__(self, parent: "Hub"):
        self._parent = parent

    @api_method("messages.send")
    def send(self, subject: str, body: str, to_ids: list[str], reply_id: Optional[int] = None) -> int:
        """
        Send a message to one or more users.

        Args:
            subject (str): Short plain text subject of the message.
            body (str): Longer markdown body of the message (math typesetting and cocalc links work).
            to_ids (list[str]): Email addresses or account_id of each recipient.
            reply_id (Optional[int]): Optional message you're replying to (for threading).

        Returns:
            int: ID of the message.
        """
        ...  # pragma: no cover

    @api_method("messages.get")
    def get(
        self,
        limit: Optional[int] = None,
        offset: Optional[int] = None,
        type: Optional[Literal["received", "sent", "new", "starred", "liked"]] = None,
    ) -> list[MessageType]:  # type: ignore[empty-body]
        """
        Get your messages.

        Args:
            limit (Optional[int]): Maximum number of messages to return.
            offset (Optional[int]): Number of messages to skip.
            type (Optional[Literal]): Filter by message type.

        Returns:
            list[MessageType]: List of messages.
        """
        ...  # pragma: no cover

get(limit=None, offset=None, type=None)

Get your messages.

Parameters:

Name Type Description Default
limit Optional[int]

Maximum number of messages to return.

None
offset Optional[int]

Number of messages to skip.

None
type Optional[Literal]

Filter by message type.

None

Returns:

Type Description
list[MessageType]

list[MessageType]: List of messages.

Source code in src/cocalc_api/hub.py
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
@api_method("messages.get")
def get(
    self,
    limit: Optional[int] = None,
    offset: Optional[int] = None,
    type: Optional[Literal["received", "sent", "new", "starred", "liked"]] = None,
) -> list[MessageType]:  # type: ignore[empty-body]
    """
    Get your messages.

    Args:
        limit (Optional[int]): Maximum number of messages to return.
        offset (Optional[int]): Number of messages to skip.
        type (Optional[Literal]): Filter by message type.

    Returns:
        list[MessageType]: List of messages.
    """
    ...  # pragma: no cover

send(subject, body, to_ids, reply_id=None)

Send a message to one or more users.

Parameters:

Name Type Description Default
subject str

Short plain text subject of the message.

required
body str

Longer markdown body of the message (math typesetting and cocalc links work).

required
to_ids list[str]

Email addresses or account_id of each recipient.

required
reply_id Optional[int]

Optional message you're replying to (for threading).

None

Returns:

Name Type Description
int int

ID of the message.

Source code in src/cocalc_api/hub.py
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
@api_method("messages.send")
def send(self, subject: str, body: str, to_ids: list[str], reply_id: Optional[int] = None) -> int:
    """
    Send a message to one or more users.

    Args:
        subject (str): Short plain text subject of the message.
        body (str): Longer markdown body of the message (math typesetting and cocalc links work).
        to_ids (list[str]): Email addresses or account_id of each recipient.
        reply_id (Optional[int]): Optional message you're replying to (for threading).

    Returns:
        int: ID of the message.
    """
    ...  # pragma: no cover