Skip to content

Commit e2dc61d

Browse files
authored
Merge pull request #1 from GetResponse/release/1.1.0
Release 1.1.0 - added imports, webinars and A/B tests.
2 parents a7cb5e8 + 39999e7 commit e2dc61d

20 files changed

+870
-10
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## 1.1.0 - 2019-04-10
2+
3+
* Added A/B tests
4+
* Added Imports
5+
* Added Webinars
6+
7+
## 1.0.0 - 2019-03-15
8+
9+
Initial release
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
namespace Getresponse\Sdk\Operation\Imports\GetImport;
3+
4+
use Getresponse\Sdk\Client\Operation\QueryOperation;
5+
use Getresponse\Sdk\OperationVersionTrait;
6+
7+
class GetImport extends QueryOperation
8+
{
9+
use OperationVersionTrait;
10+
11+
const METHOD_URL = '/v3/imports/{importId}';
12+
13+
/** @var string */
14+
private $importId;
15+
16+
/** @var GetImportFields */
17+
private $fields;
18+
19+
20+
/**
21+
* @param string $importId
22+
*/
23+
public function __construct($importId)
24+
{
25+
$this->importId = $importId;
26+
}
27+
28+
29+
/**
30+
* @return string
31+
*/
32+
public function buildUrlFromTemplate()
33+
{
34+
return str_ireplace(
35+
['{importId}'],
36+
[$this->importId],
37+
self::METHOD_URL
38+
);
39+
}
40+
41+
42+
/**
43+
* @param GetImportFields $fields
44+
* @return $this
45+
*/
46+
public function setFields(GetImportFields $fields)
47+
{
48+
$this->fields = $fields;
49+
return $this;
50+
}
51+
52+
53+
/**
54+
* @return string
55+
*/
56+
public function getUrl()
57+
{
58+
$extra = $this->getFieldsParameterArray($this->fields);
59+
return $this->buildUrlFromTemplate() . $this->buildQueryString(null, null, $extra);
60+
}
61+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
namespace Getresponse\Sdk\Operation\Imports\GetImport;
3+
4+
use Getresponse\Sdk\Client\Operation\ValueList;
5+
6+
class GetImportFields extends ValueList
7+
{
8+
/**
9+
* @return array
10+
*/
11+
public function getAllowedValues()
12+
{
13+
return [
14+
'importId',
15+
'campaign',
16+
'status',
17+
'statistics',
18+
'errorStatistics',
19+
'createdOn',
20+
'finishedOn',
21+
'href',
22+
];
23+
}
24+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
namespace Getresponse\Sdk\Operation\Imports\GetImports;
3+
4+
use Getresponse\Sdk\Client\Operation\Pagination;
5+
use Getresponse\Sdk\Client\Operation\QueryOperation;
6+
use Getresponse\Sdk\OperationVersionTrait;
7+
8+
class GetImports extends QueryOperation
9+
{
10+
use OperationVersionTrait;
11+
12+
const METHOD_URL = '/v3/imports';
13+
14+
/** @var GetImportsSearchQuery */
15+
private $query;
16+
17+
/** @var GetImportsSortParams */
18+
private $sort;
19+
20+
/** @var GetImportsFields */
21+
private $fields;
22+
23+
24+
/**
25+
* @return string
26+
*/
27+
public function buildUrlFromTemplate()
28+
{
29+
return self::METHOD_URL;
30+
}
31+
32+
33+
/**
34+
* @param GetImportsSearchQuery $query
35+
* @return $this
36+
*/
37+
public function setQuery(GetImportsSearchQuery $query)
38+
{
39+
$this->query = $query;
40+
return $this;
41+
}
42+
43+
44+
/**
45+
* @param GetImportsSortParams $sort
46+
* @return $this
47+
*/
48+
public function setSort(GetImportsSortParams $sort)
49+
{
50+
$this->sort = $sort;
51+
return $this;
52+
}
53+
54+
55+
/**
56+
* @param GetImportsFields $fields
57+
* @return $this
58+
*/
59+
public function setFields(GetImportsFields $fields)
60+
{
61+
$this->fields = $fields;
62+
return $this;
63+
}
64+
65+
66+
/**
67+
* @return string
68+
*/
69+
public function getUrl()
70+
{
71+
$extra = array_merge(
72+
$this->getFieldsParameterArray($this->fields)
73+
);
74+
75+
return $this->buildUrlFromTemplate() . $this->buildQueryString($this->query, $this->sort, $extra);
76+
}
77+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
namespace Getresponse\Sdk\Operation\Imports\GetImports;
3+
4+
use Getresponse\Sdk\Client\Operation\ValueList;
5+
6+
class GetImportsFields extends ValueList
7+
{
8+
/**
9+
* @return array
10+
*/
11+
public function getAllowedValues()
12+
{
13+
return [
14+
'importId',
15+
'campaign',
16+
'status',
17+
'statistics',
18+
'errorStatistics',
19+
'createdOn',
20+
'finishedOn',
21+
'href',
22+
];
23+
}
24+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
namespace Getresponse\Sdk\Operation\Imports\GetImports;
3+
4+
use Getresponse\Sdk\Client\Operation\DateRangeSearch;
5+
use Getresponse\Sdk\Client\Operation\SearchQuery;
6+
7+
class GetImportsSearchQuery extends SearchQuery
8+
{
9+
/**
10+
* @return array
11+
*/
12+
public function getAllowedKeys()
13+
{
14+
return [
15+
'campaignId',
16+
'createdOn',
17+
];
18+
}
19+
20+
21+
/**
22+
* @param string $campaignId
23+
* @return $this
24+
* @throws \InvalidArgumentException
25+
*/
26+
public function whereCampaignId($campaignId)
27+
{
28+
return $this->set('campaignId', $campaignId);
29+
}
30+
31+
32+
/**
33+
* @param DateRangeSearch $createdOn
34+
* @return $this
35+
* @throws \InvalidArgumentException
36+
*/
37+
public function whereCreatedOn(DateRangeSearch $createdOn)
38+
{
39+
return $this->set('createdOn', $createdOn->toArray());
40+
}
41+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
namespace Getresponse\Sdk\Operation\Imports\GetImports;
3+
4+
use Getresponse\Sdk\Client\Operation\SortParams;
5+
6+
class GetImportsSortParams extends SortParams
7+
{
8+
/**
9+
* @return array
10+
*/
11+
public function getAllowedKeys()
12+
{
13+
return [
14+
'createdOn',
15+
'finishedOn',
16+
];
17+
}
18+
}

src/Operation/Model/TransactionalEmailRecipientTo.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
class TransactionalEmailRecipientTo extends BaseModel
77
{
88
/** @var string */
9-
private $email;
9+
private $validSince = self::FIELD_NOT_SET;
1010

1111
/** @var string */
12-
private $name = self::FIELD_NOT_SET;
12+
private $email;
1313

1414
/** @var string */
15-
private $validSince = self::FIELD_NOT_SET;
15+
private $name = self::FIELD_NOT_SET;
1616

1717

1818
/**
@@ -25,20 +25,20 @@ public function __construct($email)
2525

2626

2727
/**
28-
* @param string $name
28+
* @param string $validSince
2929
*/
30-
public function setName($name)
30+
public function setValidSince($validSince)
3131
{
32-
$this->name = $name;
32+
$this->validSince = $validSince;
3333
}
3434

3535

3636
/**
37-
* @param string $validSince
37+
* @param string $name
3838
*/
39-
public function setValidSince($validSince)
39+
public function setName($name)
4040
{
41-
$this->validSince = $validSince;
41+
$this->name = $name;
4242
}
4343

4444

@@ -48,9 +48,9 @@ public function setValidSince($validSince)
4848
public function jsonSerialize()
4949
{
5050
$data = [
51+
'validSince' => $this->validSince,
5152
'email' => $this->email,
5253
'name' => $this->name,
53-
'validSince' => $this->validSince,
5454
];
5555

5656
return $this->filterUnsetFields($data);
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?php
2+
namespace Getresponse\Sdk\Operation\Splittests\GetSplittest;
3+
4+
use Getresponse\Sdk\Client\Operation\QueryOperation;
5+
use Getresponse\Sdk\OperationVersionTrait;
6+
7+
class GetSplittest extends QueryOperation
8+
{
9+
use OperationVersionTrait;
10+
11+
const METHOD_URL = '/v3/splittests/{splittestId}';
12+
13+
/** @var string */
14+
private $splittestId;
15+
16+
/** @var GetSplittestFields */
17+
private $fields;
18+
19+
20+
/**
21+
* @param string $splittestId
22+
*/
23+
public function __construct($splittestId)
24+
{
25+
$this->splittestId = $splittestId;
26+
}
27+
28+
29+
/**
30+
* @return string
31+
*/
32+
public function buildUrlFromTemplate()
33+
{
34+
return str_ireplace(
35+
['{splittestId}'],
36+
[$this->splittestId],
37+
self::METHOD_URL
38+
);
39+
}
40+
41+
42+
/**
43+
* @param GetSplittestFields $fields
44+
* @return $this
45+
*/
46+
public function setFields(GetSplittestFields $fields)
47+
{
48+
$this->fields = $fields;
49+
return $this;
50+
}
51+
52+
53+
/**
54+
* @return string
55+
*/
56+
public function getUrl()
57+
{
58+
$extra = $this->getFieldsParameterArray($this->fields);
59+
return $this->buildUrlFromTemplate() . $this->buildQueryString(null, null, $extra);
60+
}
61+
}

0 commit comments

Comments
 (0)