-
Notifications
You must be signed in to change notification settings - Fork 0
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
8 changed files
with
297 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
namespace Fortifi\Api\V1\Endpoints; | ||
|
||
use Fortifi\Api\Core\ApiEndpoint; | ||
|
||
class ContactsDeviceEndpoint extends ApiEndpoint | ||
{ | ||
protected $_path = 'contacts/device'; | ||
protected $_replacements = []; | ||
|
||
public function __construct() | ||
{ | ||
} | ||
|
||
/** | ||
* @param $hardwareId | ||
* | ||
* @return ContactsDeviceHardwareIdEndpoint | ||
*/ | ||
public function with($hardwareId) | ||
{ | ||
$endpoint = new ContactsDeviceHardwareIdEndpoint( | ||
$hardwareId | ||
); | ||
$endpoint->_buildFromEndpoint($this); | ||
return $endpoint; | ||
} | ||
} |
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,91 @@ | ||
<?php | ||
namespace Fortifi\Api\V1\Endpoints; | ||
|
||
use Fortifi\Api\Core\ApiRequestDetail; | ||
use Fortifi\Api\Core\ApiRequest; | ||
use Fortifi\Api\Core\ApiEndpoint; | ||
|
||
class ContactsDeviceHardwareIdEndpoint extends ApiEndpoint | ||
{ | ||
protected $_path = 'contacts/device/{hardwareId}'; | ||
protected $_replacements = []; | ||
|
||
public function __construct($hardwareId) | ||
{ | ||
$this->_replacements['{hardwareId}'] = $hardwareId; | ||
} | ||
|
||
/** | ||
* @summary Unsubscribe a device | ||
* | ||
* @param $unsubscribeType | ||
* @param $brandFid | ||
* @param $groupFid | ||
* | ||
* @return ApiRequest | ||
*/ | ||
public function setUnsubscribe($unsubscribeType = null, $brandFid = null, $groupFid = null) | ||
{ | ||
$request = new ApiRequest(); | ||
$request->setConnection($this->_getConnection()); | ||
$request->setEndpoint($this); | ||
|
||
$detail = new ApiRequestDetail(); | ||
$detail->setRequireAuth(true); | ||
$detail->setUrl($this->_buildUrl( | ||
str_replace( | ||
array_keys($this->_replacements), | ||
array_values($this->_replacements), | ||
'contacts/device/{hardwareId}/unsubscribe' | ||
) | ||
)); | ||
$detail->addPostField('unsubscribeType', $unsubscribeType); | ||
$detail->addPostField('brandFid', $brandFid); | ||
$detail->addPostField('groupFid', $groupFid); | ||
$detail->setMethod('PUT'); | ||
$request->setRequestDetail($detail); | ||
return $request; | ||
} | ||
|
||
/** | ||
* @summary Subscribe an device | ||
* | ||
* @param $brandFid | ||
* @param $groupFid | ||
* @param $userAgent | ||
* @param $encoding | ||
* @param $language | ||
* @param $clientIp | ||
* @param $optInStatus | ||
* @param $optInData | ||
* | ||
* @return ApiRequest | ||
*/ | ||
public function setSubscribe($brandFid = null, $groupFid = null, $userAgent = null, $encoding = null, $language = null, $clientIp = null, $optInStatus = null, $optInData = null) | ||
{ | ||
$request = new ApiRequest(); | ||
$request->setConnection($this->_getConnection()); | ||
$request->setEndpoint($this); | ||
|
||
$detail = new ApiRequestDetail(); | ||
$detail->setRequireAuth(true); | ||
$detail->setUrl($this->_buildUrl( | ||
str_replace( | ||
array_keys($this->_replacements), | ||
array_values($this->_replacements), | ||
'contacts/device/{hardwareId}/subscribe' | ||
) | ||
)); | ||
$detail->addPostField('brandFid', $brandFid); | ||
$detail->addPostField('groupFid', $groupFid); | ||
$detail->addPostField('userAgent', $userAgent); | ||
$detail->addPostField('encoding', $encoding); | ||
$detail->addPostField('language', $language); | ||
$detail->addPostField('clientIp', $clientIp); | ||
$detail->addPostField('optInStatus', $optInStatus); | ||
$detail->addPostField('optInData', $optInData); | ||
$detail->setMethod('PUT'); | ||
$request->setRequestDetail($detail); | ||
return $request; | ||
} | ||
} |
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,45 @@ | ||
<?php | ||
namespace Fortifi\Api\V1\Endpoints; | ||
|
||
use Fortifi\Api\Core\ApiRequestDetail; | ||
use Fortifi\Api\Core\ApiRequest; | ||
use Fortifi\Api\Core\ApiEndpoint; | ||
|
||
class DeviceHardwareIdEndpoint extends ApiEndpoint | ||
{ | ||
protected $_path = 'device/{hardwareId}'; | ||
protected $_replacements = []; | ||
|
||
public function __construct($hardwareId) | ||
{ | ||
$this->_replacements['{hardwareId}'] = $hardwareId; | ||
} | ||
|
||
/** | ||
* @summary Remove a Device | ||
* | ||
* @param $entityFid | ||
* | ||
* @return ApiRequest | ||
*/ | ||
public function delete($entityFid = null) | ||
{ | ||
$request = new ApiRequest(); | ||
$request->setConnection($this->_getConnection()); | ||
$request->setEndpoint($this); | ||
|
||
$detail = new ApiRequestDetail(); | ||
$detail->setRequireAuth(true); | ||
$detail->setUrl($this->_buildUrl( | ||
str_replace( | ||
array_keys($this->_replacements), | ||
array_values($this->_replacements), | ||
'device/{hardwareId}' | ||
) | ||
)); | ||
$detail->addPostField('entityFid', $entityFid); | ||
$detail->setMethod('DELETE'); | ||
$request->setRequestDetail($detail); | ||
return $request; | ||
} | ||
} |
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