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 protocol
string Protocol used (Oauth, Oauth2, Token-based, ...)
credentials
Object Object representing credentials
Properties
Name Type Description client_id
string Oauth2
CLIENT ID
grant_type
string Oauth2
GRANT TYPE
(eg. password)username
string USERNAME
password
string PASSWORD
method
string HTTP Method Verb (GET, POST)
headers
Object (optional) HTTP Headers
Returns:
Asynchronous call
- Type
- Promise
-
<static> authenticateOAuth2(credentials, method, headers)
-
Authenticate against Authentication Server (Oauth2 protocol)
Parameters:
Name Type Description credentials
Object Object representing credentials
Properties
Name Type Description client_id
string Oauth2
CLIENT ID
grant_type
string Oauth2
GRANT TYPE
(eg. password)username
string USERNAME
password
string PASSWORD
method
string HTTP Method Verb (GET, POST)
headers
Object (optional) HTTP Headers
Returns:
Asynchronous call
- Type
- Promise
-
<static> authenticateTokenBased(credentials, method, headers)
-
Authenticate against Authentication Server (Token-based protocol)
Parameters:
Name Type Description credentials
Object Object representing credentials
Properties
Name Type Description username
string USERNAME
password
string PASSWORD
method
string HTTP Method Verb (GET, POST)
headers
Object (optional) HTTP Headers
Returns:
Asynchronous call
- Type
- Promise
-
<static> createCollection(name, components)
-
Create a collection instance
Parameters:
Name Type Description name
string Backend Resource name
components
Array 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 source
function 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 async
boolean 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 schemas
Object The Schemas object got from config or backend endpoint
Returns:
itself (chaning pattern)
- Type
- apy.CompositeService