Pinion

class q2_sdk.models.pinion.Result(success=False, error_message=None, data=<factory>)[source]

Result(success: ‘bool’ = False, error_message: ‘Optional[str]’ = None, data: ‘dict’ = <factory>)

success: bool = False
error_message: Optional[str] = None
data: dict
enum q2_sdk.models.pinion.TemplatedEvents(value)[source]

Enum for templated events.

Field Details:
param:

ACCOUNT_REFRESH: Performs an account reload

param:

ALERT: Sends an alert notification

Valid values are as follows:

ACCOUNT_REFRESH = <TemplatedEvents.ACCOUNT_REFRESH: 'AccountUpdateNeeded'>
ALERT = <TemplatedEvents.ALERT: 'SendApplicationAlert'>
enum q2_sdk.models.pinion.AlertType(value)[source]

Enum for alert types.

Field Details:
param:

info: Denotes an info level alert

param:

error: Denotes an error level alert

param:

warning: Denotes an warning level alert

param:

success: Denotes an success level alert

Valid values are as follows:

INFO = <AlertType.INFO: 'info'>
ERROR = <AlertType.ERROR: 'error'>
WARNING = <AlertType.WARNING: 'warning'>
SUCCESS = <AlertType.SUCCESS: 'success'>
enum q2_sdk.models.pinion.NotificationRoutingType(value)[source]

Enum for notification routing types.

Field Details:
param:

MSG_TYPE_GENERAL: The notification is forwarded to the user identified in the userId field

param:

MSG_TYPE_FI: The notification is broadcasted to all users within the FI

Valid values are as follows:

MSG_TYPE_GENERAL = <NotificationRoutingType.MSG_TYPE_GENERAL: 0>
MSG_TYPE_FI = <NotificationRoutingType.MSG_TYPE_FI: 2>
class q2_sdk.models.pinion.NotificationRouting(notification_type, userId=None)[source]

Represents the notification routing information.

Field Details:
param:

notification_type: The type of notification to be sent to the frontend

param:

userId: The recipient of the notification message

notification_type: NotificationRoutingType
userId: Optional[str] = None
class q2_sdk.models.pinion.NotificationData(message=None, event=None, payload=<factory>)[source]

Represents the notification data.

Field Details:
param:

message: Message details

param:

event: The event tied to the request

param:

payload: Additional instructions sent to the frontend.

message: Optional[str] = None
event: Union[TemplatedEvents, str, None] = None
payload: dict
class q2_sdk.models.pinion.BaseTemplate(routing, data)[source]

Base Pinion template for sending messages.

Dictionary format:
{
routing{

notification_type: … userId: …

} data : {

message: … event: … payload: …

}

}

routing: NotificationRouting
data: NotificationData
class q2_sdk.models.pinion.BaseTemplateFactory(notification_routing_type)[source]

A factory class responsible for converting specific template instances into a BaseTemplate.

notification_routing_type: NotificationRoutingType
async to_base_template(logger, hq_credentials)[source]

Converts a specific template (AccountRefreshTemplate or AlertTemplate) instance into a BaseTemplate.

Return type:

Result

abstract async convert_to_base_template()[source]
class q2_sdk.models.pinion.AccountRefreshTemplate(notification_routing_type, user_id=None, transaction_ids=<factory>, message=None)[source]

Template designed for account reloads. This operation should be performed only when a user is logged in.

user_id: Optional[int] = None
transaction_ids: list[int]
message: Optional[str] = None
async convert_to_base_template(logger, hq_credentials)[source]

Converts the AccountRefreshTemplate to a BaseTemplate.

Return type:

Result

class q2_sdk.models.pinion.AlertTemplate(notification_routing_type, user_id=None, message=None, alert_type=None, closable=None, duration_in_ms=None)[source]

A template designed for sending alerts with control over whether the alert is closable, its duraction, and the alert type (info, error, etc.).

user_id: Optional[int] = None
message: Optional[str] = None
alert_type: Optional[AlertType] = None
closable: Optional[bool] = None
duration_in_ms: Optional[int] = None
async convert_to_base_template(logger, hq_credentials)[source]

Converts the AlertTemplate into a BaseTemplate, validating required fields and preparing the payload for sending

Return type:

Result

class q2_sdk.models.pinion.Pinion(logger=None, hq_credentials=None, environment=EnvLevel.Corporate, cache_obj=None)[source]

Pinion (Beta) is a system of services designed to deliver lightweight, distributed notifications to end-user applications via their browsers. This class provides the ability to send notifications using the SDK, which interacts with the underlying services to push messages to end users in real time. Note: This integration requires a minimum UUX version of 4.6.1.2.

async send(template)[source]

Sends a notification message based on the provided template.

Param:

template: The template to use for sending the message. Currently, supports an account refresh, alert and base template. Base template can be used for generic functionality, however, other templates have also been defined to facilitate interactions with Pinion.

Returns:

Result object returned with success or failure, including invalid transaction IDs for account refresh operation if applicable

Return type:

Result