-
Notifications
You must be signed in to change notification settings - Fork 0
Library Reference
Harsha Alva edited this page May 3, 2017
·
2 revisions
Adds Kandy SMS C++ library to your program.
#include "kandy/sms.hpp"
Contains functionality to authenticate Kandy user and send SMS.
Two constructors which store different results in variables by reference are provided.
The constructrs check the validity of the parameter values suplied by the user and authenticates them on the Kandy server.
Stores User Access Token and Device ID in two string variables by reference if authentication was successful.
sms(string domain_api_key, string domain_secret, string user_id, string &user_access_token, string &device_id)
ARGS:
domain_api_key = API key of Domain
domain_api_secret = API secret of Domain
user_id = ID of User sending the SMS
user_access_token = string variable to store User Access Token, on success.
device_id = string variable to store Device ID Token, on success.
THROWS:
std::invalid_argument - arguments are invalid or empty strings.
std::runtime_error - invalid reply from Kandy REST API.
Stores the authentication result in a boolean variable by reference.
sms(string domain_api_key, string domain_secret, string user_id, bool &success)
ARGS:
domain_api_key = API key of Domain
domain_api_secret = API secret of Domain
user_id = ID of User sending the SMS
success = boolean variable to store initialization success.
THROWS:
std::invalid_argument - arguments are invalid or empty strings.
std::runtime_error - invalid reply from Kandy REST API.
Sends SMS after checking the validity of the parameters set by the user and the Kandy authentication data.
send(string source, string destination, string text)
ARGS:
source = Sender's phone number in international format, i.e., +12345678
destination = Recipient's phone number in international format, i.e., +12345678
text = Message to be sent
THROWS:
std::invalid_argument - arguments are invalid or empty strings.
std::runtime_error - invalid reply from Kandy REST API.