Utility libraries (com.carriots.sdk.utils)

Email class

Email class is a commodity class for sending emails from Carriots. Groovy or Java emails and communications in general will not work in Carriots SDK for security reasons.

Public properties:

Property name Type Default value Comment
subject String "carriots platform"
message String ""
to String "" Semicolon (;) separated addressees
cc String "" Semicolon (;) separated carbon copy addressees
bcc String "" Semicolon (;) separated blind carbon copy addressees

Public method:

send()

Sends the email with the object properties

BasicHttp class

BasicHttp class is a commodity class for accessing external URLs from Carriots. Groovy or Java communications in general will not work in Carriots SDK for security reasons.

Public properties:

Property name Type Default value Comment
url String ""
verb String ""
headers java.util.Map null Key-value map
params java.util.Map null Key-value map
payload String ""
http_auth java.util.Map null Key-value map

Public method:

send()

Send the request (HTTP GET) to the URL specified and returns the text response from this request

Sms class

SMS class is a commodity class sending SMS from Carriots. Groovy or Java communications in general will not work in Carriots SDK for security reasons.

Public properties:

Property name Type Default value Comment
to String "" Comma (,) separated phone numbers. Phone numbers must a have the country prefix (ex: 0044) If no prefix is found, 0034 is assumed. Example: 0034123456789
message String "" Message text, max 160 characters

Public method:

send()

Send the SMS to all the Phone numbers. Returns a response with sending results: send result | operation ID | phone numbers addressees. Example: OK|1F11FEADCB6A4|1

Twitter class

Twitter class is a commodity class sending tweet from Carriots. Groovy or Java communications in general will not work in Carriots SDK for security reasons.

Public properties:

Property name Type Default value Comment
status String "" Message text

Public method:

send()

Tweet your status

MQTTPublisher class

MQTTPublisher class is a commodity class for publishing messages to a MQTT topic from Carriots.

Public constructors:

MQTTPublisher (int qualityOfService, String username, String password)

Constructs a MQTTPublisher object with a default configuration. This is recommended to use mqttbroker.carriots.com.

MQTTPublisher (String mqttBrokerDNS, int mqttBrokerPort, int qualityOfService, String username, String password)

Constructs a MQTTPublisher object assuming some configuration. This is recommended to use an external MQTT broker that admits TCP protocol as it is going to be connected using TCP.

MQTTPublisher (String mqttBrokerProtocol, String mqttBrokerDNS, int mqttBrokerPort, int qualityOfService, String username, String password, SSLCERTIFICATE)

Constructs a MQTTPublisher object with the full configuration set in the constructor. This is recommended to use an external MQTT broker with the SSL protocol. The certificate must be in one line, so carrier returns must be replaced with "n".

Public method:

publish (String topic, Object data)

Publishes a message to a topic. The message can be any data structure (String, Number, Boolean, Map, Collection...). You can publish messages to different topics with the same MQTTPublisher object if the MQTT broker configuration is the same.