new CompositeService()
The ApyService provides an Object which will load, each of your Eve's REST API schema endpoint(s) and gives you:
- A full CRUD MMI for each (Tables, Lists, Forms, ...)
- A configurable endpoint URI
- A configurable CSS theme (default: Bootstrap 3)
Example
var settings = $apy.settings.create({
// configuration example
endpoints: {
root: {
port: 5000,
hostname: "http://localhost"
}
},
authentication: {
enabled: true,
grant_type: 'password',
endpoint: 'http://localhost:5000/oauth/token',
client_id: '<your-client-id>'
},
development: {
TRUE: true
}
});
angular.module('myModule', [])
.provider('apy', function apyProvider() {
this.$get = function apyFactory() {
var $injector = angular.injector(['ng', 'ngFileUpload']);
$apy.settings.set('$http', $injector.get('$http'));
$apy.settings.set('$upload', $injector.get('Upload'));
return new $apy.CompositeService();
};
})
.controller('indexCtrl', ['$scope', 'apy', function($scope, apyProvider) {}]);
Extends
Methods
-
<static> asyncLoadSchemas()
-
Load schema definitions endpoint asynchronously
Returns:
Asynchronous call
- Type
- Promise
-
<static> authenticate(protocol, credentials, method, headers)
-
Authenticate against Authentication Server Template method aggregating all known protocols authentication
Parameters:
Name Type Description protocolstring Protocol used (Oauth, Oauth2, Token-based, ...)
credentialsObject Object representing credentials
Properties
Name Type Description client_idstring Oauth2
CLIENT IDgrant_typestring Oauth2
GRANT TYPE(eg. password)usernamestring USERNAMEpasswordstring PASSWORDmethodstring HTTP Method Verb (GET, POST)
headersObject (optional) HTTP Headers
Returns:
Asynchronous call
- Type
- Promise
-
<static> authenticateOAuth2(credentials, method, headers)
-
Authenticate against Authentication Server (Oauth2 protocol)
Parameters:
Name Type Description credentialsObject Object representing credentials
Properties
Name Type Description client_idstring Oauth2
CLIENT IDgrant_typestring Oauth2
GRANT TYPE(eg. password)usernamestring USERNAMEpasswordstring PASSWORDmethodstring HTTP Method Verb (GET, POST)
headersObject (optional) HTTP Headers
Returns:
Asynchronous call
- Type
- Promise
-
<static> authenticateTokenBased(credentials, method, headers)
-
Authenticate against Authentication Server (Token-based protocol)
Parameters:
Name Type Description credentialsObject Object representing credentials
Properties
Name Type Description usernamestring USERNAMEpasswordstring PASSWORDmethodstring HTTP Method Verb (GET, POST)
headersObject (optional) HTTP Headers
Returns:
Asynchronous call
- Type
- Promise
-
<static> createCollection(name, components)
-
Create a collection instance
Parameters:
Name Type Description namestring Backend Resource name
componentsArray A list of initial components
Returns:
Created Collection
-
<static> invalidate()
-
Authentication invalidation
Returns:
Asynchronous call
- Type
- Promise
-
<static> isAuthenticated(source)
-
Property method which holds, whether or not the User is authenticated
Parameters:
Name Type Description sourcefunction Any function returning token info.
Returns:
Whether User is authenticated or not
- Type
- Boolean
-
<static> loadSchemas(async)
-
Load schema definitions endpoint (a)synchronously
Template method to manage (a)synchronous worlds
Parameters:
Name Type Description asyncboolean Load asynchronously or not
Returns:
Asynchronous call
- Type
- Promise
-
<static> setDependencies()
-
Set dependencies
Returns:
itself (chaining pattern)
- Type
- apy.CompositeService
-
<static> setSchemas(schemas)
-
Schemas Setter
Parameters:
Name Type Description schemasObject The Schemas object got from config or backend endpoint
Returns:
itself (chaning pattern)
- Type
- apy.CompositeService