baasic-sdk-angularjs
Version:
AngularJS SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
229 lines (162 loc) • 5.7 kB
Markdown
Baasic Value Set Service provides an easy way to consume Baasic Value Set REST end-points.
* * *
Returns a promise that is resolved once the find action has been performed. Success response returns a list of value set resources matching given criteria.
**Example**:
```js
baasicValueSetService.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 value set resource.
**Example**:
```js
baasicValueSetService.get('<value-set-name>')
.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 value set action has been performed; this action creates a new value set resource.
**Example**:
```js
baasicValueSetService.create({
name: '<value-set-name>',
description: '<description>',
values: [{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 value set action has been performed; this action updates a value set resource.
**Example**:
```js
// valueSet is a resource previously fetched using get action.
valueSet.name = '<new-name>';
baasicValueSetService.update(valueSet)
.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 delete a value set resource if the action is completed successfully.
**Example**:
```js
// valueSet is a resource previously fetched using get action.
baasicValueSetService.remove(valueSet)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
Provides direct access to route definition.
**Example**:
```js
baasicValueSetService.routeService.get('<id>', expandObject);
```
Returns a promise that is resolved once the find action has been performed. Success response returns a list of value set item resources matching given criteria.
**Example**:
```js
baasicValueSetService.items.find({
setName: '<value-set-name>',
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 value set item resource.
**Example**:
```js
baasicValueSetService.items.get('<value-set-name>', '<set-item-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 value set item action has been performed; this action creates a new value set item resource.
**Example**:
```js
baasicValueSetService.items.create({
setId: '<value-set-id>',
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 value set item action has been performed; this action updates a value set item resource.
**Example**:
```js
// valueSetItem is a resource previously fetched using get action.
valueSetItem.value = '<new-value>';
baasicValueSetService.items.update(valueSetItem)
.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 delete a value set item if the action is completed successfully.
**Example**:
```js
// valueSetItem is a resource previously fetched using get action.
baasicValueSetService.items.remove(valueSetItem)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
* * *
**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