Issue with getting locaitons list using LocationsAPI

The API documentation for the getLocations() method says this.
try {
List result = apiInstance.getLocations(pageSize, pageNumber, sortOrder);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling LocationsApi#getLocations");
e.printStackTrace();
}

However when trying to use this code, the structure of the response is not a List but
a response object which has other variables like pageNumber and pageSize along with the List of LocationDefinition.

{
"entities": [
{
"id": "ae6c5b1b-ab37-4400-8d90-188bec0e4800",
"name": "Gold Coast",
"addressVerified": false,
"state": "active",
"version": 1,
"selfUri": "/api/v2/locations/ae6c5b1b-ab37-4400-8d90-188bec0e4800"
},
{
"id": "e66a55ca-a8c5-4443-88e5-e5624dbaca78",
"name": "Level 18",
"addressVerified": false,
"state": "active",
"version": 1,
"path": [
"57ec8235058d081b93eb9853"
],
"selfUri": "/api/v2/locations/e66a55ca-a8c5-4443-88e5-e5624dbaca78"
}],
"pageSize": 100,
"pageNumber": 1
}
So the API always gives an error in the response mapping. Has anyone used this API and succeeded to get the location list and How ?
Please advise if I am using the api in the wrong manner.

The type definition for the response in the SDK is incorrect because the resource is incorrectly documented. CORE-6042 exists to correct the documentation.

The workaround until that issue is fixed is to locally build a version of the SDK that contains an updated class that matches the actual response sent by the API.

Thanks Tim. Got it fixed with a custom response class.