baasic-sdk-angularjs
Version:
AngularJS SDK provides core functionality for building web and mobile applications on [Baasic](http://www.baasic.com/).
325 lines (235 loc) • 12 kB
Markdown
# baasicArticleCommentRepliesService
Baasic Article Comment Replies Service provides an easy way to consume Baasic Article Comment Replies REST API end-points. `baasicArticleCommentRepliesService` functions enable performing standard CRUD operations directly on article comment reply resources, whereas the `baasicArticleService` functions allow management between article and article comment reply. In order to obtain needed routes `baasicArticleCommentRepliesService` uses `baasicArticleCommentRepliesRouteService`.
* * *
### baasicArticleCommentRepliesService.statuses()
Contains a reference to valid list of article comment reply states. It returns an object containing all article comment reply states.
**Example**:
```js
baasicArticleCommentRepliesService.statuses.approved;
```
### baasicArticleCommentRepliesService.approve()
Returns a promise that is resolved once the approve article comment reply action has been performed. This action sets the state of an article comment reply to "approved". This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-approve').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.approve(articleCommentReply, commentOptions)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.unapprove()
Returns a promise that is resolved once the unapprove article comment reply action has been performed. This action sets the state of an article comment reply to "unapproved". This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-unapprove').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.unapprove(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.create()
Returns a promise that is resolved once the create article comment reply action has been performed; this action creates a new comment reply for an article.
**Example**:
```js
baasicArticleCommentRepliesService.create('<article-id>', {
commentId : '<comment-id>',
comment : <comment>,
userId : '<user-id>'
})
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.find()
Returns a promise that is resolved once the find action has been performed. Success response returns a list of article comment reply resources matching the given criteria.
**Example**:
```js
baasicArticleCommentRepliesService.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
});
```
### baasicArticleCommentRepliesService.flag()
Returns a promise that is resolved once the flag article comment reply action has been performed. This action sets the state of an article comment reply to "flagged". This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-flag').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.flag(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.unflag()
Returns a promise that is resolved once the unflag article comment reply action has been performed. This action removes the "flagged" comment reply state. This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-unflag').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.unflag(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.get()
Returns a promise that is resolved once the get action has been performed. Success response returns the specified article comment reply resource.
**Example**:
```js
baasicArticleCommentRepliesService.get('<comment-reply-id>')
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.remove()
Returns a promise that is resolved once the remove article comment reply action has been performed. If the action is successfully completed, the article comment reply resource will be permanently removed from the system. This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.removeParams(articleCommentReply);
var uri = params['model'].links('delete').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.remove(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.report()
Returns a promise that is resolved once the report article comment reply action has been performed. This action sets the state of an article comment reply to "reported". This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-report').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.report(articleCommentReply, commentOptions)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.unreport()
Returns a promise that is resolved once the unreport article comment reply action has been performed. This action removes the "reported" comment reply state. This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-unreport').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.unreport(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.spam()
Returns a promise that is resolved once the mark as spam article comment reply action has been performed. This action sets the state of an article comment reply to "spam". This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-spam').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.spam(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.unspam()
Returns a promise that is resolved once the unspam article comment reply action has been performed. This action removes the "spam" comment reply state. This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('comment-unspam').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.unspam(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.update()
Returns a promise that is resolved once the update article comment reply action has been performed; this action updates an article comment reply resource. This route uses HAL enabled objects to obtain routes and therefore it doesn't apply `baasicarticleCommentRepliesRouteService` route template. Here is an example of how a route can be obtained from HAL enabled objects:
```
var params = baasicApiService.updateParams(articleCommentReply);
var uri = params['model'].links('put').href;
```
**Example**:
```js
// articleCommentReply is a resource previously fetched using get action.
baasicArticleCommentRepliesService.update(articleCommentReply)
.success(function (data) {
// perform success action here
})
.error(function (response, status, headers, config) {
// perform error handling here
});
```
### baasicArticleCommentRepliesService.routeService()
Provides direct access to `baasicArticleCommentRepliesRouteService`.
**Example**:
```js
baasicArticleCommentRepliesService.routeService.get(expandObject);
```
* * *
**Notes:**
- Refer to the [REST API documentation](https://github.com/Baasic/baasic-rest-api/wiki) for detailed information about available Baasic REST API end-points.
- All end-point objects are transformed by the associated route service.