I am writing code in the script console to list the pages in a specific space called IWIKI. I am using the following code:
import com.atlassian.confluence.pages.Page
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.spaces.Space
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.api.service.content.SpaceService
import com.atlassian.confluence.api.model.content.Space
import com.atlassian.confluence.spaces.Space
import com.atlassian.confluence.api.service.content.SpaceService
import com.onresolve.scriptrunner.runner.ScriptRunnerImpl
def spaceManager = ComponentLocator.getComponent(SpaceManager)
def pageManager = ComponentLocator.getComponent(PageManager)
String spaceKey = "IWIKI"
SpaceService spaceService = ScriptRunnerImpl.getPluginComponent(SpaceService)
// here's the tricky part, just go with it
Space space = spaceService.find().withKeys(spaceKey).fetch()
List<Page> pages = pageManager.getPages(space, true)
I am getting the following error:
Anyone knows what the problem is? I think spaceService.find().withKeys(spaceKey).fetch() is returning an object of type com.atlassian.confluence.api.model.content.Space and the next line pageManager.getPage(space, true) is expecting a space parameter of type com.atlassian.confluence.spaces.Space