Source code for aries_cloudagent.protocols.connections.v1_0.messages.connection_request

"""Represents a connection request message."""

from marshmallow import EXCLUDE, fields

from .....messaging.agent_message import AgentMessage, AgentMessageSchema

from ..message_types import CONNECTION_REQUEST, PROTOCOL_PACKAGE
from ..models.connection_detail import ConnectionDetail, ConnectionDetailSchema


[docs]class ConnectionRequest(AgentMessage): """Class representing a connection request."""
[docs] class Meta: """Metadata for a connection request.""" handler_class = HANDLER_CLASS message_type = CONNECTION_REQUEST schema_class = "ConnectionRequestSchema"
def __init__( self, *, connection: ConnectionDetail = None, label: str = None, image_url: str = None, **kwargs, ): """ Initialize connection request object. Args: connection (ConnectionDetail): Connection details object label: Label for this connection request image_url: Optional image URL for this connection request """ super().__init__(**kwargs) self.connection = connection self.label = label self.image_url = image_url
[docs]class ConnectionRequestSchema(AgentMessageSchema): """Connection request schema class."""
[docs] class Meta: """Connection request schema metadata.""" model_class = ConnectionRequest unknown = EXCLUDE
connection = fields.Nested(ConnectionDetailSchema, required=True) label = fields.Str( required=True, description="Label for connection request", example="Request to connect with Bob", ) image_url = fields.Str( data_key="imageUrl", required=False, description="Optional image URL for connection request", example="", allow_none=True, )