Skip to content

Messages

airvpn.web.services.messages

Conversation

Represents a messenger conversation (thread) with one or more participants.

Attributes:

Name Type Description
owner_id int

The user ID of the conversation owner (the authenticated user).

session WebSession

The active web session used for requests.

title str

The conversation's title/subject.

body str

A snippet/preview of the conversation's body content.

id int

The unique ID of the conversation.

messages list[Message]

The messages belonging to this conversation, fetched on first access.

update(page=1)

Fetch and parse the conversation's messages from the given page, replacing the cached message list.

Parameters:

Name Type Description Default
page int

The page number of messages to retrieve. Defaults to 1.

1

InboxManager

Manages the authenticated user's messenger inbox and conversations.

Attributes:

Name Type Description
session WebSession

The active web session used for requests.

owner_id int

The user ID of the authenticated user (inbox owner).

conversations list[Conversation]

The list of conversations in the inbox.

start_conversation(user: WebUser | str, subject: str, body: str) -> Conversation

Create a conversation with a user.

Parameters:

Name Type Description Default
username str

The username of the recipient.

required
subject str

The subject of the message.

required
body str

The body content of the message.

required

Returns:

Type Description
Conversation

Conversation | None: returns the created conversation.

update()

Fetch and parse the list of conversations from the messenger inbox page, appending any found conversations to self.conversations.

Message

Represents a single message within a conversation.

Attributes:

Name Type Description
conversation Conversation

The conversation this message belongs to.

session WebSession

The active web session used for requests.

user WebUser

The user who sent the message.

content str

The stripped content of the message.

timestamp datetime

UTC datetime of when the message was sent.

id int

The unique ID of the message (comment ID).

edit(content: str)

Edit this message's content.

Parameters:

Name Type Description Default
content str

The new content to replace the existing message body.

required

Raises:

Type Description
ValidationError

If the current user is not the owner of the message/conversation.