├── .gitignore
├── src
├── ExpertSender
│ ├── Enum
│ │ ├── TemplatesType.php
│ │ ├── ContentFromUrlFtpAuth.php
│ │ ├── DeliverySettingsThrottlingMethod.php
│ │ ├── RemovedSubscribersRemoveType.php
│ │ ├── SubscribersOption.php
│ │ └── SubscribersMode.php
│ ├── Request
│ │ ├── Post
│ │ │ ├── SnoozedSubscribers.php
│ │ │ ├── Lists.php
│ │ │ ├── ListExport.php
│ │ │ ├── ListImport.php
│ │ │ ├── Newsletters.php
│ │ │ ├── Subscribers.php
│ │ │ ├── SuppressionLists.php
│ │ │ ├── Triggers.php
│ │ │ └── Transactionals.php
│ │ ├── Get
│ │ │ ├── Segments.php
│ │ │ ├── Time.php
│ │ │ ├── Templates.php
│ │ │ ├── Lists.php
│ │ │ ├── MessageInfo.php
│ │ │ ├── ExportProgress.php
│ │ │ ├── ListImportProgress.php
│ │ │ ├── MessageList.php
│ │ │ ├── MessageStatistics.php
│ │ │ ├── RemovedSubscribers.php
│ │ │ ├── Subscribers.php
│ │ │ ├── Messages.php
│ │ │ └── SnoozedSubscribers.php
│ │ ├── Delete
│ │ │ ├── SuppressionLists.php
│ │ │ └── Subscribers.php
│ │ └── Put
│ │ │ ├── Lists.php
│ │ │ └── Newsletters.php
│ ├── Response
│ │ ├── SegmentTagType.php
│ │ ├── ListsType.php
│ │ ├── EventsType.php
│ │ ├── MessagesType.php
│ │ ├── SegmentsType.php
│ │ ├── TemplatesType.php
│ │ ├── ErrorMessageType.php
│ │ ├── SuppressionListType.php
│ │ ├── ExportProgressType.php
│ │ ├── GoogleAnalyticsTagType.php
│ │ ├── RemovedSubscribersType.php
│ │ ├── SnoozedSubscribersType.php
│ │ ├── TemplateType.php
│ │ ├── StateOnListType.php
│ │ ├── SnoozedSubscriberType.php
│ │ ├── RemovedSubscriberType.php
│ │ ├── SegmentType.php
│ │ ├── ListImportProgressType.php
│ │ ├── ListImportType.php
│ │ ├── ListType.php
│ │ ├── EventType.php
│ │ ├── MessageStatisticsType.php
│ │ ├── SubscriberType.php
│ │ ├── PropertyType.php
│ │ └── MessageType.php
│ ├── Entity
│ │ ├── ListImportSourceType.php
│ │ ├── UrlIntegrationType.php
│ │ ├── FieldType.php
│ │ ├── SegmentPropertyType.php
│ │ ├── ChannelType.php
│ │ ├── SubscriberMultidataType.php
│ │ ├── ListImportTargetType.php
│ │ ├── ListImportType.php
│ │ ├── ActionType.php
│ │ ├── TriggerType.php
│ │ ├── PropertyType.php
│ │ ├── SnippetType.php
│ │ ├── GoogleAnalyticsTagsType.php
│ │ ├── SubscriberMultiDataType.php
│ │ ├── ContentFromUrlType.php
│ │ ├── SnoozedSubscriberType.php
│ │ ├── NewsletterType.php
│ │ ├── DataType.php
│ │ ├── ListType.php
│ │ ├── AddressSettingsType.php
│ │ ├── ComfirmationEmailType.php
│ │ ├── DomainSettingsType.php
│ │ ├── SubscriberSettingsType.php
│ │ ├── TransactionalType.php
│ │ ├── RecipientsType.php
│ │ ├── AttachmentType.php
│ │ ├── ListSettingsType.php
│ │ ├── ListExportType.php
│ │ ├── DeliverySettingsType.php
│ │ ├── ReceiverType.php
│ │ ├── SubscriberType.php
│ │ ├── GeneralSettingsType.php
│ │ ├── ContentType.php
│ │ └── PropertyValueType.php
│ ├── Http.php
│ ├── Response.php
│ ├── Request.php
│ ├── Service.php
│ ├── Unbound.php
│ ├── XmlParser.php
│ └── BaseType.php
├── Http.php
└── Services
│ ├── AbstractService.php
│ ├── EmailService.php
│ └── SubscriberService.php
├── composer.json
├── README.md
├── examples
├── getOneMessage.php
├── getServerTime.php
├── getMessages.php
├── postSnoozedSubscriber.php
├── getTemplates.php
├── deleteSubscriber.php
├── getLists.php
├── getSegments.php
├── deleteFromSuppressionList.php
├── getSnoozedSubscribers.php
├── getSubscriber.php
├── getRemovedSubscribers.php
├── createNewList.php
├── getSubscriberEvents.php
└── addSubscriber.php
├── list.txt
└── LICENSE
/.gitignore:
--------------------------------------------------------------------------------
1 | /index.php
2 | /vendor*
3 | /.idea
4 |
5 |
--------------------------------------------------------------------------------
/src/ExpertSender/Enum/TemplatesType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'string',
16 | 'xmlName' => 'Tag',
17 | ),
18 | );
19 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ListImportSourceType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'string',
16 | 'xmlName' => 'Url',
17 | )
18 | );
19 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/Templates.php:
--------------------------------------------------------------------------------
1 | urlParams['type'] = $type;
16 | }
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/Lists.php:
--------------------------------------------------------------------------------
1 | urlParams['seedLists'] = $seedLists === true ? 'true' : 'false';
15 | }
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/UrlIntegrationType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'integer',
17 | 'xmlName' => 'Id'
18 | )
19 | );
20 |
21 | public function __construct($id)
22 | {
23 | $this->id = $id;
24 | }
25 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/ListsType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\ListType',
16 | 'xmlName' => 'Lists',
17 | 'unbound' => true,
18 | 'unboundTag' => 'List'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Delete/SuppressionLists.php:
--------------------------------------------------------------------------------
1 | endPoint .= '/' . $id;
18 |
19 | $this->urlParams['entry'] = $entry;
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/EventsType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\EventType',
16 | 'xmlName' => 'Events',
17 | 'unbound' => true,
18 | 'unboundTag' => 'Event'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/FieldType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'string',
18 | 'xmlName' => 'Field'
19 | ),
20 | );
21 |
22 | public function __construct($field)
23 | {
24 | $this->Field = $field;
25 | }
26 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Post/SuppressionLists.php:
--------------------------------------------------------------------------------
1 | endPoint .= '/' . $id;
19 | $this->urlParams['entry'] = $entry;
20 | }
21 |
22 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This plugin is used to be a client for API service of Expertsender email marketing platform.
2 |
3 | The most requests are based on XML syntax and used POST method of http protocol. To make the building of query easier this library introduces **Entities**
4 |
5 | Entities are mirrors for XML request or response. If you wish to make query to service, you must create an instance of an Entity with specified type (if API query supports).
6 |
7 | Every XML node - is an entity, excluding scalar values, such as strings, integers, or date.
8 |
9 | Use object oriented interface to build entity of the required type.
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Post/Triggers.php:
--------------------------------------------------------------------------------
1 | endPoint .= "/{$id}";
20 | parent::__construct($data);
21 | }
22 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/MessagesType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\MessageType',
16 | 'xmlName' => 'Messages',
17 | 'unbound' => true,
18 | 'unboundTag' => 'Message'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/SegmentsType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\SegmentType',
16 | 'xmlName' => 'Segments',
17 | 'unbound' => true,
18 | 'unboundTag' => 'Segment'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/SegmentPropertyType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'integer',
17 | 'xmlName' => 'Property'
18 | ),
19 | );
20 |
21 | public function __construct($property)
22 | {
23 | $this->Property = $property;
24 | }
25 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/MessageInfo.php:
--------------------------------------------------------------------------------
1 | endPoint = '/Api/Messages/' . $id;
20 | }
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/TemplatesType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\TemplateType',
16 | 'xmlName' => 'Templates',
17 | 'unbound' => true,
18 | 'unboundTag' => 'Template'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ChannelType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'string',
17 | 'xmlName' => 'Ip'
18 | ),
19 | 'percentage' => array(
20 | 'type' => 'integer',
21 | 'xmlName' => 'Percentage',
22 | )
23 | );
24 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Post/Transactionals.php:
--------------------------------------------------------------------------------
1 | endPoint .= "/{$id}";
20 | parent::__construct($data);
21 | }
22 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Enum/SubscribersMode.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'Zhmi\\ExpertSender\\Entity\\SubscriberType',
16 | 'xmlName' => 'Subscriber',
17 | 'unbound' => true,
18 | 'unboundTag' => 'MultiData'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/ErrorMessageType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'integer',
18 | 'xmlName' => 'Code'
19 | ),
20 | 'Message' => array(
21 | 'type' => 'string',
22 | 'xmlName' => 'Message',
23 | )
24 | );
25 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/SuppressionListType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'integer',
17 | 'xmlName' => 'Status',
18 | ),
19 | 'Name' => array(
20 | 'type' => 'string',
21 | 'xmlName' => 'Name',
22 | ),
23 |
24 | );
25 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Put/Lists.php:
--------------------------------------------------------------------------------
1 | endPoint .= "/{$id}";
21 |
22 | parent::__construct($data);
23 | }
24 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/ExportProgress.php:
--------------------------------------------------------------------------------
1 | endPoint .= "/{$exportId}";
21 | }
22 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ListImportTargetType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'string',
17 | 'xmlName' => 'Name',
18 | ),
19 | 'subscriberList' => array(
20 | 'type' => 'integer',
21 | 'xmlName' => 'SubscriberList',
22 | ),
23 | );
24 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/ExportProgressType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'string',
17 | 'xmlName' => 'Status',
18 | ),
19 | 'DownloadUrl' => array(
20 | 'type' => 'string',
21 | 'xmlName' => 'DownloadUrl',
22 | ),
23 | );
24 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/ListImportProgress.php:
--------------------------------------------------------------------------------
1 | endPoint .= "/{$importId}";
21 | }
22 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Put/Newsletters.php:
--------------------------------------------------------------------------------
1 | endPoint .= "/{$id}";
22 |
23 | parent::__construct($data);
24 | }
25 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/GoogleAnalyticsTagType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'string',
18 | 'xmlName' => 'Name'
19 | ),
20 | 'Value' => array(
21 | 'type' => 'string',
22 | 'xmlName' => 'Value',
23 | ),
24 | );
25 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/RemovedSubscribersType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\RemovedSubscriberType',
16 | 'xmlName' => 'RemovedSubscribers',
17 | 'unbound' => true,
18 | 'unboundTag' => 'RemovedSubscriber'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/SnoozedSubscribersType.php:
--------------------------------------------------------------------------------
1 | array(
15 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\SnoozedSubscriberType',
16 | 'xmlName' => 'SnoozedSubscribers',
17 | 'unbound' => true,
18 | 'unboundTag' => 'SnoozedSubscriber'
19 | ),
20 | );
21 | }
--------------------------------------------------------------------------------
/examples/getOneMessage.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Get\Messages(1);
13 | $response = $service->call($request);
14 | $e = $response->getEntity();
15 | /** @var ES\Response\MessageType $e */
16 | echo $e->Subject;
17 | }
18 | catch (ES\ServiceException $e)
19 | {
20 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
21 | echo $e->getCode() . " - " . $e->getMessage();
22 | }
23 | catch (\Exception $e)
24 | {
25 | var_dump($e);
26 | }
27 |
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ListImportType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\ListImportSourceType',
17 | 'xmlName' => 'Source',
18 | ),
19 | 'target' => array(
20 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\ListImportTargetType',
21 | 'xmlName' => 'Target',
22 | ),
23 | );
24 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ActionType.php:
--------------------------------------------------------------------------------
1 | array(
24 | 'type' => 'string',
25 | 'xmlName' => 'Action',
26 | ),
27 | );
28 |
29 | public function __construct($action)
30 | {
31 | $this->action = $action;
32 | }
33 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/TriggerType.php:
--------------------------------------------------------------------------------
1 | array(
21 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\ReceiverType',
22 | 'xmlName' => 'Receiver',
23 | 'unbound' => true,
24 | 'unboundTag' => 'Receivers'
25 | )
26 | );
27 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/TemplateType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'integer',
18 | 'xmlName' => 'Id',
19 | ),
20 | 'Type' => array(
21 | 'type' => 'string',
22 | 'xmlName' => 'Type',
23 | ),
24 | 'Name' => array(
25 | 'type' => 'string',
26 | 'xmlName' => 'Name',
27 | ),
28 | );
29 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/PropertyType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'integer',
18 | 'xmlName' => 'Id'
19 | ),
20 | 'value' => array(
21 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\PropertyValueType',
22 | ),
23 | );
24 |
25 | public function __construct($id, PropertyValueType $value)
26 | {
27 | $this->id = $id;
28 | $this->value = $value;
29 | }
30 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/SnippetType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'string',
18 | 'xmlName' => 'Name'
19 | ),
20 | 'value' => array(
21 | 'type' => 'string',
22 | 'xmlName' => 'Value',
23 | 'cdata' => true
24 | ),
25 | );
26 |
27 | public function __construct($name, $value)
28 | {
29 | $this->name = $name;
30 | $this->value = $value;
31 | }
32 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/StateOnListType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'integer',
18 | 'xmlName' => 'ListId',
19 | ),
20 | 'Status' => array(
21 | 'type' => 'string',
22 | 'xmlName' => 'Status',
23 | ),
24 | 'Name' => array(
25 | 'type' => 'string',
26 | 'xmlName' => 'Name',
27 | ),
28 |
29 | );
30 | }
--------------------------------------------------------------------------------
/examples/getServerTime.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
10 |
11 | try
12 | {
13 | //Initialize request
14 | $request = new ES\Request\Get\Time;
15 |
16 | //Making a request call
17 | $response = $service->call($request);
18 | $entity = $response->getEntity();
19 |
20 | /** @var DateTime $entity */
21 | echo $entity->format('d.m.Y H:i:s');
22 | }
23 | catch (ES\ServiceException $e)
24 | {
25 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
26 | echo $e->getCode() . " - " . $e->getMessage();
27 | }
28 | catch (\Exception $e)
29 | {
30 | var_dump($e);
31 | }
--------------------------------------------------------------------------------
/examples/getMessages.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Get\Messages();
13 | $response = $service->call($request);
14 | $e = $response->getEntity();
15 | foreach ($e->Messages as $message)
16 | {
17 | /** @var ES\Response\MessageType $e */
18 | echo $message->Subject . '
';
19 | }
20 | }
21 | catch (ES\ServiceException $e)
22 | {
23 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
24 | echo $e->getCode() . " - " . $e->getMessage();
25 | }
26 | catch (\Exception $e)
27 | {
28 | var_dump($e);
29 | }
30 |
--------------------------------------------------------------------------------
/examples/postSnoozedSubscriber.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $entity = new ES\Entity\SnoozedSubscriberType();
13 | $entity->email = 'user.email@email.com';
14 | $entity->snoozeWeeks = 1;
15 |
16 | $request = new ES\Request\Post\SnoozedSubscribers( $entity );
17 | $response = $service->call($request);
18 | var_dump($response);
19 | }
20 | catch (ES\ServiceException $e)
21 | {
22 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
23 | echo $e->getCode() . " - " . $e->getMessage();
24 | }
25 | catch (\Exception $e)
26 | {
27 | var_dump($e);
28 | }
29 |
--------------------------------------------------------------------------------
/examples/getTemplates.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Get\Templates();
13 | $response = $service->call($request);
14 | $e = $response->getEntity();
15 | foreach ($e->Templates as $template)
16 | {
17 | /** @var ES\Response\TemplateType $template */
18 | echo $template->Name . '
';
19 | }
20 | }
21 | catch (ES\ServiceException $e)
22 | {
23 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
24 | echo $e->getCode() . " - " . $e->getMessage();
25 | }
26 | catch (\Exception $e)
27 | {
28 | var_dump($e);
29 | }
30 |
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/GoogleAnalyticsTagsType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'string',
18 | 'xmlName' => 'Campaign'
19 | ),
20 | 'source' => array(
21 | 'type' => 'string',
22 | 'xmlName' => 'Source',
23 | ),
24 | 'content' => array(
25 | 'type' => 'string',
26 | 'xmlName' => 'Content',
27 | )
28 | );
29 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/SubscriberMultiDataType.php:
--------------------------------------------------------------------------------
1 | array(
24 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\SubscriberType',
25 | 'xmlName' => 'Subscriber',
26 | 'unbound' => true,
27 | 'unboundTag' => 'MultiData'
28 | ),
29 | );
30 | }
--------------------------------------------------------------------------------
/examples/deleteSubscriber.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Delete\Subscribers(11234);
13 |
14 | //Making a request call
15 | $response = $service->call( $request );
16 | if ($response->isOk())
17 | {
18 | echo 'success';
19 | }
20 | else
21 | {
22 | echo $response->getCode();
23 | }
24 |
25 | }
26 | catch (ES\ServiceException $e)
27 | {
28 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
29 | echo $e->getCode() . " - " . $e->getMessage();
30 | }
31 | catch (\Exception $e)
32 | {
33 | var_dump($e);
34 | }
35 |
--------------------------------------------------------------------------------
/src/ExpertSender/Response/SnoozedSubscriberType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'string',
18 | 'xmlName' => 'Email',
19 | ),
20 | 'ListId' => array(
21 | 'type' => 'integer',
22 | 'xmlName' => 'ListId',
23 | ),
24 | 'SnoozedUntil' => array(
25 | 'type' => 'DateTime',
26 | 'xmlName' => 'SnoozedUntil'
27 | ),
28 | );
29 | }
--------------------------------------------------------------------------------
/examples/getLists.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Get\Lists();
13 | $response = $service->call($request);
14 | $e = $response->getEntity();
15 | /** @var ES\Response\ListsType $e */
16 | foreach ($e->Lists as $list)
17 | {
18 | /** @var ES\Response\ListType $segment */
19 | echo $list->Name .'
';
20 | }
21 | }
22 | catch (ES\ServiceException $e)
23 | {
24 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
25 | echo $e->getCode() . " - " . $e->getMessage();
26 | }
27 | catch (\Exception $e)
28 | {
29 | var_dump($e);
30 | }
31 |
--------------------------------------------------------------------------------
/src/ExpertSender/Response/RemovedSubscriberType.php:
--------------------------------------------------------------------------------
1 | array(
17 | 'type' => 'string',
18 | 'xmlName' => 'Email',
19 | ),
20 | 'ListId' => array(
21 | 'type' => 'integer',
22 | 'xmlName' => 'ListId',
23 | ),
24 | 'UnsubscribedOn' => array(
25 | 'type' => 'DateTime',
26 | 'xmlName' => 'UnsubscribedOn'
27 | ),
28 | );
29 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/SegmentType.php:
--------------------------------------------------------------------------------
1 | array(
16 | 'type' => 'integer',
17 | 'xmlName' => 'Id',
18 | ),
19 | 'Name' => array(
20 | 'type' => 'string',
21 | 'xmlName' => 'Name',
22 | ),
23 | 'Tags' => array(
24 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\SegmentTagType',
25 | 'xmlName' => 'Tags',
26 | 'unbound' => true,
27 | 'unboundTag' => 'Tag'
28 | ),
29 | );
30 | }
--------------------------------------------------------------------------------
/examples/getSegments.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Get\Segments();
13 | $response = $service->call($request);
14 | $e = $response->getEntity();
15 | /** @var ES\Response\SegmentsType $e */
16 | foreach ($e->Segments as $segment)
17 | {
18 | /** @var ES\Response\SegmentType $segment */
19 | echo $segment->Name .'
';
20 | }
21 | }
22 | catch (ES\ServiceException $e)
23 | {
24 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
25 | echo $e->getCode() . " - " . $e->getMessage();
26 | }
27 | catch (\Exception $e)
28 | {
29 | var_dump($e);
30 | }
31 |
--------------------------------------------------------------------------------
/list.txt:
--------------------------------------------------------------------------------
1 | GET Time +
2 | GET Subscribers +
3 | POST Subscribers +
4 | DELETE Subscribers +
5 | GET Messages +
6 | GET MessageStatistics -
7 | GET LinkStatistics -
8 | GET VendorStatistics -
9 | POST Triggers +
10 | POST Transactionals +
11 | POST SuppressionLists +
12 | DELETE SuppressionLists +
13 | GET Activities - csv
14 | GET Lists +
15 | POST Lists +
16 | GET Segments +
17 | GET ImportToListTasks -
18 | POST ImportToListTasks -
19 | POST Newsletters +
20 | GET RemovedSubscribers +
21 | GET Bounces - csv
22 | POST Goals - ??
23 | GET Exports -
24 | POST Exports -
25 | GET DataTablesGetTables -
26 | POST DataTablesGetData -
27 | POST DataTablesGetDataCount -
28 | POST DataTablesAddRow -
29 | POST DataTablesUpdateRow -
30 | POST DataTablesDeleteRow -
--------------------------------------------------------------------------------
/examples/deleteFromSuppressionList.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Delete\SuppressionLists(12, 'user.email@email.com');
13 |
14 | //Making a request call
15 | $response = $service->call( $request );
16 | if ($response->isOk())
17 | {
18 | echo 'success';
19 | }
20 | else
21 | {
22 | echo $response->getCode();
23 | }
24 |
25 | }
26 | catch (ES\ServiceException $e)
27 | {
28 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
29 | echo $e->getCode() . " - " . $e->getMessage();
30 | }
31 | catch (\Exception $e)
32 | {
33 | var_dump($e);
34 | }
35 |
--------------------------------------------------------------------------------
/examples/getSnoozedSubscribers.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Get\SnoozedSubscribers(array(13));
13 | $response = $service->call($request);
14 | $e = $response->getEntity();
15 | foreach ($e->SnoozedSubscribers as $snoozedSubscriber)
16 | {
17 | /** @var ES\Response\SnoozedSubscriberType $snoozedSubscriber */
18 | echo $snoozedSubscriber->Email . '
';
19 | }
20 | }
21 | catch (ES\ServiceException $e)
22 | {
23 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
24 | echo $e->getCode() . " - " . $e->getMessage();
25 | }
26 | catch (\Exception $e)
27 | {
28 | var_dump($e);
29 | }
30 |
--------------------------------------------------------------------------------
/examples/getSubscriber.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | //Initialize request
13 | $request = new ES\Request\Get\Subscribers('harry@potter.com', ES\Enum\SubscribersOption::FULL);
14 |
15 | //Making a request call
16 | $response = $service->call($request);
17 | $entity = $response->getEntity();
18 |
19 | /** @var ES\Response\SubscriberType $entity */
20 | echo "{$entity->Lastname} {$entity->Ip}";
21 |
22 | }
23 | catch (ES\ServiceException $e)
24 | {
25 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
26 | echo $e->getCode() . " - " . $e->getMessage();
27 | }
28 | catch (\Exception $e)
29 | {
30 | var_dump($e);
31 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Delete/Subscribers.php:
--------------------------------------------------------------------------------
1 | endPoint .= '/' . (int)$identifier;
16 | }
17 | elseif (filter_var($identifier, FILTER_VALIDATE_EMAIL))
18 | {
19 | $this->urlParams['email'] = $identifier;
20 | }
21 | else
22 | {
23 | throw new \InvalidArgumentException('Identifier must be a valid email or integer');
24 | }
25 |
26 | if ($listId !== null)
27 | {
28 | $this->urlParams['listId'] = $listId;
29 | }
30 | }
31 |
32 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/MessageList.php:
--------------------------------------------------------------------------------
1 | urlParams['type'] = $type;
16 | }
17 |
18 | if ($tag) {
19 | $this->urlParams['tag'] = $tag;
20 | }
21 |
22 | if (!is_null($startDate)) {
23 | $this->urlParams['startDate'] = $startDate->format('Y-m-d');
24 | }
25 |
26 | if (!is_null($endDate)) {
27 | $this->urlParams['endDate'] = $startDate->format('Y-m-d');
28 | }
29 | }
30 | }
--------------------------------------------------------------------------------
/examples/getRemovedSubscribers.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $request = new ES\Request\Get\RemovedSubscribers(array(13), array(ES\Enum\RemovedSubscribersRemoveType::UI));
13 | $response = $service->call($request);
14 | $e = $response->getEntity();
15 | foreach ($e->RemovedSubscribers as $removedSubscriber)
16 | {
17 | /** @var ES\Response\RemovedSubscriberType $removedSubscriber */
18 | echo $removedSubscriber->Email . '
';
19 | }
20 | }
21 | catch (ES\ServiceException $e)
22 | {
23 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
24 | echo $e->getCode() . " - " . $e->getMessage();
25 | }
26 | catch (\Exception $e)
27 | {
28 | var_dump($e);
29 | }
30 |
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ContentFromUrlType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'string',
19 | 'xmlName' => 'Url'
20 | ),
21 | 'username' => array(
22 | 'type' => 'string',
23 | 'xmlName' => 'Username',
24 | ),
25 | 'password' => array(
26 | 'type' => 'string',
27 | 'xmlName' => 'Password',
28 | ),
29 | 'ftpAuth' => array(
30 | 'type' => 'string',
31 | 'xmlName' => 'FtpAuth',
32 | )
33 | );
34 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/SnoozedSubscriberType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'integer',
19 | 'xmlName' => 'Id',
20 | ),
21 | 'email' => array(
22 | 'type' => 'string',
23 | 'xmlName' => 'Email'
24 | ),
25 | 'listId' => array(
26 | 'type' => 'integer',
27 | 'xmlName' => 'ListId',
28 | ),
29 | 'snoozeWeeks' => array(
30 | 'type' => 'integer',
31 | 'xmlName' => 'SnoozeWeeks',
32 | ),
33 | );
34 | }
--------------------------------------------------------------------------------
/examples/createNewList.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | $setting = new ES\Entity\ListSettingsType();
13 | $g = new ES\Entity\GeneralSettingsType();
14 | $g->name = 'API Created';
15 | $g->defaultFromName = 'Johnny';
16 | $g->defaultFromEmail = 'user.email@email.com';
17 | $setting->generalSettings = $g;
18 |
19 | $request = new ES\Request\Post\Lists( $setting );
20 |
21 | $response = $service->call($request);
22 | echo 'Идентификатор нового листа - ' . $response->getEntity();
23 | }
24 | catch (ES\ServiceException $e)
25 | {
26 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
27 | echo $e->getCode() . " - " . $e->getMessage();
28 | }
29 | catch (\Exception $e)
30 | {
31 | var_dump($e);
32 | }
33 |
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/MessageStatistics.php:
--------------------------------------------------------------------------------
1 | endPoint = '/Api/MessageStatistics/' . $id;
20 |
21 | if (!is_null($startDate)) {
22 | $this->urlParams['startDate'] = $startDate->format('Y-m-d');
23 | }
24 |
25 | if (!is_null($endDate)) {
26 | $this->urlParams['endDate'] = $startDate->format('Y-m-d');
27 | }
28 | }
29 |
30 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/NewsletterType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\RecipientsType',
19 | 'xmlName' => 'Recipients',
20 | ),
21 | 'content' => array(
22 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\ContentType',
23 | 'xmlName' => 'Content',
24 | ),
25 | 'deliverySettings' => array(
26 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\DeliverySettingsType',
27 | 'xmlName' => 'DeliverySettings',
28 | )
29 | );
30 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/DataType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'App\\Extensions\\ExpertSender\\BaseType',
19 | 'xmlName' => 'Data',
20 | ),
21 | 'type' => array(
22 | 'type' => 'string',
23 | 'attribute' => true,
24 | 'attributeName' => 'xsi:type'
25 | )
26 | );
27 |
28 | /**
29 | * @deprecated
30 | */
31 | public function __construct(BaseType $entity)
32 | {
33 | $this->data = $entity;
34 |
35 | $xsi = $entity->getXsiType();
36 | if ($xsi !== null)
37 | {
38 | $this->type = $xsi;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/examples/getSubscriberEvents.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
10 |
11 | try
12 | {
13 | //Initialize request
14 | $request = new ES\Request\Get\Subscribers('harry@potter.com', ES\Enum\SubscribersOption::EVENTS_HISTORY);
15 |
16 | //Making a request call
17 | $response = $service->call($request);
18 | $entity = $response->getEntity();
19 |
20 | foreach ($entity->Events as $event)
21 | {
22 | /** @var ES\Response\EventType $event */
23 | echo $event->StartDate->format('d.m.Y H:i:s') . ' - ' . $event->MessageSubject . '
';
24 | }
25 | }
26 | catch (ES\ServiceException $e)
27 | {
28 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
29 | echo $e->getCode() . " - " . $e->getMessage();
30 | }
31 | catch (\Exception $e)
32 | {
33 | var_dump($e);
34 | }
35 |
--------------------------------------------------------------------------------
/src/ExpertSender/Response/ListImportProgressType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'string',
19 | 'xmlName' => 'Name',
20 | ),
21 | 'List' => array(
22 | 'type' => 'string',
23 | 'xmlName' => 'List',
24 | ),
25 | 'Url' => array(
26 | 'type' => 'string',
27 | 'xmlName' => 'Url',
28 | ),
29 | 'History' => array(
30 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\ListImportType',
31 | 'xmlName' => 'History',
32 | 'unbound' => true,
33 | 'unboundTag' => 'Import'
34 | ),
35 | );
36 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/ListImportType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'string',
19 | 'xmlName' => 'StartedAt',
20 | ),
21 | 'UpdatedAt' => array(
22 | 'type' => 'string',
23 | 'xmlName' => 'UpdatedAt',
24 | ),
25 | 'Status' => array(
26 | 'type' => 'string',
27 | 'xmlName' => 'Status',
28 | ),
29 | 'Details' => array(
30 | 'type' => 'string',
31 | 'xmlName' => 'Details',
32 | ),
33 | );
34 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ListType.php:
--------------------------------------------------------------------------------
1 | array(
20 | 'type' => 'integer',
21 | 'xmlName' => 'Id',
22 | ),
23 | 'name' => array(
24 | 'type' => 'string',
25 | 'xmlName' => 'Name',
26 | ),
27 | 'friendlyName' => array(
28 | 'type' => 'string',
29 | 'xmlName' => 'FriendlyName',
30 | ),
31 | 'language' => array(
32 | 'type' => 'string',
33 | 'xmlName' => 'Language',
34 | ),
35 | 'optInMode' => array(
36 | 'type' => 'string',
37 | 'xmlName' => 'OptInMode',
38 | ),
39 | );
40 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/ListType.php:
--------------------------------------------------------------------------------
1 | array(
19 | 'type' => 'integer',
20 | 'xmlName' => 'Id',
21 | ),
22 | 'Name' => array(
23 | 'type' => 'string',
24 | 'xmlName' => 'Name',
25 | ),
26 | 'FriendlyName' => array(
27 | 'type' => 'string',
28 | 'xmlName' => 'FriendlyName',
29 | ),
30 | 'Language' => array(
31 | 'type' => 'string',
32 | 'xmlName' => 'Language',
33 | ),
34 | 'OptInMode' => array(
35 | 'type' => 'string',
36 | 'xmlName' => 'OptInMode',
37 | ),
38 | );
39 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/RemovedSubscribers.php:
--------------------------------------------------------------------------------
1 | urlParams['ListIds'] = implode(',', $listIds);
17 | }
18 |
19 | if (!empty($removeTypes))
20 | {
21 | $this->urlParams['removeTypes'] = implode(',', $removeTypes);
22 | }
23 |
24 | if (!is_null($startDate))
25 | {
26 | $this->urlParams['startDate'] = $startDate->format('Y-m-d');
27 | }
28 |
29 | if (!is_null($endDate))
30 | {
31 | $this->urlParams['endDate'] = $startDate->format('Y-m-d');
32 | }
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/AddressSettingsType.php:
--------------------------------------------------------------------------------
1 | array(
20 | 'type' => 'string',
21 | 'xmlName' => 'Company',
22 | ),
23 | 'city' => array(
24 | 'type' => 'string',
25 | 'xmlName' => 'City',
26 | ),
27 | 'zipPostalCode' => array(
28 | 'type' => 'string',
29 | 'xmlName' => 'ZipPostalCode',
30 | ),
31 | 'address' => array(
32 | 'type' => 'string',
33 | 'xmlName' => 'Address',
34 | ),
35 | 'address2' => array(
36 | 'type' => 'string',
37 | 'xmlName' => 'Address2',
38 | ),
39 | );
40 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ComfirmationEmailType.php:
--------------------------------------------------------------------------------
1 | array(
20 | 'type' => 'string',
21 | 'xmlName' => 'FromName',
22 | ),
23 | 'fromEmail' => array(
24 | 'type' => 'string',
25 | 'xmlName' => 'FromEmail',
26 | ),
27 | 'subject' => array(
28 | 'type' => 'string',
29 | 'xmlName' => 'Subject',
30 | ),
31 | 'html' => array(
32 | 'type' => 'string',
33 | 'xmlName' => 'Html',
34 | 'cdata' => true,
35 | ),
36 | 'plain' => array(
37 | 'type' => 'string',
38 | 'xmlName' => 'Plain',
39 | ),
40 | );
41 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Mikhail Zhurov
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
23 |
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/DomainSettingsType.php:
--------------------------------------------------------------------------------
1 | array(
20 | 'type' => 'string',
21 | 'xmlName' => 'ClickTrackingDomain',
22 | ),
23 | 'address' => array(
24 | 'type' => 'string',
25 | 'xmlName' => 'Address',
26 | ),
27 | 'address2' => array(
28 | 'type' => 'string',
29 | 'xmlName' => 'Address2',
30 | ),
31 | 'city' => array(
32 | 'type' => 'string',
33 | 'xmlName' => 'City',
34 | ),
35 | 'zipPostalCode' => array(
36 | 'type' => 'string',
37 | 'xmlName' => 'ZipPostalCode',
38 | ),
39 | );
40 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/SubscriberSettingsType.php:
--------------------------------------------------------------------------------
1 | array(
19 | 'type' => 'integer',
20 | 'xmlName' => 'FrequencyCappingTime',
21 | ),
22 | 'disableStandardMessageFooter' => array(
23 | 'type' => 'boolean',
24 | 'xmlName' => 'DisableStandardMessageFooter',
25 | ),
26 | 'disableListUnsubscribeHeader' => array(
27 | 'type' => 'boolean',
28 | 'xmlName' => 'DisableListUnsubscribeHeader',
29 | ),
30 | 'askBeforeUnsubscribing' => array(
31 | 'type' => 'boolean',
32 | 'xmlName' => 'AskBeforeUnsubscribing',
33 | ),
34 | );
35 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/TransactionalType.php:
--------------------------------------------------------------------------------
1 | array(
21 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\ReceiverType',
22 | 'xmlName' => 'Receiver',
23 | ),
24 | 'snippets' => array(
25 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\SnippetType',
26 | 'xmlName' => 'Snippet',
27 | 'unbound' => true,
28 | 'unboundTag' => 'Snippets'
29 | ),
30 | 'attachments' => array(
31 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\AttachmentType',
32 | 'xmlName' => 'Attachment',
33 | 'unbound' => true,
34 | 'unboundTag' => 'Attachments'
35 | )
36 | );
37 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/Subscribers.php:
--------------------------------------------------------------------------------
1 | urlParams['email'] = $email;
29 | $this->urlParams['option'] = $option !== null ? $option : SubscribersOption::FULL;
30 |
31 | if ($this->urlParams['option'] == SubscribersOption::EVENTS_HISTORY)
32 | {
33 | $this->responseEntity = 'App\\Extensions\\ExpertSender\\Response\\EventsType';
34 | }
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/Messages.php:
--------------------------------------------------------------------------------
1 | endPoint = '/Api/Messages/' . $id;
20 | $this->responseEntity = 'Zhmi\\ExpertSender\\Response\\MessageType';
21 | }
22 | else
23 | {
24 | if ($tag !== null)
25 | {
26 | $this->urlParams['tag'] = $tag;
27 | }
28 |
29 | if (!is_null($startDate))
30 | {
31 | $this->urlParams['startDate'] = $startDate->format('Y-m-d');
32 | }
33 |
34 | if (!is_null($endDate))
35 | {
36 | $this->urlParams['endDate'] = $startDate->format('Y-m-d');
37 | }
38 | }
39 |
40 | }
41 |
42 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/RecipientsType.php:
--------------------------------------------------------------------------------
1 | array(
19 | 'type' => 'integer',
20 | 'xmlName' => 'SubscriberList',
21 | 'unbound' => true,
22 | 'unboundTag' => 'SubscriberLists'
23 | ),
24 | 'subscriberSegments' => array(
25 | 'type' => 'integer',
26 | 'xmlName' => 'SubscriberSegment',
27 | 'unbound' => true,
28 | 'unboundTag' => 'SubscriberSegments'
29 | ),
30 | 'seedLists' => array(
31 | 'type' => 'integer',
32 | 'xmlName' => 'SeedList',
33 | 'unbound' => true,
34 | 'unboundTag' => 'SeedLists'
35 | ),
36 | 'supressionLists' => array(
37 | 'type' => 'integer',
38 | 'xmlName' => 'SuppressionList',
39 | 'unbound' => true,
40 | 'unboundTag' => 'SuppressionLists'
41 | )
42 | );
43 | }
--------------------------------------------------------------------------------
/src/Http.php:
--------------------------------------------------------------------------------
1 | $method,
19 | 'header' => '',
20 | 'timeout' => $timeout,
21 | 'ignore_errors' => true
22 | );
23 |
24 | if ($content && $method === 'POST') {
25 | $http['content'] = $content;
26 | $http['header'] = "Content-Type: application/xml;charset=UTF-8\r\n";
27 | }
28 |
29 | $context = stream_context_create(array('http' => $http));
30 |
31 | $start_microtime = microtime(true);
32 |
33 | $body = @file_get_contents($url, false, $context);
34 |
35 | $used_microtime = microtime(true) - $start_microtime;
36 |
37 | if ($body === false) {
38 | throw new \Exception("Request ExpertSender Failure, used_microtime={$used_microtime}", self::CONNECTION_ERROR);
39 | }
40 |
41 | // http_response_header is php autoregister var
42 | return [
43 | 'body' => $body,
44 | 'headers' => $http_response_header,
45 | 'used_microtime' => $used_microtime
46 | ];
47 | }
48 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/AttachmentType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'string',
19 | 'xmlName' => 'FileName'
20 | ),
21 | 'mimeType' => array(
22 | 'type' => 'string',
23 | 'xmlName' => 'MimeType',
24 | ),
25 | 'content' => array(
26 | 'type' => 'string',
27 | 'xmlName' => 'Content',
28 | ),
29 | );
30 |
31 | public function __construct($file)
32 | {
33 | $this->makeFromFile($file);
34 | }
35 |
36 | private function checkFileExists($file)
37 | {
38 | if (!file_exists($file))
39 | {
40 | throw new \InvalidArgumentException('Bad path to file');
41 | }
42 | }
43 |
44 | public function makeFromFile($file)
45 | {
46 | $this->checkFileExists($file);
47 |
48 | $this->filename = basename($file);
49 | $finfo = finfo_open(FILEINFO_MIME_TYPE);
50 | $this->mimeType = finfo_file($finfo, $this->filename);
51 | $this->content = base64_encode($file);
52 | }
53 |
54 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/EventType.php:
--------------------------------------------------------------------------------
1 | array(
21 | 'type' => 'DateTime',
22 | 'xmlName' => 'StartDate',
23 | ),
24 | 'EndDate' => array(
25 | 'type' => 'DateTime',
26 | 'xmlName' => 'EndDate',
27 | ),
28 | 'MessageType' => array(
29 | 'type' => 'string',
30 | 'xmlName' => 'MessageType'
31 | ),
32 | 'EventType' => array(
33 | 'type' => 'string',
34 | 'xmlName' => 'EventType',
35 | ),
36 | 'EventCount' => array(
37 | 'type' => 'integer',
38 | 'xmlName' => 'EventCount',
39 | ),
40 | 'MessageSubject' => array(
41 | 'type' => 'string',
42 | 'xmlName' => 'MessageSubject',
43 | ),
44 | 'MessageId' => array(
45 | 'type' => 'integer',
46 | 'xmlName' => 'MessageId',
47 | ),
48 | );
49 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request/Get/SnoozedSubscribers.php:
--------------------------------------------------------------------------------
1 | urlParams['ListIds'] = implode(',', $listIds);
27 | }
28 |
29 | if (!is_null($startDate))
30 | {
31 | $this->urlParams['startDate'] = $startDate->format('Y-m-d');
32 | }
33 |
34 | if (!is_null($endDate))
35 | {
36 | $this->urlParams['endDate'] = $startDate->format('Y-m-d');
37 | }
38 | }
39 |
40 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ListSettingsType.php:
--------------------------------------------------------------------------------
1 | array(
20 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\GeneralSettingsType',
21 | 'xmlName' => 'GeneralSettings',
22 | ),
23 | 'addressSettings' => array(
24 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\AddressSettingsType',
25 | 'xmlName' => 'AddressSettings',
26 | ),
27 | 'subscriberSettings' => array(
28 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\SubscriberSettingsType',
29 | 'xmlName' => 'SubscriberSettings',
30 | ),
31 | 'domainSettings' => array(
32 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\DomainSettingsType',
33 | 'xmlName' => 'DomainSettings',
34 | ),
35 | 'confirmationEmail' => array(
36 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\ConfirmationEmailType',
37 | 'xmlName' => 'ConfirmationEmail',
38 | ),
39 | );
40 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ListExportType.php:
--------------------------------------------------------------------------------
1 | array(
19 | 'type' => 'string',
20 | 'xmlName' => 'Type',
21 | ),
22 | 'listId' => array(
23 | 'type' => 'integer',
24 | 'xmlName' => 'ListId',
25 | ),
26 | 'segmentId' => array(
27 | 'type' => 'integer',
28 | 'xmlName' => 'SegmentId',
29 | ),
30 | 'fields' => array(
31 | 'type' => 'string',
32 | 'xmlName' => 'Field',
33 | 'unbound' => true,
34 | 'unboundTag' => 'Fields'
35 | ),
36 | 'properties' => array(
37 | 'type' => 'integer',
38 | 'xmlName' => 'Property',
39 | 'unbound' => true,
40 | 'unboundTag' => 'Properties'
41 | ),
42 | );
43 |
44 | /**
45 | * @deprecated
46 | */
47 | public function __construct($type='', $listId=0, $segmentId=0, array $fields=[], array $properties=[])
48 | {
49 | $this->type = $type;
50 | $this->listId = $listId;
51 | $this->segmentId = $segmentId;
52 | $this->fields = $fields;
53 | if (count($properties) > 0) {
54 | $this->properties = $properties;
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/DeliverySettingsType.php:
--------------------------------------------------------------------------------
1 | array(
21 | 'type' => 'DateTime',
22 | 'xmlName' => 'DeliveryDate'
23 | ),
24 | 'timeZone' => array(
25 | 'type' => 'string',
26 | 'xmlName' => 'TimeZone',
27 | ),
28 | 'overrideDeliveryCap' => array(
29 | 'type' => 'boolean',
30 | 'xmlName' => 'OverrideDeliveryCap',
31 | ),
32 | 'throttlingMethod' => array(
33 | 'type' => 'string',
34 | 'xmlName' => 'ThrottlingMethod',
35 | ),
36 | 'manualThrottlingTime' => array(
37 | 'type' => 'integer',
38 | 'xmlName' => 'ManualThrottlingTime',
39 | ),
40 | 'timeOptimizationPeriod' => array(
41 | 'type' => 'string',
42 | 'xmlName' => 'TimeOptimizationPeriod',
43 | ),
44 | 'channels' => array(
45 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\ChannelType',
46 | 'xmlName' => 'Channel',
47 | 'unbound' => true,
48 | 'unboundTag' => 'Channels'
49 | ),
50 | );
51 | }
--------------------------------------------------------------------------------
/src/Services/AbstractService.php:
--------------------------------------------------------------------------------
1 | service = new ExpertSender\Service($apiKey, $apiUri);
32 | }
33 |
34 | /**
35 | * @author huangnie
36 | * @email 980484578@qq.com
37 | * @date 2019-08-20
38 | * @return string
39 | */
40 | public function getUri()
41 | {
42 | return $this->service->getUri();
43 | }
44 |
45 | /**
46 | * @author huangnie
47 | * @email 980484578@qq.com
48 | * @date 2019-08-20
49 | * @param string $uri
50 | */
51 | public function setUri($uri)
52 | {
53 | $this->service->setUri($uri);
54 | }
55 |
56 | /**
57 | * @author huangnie
58 | * @email 980484578@qq.com
59 | * @date 2019-08-20
60 | * @return string
61 | */
62 | public function getKey()
63 | {
64 | return $this->service->getKey();
65 | }
66 |
67 | /**
68 | * @author huangnie
69 | * @email 980484578@qq.com
70 | * @date 2019-08-20
71 | * @param string $key
72 | */
73 | public function setKey($key)
74 | {
75 | $this->service->setKey($key);
76 | }
77 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/ReceiverType.php:
--------------------------------------------------------------------------------
1 | array(
18 | 'type' => 'integer',
19 | 'xmlName' => 'Id'
20 | ),
21 | 'email' => array(
22 | 'type' => 'string',
23 | 'xmlName' => 'Email',
24 | ),
25 | 'listId' => array(
26 | 'type' => 'integer',
27 | 'xmlName' => 'ListId'
28 | )
29 | );
30 |
31 | public function __construct($id = null, $email = null, $listId = null)
32 | {
33 | if ($email !== null && !filter_var($email, FILTER_VALIDATE_EMAIL))
34 | {
35 | throw new \InvalidArgumentException('Invalid email');
36 | }
37 |
38 | if ($id !== null)
39 | {
40 | $this->id = $id;
41 | }
42 |
43 | if ($email !== null)
44 | {
45 | $this->email = $email;
46 | }
47 |
48 | if ($listId !== null)
49 | {
50 | $this->listId = $listId;
51 | }
52 | }
53 |
54 | private function check()
55 | {
56 | if (&& $this->id === null $this->email === null && $this->listId === null)
57 | {
58 | throw new \InvalidArgumentException('Must be set one or more receiver parameters');
59 | }
60 | }
61 |
62 | public function __set($name, $value)
63 | {
64 | parent::__set($name, $value);
65 | $this->check();
66 | }
67 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/MessageStatisticsType.php:
--------------------------------------------------------------------------------
1 | array(
27 | 'type' => 'integer',
28 | 'xmlName' => 'Sent'
29 | ),
30 | 'Bounced' => array(
31 | 'type' => 'integer',
32 | 'xmlName' => 'Bounced'
33 | ),
34 | 'Delivered' => array(
35 | 'type' => 'integer',
36 | 'xmlName' => 'Delivered'
37 | ),
38 | 'Opens' => array(
39 | 'type' => 'integer',
40 | 'xmlName' => 'Opens'
41 | ),
42 | 'UniqueOpens' => array(
43 | 'type' => 'integer',
44 | 'xmlName' => 'UniqueOpens'
45 | ),
46 | 'Clicks' => array(
47 | 'type' => 'integer',
48 | 'xmlName' => 'Clicks'
49 | ),
50 | 'UniqueClicks' => array(
51 | 'type' => 'integer',
52 | 'xmlName' => 'UniqueClicks'
53 | ),
54 | 'Clickers' => array(
55 | 'type' => 'integer',
56 | 'xmlName' => 'Clickers'
57 | ),
58 | 'Complaints' => array(
59 | 'type' => 'integer',
60 | 'xmlName' => 'Complaints'
61 | ),
62 | 'Unsubscribes' => array(
63 | 'type' => 'integer',
64 | 'xmlName' => 'Unsubscribes'
65 | ),
66 | );
67 | }
--------------------------------------------------------------------------------
/examples/addSubscriber.php:
--------------------------------------------------------------------------------
1 | setKey('YOUR_API_KEY');
9 |
10 | try
11 | {
12 | //Create entity with it fields
13 | $entity = new ES\Entity\SubscriberType();
14 | $entity->email = 'user.email@email.com';
15 | $entity->lastname = 'David';
16 | $entity->firstname = 'Suey';
17 | $entity->listId = 13;
18 | $entity->ip = '127.0.0.1';
19 | $entity->force = true;
20 | $entity->mode = ES\Enum\SubscribersMode::ADD_AND_UPDATE;
21 | $entity->trackingCode = 'subscription_form';
22 | $entity->vendor = 'Google';
23 | $entity->properties = array(
24 | new ES\Entity\PropertyType(7, new ES\Entity\PropertyValueType( 111111 )), //Integer
25 | new ES\Entity\PropertyType(11, new ES\Entity\PropertyValueType( false )), //Boolean
26 | new ES\Entity\PropertyType(6, new ES\Entity\PropertyValueType( '+77777777777' )), //String
27 | new ES\Entity\PropertyType(9, new ES\Entity\PropertyValueType( new \DateTime() )),//DateTime
28 | new ES\Entity\PropertyType(27, new ES\Entity\PropertyValueType( '1920-01-01' )), //Date
29 | new ES\Entity\PropertyType(32, new ES\Entity\PropertyValueType( 'M' )), //SingleSelection
30 | );
31 |
32 | //Initialize request with Data wrapper with entity
33 | $request = new ES\Request\Post\Subscribers( $entity );
34 |
35 | //Making a request call
36 | $response = $service->call( $request );
37 | if ($response->isOk())
38 | {
39 | echo 'success';
40 | }
41 | else
42 | {
43 | echo $response->getCode();
44 | }
45 |
46 | }
47 | catch (ES\ServiceException $e)
48 | {
49 | print_r('Ошибка выполнения запроса к сервису:' . "\n");
50 | echo $e->getCode() . " - " . $e->getMessage();
51 | }
52 | catch (\Exception $e)
53 | {
54 | var_dump($e);
55 | }
56 |
--------------------------------------------------------------------------------
/src/ExpertSender/Response/SubscriberType.php:
--------------------------------------------------------------------------------
1 | array(
22 | 'type' => 'boolean',
23 | 'xmlName' => 'BlackList'
24 | ),
25 | 'StateOnLists' => array(
26 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\StateOnListType',
27 | 'xmlName' => 'StateOnLists',
28 | 'unbound' => true,
29 | 'unboundTag' => 'StateOnList'
30 | ),
31 | 'SuppressionLists' => array(
32 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\SuppressionListType',
33 | 'xmlName' => 'SuppressionLists',
34 | 'unbound' => true,
35 | 'unboundTag' => 'SuppressionList'
36 | ),
37 | 'Id' => array(
38 | 'type' => 'integer',
39 | 'xmlName' => 'Id',
40 | ),
41 | 'Lastname' => array(
42 | 'type' => 'string',
43 | 'xmlName' => 'Lastname',
44 | ),
45 | 'Vendor' => array(
46 | 'type' => 'string',
47 | 'xmlName' => 'Vendor',
48 | ),
49 | 'Ip' => array(
50 | 'type' => 'string',
51 | 'xmlName' => 'Ip',
52 | ),
53 | 'Properties' => array(
54 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\PropertyType',
55 | 'xmlName' => 'Properties',
56 | 'unbound' => true,
57 | 'unboundTag' => 'Property'
58 | ),
59 | );
60 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Http.php:
--------------------------------------------------------------------------------
1 | $method,
20 | 'header' => '',
21 | 'timeout' => $timeout,
22 | 'ignore_errors' => true
23 | );
24 |
25 | if ($content && in_array($method, ['POST', 'PUT'])) {
26 | $http['content'] = $content;
27 | $http['length'] = strlen($content);
28 | $http['header'] = "Content-Type: application/xml;charset=UTF-8\r\n";
29 | }
30 |
31 | $context = stream_context_create(array('http' => $http));
32 |
33 | $start_microtime = microtime(true);
34 |
35 | $body = @file_get_contents($url, false, $context);
36 |
37 | $used_microtime = microtime(true) - $start_microtime;
38 |
39 | if ($body === false) {
40 | throw new \Exception("Request ExpertSender Failure, used_microtime={$used_microtime} ", self::CONNECTION_ERROR);
41 | }
42 |
43 | // http_response_header is php autoregister var
44 | return [
45 | 'body' => $body,
46 | 'headers' => $http_response_header,
47 | 'used_microtime' => $used_microtime
48 | ];
49 | }
50 |
51 | public static function post($url, $body, $timeout=600)
52 | {
53 | return self::query($url, 'POST', $body, $timeout);
54 | }
55 |
56 | public static function get($url, $data, $timeout=600)
57 | {
58 | return self::query($url . '?' . http_build_query($data), 'GET', null, $timeout);
59 | }
60 |
61 | public static function delete($url, $data, $timeout=600)
62 | {
63 | return self::query($url . '?' . http_build_query($data), 'DELETE', null, $timeout);
64 | }
65 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/PropertyType.php:
--------------------------------------------------------------------------------
1 | array(
25 | 'type' => 'integer',
26 | 'xmlName' => 'Id',
27 | ),
28 | 'Source' => array(
29 | 'type' => 'string',
30 | 'xmlName' => 'Source'
31 | ),
32 | 'DateTimeValue' => array(
33 | 'type' => 'DateTime',
34 | 'xmlName' => 'DateTimeValue',
35 | ),
36 | 'IntValue' => array(
37 | 'type' => 'integer',
38 | 'xmlName' => 'IntValue',
39 | ),
40 | 'StringValue' => array(
41 | 'type' => 'string',
42 | 'xmlName' => 'StringValue',
43 | ),
44 | 'Type' => array(
45 | 'type' => 'string',
46 | 'xmlName' => 'Type',
47 | ),
48 | 'FriendlyName' => array(
49 | 'type' => 'string',
50 | 'xmlName' => 'FriendlyName',
51 | ),
52 | 'Name' => array(
53 | 'type' => 'string',
54 | 'xmlName' => 'Name',
55 | ),
56 | 'DefaultStringValue' => array(
57 | 'type' => 'string',
58 | 'xmlName' => 'DefaultStringValue',
59 | ),
60 | 'DefaultIntValue' => array(
61 | 'type' => 'integer',
62 | 'xmlName' => 'DefaultIntValue',
63 | ),
64 | 'DefaultDateTimeValue' => array(
65 | 'type' => 'DateTime',
66 | 'xmlName' => 'DefaultDateTimeValue',
67 | ),
68 | );
69 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response.php:
--------------------------------------------------------------------------------
1 | responseBody = $body;
39 | $this->responseHeaders = $headers;
40 |
41 | $responseCode = null;
42 | foreach ($headers as $header)
43 | {
44 | if (preg_match('~HTTP.+ ([0-9]+).+~', $header, $matches))
45 | {
46 | $responseCode = trim($matches[1]);
47 | }
48 | }
49 |
50 | $responseEntity = null;
51 | if ($body !== null)
52 | {
53 | $expectedEntity = strpos($body, 'ErrorMessage') !== false ? 'App\\Extensions\\ExpertSender\\Response\\ErrorMessageType' : $responseEntityType;
54 | $responseEntity = (new XmlParser( $expectedEntity ))->parse( $body );
55 | }
56 |
57 | $this->responseCode = $responseCode;
58 | $this->responseEntity = $responseEntity;
59 | }
60 |
61 | public function getHeades()
62 | {
63 | return $this->responseHeaders;
64 | }
65 |
66 | public function getBody()
67 | {
68 | return $this->responseBody;
69 | }
70 |
71 | public function getCode()
72 | {
73 | return $this->responseCode;
74 | }
75 |
76 | public function getResponseEntity()
77 | {
78 | return $this->responseEntity;
79 | }
80 |
81 | /**
82 | * request state
83 | * @return bool
84 | */
85 | public function isOk()
86 | {
87 | return strpos($this->responseCode, '2') === 0;
88 | }
89 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/SubscriberType.php:
--------------------------------------------------------------------------------
1 | array(
30 | 'type' => 'string',
31 | 'xmlName' => 'Mode'
32 | ),
33 | 'force' => array(
34 | 'type' => 'boolean',
35 | 'xmlName' => 'Force',
36 | ),
37 | 'listId' => array(
38 | 'type' => 'integer',
39 | 'xmlName' => 'ListId',
40 | ),
41 | 'id' => array(
42 | 'type' => 'integer',
43 | 'xmlName' => 'Id',
44 | ),
45 | 'email' => array(
46 | 'type' => 'string',
47 | 'xmlName' => 'Email',
48 | ),
49 | 'phone' => array(
50 | 'type' => 'string',
51 | 'xmlName' => 'Phone',
52 | ),
53 | 'firstname' => array(
54 | 'type' => 'string',
55 | 'xmlName' => 'Firstname',
56 | ),
57 | 'lastname' => array(
58 | 'type' => 'string',
59 | 'xmlName' => 'Lastname',
60 | ),
61 | 'trackingCode' => array(
62 | 'type' => 'string',
63 | 'xmlName' => 'TrackingCode',
64 | ),
65 | 'name' => array(
66 | 'type' => 'string',
67 | 'xmlName' => 'Name',
68 | ),
69 | 'vendor' => array(
70 | 'type' => 'string',
71 | 'xmlName' => 'Vendor',
72 | ),
73 | 'ip' => array(
74 | 'type' => 'string',
75 | 'xmlName' => 'Ip',
76 | ),
77 | 'properties' => array(
78 | 'type' => 'App\\Extensions\\ExpertSender\\Entity\\PropertyType',
79 | 'xmlName' => 'Property',
80 | 'unbound' => true,
81 | 'unboundTag' => 'Properties'
82 | ),
83 | );
84 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Entity/GeneralSettingsType.php:
--------------------------------------------------------------------------------
1 | array(
28 | 'type' => 'string',
29 | 'xmlName' => 'Name',
30 | ),
31 | 'friendlyName' => array(
32 | 'type' => 'string',
33 | 'xmlName' => 'FriendlyName',
34 | ),
35 | 'description' => array(
36 | 'type' => 'string',
37 | 'xmlName' => 'Description',
38 | ),
39 | 'language' => array(
40 | 'type' => 'string',
41 | 'xmlName' => 'Language',
42 | ),
43 | 'optInMode' => array(
44 | 'type' => 'string',
45 | 'xmlName' => 'OptInMode',
46 | ),
47 | 'defaultFromName' => array(
48 | 'type' => 'string',
49 | 'xmlName' => 'DefaultFromName',
50 | ),
51 | 'defaultFromEmail' => array(
52 | 'type' => 'string',
53 | 'xmlName' => 'DefaultFromEmail',
54 | ),
55 | 'defaultReplyToName' => array(
56 | 'type' => 'string',
57 | 'xmlName' => 'DefaultReplyToName',
58 | ),
59 | 'charset' => array(
60 | 'type' => 'string',
61 | 'xmlName' => 'Charset',
62 | ),
63 | 'subscriptionConfirmPageUrl' => array(
64 | 'type' => 'string',
65 | 'xmlName' => 'SubscriptionConfirmPageUrl',
66 | ),
67 | 'subscriptionThankYouPageUrl' => array(
68 | 'type' => 'string',
69 | 'xmlName' => 'SubscriptionThankYouPageUrl',
70 | ),
71 | 'removalPageUrl' => array(
72 | 'type' => 'string',
73 | 'xmlName' => 'RemovalPageUrl',
74 | ),
75 | 'preferencesChangeUrl' => array(
76 | 'type' => 'string',
77 | 'xmlName' => 'PreferencesChangeUrl',
78 | ),
79 | );
80 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Response/MessageType.php:
--------------------------------------------------------------------------------
1 | array(
23 | 'type' => 'integer',
24 | 'xmlName' => 'Id',
25 | ),
26 | 'Type' => array(
27 | 'type' => 'string',
28 | 'xmlName' => 'Type',
29 | ),
30 | 'FromName' => array(
31 | 'type' => 'string',
32 | 'xmlName' => 'FromName'
33 | ),
34 | 'FromEmail' => array(
35 | 'type' => 'string',
36 | 'xmlName' => 'FromEmail',
37 | ),
38 | 'Subject' => array(
39 | 'type' => 'string',
40 | 'xmlName' => 'Subject',
41 | ),
42 | 'SentDate' => array(
43 | 'type' => 'DateTime',
44 | 'xmlName' => 'SentDate',
45 | ),
46 | 'Tags' => array(
47 | 'type' => 'string',
48 | 'xmlName' => 'Tags',
49 | ),
50 | 'YandexListId' => array(
51 | 'type' => 'integer',
52 | 'xmlName' => 'YandexListId',
53 | ),
54 | 'Channels' => array(
55 | 'type' => 'string',
56 | 'xmlName' => 'Channels',
57 | ),
58 | 'ThrottlingMethod' => array(
59 | 'type' => 'string',
60 | 'xmlName' => 'ThrottlingMethod',
61 | ),
62 | 'Throttling' => array(
63 | 'type' => 'integer',
64 | 'xmlName' => 'Throttling',
65 | ),
66 | 'Status' => array(
67 | 'type' => 'string',
68 | 'xmlName' => 'Status',
69 | ),
70 | 'Lists' => array(
71 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\ListType',
72 | 'xmlName' => 'Lists',
73 | 'unbound' => true,
74 | 'unboundTag' => 'List'
75 | ),
76 | 'Segments' => array(
77 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\SegmentType',
78 | 'xmlName' => 'Segments',
79 | 'unbound' => true,
80 | 'unboundTag' => 'Segment'
81 | ),
82 | 'GoogleAnalyticsTags' => array(
83 | 'type' => 'App\\Extensions\\ExpertSender\\Response\\GoogleAnalyticsTagType',
84 | 'xmlName' => 'GoogleAnalyticsTags',
85 | 'unbound' => true,
86 | 'unboundTag' => 'GoogleAnalyticsTag'
87 | ),
88 | );
89 | }
--------------------------------------------------------------------------------
/src/ExpertSender/Request.php:
--------------------------------------------------------------------------------
1 | requestEntity = $entity;
42 | }
43 |
44 | /**
45 | * 请求数据结构
46 | *
47 | * @return [type] [description]
48 | */
49 | public function getResponseEntity()
50 | {
51 | return $this->responseEntity;
52 | }
53 |
54 | /**
55 | * Получает адрес запроса на основании текущего состояния класса
56 | * @param array $additionalParams
57 | * @return string Адрес запроса
58 | */
59 | public function getRequestUrl(array $additionalParams = array())
60 | {
61 | if (!empty($additionalParams)) {
62 | $this->urlParams = array_merge($additionalParams, $this->urlParams);
63 | }
64 |
65 | if (count($this->urlParams) > 0) {
66 | return $this->endPoint . '?' . http_build_query($this->urlParams);
67 | } else {
68 | return $this->endPoint;
69 | }
70 | }
71 |
72 | /**
73 | * Получает тело запроса
74 | * @param string $apiKey Api ключ, который нужно исопльзовать при построении тела запроса
75 | * @return string
76 | */
77 | public function getRequestBody($apiKey)
78 | {
79 | $xml = '';
80 | if (!is_null($this->requestEntity)) {
81 | $xml .= '