-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Delete interactions * Update client.php * Update client.php
- Loading branch information
1 parent
fbd619f
commit 3ba6cb2
Showing
3 changed files
with
55 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
namespace Examples\DeleteInteraction; | ||
|
||
require_once "../../vendor/autoload.php"; | ||
|
||
use OneCommunity\Client; | ||
use OneCommunity\Exceptions\RequestException; | ||
use OneCommunity\Requests\DeleteInteractionRequest; | ||
|
||
$apiKey = "DRSt3jWF4YqRZSi6Z8xzSAtBpVTauJ6b"; | ||
$userId = 1; | ||
$projectName = "yourproject"; | ||
|
||
$client = new Client($apiKey, $userId, $projectName); | ||
$client->loadPrivateKey("../private_rsa.pem"); | ||
|
||
$interactionId = 1; | ||
|
||
try { | ||
$request = new DeleteInteractionRequest($interactionId); | ||
|
||
$response = $client->send($request); | ||
|
||
dump($response->getData()); | ||
} catch (RequestException $exception) { | ||
http_response_code(400); | ||
|
||
dump($exception->getMessage()); | ||
} |
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,25 @@ | ||
<?php | ||
namespace OneCommunity\Requests; | ||
|
||
class DeleteInteractionRequest extends Request | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
protected $interactionId; | ||
|
||
public function __construct(int $interactionId) | ||
{ | ||
$this->interactionId = $interactionId; | ||
} | ||
|
||
public function getMethod(): string | ||
{ | ||
return 'POST'; | ||
} | ||
|
||
public function getUri(): string | ||
{ | ||
return "interactions/{$this->interactionId}/delete"; | ||
} | ||
} |