|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SevenShores\Hubspot\Resources; |
|
4
|
|
|
|
|
5
|
|
|
class SocialMedia extends Resource |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Get all publishing channels. |
|
9
|
|
|
* |
|
10
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
11
|
|
|
*/ |
|
12
|
|
|
function channels() |
|
|
|
|
|
|
13
|
|
|
{ |
|
14
|
|
|
$endpoint = 'https://api.hubapi.com/broadcast/v1/channels/setting/publish/current'; |
|
15
|
|
|
|
|
16
|
|
|
return $this->client->request('get', $endpoint); |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Get a broadcast channel. |
|
21
|
|
|
* |
|
22
|
|
|
* @param string $channel_guid |
|
23
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
24
|
|
|
*/ |
|
25
|
|
|
function getChannelById($channel_guid) |
|
|
|
|
|
|
26
|
|
|
{ |
|
27
|
|
|
$endpoint = "https://api.hubapi.com/broadcast/v1/channels/{$channel_guid}"; |
|
28
|
|
|
|
|
29
|
|
|
return $this->client->request('get', $endpoint); |
|
30
|
|
|
} |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Get all broadcast messages. |
|
34
|
|
|
* |
|
35
|
|
|
* @param array $params |
|
36
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
37
|
|
|
*/ |
|
38
|
|
|
function broadcasts($params = []) |
|
|
|
|
|
|
39
|
|
|
{ |
|
40
|
|
|
$endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts"; |
|
41
|
|
|
|
|
42
|
|
|
$queryString = build_query_string($params); |
|
43
|
|
|
|
|
44
|
|
|
return $this->client->request('get', $endpoint, [], $queryString); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* Get a broadcast. |
|
49
|
|
|
* |
|
50
|
|
|
* @param string $broadcast_guid |
|
51
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
52
|
|
|
*/ |
|
53
|
|
|
function getBroadcastById($broadcast_guid) |
|
|
|
|
|
|
54
|
|
|
{ |
|
55
|
|
|
$endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts/{$broadcast_guid}"; |
|
56
|
|
|
|
|
57
|
|
|
return $this->client->request('get', $endpoint); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* Create a new broadcast message. |
|
62
|
|
|
* |
|
63
|
|
|
* @param array $broadcast |
|
64
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
65
|
|
|
*/ |
|
66
|
|
|
function createBroadcast($broadcast) |
|
|
|
|
|
|
67
|
|
|
{ |
|
68
|
|
|
$endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts"; |
|
69
|
|
|
|
|
70
|
|
|
$options['json'] = $broadcast; |
|
71
|
|
|
|
|
72
|
|
|
return $this->client->request('post', $endpoint, $options); |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* Cancel a broadcast message. |
|
77
|
|
|
* |
|
78
|
|
|
* @param string $broadcast_guid |
|
79
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
80
|
|
|
*/ |
|
81
|
|
|
function cancelBroadcast($broadcast_guid) |
|
|
|
|
|
|
82
|
|
|
{ |
|
83
|
|
|
$endpoint = "https://api.hubapi.com/broadcast/v1/broadcasts/{$broadcast_guid}"; |
|
84
|
|
|
|
|
85
|
|
|
return $this->client->request('delete', $endpoint); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
} |
|
89
|
|
|
|
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.