enrobie.clients package#

Subpackages#

Module contents#

Functions and routines associated with Enasis Network Chatting Robie.

This file is part of Enasis Network software eco-system. Distribution is permitted, for more information consult the project license file.

class enrobie.clients.DSCClient(robie: Robie, name: str, params: RobieChildParams)[source]#

Bases: RobieClient

Establish and maintain connection with the chat service.

property channels: ClientChannels#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property client: Client#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

compose(target: str, content: str) RobieCommand[source]#

Compose the message and transmit using the chat client.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • target – Where the composed message will be sent.

  • content – Content that will be source of message.

property family: Literal['discord']#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

get_command(method: Literal['delete', 'get', 'post', 'patch', 'put'] | None = None, path: str | None = None, params: dict[str, Any] | None = None, json: dict[str, Any] | None = None) DSCCommand[source]#

Return the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Returns:

New item containing information for operation.

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.

get_message(event: ClientEvent | None = None) DSCMessage[source]#

Return the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:

event – Raw event received from the network peer.

Returns:

New item containing information for operation.

operate() None[source]#

Perform the operation related to Robie service threads.

property params: DSCClientParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

property publish: ClientPublish#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

put_command(cqueue: RobieQueue[RobieCommand], method: Literal['delete', 'get', 'post', 'patch', 'put'] | None = None, path: str | None = None, params: dict[str, Any] | None = None, json: dict[str, Any] | None = None) None[source]#

Insert the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • cqueue – Queue instance where the item is received.

  • 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.

put_message(mqueue: RobieQueue[RobieMessage], event: ClientEvent | None = None) None[source]#

Insert the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • mqueue – Queue instance where the item is received.

  • event – Raw event received from the network peer.

classmethod schema() Type[DSCClientParams][source]#

Return the configuration parameters relevant for class.

Returns:

Configuration parameters relevant for class.

validate() None[source]#

Perform advanced validation on the parameters provided.

pydantic model enrobie.clients.DSCClientParams[source]#

Bases: RobieClientParams

Process and validate the Robie configuration parameters.

Show JSON schema
{
   "title": "DSCClientParams",
   "description": "Process and validate the Robie configuration parameters.",
   "type": "object",
   "properties": {
      "enable": {
         "default": false,
         "description": "Determine whether child enabled",
         "title": "Enable",
         "type": "boolean"
      },
      "locate": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "For which client are parameters",
         "examples": [
            "enrobie.clients.DSCClient",
            "enrobie.clients.IRCClient",
            "enrobie.clients.MTMClient"
         ],
         "title": "Locate"
      },
      "client": {
         "$ref": "#/$defs/ClientParams",
         "description": "Parameters for the base client"
      },
      "intents": {
         "default": 4609,
         "description": "Timeout connecting to server",
         "maximum": 65535,
         "minimum": 0,
         "title": "Intents",
         "type": "integer"
      },
      "delay": {
         "default": 15,
         "description": "Period to wait for reconnect",
         "maximum": 300,
         "minimum": 1,
         "title": "Delay",
         "type": "integer"
      },
      "status": {
         "$ref": "#/$defs/StatusPluginIconParams",
         "description": "Icon used per chat platform"
      }
   },
   "$defs": {
      "ClientParams": {
         "additionalProperties": false,
         "description": "Process and validate the class configuration parameters.",
         "properties": {
            "appid": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Optional application identifier",
               "title": "Appid"
            },
            "token": {
               "description": "Parameter for the integration",
               "minLength": 1,
               "title": "Token",
               "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"
            }
         },
         "required": [
            "token"
         ],
         "title": "ClientParams",
         "type": "object"
      },
      "StatusPluginIconParams": {
         "additionalProperties": false,
         "description": "Contain information for constructing the chat messages.",
         "properties": {
            "irc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Irc"
            },
            "dsc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Dsc"
            },
            "mtm": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Mtm"
            }
         },
         "title": "StatusPluginIconParams",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "client"
   ]
}

Config:
  • extra: str = forbid

Fields:
field client: Annotated[ClientParams, FieldInfo(annotation=NoneType, required=True, description='Parameters for the base client')] [Required]#

Parameters for the base client

field delay: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=15, description='Period to wait for reconnect', metadata=[Ge(ge=1), Le(le=300)])] = 15#

Period to wait for reconnect

Constraints:
  • ge = 1

  • le = 300

field intents: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=4609, description='Timeout connecting to server', metadata=[Ge(ge=0), Le(le=65535)])] = 4609#

Timeout connecting to server

Constraints:
  • ge = 0

  • le = 65535

field status: Annotated[StatusPluginIconParams, FieldInfo(annotation=NoneType, required=False, default_factory=StatusPluginIconParams, description='Icon used per chat platform')] [Optional]#

Icon used per chat platform

class enrobie.clients.IRCClient(robie: Robie, name: str, params: RobieChildParams)[source]#

Bases: RobieClient

Establish and maintain connection with the chat service.

property channels: ClientChannels#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property client: Client#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

compose(target: str, content: str) RobieCommand[source]#

