$user = $graph->createRequest("GET", "/me")
->setReturnType(Model\User::class)
->execute();
How can I know the return type of /me call is Model\User::class?
To determine endpoint entity type the following approach could be considered. Set Accept
header to odata.metadata=full
to return @odata.type
property along with data in response payload(refer OData spec for a more details)
Example
$resp = $client->createRequest("GET", "/me")
->addHeaders(array(
"Accept" => "application/json;odata.metadata=full;odata.streaming=true"
))
->execute();
$entity = $resp->getBody();
$entityType = $entity["@odata.type"];
Result
For the provide example $entityType
returns #microsoft.graph.user
which corresponds to Microsoft\Graph\Model\User
type from msgraph-sdk-php