|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the bitbucket-api package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Alexandru G. <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bitbucket\API\Repositories; |
|
13
|
|
|
|
|
14
|
|
|
use Bitbucket\API; |
|
15
|
|
|
use Buzz\Message\MessageInterface; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Allows you to browse directories and view files. |
|
19
|
|
|
* |
|
20
|
|
|
* NOTE: This is read-only! |
|
21
|
|
|
* |
|
22
|
|
|
* @author Alexandru G. <[email protected]> |
|
23
|
|
|
*/ |
|
24
|
|
|
class Src extends API\Api |
|
25
|
|
|
{ |
|
26
|
|
|
/** |
|
27
|
|
|
* Get a list of repo source |
|
28
|
|
|
* |
|
29
|
|
|
* @access public |
|
30
|
|
|
* @param string $account The team or individual account owning the repository. |
|
31
|
|
|
* @param string $repo The repository identifier. |
|
32
|
|
|
* @param string $revision A value representing the revision or branch to list. |
|
33
|
|
|
* @param string $path The path can be a filename or a directory path. |
|
34
|
|
|
* @return MessageInterface |
|
35
|
|
|
*/ |
|
36
|
2 |
|
public function get($account, $repo, $revision, $path) |
|
37
|
|
|
{ |
|
38
|
2 |
|
return $this->requestGet( |
|
39
|
2 |
|
sprintf('repositories/%s/%s/src/%s/%s', $account, $repo, $revision, $path) |
|
40
|
|
|
); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Get raw content of an individual file |
|
45
|
|
|
* |
|
46
|
|
|
* @access public |
|
47
|
|
|
* @param string $account The team or individual account owning the repository. |
|
48
|
|
|
* @param string $repo The repository identifier. |
|
49
|
|
|
* @param string $revision A value representing the revision or branch to list. |
|
50
|
|
|
* @param string $path The path can be a filename or a directory path. |
|
51
|
|
|
* @return MessageInterface |
|
52
|
|
|
*/ |
|
53
|
|
|
public function raw($account, $repo, $revision, $path) |
|
54
|
3 |
|
{ |
|
55
|
|
|
return $this->requestGet( |
|
56
|
|
|
sprintf('repositories/%s/%s/raw/%s/%s', $account, $repo, $revision, $path) |
|
57
|
3 |
|
); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
|