Compose the message and transmit using the chat client.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • target – Where the composed message will be sent.

  • content – Content that will be source of message.

property family: Literal['irc']#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

get_command(event: str | None = None) IRCCommand[source]#

Return the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:

event – Raw event to be sent to the network peer.

Returns:

New item containing information for operation.

get_message(event: ClientEvent | None = None) IRCMessage[source]#

Return the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:

event – Raw event received from the network peer.

Returns:

New item containing information for operation.

operate() None[source]#

Perform the operation related to Robie service threads.

property params: IRCClientParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

property publish: ClientPublish#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

put_command(cqueue: RobieQueue[RobieCommand], event: str | None = None) None[source]#

Insert the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • cqueue – Queue instance where the item is received.

  • event – Raw event to be sent to the network peer.

put_message(mqueue: RobieQueue[RobieMessage], event: ClientEvent | None = None) None[source]#

Insert the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • mqueue – Queue instance where the item is received.

  • event – Raw event received from the network peer.

classmethod schema() Type[IRCClientParams][source]#

Return the configuration parameters relevant for class.

Returns:

Configuration parameters relevant for class.

validate() None[source]#

Perform advanced validation on the parameters provided.

pydantic model enrobie.clients.IRCClientParams[source]#

Bases: RobieClientParams

Process and validate the Robie configuration parameters.

Show JSON schema
{
   "title": "IRCClientParams",
   "description": "Process and validate the Robie configuration parameters.",
   "type": "object",
   "properties": {
      "enable": {
         "default": false,
         "description": "Determine whether child enabled",
         "title": "Enable",
         "type": "boolean"
      },
      "locate": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "For which client are parameters",
         "examples": [
            "enrobie.clients.DSCClient",
            "enrobie.clients.IRCClient",
            "enrobie.clients.MTMClient"
         ],
         "title": "Locate"
      },
      "client": {
         "$ref": "#/$defs/ClientParams",
         "description": "Parameters for the base client"
      },
      "delay": {
         "default": 15,
         "description": "Period to wait for reconnect",
         "maximum": 300,
         "minimum": 1,
         "title": "Delay",
         "type": "integer"
      },
      "status": {
         "$ref": "#/$defs/StatusPluginIconParams",
         "description": "Icon used per chat platform"
      }
   },
   "$defs": {
      "ClientParams": {
         "additionalProperties": false,
         "description": "Process and validate the class configuration parameters.",
         "properties": {
            "server": {
               "description": "Server address for connection",
               "minLength": 1,
               "title": "Server",
               "type": "string"
            },
            "port": {
               "default": 6697,
               "description": "Server address for connection",
               "maximum": 65535,
               "minimum": 1,
               "title": "Port",
               "type": "integer"
            },
            "timeout": {
               "default": 30,
               "description": "Timeout connecting to server",
               "maximum": 300,
               "minimum": 1,
               "title": "Timeout",
               "type": "integer"
            },
            "operate": {
               "default": "normal",
               "description": "Method for server connection",
               "enum": [
                  "normal",
                  "service"
               ],
               "title": "Operate",
               "type": "string"
            },
            "nickname": {
               "default": "ircbot",
               "description": "Parameter for the integration",
               "minLength": 1,
               "title": "Nickname",
               "type": "string"
            },
            "username": {
               "default": "ircbot",
               "description": "Parameter for the integration",
               "minLength": 1,
               "title": "Username",
               "type": "string"
            },
            "realname": {
               "default": "Chatting Robie",
               "description": "Parameter for the integration",
               "minLength": 1,
               "title": "Realname",
               "type": "string"
            },
            "password": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Parameter for the integration",
               "title": "Password"
            },
            "servername": {
               "default": "services.invalid",
               "description": "Parameter for the integration",
               "minLength": 1,
               "title": "Servername",
               "type": "string"
            },
            "serverid": {
               "default": "42X",
               "description": "Unique identifier for services",
               "minLength": 1,
               "title": "Serverid",
               "type": "string"
            },
            "ssl_enable": {
               "default": true,
               "description": "Enable connection encryption",
               "title": "Ssl Enable",
               "type": "boolean"
            },
            "ssl_verify": {
               "default": true,
               "description": "Verify the ceritifcate valid",
               "title": "Ssl Verify",
               "type": "boolean"
            },
            "queue_size": {
               "default": 10000,
               "description": "Maximum size for queued events",
               "maximum": 1000000,
               "minimum": 1000,
               "title": "Queue Size",
               "type": "integer"
            }
         },
         "required": [
            "server"
         ],
         "title": "ClientParams",
         "type": "object"
      },
      "StatusPluginIconParams": {
         "additionalProperties": false,
         "description": "Contain information for constructing the chat messages.",
         "properties": {
            "irc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Irc"
            },
            "dsc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Dsc"
            },
            "mtm": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Mtm"
            }
         },
         "title": "StatusPluginIconParams",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "client"
   ]
}

Config:
  • extra: str = forbid

Fields:
field client: Annotated[ClientParams, FieldInfo(annotation=NoneType, required=True, description='Parameters for the base client')] [Required]#

