Skip to content

Commit

Permalink
Development (#3)
Browse files Browse the repository at this point in the history
* Add Received/Sent messages methods

* Update README.md
  • Loading branch information
Amir Hossein Baghaie authored Nov 9, 2020
1 parent 0d2413a commit f6e9d8e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 3 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,16 @@ send(array $messages, array $mobileNumbers, $sendDateTime = null): array

sendVerificationCode(string $code, string $mobileNumber): array

ultraFastSend(array $parameters, string $templateId, string $mobileNumber): array
ultraFastSend(array $parameters, string $templateId, string $mobileNumber): array

getSentMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): array

getReceivedMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): array
```
### Roadmap:

- [X] Add remaining methods
- [ ] Add exception handling
- [ ] Add remaining methods
- [ ] Add Laravel 8.x support
- [ ] Add customer club
- [ ] Add Tests
- [ ] Add CI/CD
45 changes: 45 additions & 0 deletions src/SmsIRClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,49 @@ public function ultraFastSend(array $parameters, string $templateId, string $mob
$result = $this->executeRequest('UltraFastSend', $body);
return json_decode($result->getBody()->getContents(), true);
}

/**
* this method used for fetch your sent messages
*
* @param $perPage = how many sms you want to fetch in every page
* @param $pageNumber = the page number
* @param $fromDate = from date (example: 1399/06/01)
* @param $toDate = to date (example: 1399/08/25)
* @return array
* @throws GuzzleException
*/
public function getSentMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): array
{
if(empty($fromDate)) {
die("please fill parameter fromDate\n");
}
if(empty($toDate)) {
die("please fill parameter toDate\n");
}
$result = $this->executeRequest("MessageSend?Shamsi_FromDate=$fromDate&Shamsi_ToDate=$toDate&RowsPerPage=$perPage&RequestedPageNumber=$pageNumber");
return json_decode($result->getBody()->getContents(), true);
}

/**
* this method used for fetch received messages
*
* @param $perPage = how many sms you want to fetch in every page
* @param $pageNumber = the page number
* @param $fromDate = from date (example: 1399/06/01)
* @param $toDate = to date (example: 1399/08/25)
* @return array
* @throws GuzzleException
*
*/
public function getReceivedMessages($fromDate, $toDate, $pageNumber = 1, $perPage = 100): array
{
if(empty($fromDate)) {
die("please fill parameter fromDate\n");
}
if(empty($toDate)) {
die("please fill parameter toDate\n");
}
$result = $this->executeRequest("ReceiveMessage?Shamsi_FromDate=$fromDate&Shamsi_ToDate=$toDate&RowsPerPage=$perPage&RequestedPageNumber=$pageNumber");
return json_decode($result->getBody()->getContents(), true);
}
}

0 comments on commit f6e9d8e

Please sign in to comment.