Repository navigation
Expand file tree
/
Copy pathApi.php
More file actions
49 lines (45 loc) · 1.45 KB
/
Copy pathApi.php
File metadata and controls
49 lines (45 loc) · 1.45 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
<?php
/**
* Abstract class for Github_Api classes
*
* @author Thibault Duplessis <thibault.duplessis at gmail dot com>
* @license MIT License
*/
abstract class Github_Api implements Github_ApiInterface
{
/**
* The client
* @var Github_Client
*/
private $client;
public function __construct(Github_Client $client)
{
$this->client = $client;
}
/**
* Call any path, GET method
* Ex: $api->get('repos/show/my-username/my-repo')
*
* @param string $path the GitHub path
* @param array $parameters GET parameters
* @param array $requestOptions reconfigure the request
* @return array data returned
*/
protected function get($path, array $parameters = array(), $requestOptions = array())
{
return $this->client->get($path, $parameters, $requestOptions);
}
/**
* Call any path, POST method
* Ex: $api->post('repos/show/my-username', array('email' => 'my-new-email@provider.org'))
*
* @param string $path the GitHub path
* @param array $parameters POST parameters
* @param array $requestOptions reconfigure the request
* @return array data returned
*/
protected function post($path, array $parameters = array(), $requestOptions = array())
{
return $this->client->post($path, $parameters, $requestOptions);
}
}