Skip to content

Commit b2cbf4b

Browse files
authored
Merge pull request #1 from linkstreet/vigneshgurusamy-readme
Use syntax highlighting block
2 parents e197c86 + bb2a546 commit b2cbf4b

File tree

1 file changed

+41
-31
lines changed

1 file changed

+41
-31
lines changed

README.md

Lines changed: 41 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -21,54 +21,64 @@ So far this SDK has only machine to machine authentication mechanism and the fol
2121

2222
### Usage
2323

24-
use Linkstreet\Box;
25-
use Linkstreet\Box\Enums\SubscriptionType;
24+
```php
25+
use Linkstreet\Box;
26+
use Linkstreet\Box\Enums\SubscriptionType;
2627

27-
$box_sdk = new Box(['client_id' => "", "client_secret" => ""]);
28+
$box_sdk = new Box(['client_id' => "", "client_secret" => ""]);
2829

29-
$app_auth_info = [
30-
"key_id" => "key id from box app",
31-
"private_key" => "path to private key",
32-
"pass_phrase" => "passphrase", // Can be empty
33-
"subscription_type" => SubscriptionType::ENTERPRISE or SubscriptionType::USER,
34-
"id" => "enterprise id or user id"
35-
];
30+
$app_auth_info = [
31+
"key_id" => "key id from box app",
32+
"private_key" => "path to private key",
33+
"pass_phrase" => "passphrase", // Can be empty
34+
"subscription_type" => SubscriptionType::ENTERPRISE or SubscriptionType::USER,
35+
"id" => "enterprise id or user id"
36+
];
3637

37-
// Authenticates with box server and returns app_auth instance.
38-
// Throws `GuzzleHttp\Exception\ClientException` on failure
39-
$app_auth_instance = $box_sdk->getAppAuthClient($app_auth_info);
38+
// Authenticates with box server and returns app_auth instance.
39+
// Throws `GuzzleHttp\Exception\ClientException` on failure
40+
$app_auth_instance = $box_sdk->getAppAuthClient($app_auth_info);
41+
```
4042

4143
#### Folder Service
4244
1. To get the service
4345

44-
$folder_service = $app_auth_instance->getFolderService();
46+
```php
47+
$folder_service = $app_auth_instance->getFolderService();
48+
```
4549

4650
2. Methods available in `$folder_service`
47-
48-
1. getFolderInfo($folder_id); // Defaults to root folder (id = 0)
49-
2. getFolderItems($folder_id); // Defaults to root folder (id = 0)
50-
3. create($folder_name, $parent_folder_id = 0)
51-
4. delete($folder_id, $recursive = false, $e_tag = null)
52-
5. getTrashedItems()
53-
6. destroyTrashedFolder($folder_id)
54-
7. restore($trashed_folder_id, $new_name = null, $parent_folder_id = null)
51+
52+
```
53+
1. getFolderInfo($folder_id); // Defaults to root folder (id = 0)
54+
2. getFolderItems($folder_id); // Defaults to root folder (id = 0)
55+
3. create($folder_name, $parent_folder_id = 0)
56+
4. delete($folder_id, $recursive = false, $e_tag = null)
57+
5. getTrashedItems()
58+
6. destroyTrashedFolder($folder_id)
59+
7. restore($trashed_folder_id, $new_name = null, $parent_folder_id = null)
60+
```
5561

5662
#### File Service
5763
1. To get the service
5864

59-
$file_service = $app_auth_instance->getFileService();
65+
```php
66+
$file_service = $app_auth_instance->getFileService();
67+
```
6068

6169
2. Methods available in `$file_service`
62-
63-
1. uploadPreFlight($file_path = "", $folder_id = 0, $filename = null); // If filename is null, file name will be derived from actual file name.
64-
2. upload($file_path = "", $folder_id = 0, $filename = null); // If filename is null, file name will be derived from actual file name.
65-
3. getEmbedUrl($file_id)
66-
4. delete($file_id)
67-
5. destroyTrashedFile($file_id)
68-
6. restore($trashed_file_id, $new_name = null, $parent_folder_id = null)
70+
71+
```
72+
1. uploadPreFlight($file_path = "", $folder_id = 0, $filename = null); // If filename is null, file name will be derived from actual file name.
73+
2. upload($file_path = "", $folder_id = 0, $filename = null); // If filename is null, file name will be derived from actual file name.
74+
3. getEmbedUrl($file_id)
75+
4. delete($file_id)
76+
5. destroyTrashedFile($file_id)
77+
6. restore($trashed_file_id, $new_name = null, $parent_folder_id = null)
78+
```
6979

7080

7181
##### NOTE:
7282

7383
1. All APIs return `\GuzzleHttp\Psr7\Response` (to get the body use `$response->getBody()->getContents()`. Refer [Guzzle HTTP Messages](http://docs.guzzlephp.org/en/latest/psr7.html#responses)) except `getEmbedUrl($file_id)` which returns string.
74-
2. Guzzle related exceptions and its documentation can be found in [Guzzle Docs](http://docs.guzzlephp.org/en/latest/quickstart.html#exceptions)
84+
2. Guzzle related exceptions and its documentation can be found in [Guzzle Docs](http://docs.guzzlephp.org/en/latest/quickstart.html#exceptions)

0 commit comments

Comments
 (0)