|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace SevenShores\Hubspot\Resources; |
|
4
|
|
|
|
|
5
|
|
|
class Blogs extends Resource |
|
6
|
|
|
{ |
|
7
|
|
|
/** |
|
8
|
|
|
* Get all blogs. |
|
9
|
|
|
* |
|
10
|
|
|
* @param array $params Optional parameters ['limit', 'offset', 'created', 'deleted_at', 'name'] |
|
11
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
12
|
|
|
*/ |
|
13
|
|
|
function all($params = []) |
|
|
|
|
|
|
14
|
|
|
{ |
|
15
|
|
|
$endpoint = 'https://api.hubapi.com/content/api/v2/blogs'; |
|
16
|
|
|
|
|
17
|
|
|
$queryString = build_query_string($params); |
|
18
|
|
|
|
|
19
|
|
|
return $this->client->request('get', $endpoint, [], $queryString); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Get information about a specific blog. |
|
24
|
|
|
* |
|
25
|
|
|
* @param string $id |
|
26
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
27
|
|
|
*/ |
|
28
|
|
|
function getById($id) |
|
|
|
|
|
|
29
|
|
|
{ |
|
30
|
|
|
$endpoint = "https://api.hubapi.com/content/api/v2/blogs/{$id}"; |
|
31
|
|
|
|
|
32
|
|
|
return $this->client->request('get', $endpoint); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* Get previous versions of the blog. |
|
37
|
|
|
* |
|
38
|
|
|
* @param string $id Blog id. |
|
39
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
40
|
|
|
*/ |
|
41
|
|
|
function versions($id) |
|
|
|
|
|
|
42
|
|
|
{ |
|
43
|
|
|
$endpoint = "https://api.hubapi.com/content/api/v2/blogs/{$id}/versions"; |
|
44
|
|
|
|
|
45
|
|
|
return $this->client->request('get', $endpoint); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* Get a previous version of the blog. |
|
50
|
|
|
* |
|
51
|
|
|
* @param string $id Blog id. |
|
52
|
|
|
* @param string $version_id Version id. |
|
53
|
|
|
* @return \SevenShores\Hubspot\Http\Response |
|
54
|
|
|
*/ |
|
55
|
|
|
function getVersion($id, $version_id) |
|
|
|
|
|
|
56
|
|
|
{ |
|
57
|
|
|
$endpoint = "https://api.hubapi.com/content/api/v2/blogs/{$id}/versions/{$version_id}"; |
|
58
|
|
|
|
|
59
|
|
|
return $this->client->request('get', $endpoint); |
|
60
|
|
|
} |
|
61
|
|
|
} |
|
62
|
|
|
|
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.