| 1 |
<?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 |
|
| 3 |
/** |
| 4 |
* JSON API plugins get endpoint. |
| 5 |
*/ |
| 6 |
new Jetpack_JSON_API_Plugins_Get_Endpoint( |
| 7 |
array( |
| 8 |
'description' => 'Get the Plugin data.', |
| 9 |
'method' => 'GET', |
| 10 |
'path' => '/sites/%s/plugins/%s/', |
| 11 |
'min_version' => '1', |
| 12 |
'max_version' => '1.1', |
| 13 |
'stat' => 'plugins:1', |
| 14 |
'path_labels' => array( |
| 15 |
'$site' => '(int|string) The site ID, The site domain', |
| 16 |
'$plugin' => '(string) The plugin ID', |
| 17 |
), |
| 18 |
'allow_jetpack_site_auth' => true, |
| 19 |
'response_format' => Jetpack_JSON_API_Plugins_Endpoint::$_response_format, |
| 20 |
'example_request_data' => array( |
| 21 |
'headers' => array( |
| 22 |
'authorization' => 'Bearer YOUR_API_TOKEN', |
| 23 |
), |
| 24 |
), |
| 25 |
'example_request' => 'https://public-api.wordpress.com/rest/v1/sites/example.wordpress.org/plugins/hello-dolly%20hello', |
| 26 |
) |
| 27 |
); |
| 28 |
|
| 29 |
/** |
| 30 |
* Plugins get endpoint class. |
| 31 |
* |
| 32 |
* GET /sites/%s/plugins/%s |
| 33 |
* |
| 34 |
* No v1.2 version since it is .com only |
| 35 |
*/ |
| 36 |
class Jetpack_JSON_API_Plugins_Get_Endpoint extends Jetpack_JSON_API_Plugins_Endpoint { |
| 37 |
/** |
| 38 |
* Needed capabilities. |
| 39 |
* |
| 40 |
* @var string |
| 41 |
*/ |
| 42 |
protected $needed_capabilities = 'activate_plugins'; |
| 43 |
} |
| 44 |
|