Skip to content

Commit

Permalink
Added action campaigns request
Browse files Browse the repository at this point in the history
  • Loading branch information
jarnovanleeuwen committed Jun 22, 2023
1 parent 6ba42ab commit 6d8f60c
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/ActionCampaigns/client.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
namespace Examples\ActionCampaigns;

require_once "../../vendor/autoload.php";

use OneCommunity\Client;
use OneCommunity\Exceptions\RequestException;
use OneCommunity\Requests\ActionCampaignsRequest;

$apiKey = "DRSt3jWF4YqRZSi6Z8xzSAtBpVTauJ6b";
$userId = 1;
$projectName = "yourproject";

$client = new Client($apiKey, $userId, $projectName);
$client->loadPrivateKey("../private_rsa.pem");

$page = 1;
$perPage = 10;

try {
$request = new ActionCampaignsRequest;
$request->setPage($page);
$request->setPerPage($perPage);

$response = $client->send($request);

dump($response->getData());
} catch (RequestException $exception) {
http_response_code(400);

dump($exception->getMessage());
}
10 changes: 10 additions & 0 deletions src/Requests/ActionCampaignsRequest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php
namespace OneCommunity\Requests;

class ActionCampaignsRequest extends CollectionRequest
{
public function getUri(): string
{
return 'action_campaigns';
}
}

0 comments on commit 6d8f60c

Please sign in to comment.