googleSheetsService = $googleSheetsService; } /** * @throws ForbiddenException */ protected function handle(WP_REST_Request $data): WP_REST_Response { Sanitizer::verifyNonce($data->get_header('X-WP-Nonce')); $spreadsheetId = Sanitizer::sanitizeText((string) $data->get_param('spreadsheet_id')); return new WP_REST_Response([ 'worksheets' => $this->googleSheetsService->listWorksheets($spreadsheetId), ], 200); } }