@@ -33,6 +33,1097 @@ var urlBaseHost = getHost(urlBase) || location.host;
*/
var module = angular . module ( "lbServices" , [ 'ngResource' ] ) ;
/**
* @ngdoc object
* @name lbServices.User
* @header lbServices.User
* @object
*
* @description
*
* A $resource object for interacting with the `User` model.
*
* ## Example
*
* See
* {@link http://docs.angularjs.org/api/ngResource.$resource#example $resource}
* for an example of using this object.
*
*/
module . factory (
"User" ,
[ 'LoopBackResource' , 'LoopBackAuth' , '$injector' , function ( Resource , LoopBackAuth , $injector ) {
var R = Resource (
urlBase + "/Users/:id" ,
{ 'id' : '@id' } ,
{
/**
* @ngdoc method
* @name lbServices.User#prototype$__findById__accessTokens
* @methodOf lbServices.User
*
* @description
*
* Find a related item by id for accessTokens.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `fk` – `{*}` - Foreign key for accessTokens
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"prototype$__findById__accessTokens" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/Users/:id/accessTokens/:fk" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#prototype$__destroyById__accessTokens
* @methodOf lbServices.User
*
* @description
*
* Delete a related item by id for accessTokens.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `fk` – `{*}` - Foreign key for accessTokens
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* This method returns no data.
*/
"prototype$__destroyById__accessTokens" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/Users/:id/accessTokens/:fk" ,
method : "DELETE"
} ,
/**
* @ngdoc method
* @name lbServices.User#prototype$__updateById__accessTokens
* @methodOf lbServices.User
*
* @description
*
* Update a related item by id for accessTokens.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `fk` – `{*}` - Foreign key for accessTokens
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"prototype$__updateById__accessTokens" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/Users/:id/accessTokens/:fk" ,
method : "PUT"
} ,
/**
* @ngdoc method
* @name lbServices.User#prototype$__get__accessTokens
* @methodOf lbServices.User
*
* @description
*
* Queries accessTokens of User.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `filter` – `{object=}` -
*
* @param {function(Array.<Object>,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Array.<Object> } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"prototype$__get__accessTokens" : {
isArray : true ,
url : urlBase + "/Users/:id/accessTokens" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#prototype$__create__accessTokens
* @methodOf lbServices.User
*
* @description
*
* Creates a new instance in accessTokens of this model.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"prototype$__create__accessTokens" : {
url : urlBase + "/Users/:id/accessTokens" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#prototype$__delete__accessTokens
* @methodOf lbServices.User
*
* @description
*
* Deletes all accessTokens of this model.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* This method returns no data.
*/
"prototype$__delete__accessTokens" : {
url : urlBase + "/Users/:id/accessTokens" ,
method : "DELETE"
} ,
/**
* @ngdoc method
* @name lbServices.User#prototype$__count__accessTokens
* @methodOf lbServices.User
*
* @description
*
* Counts accessTokens of User.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `where` – `{object=}` - Criteria to match model instances
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* Data properties:
*
* - `count` – `{number=}` -
*/
"prototype$__count__accessTokens" : {
url : urlBase + "/Users/:id/accessTokens/count" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#create
* @methodOf lbServices.User
*
* @description
*
* Create a new instance of the model and persist it into the data source.
*
* @param {Object= } parameters Request parameters.
*
* This method does not accept any parameters.
* Supply an empty object or omit this argument altogether.
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"create" : {
url : urlBase + "/Users" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#createMany
* @methodOf lbServices.User
*
* @description
*
* Create a new instance of the model and persist it into the data source.
*
* @param {Object= } parameters Request parameters.
*
* This method does not accept any parameters.
* Supply an empty object or omit this argument altogether.
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Array.<Object>,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Array.<Object> } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"createMany" : {
isArray : true ,
url : urlBase + "/Users" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#upsert
* @methodOf lbServices.User
*
* @description
*
* Update an existing model instance or insert a new one into the data source.
*
* @param {Object= } parameters Request parameters.
*
* This method does not accept any parameters.
* Supply an empty object or omit this argument altogether.
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"upsert" : {
url : urlBase + "/Users" ,
method : "PUT"
} ,
/**
* @ngdoc method
* @name lbServices.User#exists
* @methodOf lbServices.User
*
* @description
*
* Check whether a model instance exists in the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - Model id
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* Data properties:
*
* - `exists` – `{boolean=}` -
*/
"exists" : {
url : urlBase + "/Users/:id/exists" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#findById
* @methodOf lbServices.User
*
* @description
*
* Find a model instance by id from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - Model id
*
* - `filter` – `{object=}` - Filter defining fields and include
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"findById" : {
url : urlBase + "/Users/:id" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#find
* @methodOf lbServices.User
*
* @description
*
* Find all instances of the model matched by filter from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `filter` – `{object=}` - Filter defining fields, where, include, order, offset, and limit
*
* @param {function(Array.<Object>,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Array.<Object> } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"find" : {
isArray : true ,
url : urlBase + "/Users" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#findOne
* @methodOf lbServices.User
*
* @description
*
* Find first instance of the model matched by filter from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `filter` – `{object=}` - Filter defining fields, where, include, order, offset, and limit
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"findOne" : {
url : urlBase + "/Users/findOne" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#updateAll
* @methodOf lbServices.User
*
* @description
*
* Update instances of the model matched by where from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `where` – `{object=}` - Criteria to match model instances
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* The number of instances updated
*/
"updateAll" : {
url : urlBase + "/Users/update" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#deleteById
* @methodOf lbServices.User
*
* @description
*
* Delete a model instance by id from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - Model id
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"deleteById" : {
url : urlBase + "/Users/:id" ,
method : "DELETE"
} ,
/**
* @ngdoc method
* @name lbServices.User#count
* @methodOf lbServices.User
*
* @description
*
* Count instances of the model matched by where from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `where` – `{object=}` - Criteria to match model instances
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* Data properties:
*
* - `count` – `{number=}` -
*/
"count" : {
url : urlBase + "/Users/count" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#prototype$updateAttributes
* @methodOf lbServices.User
*
* @description
*
* Update attributes for a model instance and persist it into the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
"prototype$updateAttributes" : {
url : urlBase + "/Users/:id" ,
method : "PUT"
} ,
/**
* @ngdoc method
* @name lbServices.User#createChangeStream
* @methodOf lbServices.User
*
* @description
*
* Create a change stream.
*
* @param {Object= } parameters Request parameters.
*
* This method does not accept any parameters.
* Supply an empty object or omit this argument altogether.
*
* @param {Object } postData Request data.
*
* - `options` – `{object=}` -
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* Data properties:
*
* - `changes` – `{ReadableStream=}` -
*/
"createChangeStream" : {
url : urlBase + "/Users/change-stream" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#login
* @methodOf lbServices.User
*
* @description
*
* Login a user with username/email and password.
*
* @param {Object= } parameters Request parameters.
*
* - `include` – `{string=}` - Related objects to include in the response. See the description of return value for more details.
* Default value: `user`.
*
* - `rememberMe` - `boolean` - Whether the authentication credentials
* should be remembered in localStorage across app/browser restarts.
* Default: `true`.
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* The response body contains properties of the AccessToken created on login.
* Depending on the value of `include` parameter, the body may contain additional properties:
*
* - `user` - `{User}` - Data of the currently logged in user. (`include=user`)
*
*
*/
"login" : {
params : {
include : "user"
} ,
interceptor : {
response : function ( response ) {
var accessToken = response . data ;
LoopBackAuth . setUser ( accessToken . id , accessToken . userId , accessToken . user ) ;
LoopBackAuth . rememberMe = response . config . params . rememberMe !== false ;
LoopBackAuth . save ( ) ;
return response . resource ;
}
} ,
url : urlBase + "/Users/login" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#logout
* @methodOf lbServices.User
*
* @description
*
* Logout a user with access token.
*
* @param {Object= } parameters Request parameters.
*
* This method does not accept any parameters.
* Supply an empty object or omit this argument altogether.
*
* @param {Object } postData Request data.
*
* - `access_token` – `{string}` - Do not supply this argument, it is automatically extracted from request headers.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* This method returns no data.
*/
"logout" : {
interceptor : {
response : function ( response ) {
LoopBackAuth . clearUser ( ) ;
LoopBackAuth . clearStorage ( ) ;
return response . resource ;
}
} ,
url : urlBase + "/Users/logout" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#confirm
* @methodOf lbServices.User
*
* @description
*
* Confirm a user registration with email verification token.
*
* @param {Object= } parameters Request parameters.
*
* - `uid` – `{string}` -
*
* - `token` – `{string}` -
*
* - `redirect` – `{string=}` -
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* This method returns no data.
*/
"confirm" : {
url : urlBase + "/Users/confirm" ,
method : "GET"
} ,
/**
* @ngdoc method
* @name lbServices.User#resetPassword
* @methodOf lbServices.User
*
* @description
*
* Reset password for a user with email.
*
* @param {Object= } parameters Request parameters.
*
* This method does not accept any parameters.
* Supply an empty object or omit this argument altogether.
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* This method returns no data.
*/
"resetPassword" : {
url : urlBase + "/Users/reset" ,
method : "POST"
} ,
/**
* @ngdoc method
* @name lbServices.User#getCurrent
* @methodOf lbServices.User
*
* @description
*
* Get data of the currently logged user. Fail with HTTP result 401
* when there is no user logged in.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*/
"getCurrent" : {
url : urlBase + "/Users" + "/:id" ,
method : "GET" ,
params : {
id : function ( ) {
var id = LoopBackAuth . currentUserId ;
if ( id == null ) id = '__anonymous__' ;
return id ;
} ,
} ,
interceptor : {
response : function ( response ) {
LoopBackAuth . currentUserData = response . data ;
return response . resource ;
}
} ,
__isGetCurrentUser__ : true
}
}
) ;
/**
* @ngdoc method
* @name lbServices.User#updateOrCreate
* @methodOf lbServices.User
*
* @description
*
* Update an existing model instance or insert a new one into the data source.
*
* @param {Object= } parameters Request parameters.
*
* This method does not accept any parameters.
* Supply an empty object or omit this argument altogether.
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
R [ "updateOrCreate" ] = R [ "upsert" ] ;
/**
* @ngdoc method
* @name lbServices.User#update
* @methodOf lbServices.User
*
* @description
*
* Update instances of the model matched by where from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `where` – `{object=}` - Criteria to match model instances
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* The number of instances updated
*/
R [ "update" ] = R [ "updateAll" ] ;
/**
* @ngdoc method
* @name lbServices.User#destroyById
* @methodOf lbServices.User
*
* @description
*
* Delete a model instance by id from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - Model id
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
R [ "destroyById" ] = R [ "deleteById" ] ;
/**
* @ngdoc method
* @name lbServices.User#removeById
* @methodOf lbServices.User
*
* @description
*
* Delete a model instance by id from the data source.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - Model id
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `User` object.)
* </em>
*/
R [ "removeById" ] = R [ "deleteById" ] ;
/**
* @ngdoc method
* @name lbServices.User#getCachedCurrent
* @methodOf lbServices.User
*
* @description
*
* Get data of the currently logged user that was returned by the last
* call to {@link lbServices.User#login} or
* {@link lbServices.User#getCurrent}. Return null when there
* is no user logged in or the data of the current user were not fetched
* yet.
*
* @returns {Object } A User instance.
*/
R . getCachedCurrent = function ( ) {
var data = LoopBackAuth . currentUserData ;
return data ? new R ( data ) : null ;
} ;
/**
* @ngdoc method
* @name lbServices.User#isAuthenticated
* @methodOf lbServices.User
*
* @returns {boolean } True if the current user is authenticated (logged in).
*/
R . isAuthenticated = function ( ) {
return this . getCurrentId ( ) != null ;
} ;
/**
* @ngdoc method
* @name lbServices.User#getCurrentId
* @methodOf lbServices.User
*
* @returns {Object } Id of the currently logged-in user or null.
*/
R . getCurrentId = function ( ) {
return LoopBackAuth . currentUserId ;
} ;
/**
* @ngdoc property
* @name lbServices.User#modelName
* @propertyOf lbServices.User
* @description
* The name of the model represented by this $resource,
* i.e. `User`.
*/
R . modelName = "User" ;
return R ;
} ] ) ;
/**
* @ngdoc object
* @name lbServices.Poll
@@ -537,65 +1628,6 @@ module.factory(
url : urlBase + "/Questions/:id/poll" ,
method : "GET"
} ,
// INTERNAL. Use Person.polls.findById() instead.
"::findById::Person::polls" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/People/:id/polls/:fk" ,
method : "GET"
} ,
// INTERNAL. Use Person.polls.destroyById() instead.
"::destroyById::Person::polls" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/People/:id/polls/:fk" ,
method : "DELETE"
} ,
// INTERNAL. Use Person.polls.updateById() instead.
"::updateById::Person::polls" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/People/:id/polls/:fk" ,
method : "PUT"
} ,
// INTERNAL. Use Person.polls() instead.
"::get::Person::polls" : {
isArray : true ,
url : urlBase + "/People/:id/polls" ,
method : "GET"
} ,
// INTERNAL. Use Person.polls.create() instead.
"::create::Person::polls" : {
url : urlBase + "/People/:id/polls" ,
method : "POST"
} ,
// INTERNAL. Use Person.polls.createMany() instead.
"::createMany::Person::polls" : {
isArray : true ,
url : urlBase + "/People/:id/polls" ,
method : "POST"
} ,
// INTERNAL. Use Person.polls.destroyAll() instead.
"::delete::Person::polls" : {
url : urlBase + "/People/:id/polls" ,
method : "DELETE"
} ,
// INTERNAL. Use Person.polls.count() instead.
"::count::Person::polls" : {
url : urlBase + "/People/:id/polls/count" ,
method : "GET"
} ,
}
) ;
@@ -3980,33 +5012,6 @@ module.factory(
method : "PUT"
} ,
// INTERNAL. Use Person.polls.findById() instead.
"prototype$__findById__polls" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/People/:id/polls/:fk" ,
method : "GET"
} ,
// INTERNAL. Use Person.polls.destroyById() instead.
"prototype$__destroyById__polls" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/People/:id/polls/:fk" ,
method : "DELETE"
} ,
// INTERNAL. Use Person.polls.updateById() instead.
"prototype$__updateById__polls" : {
params : {
'fk' : '@fk'
} ,
url : urlBase + "/People/:id/polls/:fk" ,
method : "PUT"
} ,
/**
* @ngdoc method
* @name lbServices.Person#prototype$__get__accessTokens
@@ -4139,33 +5144,8 @@ module.factory(
*
* - `count` – `{number=}` -
*/
"prototype$__count__accessTokens" : {
url : urlBase + "/People/:id/accessTokens/count" ,
method : "GET"
} ,
// INTERNAL. Use Person.polls() instead.
"prototype$__get__polls" : {
isArray : true ,
url : urlBase + "/People/:id/polls" ,
method : "GET"
} ,
// INTERNAL. Use Person.polls.create() instead.
"prototype$__create__polls" : {
url : urlBase + "/People/:id/polls" ,
method : "POST"
} ,
// INTERNAL. Use Person.polls.destroyAll() instead.
"prototype$__delete__polls" : {
url : urlBase + "/People/:id/polls" ,
method : "DELETE"
} ,
// INTERNAL. Use Person.polls.count() instead.
"prototype$__count__polls" : {
url : urlBase + "/People/:id/polls/count" ,
"prototype$__count__accessTokens" : {
url : urlBase + "/People/:id/accessTokens/count" ,
method : "GET"
} ,
@@ -4979,307 +5959,6 @@ module.factory(
*/
R . modelName = "Person" ;
/**
* @ngdoc object
* @name lbServices.Person.polls
* @header lbServices.Person.polls
* @object
* @description
*
* The object `Person.polls` groups methods
* manipulating `Poll` instances related to `Person`.
*
* Call {@link lbServices.Person#polls Person.polls()}
* to query all related instances.
*/
/**
* @ngdoc method
* @name lbServices.Person#polls
* @methodOf lbServices.Person
*
* @description
*
* Queries polls of Person.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `filter` – `{object=}` -
*
* @param {function(Array.<Object>,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Array.<Object> } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `Poll` object.)
* </em>
*/
R . polls = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::get::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
/**
* @ngdoc method
* @name lbServices.Person.polls#count
* @methodOf lbServices.Person.polls
*
* @description
*
* Counts polls of Person.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `where` – `{object=}` - Criteria to match model instances
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* Data properties:
*
* - `count` – `{number=}` -
*/
R . polls . count = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::count::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
/**
* @ngdoc method
* @name lbServices.Person.polls#create
* @methodOf lbServices.Person.polls
*
* @description
*
* Creates a new instance in polls of this model.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `Poll` object.)
* </em>
*/
R . polls . create = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::create::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
/**
* @ngdoc method
* @name lbServices.Person.polls#createMany
* @methodOf lbServices.Person.polls
*
* @description
*
* Creates a new instance in polls of this model.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Array.<Object>,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Array.<Object> } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `Poll` object.)
* </em>
*/
R . polls . createMany = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::createMany::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
/**
* @ngdoc method
* @name lbServices.Person.polls#destroyAll
* @methodOf lbServices.Person.polls
*
* @description
*
* Deletes all polls of this model.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* This method returns no data.
*/
R . polls . destroyAll = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::delete::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
/**
* @ngdoc method
* @name lbServices.Person.polls#destroyById
* @methodOf lbServices.Person.polls
*
* @description
*
* Delete a related item by id for polls.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `fk` – `{*}` - Foreign key for polls
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* This method returns no data.
*/
R . polls . destroyById = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::destroyById::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
/**
* @ngdoc method
* @name lbServices.Person.polls#findById
* @methodOf lbServices.Person.polls
*
* @description
*
* Find a related item by id for polls.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `fk` – `{*}` - Foreign key for polls
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `Poll` object.)
* </em>
*/
R . polls . findById = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::findById::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
/**
* @ngdoc method
* @name lbServices.Person.polls#updateById
* @methodOf lbServices.Person.polls
*
* @description
*
* Update a related item by id for polls.
*
* @param {Object= } parameters Request parameters.
*
* - `id` – `{*}` - User id
*
* - `fk` – `{*}` - Foreign key for polls
*
* @param {Object } postData Request data.
*
* This method expects a subset of model properties as request parameters.
*
* @param {function(Object,Object)= } successCb
* Success callback with two arguments: `value`, `responseHeaders`.
*
* @param {function(Object)= } errorCb Error callback with one argument:
* `httpResponse`.
*
* @returns {Object } An empty reference that will be
* populated with the actual data once the response is returned
* from the server.
*
* <em>
* (The remote method definition does not provide any description.
* This usually means the response is a `Poll` object.)
* </em>
*/
R . polls . updateById = function ( ) {
var TargetResource = $injector . get ( "Poll" ) ;
var action = TargetResource [ "::updateById::Person::polls" ] ;
return action . apply ( R , arguments ) ;
} ;
return R ;
} ] ) ;