|
8 | 8 | use Scn\EvalancheSoapApiConnector\Client\ClientInterface; |
9 | 9 | use Scn\EvalancheSoapApiConnector\Client\Generic\ResourceTrait; |
10 | 10 | use Scn\EvalancheSoapApiConnector\Exception\EmptyResultException; |
| 11 | +use Scn\EvalancheSoapStruct\Struct\Generic\HashMapInterface; |
11 | 12 | use Scn\EvalancheSoapStruct\Struct\Generic\ResourceInformationInterface; |
| 13 | +use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageSlotConfigurationInterface; |
| 14 | +use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageSlotInterface; |
| 15 | +use Scn\EvalancheSoapStruct\Struct\LeadPage\LeadpageSlotItemInterface; |
12 | 16 | use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\LeadpageTemplateConfiguration; |
13 | 17 | use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\LeadpageTemplateConfigurationInterface; |
14 | 18 | use Scn\EvalancheSoapStruct\Struct\LeadPageTemplate\TemplatesSourcesInterface; |
@@ -189,4 +193,130 @@ public function addArticles(int $id, array $articles): array |
189 | 193 | $this->hydratorConfigFactory->createLeadpageArticleConfig() |
190 | 194 | ); |
191 | 195 | } |
| 196 | + |
| 197 | + /** @inheritdoc */ |
| 198 | + public function removeSlot(int $id, int $slotId): bool |
| 199 | + { |
| 200 | + return $this->responseMapper->getBoolean( |
| 201 | + $this->soapClient->removeSlot([ |
| 202 | + 'leadpage_template_id' => $id, |
| 203 | + 'slot_id' => $slotId |
| 204 | + ]), |
| 205 | + 'removeSlotResult' |
| 206 | + ); |
| 207 | + } |
| 208 | + |
| 209 | + /** @inheritdoc */ |
| 210 | + public function removeTemplateFromSlot( |
| 211 | + int $id, |
| 212 | + int $slotId, |
| 213 | + int $templateType, |
| 214 | + int $articleTypeId = 0 |
| 215 | + ): bool { |
| 216 | + return $this->responseMapper->getBoolean( |
| 217 | + $this->soapClient->removeTemplateFromSlot([ |
| 218 | + 'leadpage_template_id' => $id, |
| 219 | + 'slot_id' => $slotId, |
| 220 | + 'template_type' => $templateType, |
| 221 | + 'article_type_id' => $articleTypeId |
| 222 | + ]), |
| 223 | + 'removeTemplateFromSlotResult' |
| 224 | + ); |
| 225 | + } |
| 226 | + |
| 227 | + /** @inheritdoc */ |
| 228 | + public function getSlotConfiguration(int $id): LeadpageSlotConfigurationInterface |
| 229 | + { |
| 230 | + return $this->responseMapper->getObject( |
| 231 | + $this->soapClient->getSlotConfiguration(['leadpage_template_id' => $id]), |
| 232 | + 'getSlotConfigurationResult', |
| 233 | + $this->hydratorConfigFactory->createLeadpageSlotConfigurationConfig() |
| 234 | + ); |
| 235 | + } |
| 236 | + |
| 237 | + /** @inheritdoc */ |
| 238 | + public function addSlot( |
| 239 | + int $id, |
| 240 | + int $slotNumber |
| 241 | + ): LeadpageSlotInterface { |
| 242 | + return $this->responseMapper->getObject( |
| 243 | + $this->soapClient->addSlot([ |
| 244 | + 'leadpage_template_id' => $id, |
| 245 | + 'slot_number' => $slotNumber, |
| 246 | + ]), |
| 247 | + 'addSlotResult', |
| 248 | + $this->hydratorConfigFactory->createLeadpageSlotConfig() |
| 249 | + ); |
| 250 | + } |
| 251 | + |
| 252 | + /** @inheritdoc */ |
| 253 | + public function updateSlot( |
| 254 | + int $id, |
| 255 | + int $slotId, |
| 256 | + int $slotNumber, |
| 257 | + string $name, |
| 258 | + int $sortTypeId, |
| 259 | + int $sortValue |
| 260 | + ): LeadpageSlotInterface { |
| 261 | + return $this->responseMapper->getObject( |
| 262 | + $this->soapClient->updateSlot([ |
| 263 | + 'leadpage_template_id' => $id, |
| 264 | + 'slot_id' => $slotId, |
| 265 | + 'slot_number' => $slotNumber, |
| 266 | + 'name' => $name, |
| 267 | + 'sort_type_id' => $sortTypeId, |
| 268 | + 'sort_value' => $sortValue |
| 269 | + ]), |
| 270 | + 'updateSlotResult', |
| 271 | + $this->hydratorConfigFactory->createLeadpageSlotConfig() |
| 272 | + ); |
| 273 | + } |
| 274 | + |
| 275 | + /** @inheritdoc */ |
| 276 | + public function addTemplatesToSlot( |
| 277 | + int $id, |
| 278 | + int $slotId, |
| 279 | + HashMapInterface $config, |
| 280 | + int $articleTypeId = 0, |
| 281 | + array $allowed_templates = [] |
| 282 | + ): LeadpageSlotItemInterface { |
| 283 | + return $this->responseMapper->getObject( |
| 284 | + $this->soapClient->addTemplatesToSlot([ |
| 285 | + 'leadpage_template_id' => $id, |
| 286 | + 'slot_id' => $slotId, |
| 287 | + 'data' => $config, |
| 288 | + 'article_type_id' => $articleTypeId, |
| 289 | + 'allowed_templates' => $this->extractor->extractArray( |
| 290 | + $this->hydratorConfigFactory->createLeadpageTemplateAllowedTemplatesConfig(), |
| 291 | + $allowed_templates |
| 292 | + ) |
| 293 | + ]), |
| 294 | + 'addTemplatesToSlotResult', |
| 295 | + $this->hydratorConfigFactory->createLeadpageSlotItemConfig() |
| 296 | + ); |
| 297 | + } |
| 298 | + |
| 299 | + /** @inheritdoc */ |
| 300 | + public function updateSlotTemplates( |
| 301 | + int $id, |
| 302 | + int $slotId, |
| 303 | + HashMapInterface $config, |
| 304 | + int $articleTypeId = 0, |
| 305 | + array $allowed_templates = [] |
| 306 | + ): LeadpageSlotItemInterface { |
| 307 | + return $this->responseMapper->getObject( |
| 308 | + $this->soapClient->updateSlotTemplates([ |
| 309 | + 'leadpage_template_id' => $id, |
| 310 | + 'slot_id' => $slotId, |
| 311 | + 'data' => $config, |
| 312 | + 'article_type_id' => $articleTypeId, |
| 313 | + 'allowed_templates' => $this->extractor->extractArray( |
| 314 | + $this->hydratorConfigFactory->createLeadpageTemplateAllowedTemplatesConfig(), |
| 315 | + $allowed_templates |
| 316 | + ) |
| 317 | + ]), |
| 318 | + 'updateSlotTemplatesResult', |
| 319 | + $this->hydratorConfigFactory->createLeadpageSlotItemConfig() |
| 320 | + ); |
| 321 | + } |
192 | 322 | } |
0 commit comments