| @@ -1,0 +1,30 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +declare(strict_types=1); | |
| 4 | + | |
| 5 | +namespace Metricool\Interfaces; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * This interface can be used instead of {@see SingleEndpointInterface} to register | |
| 9 | + * multiple routes at once. This is useful when a single route has multiple | |
| 10 | + * endpoints. | |
| 11 | + */ | |
| 12 | +interface MultiEndpointInterface | |
| 13 | +{ | |
| 14 | + /** | |
| 15 | + * The routes to register. For each array in the array, the key is the route | |
| 16 | + * and the value is an array of arguments to pass to the register_rest_route | |
| 17 | + * function: {@see EndpointManager::registerWordPressRestRoutes}. | |
| 18 | + * | |
| 19 | + * Arguments you can use are documented with filter: metricool_rest_routes | |
| 20 | + * in method: {@see EndpointManager::getPluginRoutes} | |
| 21 | + */ | |
| 22 | + public function registerRoutes(): array; | |
| 23 | + | |
| 24 | + /** | |
| 25 | + * This method should return true if the endpoint is enabled, false | |
| 26 | + * otherwise. Endpoint will not be registered if this method returns false: | |
| 27 | + * {@see EndpointManager::registerEndpoints} | |
| 28 | + */ | |
| 29 | + public function enabled(): bool; | |
| 30 | +} | |