-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
353 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Sms77\Api\Constant; | ||
|
||
class HooksConstants { | ||
public const ACTION_READ = 'read'; | ||
|
||
public const ACTION_SUBSCRIBE = 'subscribe'; | ||
|
||
public const ACTION_UNSUBSCRIBE = 'unsubscribe'; | ||
|
||
public const ACTIONS = [ | ||
self::ACTION_READ, | ||
self::ACTION_SUBSCRIBE, | ||
self::ACTION_UNSUBSCRIBE, | ||
]; | ||
|
||
public const EVENT_TYPE_SMS_INBOUND = 'sms_mo'; | ||
|
||
public const EVENT_TYPE_SMS_STATUS = 'dlr'; | ||
|
||
public const EVENT_TYPE_VOICE_STATUS = 'voice_status'; | ||
|
||
public const EVENT_TYPES = [ | ||
self::EVENT_TYPE_SMS_INBOUND, | ||
self::EVENT_TYPE_SMS_STATUS, | ||
self::EVENT_TYPE_VOICE_STATUS, | ||
]; | ||
|
||
public const REQUEST_METHOD_GET = 'GET'; | ||
|
||
public const REQUEST_METHOD_POST = 'POST'; | ||
|
||
public const REQUEST_METHOD_DEFAULT = self::REQUEST_METHOD_POST; | ||
|
||
public const REQUEST_METHODS = [ | ||
self::REQUEST_METHOD_POST, | ||
self::REQUEST_METHOD_GET, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Sms77\Api\Response; | ||
|
||
use Sms77\Api\Library\JsonObject; | ||
|
||
/** | ||
* @property int id | ||
* @property string target_url | ||
* @property string event_type | ||
* @property string request_method | ||
* @property string created | ||
*/ | ||
class Webhook extends JsonObject { | ||
public function __construct(?object $class = null) { | ||
/** @var self $class */ | ||
if ($class) { | ||
$class->id = (int)$class->id; | ||
} | ||
|
||
parent::__construct($class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Sms77\Api\Response; | ||
|
||
use Sms77\Api\Library\JsonObject; | ||
|
||
/** | ||
* @property int id | ||
* @property bool success | ||
*/ | ||
class WebhookAction extends JsonObject { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Sms77\Api\Response; | ||
|
||
use Sms77\Api\Library\JsonObject; | ||
|
||
/** | ||
* @property bool success | ||
* @property Webhook[] hooks | ||
*/ | ||
class Webhooks extends JsonObject { | ||
public function __construct(?object $class = null) { | ||
/** @var self $class */ | ||
if ($class) { | ||
foreach ($class->hooks as $k => $v) { | ||
$class->hooks[$k] = new Webhook($v); | ||
} | ||
} | ||
|
||
parent::__construct($class); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.