-
Notifications
You must be signed in to change notification settings - Fork 144
Expand file tree
/
Copy pathIntercomArticles.php
More file actions
88 lines (80 loc) · 2.24 KB
/
IntercomArticles.php
File metadata and controls
88 lines (80 loc) · 2.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<?php
namespace Intercom;
use Http\Client\Exception;
use stdClass;
class IntercomArticles extends IntercomResource
{
/**
* Creates an Article.
*
* @see https://developers.intercom.com/intercom-api-reference/v0/reference#create-an-article
* @param array $options
* @return stdClass
* @throws Exception
*/
public function create(array $options)
{
return $this->client->post("articles", $options);
}
/**
* Gets a single Article based on the Article ID.
*
* @see https://developers.intercom.com/intercom-api-reference/v0/reference#retrieve-an-article
* @param string $id
* @param array $options
* @return stdClass
* @throws Exception
*/
public function getArticle(string $id, array $options = [])
{
$path = $this->articlePath($id);
return $this->client->get($path, $options);
}
/**
* Updates an existing Article
*
* @see https://developers.intercom.com/intercom-api-reference/v0/reference#update-an-article
* @param string $id
* @param array $options
* @return stdClass
*/
public function update(string $id, array $options = [])
{
$path = $this->articlePath($id);
return $this->client->put($path, $options);
}
/**
* Deletes a single article based on the Article ID.
*
* @see https://developers.intercom.com/intercom-api-reference/v0/reference#delete-an-article
* @param string $id
* @param array $options
* @return stdClass
* @throws Exception
*/
public function deleteArticle(string $id, array $options = [])
{
$path = $this->articlePath($id);
return $this->client->delete($path, $options);
}
/**
* Lists Articles.
*
* @see https://developers.intercom.com/intercom-api-reference/v0/reference#list-all-articles
* @param array $options
* @return stdClass
* @throws Exception
*/
public function getArticles(array $options = [])
{
return $this->client->get('articles', $options);
}
/**
* @param string $id
* @return string
*/
public function articlePath(string $id)
{
return 'articles/' . $id;
}
}