baasic-sdk-angularjs
Version:
AngularJS SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
130 lines (88 loc) • 3.09 kB
Markdown
Baasic Key Value Service provides an easy way to consume Baasic Key Value REST API end-points.
* * *
Returns a promise that is resolved once the find action has been performed. Success response returns a list of key value resources matching the given criteria.
**Example**:
```js
baasicKeyValueService.find({
pageNumber : 1,
pageSize : 10,
orderBy : '<field>',
orderDirection : '<asc|desc>',
search : '<search-phrase>'
})
.success(function (collection) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Returns a promise that is resolved once the get action has been performed. Success response returns the specified key value resource.
**Example**:
```js
baasicKeyValueService.get('<key-value-id>')
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Returns a promise that is resolved once the create key value action has been performed; this action creates a new key value resource.
**Example**:
```js
baasicKeyValueService.create({
key : '<key>',
value : '<value>',
})
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Returns a promise that is resolved once the update key value action has been performed; this action updates a key value resource.
**Example**:
```js
// keyValue is a resource previously fetched using get action.
keyValue.value = '<new-value>';
baasicKeyValueService.update(keyValue)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Returns a promise that is resolved once the remove action has been performed. This action will remove a key value resource from the system if successfully completed.
**Example**:
```js
// keyValue is a resource previously fetched using get action.
baasicKeyValueService.remove(keyValue)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Provides direct access to routeDefinition.
**Example**:
```js
baasicKeyValueService.routeService.get('<id>', { embed:'<embeds>', fields: '<fields>' });
```
* * *
**Notes:**
- Refer to the [Baasic REST API](http://dev.baasic.com/api/reference/home) for detailed information about available Baasic REST API end-points.
- All end-point objects are transformed by the associated route service.
*(c) 2017 Mono Ltd*
**Author:** Mono Ltd
**License:** MIT