Services

Instance

Parameters:

Optional token: str
Token is a optional parameter (Analysis Token).
Optional region: str “usa-1” or “env”
Region is a optional parameter
Example:
    from tagoio_sdk import Services

    services = Services()

Attachment

Send Attachment

Parameters:

archive: ArchiveFile
Archive JSON Object
Example:
        from tagoio_sdk import Services

        services = Services()
        services.Attachment.upload(
            {
                "name": "Test",
                "content": "base64",
                "type": "Test",
            }
        )

ConsoleService

Log message in analysis console

Parameters:

message: str
Log message
Optional time: datetime
Date of message
Example:
        from tagoio_sdk import Services

        services = Services()
        services.console.log(
            {
                "message": "Test",
            }
        )

Email

Send Email

Parameters:

Email objects
Example:
        from tagoio_sdk import Services

        services = Services()
        services.email.send(
            {
                "to": "myclien@tago.io",
                "subject": "Test Subject",
            }
        )

MQTT

Publish to a MQTT Device

Parameters:

mqtt: MQTTData
MQTT object, contains topic, bucket, message and options(retain and qos)
Example:
        from tagoio_sdk import Services

        services = Services()
        services.MQTT.publish(
            {
                "bucket": "my_device_id",
                "message": "Test",
                "topic": "teste/TEMPERATURE",
                "options": {"qos": 0, "retain": False},
            }
        )

Notification

Send Notification

You can add ref_id from a bucket or dashboard, if it is valid it will show up a button Go To Dashboard Any account with share of the dashboard/bucket will receive too.

Parameters:

notification: NotificationCreate
Notification Object
Example:
        from tagoio_sdk import Services

        services = Services()
        services.Notification.send(
            {
                title: "Example",
                message: "Message Test",
            }
        )

PDF

Generate a PDF from html, url or base64

Parameters:

params: PDFParams
Parameters used to generate the pdf
Example:
        from tagoio_sdk import Services

        services = Services()
        services.PDF.generate(
            {
                base64: "base64"
            }
        )

SMS

Send SMS to phone number

Parameters:

sms: SMSData
Data that sms will be send, number and message
Example:
        from tagoio_sdk import Services

        services = Services()
        services.sms.send(
            {
                "to": "434434434434",
                "message": "Test",
            }
        )