enconnect.mattermost package#
Subpackages#
Submodules#
enconnect.mattermost.client module#
Functions and routines associated with Enasis Network Remote Connect.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- class enconnect.mattermost.client.Client(params: ClientParams, logger: Callable[[...], None] | None = None)[source]#
Bases:
object
Establish and maintain connection with the chat service.
- Parameters:
params – Parameters used to instantiate the class.
- property canceled: bool#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property connected: bool#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property mqueue: Queue[ClientEvent]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property nickname: tuple[str, str] | None#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property params: ClientParams#
Return the Pydantic model containing the configuration.
- Returns:
Pydantic model containing the configuration.
- request(method: Literal['delete', 'get', 'post', 'patch', 'put'], path: str, params: dict[str, Any] | None = None, json: dict[str, Any] | None = None, *, timeout: int | None = None) Response [source]#
Return the response for upstream request to the server.
- Parameters:
method – Method for operation with the API server.
path – Path for the location to upstream endpoint.
params – Optional parameters included in request.
json – Optional JSON payload included in request.
timeout – Timeout waiting for the server response. This will override the default client instantiated.
- Returns:
Response from upstream request to the server.
- socket_recv() dict[str, Any] | None [source]#
Return the content received from the socket connection.
- Returns:
Content received from the socket connection.
enconnect.mattermost.models module#
Functions and routines associated with Enasis Network Remote Connect.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- pydantic model enconnect.mattermost.models.ClientEvent[source]#
Bases:
BaseModel
Contains information returned from the upstream server.
Show JSON schema
{ "title": "ClientEvent", "description": "Contains information returned from the upstream server.", "type": "object", "properties": { "type": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Type of event that occurred", "title": "Type" }, "data": { "anyOf": [ { "additionalProperties": true, "minProperties": 1, "type": "object" }, { "type": "null" } ], "default": null, "description": "Payload with the event data", "title": "Data" }, "broadcast": { "anyOf": [ { "additionalProperties": true, "minProperties": 1, "type": "object" }, { "type": "null" } ], "default": null, "description": "Payload with the event data", "title": "Broadcast" }, "seqno": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "Event number within squence", "title": "Seqno" }, "status": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Type of event that occurred", "title": "Status" }, "error": { "anyOf": [ { "additionalProperties": true, "minProperties": 1, "type": "object" }, { "type": "null" } ], "default": null, "description": "Payload with the event data", "title": "Error" }, "seqre": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "Reply number within squence", "title": "Seqre" }, "original": { "additionalProperties": true, "description": "Original received from server", "minProperties": 1, "title": "Original", "type": "object" }, "kind": { "default": "event", "description": "Dynamic field parsed from event", "enum": [ "event", "chanmsg", "privmsg" ], "title": "Kind", "type": "string" }, "isme": { "default": false, "description": "Indicates message is from client", "title": "Isme", "type": "boolean" }, "hasme": { "default": false, "description": "Indicates message mentions client", "title": "Hasme", "type": "boolean" }, "whome": { "anyOf": [ { "maxItems": 2, "minItems": 1, "prefixItems": [ { "type": "string" }, { "type": "string" } ], "type": "array" }, { "type": "null" } ], "default": null, "description": "Current nickname of when received", "title": "Whome" }, "author": { "anyOf": [ { "maxItems": 2, "minItems": 1, "prefixItems": [ { "type": "string" }, { "type": "string" } ], "type": "array" }, { "type": "null" } ], "default": null, "description": "Dynamic field parsed from event", "title": "Author" }, "recipient": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Dynamic field parsed from event", "title": "Recipient" }, "message": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Dynamic field parsed from event", "title": "Message" } }, "required": [ "original" ] }
- Config:
extra: str = ignore
- Fields:
- field author: Annotated[tuple[str, str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Dynamic field parsed from event', metadata=[MinLen(min_length=1)])] = None#
Dynamic field parsed from event
- Constraints:
min_length = 1
- field broadcast: Annotated[dict[str, Any] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Payload with the event data', metadata=[MinLen(min_length=1)])] = None#
Payload with the event data
- Constraints:
min_length = 1
- field data: Annotated[dict[str, Any] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Payload with the event data', metadata=[MinLen(min_length=1)])] = None#
Payload with the event data
- Constraints:
min_length = 1
- field error: Annotated[dict[str, Any] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Payload with the event data', metadata=[MinLen(min_length=1)])] = None#
Payload with the event data
- Constraints:
min_length = 1
- field hasme: Annotated[bool, FieldInfo(annotation=NoneType, required=False, default=False, description='Indicates message mentions client')] = False#
Indicates message mentions client
- field isme: Annotated[bool, FieldInfo(annotation=NoneType, required=False, default=False, description='Indicates message is from client')] = False#
Indicates message is from client
- field kind: Annotated[Literal['event', 'chanmsg', 'privmsg'], FieldInfo(annotation=NoneType, required=False, default='event', description='Dynamic field parsed from event')] = 'event'#
Dynamic field parsed from event
- field message: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Dynamic field parsed from event', metadata=[MinLen(min_length=1)])] = None#
Dynamic field parsed from event
- Constraints:
min_length = 1
- field original: Annotated[dict[str, Any], FieldInfo(annotation=NoneType, required=True, description='Original received from server', metadata=[MinLen(min_length=1)])] [Required]#
Original received from server
- Constraints:
min_length = 1
- field recipient: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Dynamic field parsed from event', metadata=[MinLen(min_length=1)])] = None#
Dynamic field parsed from event
- Constraints:
min_length = 1
- field seqno: Annotated[int | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Event number within squence', metadata=[Ge(ge=0)])] = None#
Event number within squence
- Constraints:
ge = 0
- field seqre: Annotated[int | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Reply number within squence', metadata=[Ge(ge=0)])] = None#
Reply number within squence
- Constraints:
ge = 0
- field status: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Type of event that occurred', metadata=[MinLen(min_length=1)])] = None#
Type of event that occurred
- Constraints:
min_length = 1
enconnect.mattermost.params module#
Functions and routines associated with Enasis Network Remote Connect.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- pydantic model enconnect.mattermost.params.ClientParams[source]#
Bases:
BaseModel
Process and validate the class configuration parameters.
Show JSON schema
{ "title": "ClientParams", "description": "Process and validate the class configuration parameters.", "type": "object", "properties": { "server": { "description": "Server address for connection", "minLength": 1, "title": "Server", "type": "string" }, "port": { "default": 443, "description": "Server address for connection", "maximum": 65535, "minimum": 1, "title": "Port", "type": "integer" }, "token": { "description": "Parameter for the integration", "minLength": 1, "title": "Token", "type": "string" }, "teamid": { "description": "Parameter for the integration", "minLength": 1, "title": "Teamid", "type": "string" }, "timeout": { "default": 30, "description": "Timeout connecting to server", "maximum": 300, "minimum": 1, "title": "Timeout", "type": "integer" }, "ssl_verify": { "default": true, "description": "Verify the ceritifcate valid", "title": "Ssl Verify", "type": "boolean" }, "ssl_capem": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Verify the ceritifcate valid", "title": "Ssl Capem" }, "queue_size": { "default": 10000, "description": "Maximum size for queued events", "maximum": 1000000, "minimum": 1000, "title": "Queue Size", "type": "integer" } }, "additionalProperties": false, "required": [ "server", "token", "teamid" ] }
- Config:
extra: str = forbid
- Fields:
- field port: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=443, description='Server address for connection', metadata=[Ge(ge=1), Le(le=65535)])] = 443#
Server address for connection
- Constraints:
ge = 1
le = 65535
- field queue_size: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=10000, description='Maximum size for queued events', metadata=[Ge(ge=1000), Le(le=1000000)])] = 10000#
Maximum size for queued events
- Constraints:
ge = 1000
le = 1000000
- field server: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Server address for connection', metadata=[MinLen(min_length=1)])] [Required]#
Server address for connection
- Constraints:
min_length = 1
- field ssl_capem: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Verify the ceritifcate valid', metadata=[MinLen(min_length=1)])] = None#
Verify the ceritifcate valid
- Constraints:
min_length = 1
- field ssl_verify: Annotated[bool, FieldInfo(annotation=NoneType, required=False, default=True, description='Verify the ceritifcate valid')] = True#
Verify the ceritifcate valid
- field teamid: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Parameter for the integration', metadata=[MinLen(min_length=1)])] [Required]#
Parameter for the integration
- Constraints:
min_length = 1
Module contents#
Functions and routines associated with Enasis Network Remote Connect.
This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.
- class enconnect.mattermost.Client(params: ClientParams, logger: Callable[[...], None] | None = None)[source]#
Bases:
object
Establish and maintain connection with the chat service.
- Parameters:
params – Parameters used to instantiate the class.
- property canceled: bool#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property connected: bool#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property mqueue: Queue[ClientEvent]#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property nickname: tuple[str, str] | None#
Return the value for the attribute from class instance.
- Returns:
Value for the attribute from class instance.
- property params: ClientParams#
Return the Pydantic model containing the configuration.
- Returns:
Pydantic model containing the configuration.
- request(method: Literal['delete', 'get', 'post', 'patch', 'put'], path: str, params: dict[str, Any] | None = None, json: dict[str, Any] | None = None, *, timeout: int | None = None) Response [source]#
Return the response for upstream request to the server.
- Parameters:
method – Method for operation with the API server.
path – Path for the location to upstream endpoint.
params – Optional parameters included in request.
json – Optional JSON payload included in request.
timeout – Timeout waiting for the server response. This will override the default client instantiated.
- Returns:
Response from upstream request to the server.
- socket_recv() dict[str, Any] | None [source]#
Return the content received from the socket connection.
- Returns:
Content received from the socket connection.
- pydantic model enconnect.mattermost.ClientEvent[source]#
Bases:
BaseModel
Contains information returned from the upstream server.
Show JSON schema
{ "title": "ClientEvent", "description": "Contains information returned from the upstream server.", "type": "object", "properties": { "type": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Type of event that occurred", "title": "Type" }, "data": { "anyOf": [ { "additionalProperties": true, "minProperties": 1, "type": "object" }, { "type": "null" } ], "default": null, "description": "Payload with the event data", "title": "Data" }, "broadcast": { "anyOf": [ { "additionalProperties": true, "minProperties": 1, "type": "object" }, { "type": "null" } ], "default": null, "description": "Payload with the event data", "title": "Broadcast" }, "seqno": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "Event number within squence", "title": "Seqno" }, "status": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Type of event that occurred", "title": "Status" }, "error": { "anyOf": [ { "additionalProperties": true, "minProperties": 1, "type": "object" }, { "type": "null" } ], "default": null, "description": "Payload with the event data", "title": "Error" }, "seqre": { "anyOf": [ { "minimum": 0, "type": "integer" }, { "type": "null" } ], "default": null, "description": "Reply number within squence", "title": "Seqre" }, "original": { "additionalProperties": true, "description": "Original received from server", "minProperties": 1, "title": "Original", "type": "object" }, "kind": { "default": "event", "description": "Dynamic field parsed from event", "enum": [ "event", "chanmsg", "privmsg" ], "title": "Kind", "type": "string" }, "isme": { "default": false, "description": "Indicates message is from client", "title": "Isme", "type": "boolean" }, "hasme": { "default": false, "description": "Indicates message mentions client", "title": "Hasme", "type": "boolean" }, "whome": { "anyOf": [ { "maxItems": 2, "minItems": 1, "prefixItems": [ { "type": "string" }, { "type": "string" } ], "type": "array" }, { "type": "null" } ], "default": null, "description": "Current nickname of when received", "title": "Whome" }, "author": { "anyOf": [ { "maxItems": 2, "minItems": 1, "prefixItems": [ { "type": "string" }, { "type": "string" } ], "type": "array" }, { "type": "null" } ], "default": null, "description": "Dynamic field parsed from event", "title": "Author" }, "recipient": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Dynamic field parsed from event", "title": "Recipient" }, "message": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Dynamic field parsed from event", "title": "Message" } }, "required": [ "original" ] }
- Config:
extra: str = ignore
- Fields:
- field author: Annotated[tuple[str, str] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Dynamic field parsed from event', metadata=[MinLen(min_length=1)])] = None#
Dynamic field parsed from event
- Constraints:
min_length = 1
- field broadcast: Annotated[dict[str, Any] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Payload with the event data', metadata=[MinLen(min_length=1)])] = None#
Payload with the event data
- Constraints:
min_length = 1
- field data: Annotated[dict[str, Any] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Payload with the event data', metadata=[MinLen(min_length=1)])] = None#
Payload with the event data
- Constraints:
min_length = 1
- field error: Annotated[dict[str, Any] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Payload with the event data', metadata=[MinLen(min_length=1)])] = None#
Payload with the event data
- Constraints:
min_length = 1
- field hasme: Annotated[bool, FieldInfo(annotation=NoneType, required=False, default=False, description='Indicates message mentions client')] = False#
Indicates message mentions client
- field isme: Annotated[bool, FieldInfo(annotation=NoneType, required=False, default=False, description='Indicates message is from client')] = False#
Indicates message is from client
- field kind: Annotated[Literal['event', 'chanmsg', 'privmsg'], FieldInfo(annotation=NoneType, required=False, default='event', description='Dynamic field parsed from event')] = 'event'#
Dynamic field parsed from event
- field message: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Dynamic field parsed from event', metadata=[MinLen(min_length=1)])] = None#
Dynamic field parsed from event
- Constraints:
min_length = 1
- field original: Annotated[dict[str, Any], FieldInfo(annotation=NoneType, required=True, description='Original received from server', metadata=[MinLen(min_length=1)])] [Required]#
Original received from server
- Constraints:
min_length = 1
- field recipient: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Dynamic field parsed from event', metadata=[MinLen(min_length=1)])] = None#
Dynamic field parsed from event
- Constraints:
min_length = 1
- field seqno: Annotated[int | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Event number within squence', metadata=[Ge(ge=0)])] = None#
Event number within squence
- Constraints:
ge = 0
- field seqre: Annotated[int | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Reply number within squence', metadata=[Ge(ge=0)])] = None#
Reply number within squence
- Constraints:
ge = 0
- field status: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Type of event that occurred', metadata=[MinLen(min_length=1)])] = None#
Type of event that occurred
- Constraints:
min_length = 1
- pydantic model enconnect.mattermost.ClientParams[source]#
Bases:
BaseModel
Process and validate the class configuration parameters.
Show JSON schema
{ "title": "ClientParams", "description": "Process and validate the class configuration parameters.", "type": "object", "properties": { "server": { "description": "Server address for connection", "minLength": 1, "title": "Server", "type": "string" }, "port": { "default": 443, "description": "Server address for connection", "maximum": 65535, "minimum": 1, "title": "Port", "type": "integer" }, "token": { "description": "Parameter for the integration", "minLength": 1, "title": "Token", "type": "string" }, "teamid": { "description": "Parameter for the integration", "minLength": 1, "title": "Teamid", "type": "string" }, "timeout": { "default": 30, "description": "Timeout connecting to server", "maximum": 300, "minimum": 1, "title": "Timeout", "type": "integer" }, "ssl_verify": { "default": true, "description": "Verify the ceritifcate valid", "title": "Ssl Verify", "type": "boolean" }, "ssl_capem": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "description": "Verify the ceritifcate valid", "title": "Ssl Capem" }, "queue_size": { "default": 10000, "description": "Maximum size for queued events", "maximum": 1000000, "minimum": 1000, "title": "Queue Size", "type": "integer" } }, "additionalProperties": false, "required": [ "server", "token", "teamid" ] }
- Config:
extra: str = forbid
- Fields:
- field port: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=443, description='Server address for connection', metadata=[Ge(ge=1), Le(le=65535)])] = 443#
Server address for connection
- Constraints:
ge = 1
le = 65535
- field queue_size: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=10000, description='Maximum size for queued events', metadata=[Ge(ge=1000), Le(le=1000000)])] = 10000#
Maximum size for queued events
- Constraints:
ge = 1000
le = 1000000
- field server: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Server address for connection', metadata=[MinLen(min_length=1)])] [Required]#
Server address for connection
- Constraints:
min_length = 1
- field ssl_capem: Annotated[str | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Verify the ceritifcate valid', metadata=[MinLen(min_length=1)])] = None#
Verify the ceritifcate valid
- Constraints:
min_length = 1
- field ssl_verify: Annotated[bool, FieldInfo(annotation=NoneType, required=False, default=True, description='Verify the ceritifcate valid')] = True#
Verify the ceritifcate valid
- field teamid: Annotated[str, FieldInfo(annotation=NoneType, required=True, description='Parameter for the integration', metadata=[MinLen(min_length=1)])] [Required]#
Parameter for the integration
- Constraints:
min_length = 1