-
Notifications
You must be signed in to change notification settings - Fork 9
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
13 changed files
with
477 additions
and
8 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,89 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Scn\EvalancheSoapApiConnector\Client\LeadPageTemplate; | ||
|
||
use Scn\EvalancheSoapApiConnector\Client\AbstractClient; | ||
use Scn\EvalancheSoapApiConnector\Client\ClientInterface; | ||
use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTrait; | ||
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException; | ||
use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface; | ||
use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\TemplatesSourcesInterface; | ||
|
||
class LeadpageTemplateClient extends AbstractClient implements LeadpageTemplateClientInterface | ||
{ | ||
use ResourceTrait; | ||
const PORTNAME = 'leadpagetemplate'; | ||
const VERSION = ClientInterface::VERSION_V0; | ||
|
||
/** | ||
* @param string $title | ||
* @param int $folderId | ||
* | ||
* @return ResourceInformationInterface | ||
* @throws EmptyResultException | ||
*/ | ||
public function create( | ||
string $title, | ||
int $folderId | ||
): ResourceInformationInterface { | ||
return $this->responseMapper->getObject( | ||
$this->soapClient->create( | ||
[ | ||
'name' => $title, | ||
'category_id' => $folderId, | ||
] | ||
), | ||
'createResult', | ||
$this->hydratorConfigFactory->createResourceInformationConfig() | ||
); | ||
} | ||
|
||
/** | ||
* @param int $id | ||
* | ||
* @return TemplatesSourcesInterface | ||
* @throws EmptyResultException | ||
*/ | ||
public function getSources(int $id): TemplatesSourcesInterface | ||
{ | ||
return $this->responseMapper->getObject( | ||
$this->soapClient->getSources( | ||
[ | ||
'leadpage_template_id' => $id, | ||
] | ||
), | ||
'getSourcesResult', | ||
$this->hydratorConfigFactory->createLeadpageTemplateSourcesConfig() | ||
); | ||
} | ||
|
||
/** | ||
* @param int $id | ||
* @param TemplatesSourcesInterface $configuration | ||
* | ||
* @return TemplatesSourcesInterface | ||
* @throws EmptyResultException | ||
*/ | ||
public function setSources( | ||
int $id, | ||
TemplatesSourcesInterface $configuration, | ||
bool $overwrite = false | ||
): TemplatesSourcesInterface { | ||
return $this->responseMapper->getObject( | ||
$this->soapClient->setSources( | ||
[ | ||
'leadpage_template_id' => $id, | ||
'sources' => $this->extractor->extract( | ||
$this->hydratorConfigFactory->createLeadpageTemplateSourcesConfig(), | ||
$configuration | ||
), | ||
'overwrite' => $overwrite | ||
] | ||
), | ||
'setSourcesResult', | ||
$this->hydratorConfigFactory->createLeadpageTemplateSourcesConfig() | ||
); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/Client/LeadPageTemplate/LeadpageTemplateClientInterface.php
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 Scn\EvalancheSoapApiConnector\Client\LeadPageTemplate; | ||
|
||
use Scn\EvalancheSoapApiConnector\Client\ClientInterface; | ||
use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTraitInterface; | ||
use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException; | ||
use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface; | ||
use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\TemplatesSourcesInterface; | ||
|
||
interface LeadpageTemplateClientInterface extends ResourceTraitInterface, ClientInterface | ||
{ | ||
/** | ||
* @param string $title | ||
* @param int $folderId | ||
* | ||
* @return ResourceInformationInterface | ||
* @throws EmptyResultException | ||
*/ | ||
public function create( | ||
string $title, | ||
int $folderId | ||
): ResourceInformationInterface; | ||
|
||
/** | ||
* @param int $id | ||
* | ||
* @return TemplatesSourcesInterface | ||
* @throws EmptyResultException | ||
*/ | ||
public function getSources(int $id): TemplatesSourcesInterface; | ||
|
||
/** | ||
* @param int $id | ||
* @param TemplatesSourcesInterface $configuration | ||
* | ||
* @return TemplatesSourcesInterface | ||
* @throws EmptyResultException | ||
*/ | ||
public function setSources( | ||
int $id, | ||
TemplatesSourcesInterface $configuration, | ||
bool $overwrite = false | ||
): TemplatesSourcesInterface; | ||
} |
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
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
34 changes: 34 additions & 0 deletions
34
src/Hydrator/Config/LeadPageTemplate/LeadpageTemplateSourcesConfig.php
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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Scn\EvalancheSoapApiConnector\Hydrator\Config\LeadPageTemplate; | ||
|
||
use Scn\EvalancheSoapApiConnector\Hydrator\Config\HydratorConfigInterface; | ||
use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\TemplatesSources; | ||
use Scn\EvalancheSoapStruct\Struct\StructInterface; | ||
use Scn\HydratorPropertyValues\Property\StringValue; | ||
|
||
class LeadpageTemplateSourcesConfig implements HydratorConfigInterface | ||
{ | ||
public function getObject(): StructInterface | ||
{ | ||
return new TemplatesSources(); | ||
} | ||
|
||
public function getHydratorProperties(): array | ||
{ | ||
return [ | ||
'web' => StringValue::set('templateWeb'), | ||
'landingpage' => StringValue::set('templateLandingpage'), | ||
]; | ||
} | ||
|
||
public function getExtractorProperties(): array | ||
{ | ||
return [ | ||
'web' => StringValue::get('templateWeb'), | ||
'landingpage' => StringValue::get('templateLandingpage'), | ||
]; | ||
} | ||
} |
Oops, something went wrong.