Skip to content

Commit

Permalink
Merge pull request #7 from rahulreghunath/add-php-doc-comments
Browse files Browse the repository at this point in the history
PHPDoc Comments modified
  • Loading branch information
rahulreghunath authored Aug 16, 2020
2 parents 21f2c78 + d35af56 commit 5ce38bb
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ npm-debug.log
# Laravel 4 specific
bootstrap/compiled.php
app/storage/
.idea

# Laravel 5 & Lumen specific
public/storage
Expand Down
77 changes: 54 additions & 23 deletions src/TextLocalOriginal.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*
* @package Rahulreghunath\Textlocal
* @subpackage API
* @author Andy Dixon <andy.dixon@tetxlocal.com>
* @author Andy Dixon <andy.dixon@tetxlocal.com>, Rahul Reghunath <me@rahulr.me>
* @version 1.4-IN
* @const REQUEST_URL URL to make the request to
* @const REQUEST_TIMEOUT Timeout in seconds for the HTTP request
Expand Down Expand Up @@ -69,7 +69,7 @@ public function getLastRequest()
* @param null $sched
* @param false $test
* @param null $receiptURL
* @param numm $custom
* @param null $custom
* @param false $optouts
* @param false $simpleReplyService
* @return array|mixed
Expand Down Expand Up @@ -186,7 +186,7 @@ private function _sendRequestCurl($command, $params)
* @param null $sender
* @param false $test
* @param null $receiptURL
* @param numm $custom
* @param null $custom
* @param false $optouts
* @param false $simpleReplyService
* @return array|mixed
Expand Down Expand Up @@ -300,6 +300,7 @@ public function sendMmsGroup($groupId, $fileSource, $message, $sched = null, $te
/**
*Returns reseller customer's ID's
* @return array
* @throws Exception
**/

public function getUsers()
Expand Down Expand Up @@ -342,16 +343,20 @@ public function transferCredits($user, $credits)
return $this->_sendRequest('transfer_credits', $params);
}

/**Get templates from an account **/

/**
* Get templates from an account
* @return array|mixed
* @throws Exception
*/
public function getTemplates()
{
return $this->_sendRequest('get_templates');
}

