-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode.power
More file actions
36 lines (33 loc) · 882 Bytes
/
code.power
File metadata and controls
36 lines (33 loc) · 882 Bytes
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
/**
* Get a file or its LFS object from a repository.
*
* @param string $owner The owner name.
* @param string $repo The repository name.
* @param string $filepath The file path.
* @param string|null $ref The name of the commit/branch/tag. (Optional)
*
* @return string
* @since 3.2.0
*/
public function get(
string $owner,
string $repo,
string $filepath,
?string $ref = null
): string
{
// Build the request path.
$encodedFilepath = rawurlencode($filepath);
$path = "/repos/{$owner}/{$repo}/media/{$encodedFilepath}";
// Prepare the URI.
$uri = $this->uri->get($path);
// Add the 'ref' query parameter if provided.
if ($ref !== null)
{
$uri->setVar('ref', $ref);
}
// Send the GET request.
return $this->response->get(
$this->http->get($uri), 200, 'success'
);
}