1 | <?php |
||
10 | class Files |
||
11 | { |
||
12 | |||
13 | /** |
||
14 | * @var B2Client |
||
15 | */ |
||
16 | public $B2Client; |
||
17 | |||
18 | /** |
||
19 | * Files constructor. |
||
20 | * @param B2Client $B2Client |
||
21 | */ |
||
22 | 6 | public function __construct(B2Client $B2Client) |
|
23 | { |
||
24 | 6 | $this->B2Client = $B2Client; |
|
25 | 6 | } |
|
26 | |||
27 | /** |
||
28 | * @param $bucketId |
||
29 | * @param $startFileName |
||
30 | * @return mixed |
||
31 | * @throws \Exception |
||
32 | */ |
||
33 | public function listFileNames($bucketId, $startFileName = null, $maxFileCount = 100) |
||
41 | |||
42 | /** |
||
43 | * Lists all files in a bucket and starting filename. For very large buckets this may fail, use listFileNames() directly |
||
44 | * |
||
45 | * @param $bucketId |
||
46 | * @param $startFileName |
||
47 | * @return array |
||
48 | */ |
||
49 | public function listAllFileNames($bucketId, $startFileName) |
||
63 | |||
64 | /** |
||
65 | * @param $fileID |
||
66 | * @return mixed |
||
67 | * @throws \Exception |
||
68 | */ |
||
69 | public function getFileInfo($fileId) |
||
73 | |||
74 | /** |
||
75 | * @param $bucketId |
||
76 | * @return mixed |
||
77 | * @throws \Exception |
||
78 | */ |
||
79 | public function getUploadUrl($bucketId) |
||
83 | |||
84 | /** |
||
85 | * @param $bucketId |
||
86 | * @param string $filePath The path to the local file |
||
87 | * @param string $fileName The name/path on B2 |
||
88 | * @param string $contentType |
||
89 | * @param array $uploadUrlResponse |
||
90 | * @return array |
||
91 | */ |
||
92 | public function uploadFile($bucketId, $filePath, $fileName, $contentType, $uploadUrlResponse = []) |
||
108 | |||
109 | /** |
||
110 | * @param $bucketId |
||
111 | * @param $fileName |
||
112 | * @return mixed |
||
113 | * @throws \Exception |
||
114 | */ |
||
115 | public function downloadFileByName($bucketName, $fileName) |
||
119 | |||
120 | /** |
||
121 | * @param $bucketId |
||
122 | * @param $fileName |
||
123 | */ |
||
124 | public function hideFile($bucketId, $fileName) |
||
128 | |||
129 | } |
||
130 |