/** Check the availability of a keyword
* @param $keyword
* return array|mixed
* @return array|mixed
* @throws Exception
*/
public function checkKeyword($keyword)
{
Expand All @@ -364,6 +369,7 @@ public function checkKeyword($keyword)
* Create a new contact group
* @param $name
* @return array|mixed
* @throws Exception
*/
public function createGroup($name)
{
Expand Down Expand Up @@ -402,6 +408,7 @@ public function getContacts($groupId, $limit, $startPos = 0)
* @param $numbers
* @param string $groupid
* @return array|mixed
* @throws Exception
*/
public function createContacts($numbers, $groupid = '5')
{
Expand All @@ -419,10 +426,10 @@ public function createContacts($numbers, $groupid = '5')
/**
* Create bulk contacts - with name and custom information from an array of:
* [first_name] [last_name] [number] [custom1] [custom2] [custom3]
*
* @param array $contacts
* @param string $groupid
* @return array|mixed
* @throws Exception
*/
function createContactsBulk($contacts, $groupid = '5')
{
Expand All @@ -437,6 +444,7 @@ function createContactsBulk($contacts, $groupid = '5')
/**
* Get a list of groups and group IDs
* @return array|mixed
* @throws Exception
*/
public function getGroups()
{
Expand All @@ -447,6 +455,7 @@ public function getGroups()
* Get the status of a message based on the Message ID - this can be taken from sendSMS or from a history report
* @param $messageid
* @return array|mixed
* @throws Exception
*/
public function getMessageStatus($messageid)
{
Expand All @@ -458,6 +467,7 @@ public function getMessageStatus($messageid)
* Get the status of a message based on the Batch ID - this can be taken from sendSMS or from a history report
* @param $batchid
* @return array|mixed
* @throws Exception
*/
public function getBatchStatus($batchid)
{
Expand All @@ -468,6 +478,7 @@ public function getBatchStatus($batchid)
/**
* Get sender names
* @return array|mixed
* @throws Exception
*/
public function getSenderNames()
{
Expand All @@ -477,6 +488,7 @@ public function getSenderNames()
/**
* Get inboxes available on the account
* @return array|mixed
* * @throws Exception
*/
public function getInboxes()
{
Expand All @@ -486,6 +498,7 @@ public function getInboxes()
/**
* Get Credit Balances
* @return array
* @throws Exception
*/
public function getBalance()
{
Expand All @@ -497,6 +510,7 @@ public function getBalance()
* Get messages from an inbox - The ID can ge retrieved from getInboxes()
* @param $inbox
* @return array|bool|mixed
* @throws Exception
*/
public function getMessages($inbox)
{
Expand All @@ -509,6 +523,7 @@ public function getMessages($inbox)
* Cancel a scheduled message based on a message ID from getScheduledMessages()
* @param $id
* @return array|bool|mixed
* @throws Exception
*/
public function cancelScheduledMessage($id)
{
Expand All @@ -520,6 +535,7 @@ public function cancelScheduledMessage($id)
/**
* Get Scheduled Message information
* @return array|mixed
* @throws Exception
*/
public function getScheduledMessages()
{
Expand All @@ -531,6 +547,7 @@ public function getScheduledMessages()
* @param $number
* @param int $groupid
* @return array|bool|mixed
* @throws Exception
*/
public function deleteContact($number, $groupid = 5)
{
Expand All @@ -543,6 +560,7 @@ public function deleteContact($number, $groupid = 5)
* Delete a group - Be careful, we can not recover any data deleted by mistake
* @param $groupid
* @return array|mixed
* @throws Exception
*/
public function deleteGroup($groupid)
{
Expand All @@ -554,9 +572,10 @@ public function deleteGroup($groupid)
* Get single SMS history (single numbers, comma seperated numbers when sending)
* @param $start
* @param $limit
* @param $min_time Unix timestamp
* @param $max_time Unix timestamp
* @param $min_time
* @param $max_time
* @return array|bool|mixed
* @throws Exception
*/
public function getSingleMessageHistory($start, $limit, $min_time, $max_time)
{
Expand All @@ -568,9 +587,10 @@ public function getSingleMessageHistory($start, $limit, $min_time, $max_time)
* @param $type
* @param $start
* @param $limit
* @param $min_time
* @param $max_time
* @param $min_time - timestamp
* @param $max_time - timestamp
* @return array|bool|mixed
* @throws Exception
*/
private function getHistory($type, $start, $limit, $min_time, $max_time)
{
Expand All @@ -583,9 +603,10 @@ private function getHistory($type, $start, $limit, $min_time, $max_time)
* Get API SMS Message history
* @param $start
* @param $limit
* @param $min_time Unix timestamp
* @param $max_time Unix timestamp
* @param $min_time - timestamp
* @param $max_time - timestamp
* @return array|bool|mixed
* @throws Exception
*/
public function getAPIMessageHistory($start, $limit, $min_time, $max_time)
{
Expand All @@ -596,9 +617,10 @@ public function getAPIMessageHistory($start, $limit, $min_time, $max_time)
* Get Email to SMS History
* @param $start
* @param $limit
* @param $min_time Unix timestamp
* @param $max_time Unix timestamp
* @param $min_time - timestamp
* @param $max_time - timestamp
* @return array|bool|mixed
* @throws Exception
*/
public function getEmailToSMSHistory($start, $limit, $min_time, $max_time)
{
Expand All @@ -609,9 +631,10 @@ public function getEmailToSMSHistory($start, $limit, $min_time, $max_time)
* Get group SMS history
* @param $start
* @param $limit
* @param $min_time Unix timestamp
* @param $max_time Unix timestamp
* @param $min_time - timestamp
* @param $max_time - timestamp
* @return array|bool|mixed
* @throws Exception
*/
public function getGroupMessageHistory($start, $limit, $min_time, $max_time)
{
Expand All @@ -621,38 +644,46 @@ public function getGroupMessageHistory($start, $limit, $min_time, $max_time)
/**
* Get a list of surveys
* @return array|mixed
* @throws Exception
*/
public function getSurveys()
{
return $this->_sendRequest('get_surveys');
}

/**
* Get a deatils of a survey
* Get a details of a survey
* @param $survey_id - survey id
* @return array|mixed
* @throws Exception
*/
public function getSurveyDetails()
public function getSurveyDetails($survey_id)
{
$options = array('survey_id' => $surveyid);
$options = array('survey_id' => $survey_id);
return $this->_sendRequest('get_survey_details');
}

/**
* Get a the results of a given survey
* @param $survey_id
* @param $start - start date
* @param $end - end date
* @return array|mixed
* @throws Exception
*/
public function getSurveyResults($surveyid, $start, $end)
public function getSurveyResults($survey_id, $start, $end)
{
$options = array('survey_id' => $surveyid, 'start_date' => $start, 'end_date' => $end);
$options = array('survey_id' => $survey_id, 'start_date' => $start, 'end_date' => $end);
return $this->_sendRequest('get_surveys', $options);
}

/**
* Get all account optouts
* @return array|mixed
* @throws Exception
*/

public function getOptouts($time = null)
public function getOptouts()
{
return $this->_sendRequest('get_optouts');
}
Expand Down
17 changes: 14 additions & 3 deletions src/Textlocal.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

namespace Rahulreghunath\Textlocal;

use Exception;

/**
* Textlocal Laravel Wrapper Class
*
* This class is used to interface with Laravel and Textlocal API2 to send messages, manage contacts, retrieve messages from
* inboxes, track message delivery statuses, access history reports
*
* @package Rahulreghunath\Textlocal
* @subpackage API
* @author Rahul Reghunath <me@rahulr.me>
*/
class Textlocal extends TextLocalOriginal
{
private $sender;
Expand All @@ -17,11 +29,10 @@ public function __construct()
* @param string $receiver
* @param string $sender
* @return array|mixed
* @throws \Exception
* @throws Exception
*/
public function send($message, $receiver, $sender = '')
{
$result = $this->sendSms([$receiver], $message, $sender != '' ? $sender : $this->sender);
return $result;
return $this->sendSms([$receiver], $message, $sender != '' ? $sender : $this->sender);
}
}

0 comments on commit 5ce38bb

Please sign in to comment.