How can I interact with Users via the ElementAPI? I am attempting to use the ElementAPI to check if a user is logged in or not. I've used the ElementAPI before to check/get entries for a given section, but never for user-based entries.

Here is my elementapi.php file:

&lt;?php
namespace Craft;

return [
    'endpoints' =&gt; [
        'user/current.json' =&gt; [
            'elementType' =&gt; 'User',
            'criteria' =&gt; [
                'foo' =&gt; 'bar', // Not sure what to do here.
            ],
            'transformer' =&gt; function (EntryModel $user) {
                // Not sure about this either...
                if ($user-&gt;isCurrent) {
                    return [
                        'status' =&gt; true
                    ];
                } else {
                    return [
                        'status' =&gt; false
                    ];
                }
            },
        ]
    ]
];


I'm getting to the plugin, but It really is not happy with what I'm giving it:

Argument 1 passed to Craft\ConfigService::Craft\{closure}() must be an instance of Craft\EntryModel, instance of Craft\UserModel given


Pretty sure it has something to do with the criteria?
Change



function (EntryModel $user)


to 

function (UserModel $user)


You were passing in a user to a function that’s expecting an EntryModel. That’s the reason for the error you are getting.