Getting boards for a project not working in jira

Hello

I want to get all boards for a certain project in jira using java api
I’m using this method ServiceOutcome<List> boardsForProject=boardService.getBoardsForProject(ApplicationUser var1, long projectId);, and getting the value by: boardsForProject.get() or boardsForProject.getReturnedValue() however it is returning 0 either way Note:ApplicationUser has access to the boards and I’m sure project id is valid

Any idea what is the reason, or any other java api alternative

Thanks in advance