Initial commit: CloudOps infrastructure platform
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration;
|
||||
|
||||
use Mautic\IntegrationsBundle\Integration\Interfaces\IntegrationInterface;
|
||||
use Mautic\PluginBundle\Entity\Integration;
|
||||
|
||||
abstract class BasicIntegration implements IntegrationInterface
|
||||
{
|
||||
use ConfigurationTrait;
|
||||
|
||||
public function getDisplayName(): string
|
||||
{
|
||||
return $this->getName();
|
||||
}
|
||||
|
||||
public function setIntegrationSettings(Integration $integration): void
|
||||
{
|
||||
$this->setIntegrationConfiguration($integration);
|
||||
}
|
||||
|
||||
public function getIntegrationSettings(): ?Integration
|
||||
{
|
||||
return $this->hasIntegrationConfiguration() ? $this->getIntegrationConfiguration() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSupportedFeatures(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getPriority(): int
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration;
|
||||
|
||||
use Mautic\IntegrationsBundle\DTO\Note;
|
||||
|
||||
trait ConfigFormNotesTrait
|
||||
{
|
||||
public function getAuthorizationNote(): ?Note
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFeaturesNote(): ?Note
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getFieldMappingNote(): ?Note
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration;
|
||||
|
||||
use Mautic\PluginBundle\Entity\Integration;
|
||||
|
||||
trait ConfigurationTrait
|
||||
{
|
||||
private ?Integration $integration = null;
|
||||
|
||||
public function getIntegrationConfiguration(): Integration
|
||||
{
|
||||
return $this->integration;
|
||||
}
|
||||
|
||||
public function setIntegrationConfiguration(Integration $integration): void
|
||||
{
|
||||
$this->integration = $integration;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Integration entity has been set to prevent PHP fatal error with using getIntegrationEntity.
|
||||
*/
|
||||
public function hasIntegrationConfiguration(): bool
|
||||
{
|
||||
return null !== $this->integration;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration;
|
||||
|
||||
trait DefaultConfigFormTrait
|
||||
{
|
||||
/**
|
||||
* Use the default.
|
||||
*/
|
||||
public function getConfigFormName(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the default.
|
||||
*/
|
||||
public function getConfigFormContentTemplate(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Use the default.
|
||||
*/
|
||||
public function getSyncConfigFormName(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
|
||||
interface AuthenticationInterface extends IntegrationInterface
|
||||
{
|
||||
/**
|
||||
* Returns true if the integration has already been authorized with the 3rd party service.
|
||||
*/
|
||||
public function isAuthenticated(): bool;
|
||||
|
||||
/**
|
||||
* This would be where one will use a client to store access tokens such as.
|
||||
*
|
||||
* @return string message to render if succeeded
|
||||
*/
|
||||
public function authenticateIntegration(Request $request): string;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
|
||||
interface BasicInterface extends UnifiedIntegrationInterface
|
||||
{
|
||||
/**
|
||||
* Return the integration's name.
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
public function getIcon(): string;
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
interface BuilderInterface extends IntegrationInterface
|
||||
{
|
||||
public function isSupported(string $featureName): bool;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
interface ConfigFormAuthInterface
|
||||
{
|
||||
/**
|
||||
* Return the name of the form type service for the authorization tab which should include all the fields required for the API to work.
|
||||
*/
|
||||
public function getAuthConfigFormName(): string;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
interface ConfigFormAuthorizeButtonInterface
|
||||
{
|
||||
public function isAuthorized(): bool;
|
||||
|
||||
public function getAuthorizationUrl(): string;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
interface ConfigFormCallbackInterface
|
||||
{
|
||||
/**
|
||||
* Message ID used in form as description what for is used callback URL.
|
||||
*/
|
||||
public function getCallbackHelpMessageTranslationKey(): string;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
interface ConfigFormFeatureSettingsInterface
|
||||
{
|
||||
/**
|
||||
* Return the name of the form type service for the feature settings.
|
||||
*/
|
||||
public function getFeatureSettingsConfigFormName(): string;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
interface ConfigFormFeaturesInterface
|
||||
{
|
||||
public const FEATURE_SYNC = 'sync';
|
||||
|
||||
public const FEATURE_PUSH_ACTIVITY = 'push_activity';
|
||||
|
||||
/**
|
||||
* Return an array of value => label pairs for the features this integration supports.
|
||||
*/
|
||||
public function getSupportedFeatures(): array;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
interface ConfigFormInterface extends IntegrationInterface
|
||||
{
|
||||
public function getDisplayName(): string;
|
||||
|
||||
/**
|
||||
* Return the name/class of the form type to override the default or just return NULL to use the default.
|
||||
*
|
||||
* @return string|null Name of the form type service
|
||||
*/
|
||||
public function getConfigFormName(): ?string;
|
||||
|
||||
/**
|
||||
* Return the template to use from the controller. Return null to use the default.
|
||||
*
|
||||
* @return string|null Name of the template like SomethingBundle:Config:form.html.twig
|
||||
*/
|
||||
public function getConfigFormContentTemplate(): ?string;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
use Mautic\IntegrationsBundle\DTO\Note;
|
||||
|
||||
interface ConfigFormNotesInterface
|
||||
{
|
||||
public function getAuthorizationNote(): ?Note;
|
||||
|
||||
public function getFeaturesNote(): ?Note;
|
||||
|
||||
public function getFieldMappingNote(): ?Note;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
use Mautic\IntegrationsBundle\Mapping\MappedFieldInfoInterface;
|
||||
|
||||
interface ConfigFormSyncInterface extends IntegrationInterface
|
||||
{
|
||||
/**
|
||||
* Return an array of Integration objects in the format of [$object => $translatableObjectNameString].
|
||||
* i.e. ['Customer' => 'mautic.something.object.customer', 'Account' => 'mautic.something.object.account'];.
|
||||
*/
|
||||
public function getSyncConfigObjects(): array;
|
||||
|
||||
/**
|
||||
* Return an array of Integration objects and what Mautic objects they are mapped to.
|
||||
* i.e. ['Customer' => Contact::NAME, 'Account' => Company::NAME];.
|
||||
*/
|
||||
public function getSyncMappedObjects(): array;
|
||||
|
||||
/**
|
||||
* Return an array of required fields.
|
||||
*
|
||||
* @return MappedFieldInfoInterface[]
|
||||
*/
|
||||
public function getRequiredFieldsForMapping(string $object): array;
|
||||
|
||||
/**
|
||||
* Return an array of optional fields.
|
||||
*
|
||||
* @return MappedFieldInfoInterface[]
|
||||
*/
|
||||
public function getOptionalFieldsForMapping(string $object): array;
|
||||
|
||||
/**
|
||||
* Return an array of all fields.
|
||||
*
|
||||
* @return MappedFieldInfoInterface[]
|
||||
*/
|
||||
public function getAllFieldsForMapping(string $object): array;
|
||||
|
||||
/**
|
||||
* Return a custom form field name to be included in the features array specific to sync.
|
||||
*/
|
||||
public function getSyncConfigFormName(): ?string;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
use Mautic\PluginBundle\Entity\Integration;
|
||||
use Mautic\PluginBundle\Integration\UnifiedIntegrationInterface;
|
||||
|
||||
interface IntegrationInterface extends UnifiedIntegrationInterface
|
||||
{
|
||||
/**
|
||||
* Return the integration's name.
|
||||
*/
|
||||
public function getName(): string;
|
||||
|
||||
public function getDisplayName(): string;
|
||||
|
||||
public function hasIntegrationConfiguration(): bool;
|
||||
|
||||
public function getIntegrationConfiguration(): Integration;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function setIntegrationConfiguration(Integration $integration);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Mautic\IntegrationsBundle\Integration\Interfaces;
|
||||
|
||||
use Mautic\IntegrationsBundle\Sync\DAO\Mapping\MappingManualDAO;
|
||||
use Mautic\IntegrationsBundle\Sync\SyncDataExchange\SyncDataExchangeInterface;
|
||||
|
||||
interface SyncInterface extends IntegrationInterface
|
||||
{
|
||||
public function getMappingManual(): MappingManualDAO;
|
||||
|
||||
public function getSyncDataExchange(): SyncDataExchangeInterface;
|
||||
}
|
||||
Reference in New Issue
Block a user