Parameters for the base client

field delay: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=15, description='Period to wait for reconnect', metadata=[Ge(ge=1), Le(le=300)])] = 15#

Period to wait for reconnect

Constraints:
  • ge = 1

  • le = 300

field status: Annotated[StatusPluginIconParams, FieldInfo(annotation=NoneType, required=False, default_factory=StatusPluginIconParams, description='Icon used per chat platform')] [Optional]#

Icon used per chat platform

class enrobie.clients.MTMClient(robie: Robie, name: str, params: RobieChildParams)[source]#

Bases: RobieClient

Establish and maintain connection with the chat service.

property channels: ClientChannels#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

property client: Client#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

compose(target: str, content: str) RobieCommand[source]#

Compose the message and transmit using the chat client.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • target – Where the composed message will be sent.

  • content – Content that will be source of message.

property family: Literal['mattermost']#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

get_command(method: Literal['delete', 'get', 'post', 'patch', 'put'] | None = None, path: str | None = None, params: dict[str, Any] | None = None, json: dict[str, Any] | None = None) MTMCommand[source]#

Return the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Returns:

New item containing information for operation.

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.

get_message(event: ClientEvent | None = None) MTMMessage[source]#

Return the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:

event – Raw event received from the network peer.

Returns:

New item containing information for operation.

operate() None[source]#

Perform the operation related to Robie service threads.

property params: MTMClientParams#

Return the Pydantic model containing the configuration.

Returns:

Pydantic model containing the configuration.

property publish: ClientPublish#

Return the value for the attribute from class instance.

Returns:

Value for the attribute from class instance.

put_command(cqueue: RobieQueue[RobieCommand], method: Literal['delete', 'get', 'post', 'patch', 'put'] | None = None, path: str | None = None, params: dict[str, Any] | None = None, json: dict[str, Any] | None = None) None[source]#

Insert the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • cqueue – Queue instance where the item is received.

  • 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.

put_message(mqueue: RobieQueue[RobieMessage], event: ClientEvent | None = None) None[source]#

Insert the new item containing information for operation.

Note

Though parameters are marked optional, that is not necessarily the case; for typing purposes one cannot introduce required parameters outside of the parent.

Parameters:
  • mqueue – Queue instance where the item is received.

  • event – Raw event received from the network peer.

classmethod schema() Type[MTMClientParams][source]#

Return the configuration parameters relevant for class.

Returns:

Configuration parameters relevant for class.

validate() None[source]#

Perform advanced validation on the parameters provided.

pydantic model enrobie.clients.MTMClientParams[source]#

Bases: RobieClientParams

Process and validate the Robie configuration parameters.

Show JSON schema
{
   "title": "MTMClientParams",
   "description": "Process and validate the Robie configuration parameters.",
   "type": "object",
   "properties": {
      "enable": {
         "default": false,
         "description": "Determine whether child enabled",
         "title": "Enable",
         "type": "boolean"
      },
      "locate": {
         "anyOf": [
            {
               "minLength": 1,
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "description": "For which client are parameters",
         "examples": [
            "enrobie.clients.DSCClient",
            "enrobie.clients.IRCClient",
            "enrobie.clients.MTMClient"
         ],
         "title": "Locate"
      },
      "client": {
         "$ref": "#/$defs/ClientParams",
         "description": "Parameters for the base client"
      },
      "delay": {
         "default": 15,
         "description": "Period to wait for reconnect",
         "maximum": 300,
         "minimum": 1,
         "title": "Delay",
         "type": "integer"
      },
      "status": {
         "$ref": "#/$defs/StatusPluginIconParams",
         "description": "Icon used per chat platform"
      }
   },
   "$defs": {
      "ClientParams": {
         "additionalProperties": false,
         "description": "Process and validate the class configuration parameters.",
         "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"
            }
         },
         "required": [
            "server",
            "token",
            "teamid"
         ],
         "title": "ClientParams",
         "type": "object"
      },
      "StatusPluginIconParams": {
         "additionalProperties": false,
         "description": "Contain information for constructing the chat messages.",
         "properties": {
            "irc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Irc"
            },
            "dsc": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Dsc"
            },
            "mtm": {
               "anyOf": [
                  {
                     "minLength": 1,
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "description": "Icon used for the chat platform",
               "title": "Mtm"
            }
         },
         "title": "StatusPluginIconParams",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "client"
   ]
}

Config:
  • extra: str = forbid

Fields:
field client: Annotated[ClientParams, FieldInfo(annotation=NoneType, required=True, description='Parameters for the base client')] [Required]#

Parameters for the base client

field delay: Annotated[int, FieldInfo(annotation=NoneType, required=False, default=15, description='Period to wait for reconnect', metadata=[Ge(ge=1), Le(le=300)])] = 15#

Period to wait for reconnect

Constraints:
  • ge = 1

  • le = 300

field status: Annotated[StatusPluginIconParams, FieldInfo(annotation=NoneType, required=False, default_factory=StatusPluginIconParams, description='Icon used per chat platform')] [Optional]#

Icon used per chat platform