@@ -21,54 +21,64 @@ So far this SDK has only machine to machine authentication mechanism and the fol
21
21
22
22
### Usage
23
23
24
- use Linkstreet\Box;
25
- use Linkstreet\Box\Enums\SubscriptionType;
24
+ ``` php
25
+ use Linkstreet\Box;
26
+ use Linkstreet\Box\Enums\SubscriptionType;
26
27
27
- $box_sdk = new Box(['client_id' => "", "client_secret" => ""]);
28
+ $box_sdk = new Box(['client_id' => "", "client_secret" => ""]);
28
29
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
+ ];
36
37
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
+ ```
40
42
41
43
#### Folder Service
42
44
1 . To get the service
43
45
44
- $folder_service = $app_auth_instance->getFolderService();
46
+ ``` php
47
+ $folder_service = $app_auth_instance->getFolderService();
48
+ ```
45
49
46
50
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
+ ```
55
61
56
62
#### File Service
57
63
1. To get the service
58
64
59
- $file_service = $app_auth_instance->getFileService();
65
+ ```php
66
+ $file_service = $app_auth_instance->getFileService();
67
+ ```
60
68
61
69
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
+ ```
69
79
70
80
71
81
##### NOTE:
72
82
73
83
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