Product EmailMarketing API
getAll()
Description
Returns the list of existing Email Marketing products.
Signature
getAll(Filter\Product\EmailMarketing\GetAll $filters = null): DataObject\Product\EmailMarketing\Existing[]
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Filter;
use Dreamscape\ResellerApiSdk\PredefinedValue;
use Dreamscape\ResellerApiSdk\Exception;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
$filters = Filter\Product\EmailMarketing\GetAll::build();
$filters->customerId = 123456;
$filters->statusId = 1;
$filters->limit = 10;
$filters->page = 1;
try {
$products = $api->products->emailMarketings->getAll($filters);
foreach ($products as $product) {
echo 'Product ID: ' . $product->id . PHP_EOL;
echo 'Plan ID: ' . $product->planId . PHP_EOL;
}
echo 'Total items: ' . $products->totalItems . PHP_EOL;
echo 'Total pages: ' . $products->totalPages . PHP_EOL;
echo 'Current page: ' . $products->currentPage . PHP_EOL;
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
}
getDetails()
Description
Returns the details about single Email Marketing product.
Signature
getDetails(int $product_id): DataObject\Product\EmailMarketing\Existing
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Exception;
use Dreamscape\ResellerApiSdk\PredefinedValue;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
try {
$product = $api->products->emailMarketings->getDetails(123456);
echo 'Product ID: ' . $product->id . PHP_EOL;
echo 'Plan ID: ' . $product->planId . PHP_EOL;
if ($product->statusId === PredefinedValue\Product::STATUS_REGISTERED) {
echo 'Product is registered' . PHP_EOL;
}
} catch (Exception\NotFoundException $e) {
// Handle the exception.
}
register()
Description
Registers new Email Marketing product.
Signature
register(DataObject\Product\EmailMarketing\Register $data_object): DataObject\Product\EmailMarketing\Existing
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\DataObject;
use Dreamscape\ResellerApiSdk\Exception;
use Dreamscape\ResellerApiSdk\PredefinedValue;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
$new_product = DataObject\Product\EmailMarketing\Register::build()
->setCustomerId(123456)
->setPlanId(257)
->setPeriod(12);
try {
$product = $api->products->emailMarketings->register($new_product);
echo 'Product ID: ' . $product->id;
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
} catch (Exception\PaymentRequiredException $e) {
// Handle the exception.
}
renew()
Description
Renews Email Marketing product.
Signature
renew(int $product_id, DataObject\Product\EmailMarketing\Renew $data_object = null): DataObject\Product\EmailMarketing\Existing
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\DataObject;
use Dreamscape\ResellerApiSdk\Exception;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
$renew_product = DataObject\Product\EmailMarketing\Renew::build();
$renew_product->period = 24;
try {
$product = $api->products->emailMarketings->renew(123456, $renew_product);
echo 'Product ID: ' . $product->id;
} catch (Exception\NotFoundException $e) {
// Handle the exception.
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
} catch (Exception\PaymentRequiredException $e) {
// Handle the exception.
}
terminate()
Description
Terminates Email Marketing product.
Signature
terminate(int $product_id): bool
Throws
Example
<?php
use Dreamscape\ResellerApiSdk\Api;
use Dreamscape\ResellerApiSdk\Authenticator\ApiKey;
use Dreamscape\ResellerApiSdk\Http\Adapter\Curl;
use Dreamscape\ResellerApiSdk\Exception;
$api = new Api(new Curl(new ApiKey('YourAPIKeyGoesHere'), 'https://reseller-api.sandbox.ds.network'));
try {
$api->products->emailMarketings->terminate(123456);
echo 'Product successfully terminated';
} catch (Exception\BadRequestException $e) {
// Handle the errors in $e->getErrors().
} catch (Exception\NotFoundException $e) {
// Handle the exception.
}