Source code for luna_lambda_tools.public.clients.sender

"""
Module contains luna-sender client adapted for usage in lambda
"""

from luna3.sender.wsclient import LunaWSClient


[docs] class Sender: """Luna-sender client"""
[docs] def __init__(self, senderClient: LunaWSClient, accountId: str): self._accountId = accountId self._senderClient = senderClient
[docs] def getAddress(self) -> str: """Get luna sender address""" return self._senderClient.baseUri
[docs] def publish( self, events: list[dict], *, handlerId: str, eventCreateTime: str, eventEndTime: str, raiseError=True, **kwargs, ): """ Publish user generated events. Args: events: user generated events to be published handlerId: event handler id eventCreateTime: event creation time eventEndTime: event end time raiseError: whether to raise LunaApiException in case of failure """ return self._senderClient.publish( events=events, accountId=self._accountId, handlerId=handlerId, eventCreateTime=eventCreateTime, eventEndTime=eventEndTime, raiseError=raiseError, **kwargs, )