|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SevenShores\Hubspot\Resources; |
|
4
|
|
|
|
|
5
|
|
|
class EmailEvents extends Resource |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Get campaign IDs for a portal. |
|
9
|
|
|
* |
|
10
|
|
|
* @param array $params Optional parameters |
|
11
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
12
|
|
|
*/ |
|
13
|
|
|
function getCampaignIds($params = []) |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
$endpoint = "https://api.hubapi.com/email/public/v1/campaigns"; |
|
16
|
|
|
|
|
17
|
|
|
$queryString = build_query_string($params); |
|
18
|
|
|
|
|
19
|
|
|
return $this->client->request('get', $endpoint, [], $queryString); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Get campaign data for a given campaign. |
|
24
|
|
|
* |
|
25
|
|
|
* @param int $campaign_id |
|
26
|
|
|
* @param int $application_id |
|
27
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
28
|
|
|
*/ |
|
29
|
|
|
function getCampaignById($campaign_id, $application_id) |
|
|
|
|
|
|
30
|
|
|
{ |
|
31
|
|
|
$endpoint = "https://api.hubapi.com/email/public/v1/campaigns/{$campaign_id}"; |
|
32
|
|
|
|
|
33
|
|
|
$queryString = build_query_string(['appId' => $application_id]); |
|
34
|
|
|
|
|
35
|
|
|
return $this->client->request('get', $endpoint, [], $queryString); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Get email events for a campaign or recipient. |
|
40
|
|
|
* |
|
41
|
|
|
* @param array $params Optional parameters |
|
42
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
43
|
|
|
*/ |
|
44
|
|
|
function all($params = []) |
|
|
|
|
|
|
45
|
|
|
{ |
|
46
|
|
|
$endpoint = "https://api.hubapi.com/email/public/v1/events"; |
|
47
|
|
|
|
|
48
|
|
|
$queryString = build_query_string($params); |
|
49
|
|
|
|
|
50
|
|
|
return $this->client->request('get', $endpoint, [], $queryString); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
/** |
|
54
|
|
|
* Get event data for a specific event. |
|
55
|
|
|
* |
|
56
|
|
|
* @param int $id The event ID |
|
57
|
|
|
* @param int $created Timestamp (milliseconds) when the event was created |
|
58
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
59
|
|
|
*/ |
|
60
|
|
|
function getById($id, $created) |
|
|
|
|
|
|
61
|
|
|
{ |
|
62
|
|
|
$endpoint = "https://api.hubapi.com/email/public/v1/events/{$created}/{$id}"; |
|
63
|
|
|
|
|
64
|
|
|
return $this->client->request('get', $endpoint); |
|
65
|
|
|
} |
|
66
|
|
|
} |
|
67
|
|
|
|
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.