Skip to content

Commit 4a07612

Browse files
committed
Support new content-generation api methods
This adds the following new methods: - `runContentGeneration` - Allows to trigger content-generation on mailings/leadpages; returns a generic `JobState` - `getJobState` - Allows to query the api for the state of a certain Job Also, this updates the dependencies.
1 parent e816942 commit 4a07612

16 files changed

+407
-84
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"require": {
2525
"php": "^8.1",
2626
"ext-soap": "*",
27-
"scn/evalanche-soap-api-struct": "^2.4",
27+
"scn/evalanche-soap-api-struct": "^2.5",
2828
"scn/hydrator": "^2|^3",
2929
"scn/hydrator-property-values": "^2.0|^3.0"
3030
},

composer.lock

Lines changed: 99 additions & 80 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapApiConnector\Client\Generic;
6+
7+
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
8+
use Scn\EvalancheSoapStruct\Struct\Generic\HashMapInterface;
9+
use Scn\EvalancheSoapStruct\Struct\Generic\JobStateInterface;
10+
11+
interface ContentGenerationInterface extends GetJobStateInterface
12+
{
13+
/**
14+
* Runs the content-generation
15+
*
16+
* @throws EmptyResultException
17+
*/
18+
public function runContentGeneration(
19+
int $id,
20+
HashMapInterface $variables
21+
): JobStateInterface;
22+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapApiConnector\Client\Generic;
6+
7+
use Scn\EvalancheSoapStruct\Struct\Generic\HashMapInterface;
8+
use Scn\EvalancheSoapStruct\Struct\Generic\JobStateInterface;
9+
10+
trait ContentGenerationTrait
11+
{
12+
use GetJobStateTrait;
13+
14+
/** @inheritDoc */
15+
public function runContentGeneration(
16+
int $id,
17+
HashMapInterface $variables
18+
): JobStateInterface {
19+
return $this->responseMapper->getObject(
20+
$this->soapClient->runContentGeneration([
21+
'resource_id' => $id,
22+
'variables' => $this->extractor->extract(
23+
$this->hydratorConfigFactory->createHashMapConfig(),
24+
$variables
25+
)
26+
]),
27+
'runContentGenerationResult',
28+
$this->hydratorConfigFactory->createJobStateConfig()
29+
);
30+
}
31+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapApiConnector\Client\Generic;
6+
7+
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
8+
use Scn\EvalancheSoapStruct\Struct\Generic\JobStateInterface;
9+
10+
interface GetJobStateInterface
11+
{
12+
/**
13+
* Returns the state of a background-job
14+
*
15+
* @throws EmptyResultException
16+
*/
17+
public function getJobState(
18+
string $job_id,
19+
): JobStateInterface;
20+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Scn\EvalancheSoapApiConnector\Client\Generic;
6+
7+
use Scn\EvalancheSoapStruct\Struct\Generic\JobStateInterface;
8+
9+
trait GetJobStateTrait
10+
{
11+
/** @inheritDoc */
12+
public function getJobState(
13+
string $job_id,
14+
): JobStateInterface {
15+
return $this->responseMapper->getObject(
16+
$this->soapClient->getJobState([
17+
'job_id' => $job_id,
18+
]),
19+
'getJobStateResult',
20+
$this->hydratorConfigFactory->createJobStateConfig()
21+
);
22+
}
23+
}

src/Client/LeadPage/LeadpageClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use Scn\EvalancheSoapApiConnector\Client\AbstractClient;
88
use Scn\EvalancheSoapApiConnector\Client\ClientInterface;
9+
use Scn\EvalancheSoapApiConnector\Client\Generic\ContentGenerationTrait;
910
use Scn\EvalancheSoapApiConnector\Client\Generic\EditorModuleTypesTrait;
1011
use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTrait;
1112
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
@@ -15,6 +16,7 @@
1516

1617
class LeadpageClient extends AbstractClient implements LeadpageClientInterface
1718
{
19+
use ContentGenerationTrait;
1820
use ResourceTrait;
1921
use EditorModuleTypesTrait;
2022
const PORTNAME = 'leadpage';

src/Client/LeadPage/LeadpageClientInterface.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
namespace Scn\EvalancheSoapApiConnector\Client\LeadPage;
44

55
use Scn\EvalancheSoapApiConnector\Client\ClientInterface;
6+
use Scn\EvalancheSoapApiConnector\Client\Generic\ContentGenerationInterface;
67
use Scn\EvalancheSoapApiConnector\Client\Generic\EditorModulesTypesTraitInterface;
78
use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTraitInterface;
89
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
910
use Scn\EvalancheSoapStruct\Struct\Generic\HashMapInterface;
1011
use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface;
1112
use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageConfigurationInterface;
1213

13-
interface LeadpageClientInterface extends ResourceTraitInterface, EditorModulesTypesTraitInterface, ClientInterface
14+
interface LeadpageClientInterface extends
15+
ContentGenerationInterface,
16+
ResourceTraitInterface,
17+
EditorModulesTypesTraitInterface,
18+
ClientInterface
1419
{
1520
/**
1621
* @param int $id

src/Client/Mailing/MailingClient.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Scn\EvalancheSoapApiConnector\Client\AbstractClient;
66
use Scn\EvalancheSoapApiConnector\Client\ClientInterface;
7+
use Scn\EvalancheSoapApiConnector\Client\Generic\ContentGenerationTrait;
78
use Scn\EvalancheSoapApiConnector\Client\Generic\EditorModuleTypesTrait;
89
use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTrait;
910
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
@@ -29,6 +30,7 @@
2930
*/
3031
final class MailingClient extends AbstractClient implements MailingClientInterface
3132
{
33+
use ContentGenerationTrait;
3234
use ResourceTrait;
3335
use EditorModuleTypesTrait;
3436
const PORTNAME = 'mailing';

src/Client/Mailing/MailingClientInterface.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Scn\EvalancheSoapApiConnector\Client\Mailing;
44

55
use Scn\EvalancheSoapApiConnector\Client\ClientInterface;
6+
use Scn\EvalancheSoapApiConnector\Client\Generic\ContentGenerationInterface;
67
use Scn\EvalancheSoapApiConnector\Client\Generic\EditorModulesTypesTraitInterface;
78
use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTraitInterface;
89
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException;
@@ -29,7 +30,11 @@
2930
*
3031
* @package Scn\EvalancheSoapApiConnector\Client\Mailing
3132
*/
32-
interface MailingClientInterface extends ResourceTraitInterface, EditorModulesTypesTraitInterface, ClientInterface
33+
interface MailingClientInterface extends
34+
ContentGenerationInterface,
35+
ResourceTraitInterface,
36+
EditorModulesTypesTraitInterface,
37+
ClientInterface
3338
{
3439
/**
3540
* @param int $id

0 commit comments

Comments
 (0)