Helper Class Reference  1.1
HomeGenie - Automation Programs' Engine SDK
Public Member Functions | List of all members
NetHelper Class Reference

Net Helper class.
Class instance accessor: Net More...

Public Member Functions

NetHelper MailService (string smtpServer)
 Set the SMTP server address for sending emails. If "E-Mail Account" program has been already configured, this method can be used to specify a different SMTP server to use for Net.SendMessage method. More...
 
NetHelper MailService (string smtpServer, int port, bool useSsl)
 Set the SMTP server address for sending emails. If "E-Mail Account" program has been already configured, this method can be used to specify a different SMTP server to use for Net.SendMessage method. More...
 
NetHelper AddAttachment (string name, byte[] data)
 Adds an attachment to the message. Can be called multiple times for attaching more files. More...
 
bool SendMessage (string recipients, string subject, string messageText)
 Sends an E-Mail. More...
 
bool SendMessage (string from, string recipients, string subject, string messageText)
 Sends an E-Mail. More...
 
ImapClient ImapClient (string host, int port, bool useSsl)
 IMAP mail client helper. More...
 
NetHelper WebService (string serviceUrl)
 Set the web service URL to call. More...
 
NetHelper Put (string data)
 Sends the specified string data using the PUT method. More...
 
NetHelper Post (string data)
 Sends the specified string data using the POST method. More...
 
NetHelper AddHeader (string name, string value)
 Adds the specified HTTP header to the HTTP request. More...
 
string Call ()
 Call the web service url. More...
 
dynamic GetData ()
 Call the web service url and returns the server response. More...
 
byte[] GetBytes ()
 Call the web service url and returns the server response as binary data. More...
 
bool Ping (string remoteAddress)
 Ping the specified remote host. More...
 
NetHelper WithCredentials (string user, string pass)
 Use provided credentials when connecting. More...
 

Detailed Description

Net Helper class.
Class instance accessor: Net

Member Function Documentation

NetHelper MailService ( string  smtpServer)

Set the SMTP server address for sending emails. If "E-Mail Account" program has been already configured, this method can be used to specify a different SMTP server to use for Net.SendMessage method.

Returns
NetHelper.
Parameters
smtpServerSMTP server address
NetHelper MailService ( string  smtpServer,
int  port,
bool  useSsl 
)

Set the SMTP server address for sending emails. If "E-Mail Account" program has been already configured, this method can be used to specify a different SMTP server to use for Net.SendMessage method.

Returns
NetHelper.
Parameters
smtpServerSMTP server address
portSMTP server port.
useSslIf set to true use SSL.
NetHelper AddAttachment ( string  name,
byte[]  data 
)

Adds an attachment to the message. Can be called multiple times for attaching more files.

Returns
NetHelper
Parameters
nameFile name (without path).
dataBinary data of the file to attach.
bool SendMessage ( string  recipients,
string  subject,
string  messageText 
)

Sends an E-Mail.

Returns
true, if message was sent, false otherwise.
Parameters
recipientsMessage recipients.
subjectMessage subject.
messageTextMessage text.
bool SendMessage ( string  from,
string  recipients,
string  subject,
string  messageText 
)

Sends an E-Mail.

Returns
true, if message was sent, false otherwise.
Parameters
fromMessage sender.
recipientsMessage recipients.
subjectMessage subject.
messageTextMessage text.
ImapClient ImapClient ( string  host,
int  port,
bool  useSsl 
)

IMAP mail client helper.

Returns
The IMAP client.
Parameters
hostHost.
portPort.
useSslIf set to true use ssl.
NetHelper WebService ( string  serviceUrl)

Set the web service URL to call.

Returns
NetHelper.
Parameters
serviceUrlService URL.

Example:

var iplocation = Net.WebService("http://freegeoip.net/json/").GetData();
Program.Notify("IP to Location", iplocation.city);
NetHelper Put ( string  data)

Sends the specified string data using the PUT method.

Parameters
dataData to send.
NetHelper Post ( string  data)

Sends the specified string data using the POST method.

Parameters
dataString containing post data fields and values in the form field1=value1&filed2=value2&...&fieldn=valuen.
NetHelper AddHeader ( string  name,
string  value 
)

Adds the specified HTTP header to the HTTP request.

Returns
NetHelper.
Parameters
nameHeader name.
valueHeader value.
string Call ( )

Call the web service url.

Returns
String containing the server response.
dynamic GetData ( )

Call the web service url and returns the server response.

Returns
The returned value can be a simple string or an object containing all fields mapped from the JSON/XML response (see Net.WebService example).
byte [] GetBytes ( )

Call the web service url and returns the server response as binary data.

Returns
Byte array containing the raw server response.
bool Ping ( string  remoteAddress)

Ping the specified remote host.

Parameters
remoteAddressIP or DNS address.
NetHelper WithCredentials ( string  user,
string  pass 
)

Use provided credentials when connecting.

Returns
NetHelper.
Parameters
userUsername.
passPassword.

The documentation for this class was generated from the following file: