RuleService
Extends:
Service handling Rule calls with specific endpoints.
Constructor Summary
Public Constructor | ||
public |
Update type to be rules |
Method Summary
Public Methods | ||
public |
|
|
public |
|
|
public |
this method was deprecated. Returns all reminder events.
|
|
public |
getEventsByDate(ruleId: String, date: String): Promise this method was deprecated. Returns all the vents for a given rule that occur on the supplied date.
If the date is in the future, new events may be created depending on the
rules and their schedule.
|
|
public |
getEventsByRule(ruleId: String): Promise this method was deprecated. Returns all reminder events. Requires a rule ID to filter the events to return.
|
|
public |
getFilteredRecentEvents(ruleId: String, timeUnit: String): Promise this method was deprecated. Returns the most recent events for all rules. This method requires a rule ID in order
to filter the recent events by rules. Optionally, the time unit can be specified
to filter the events to return.
|
|
public |
getNextEvent(ruleId: String): Promise this method was deprecated. Returns the next event for a given rule. If there is not a next event
a 404 status will be returned.
|
|
public |
getRecentEvents(timeUnit: String): Promise this method was deprecated. Returns the most recent events for all rules. Optionally, the time unit can be specified
to filter the events to return.
|
|
public |
getUpcomingEvents(ruleId: String, timeUnit: String): Promise this method was deprecated. Returns the events that will occur soon for the given rule ID.
Optionally, the time unit can be specified to filter the events to return.
|
|
public |
|
|
public |
this method was deprecated. Marks the event depending on the action given. The results can vary depending on the time this
method is called. If an invalid action is given, it will be interpreted as 'ignored'.
Event action is either 'completed' or 'ignored'. Passes parameters in URL.
|
|
public |
markEventByObj(ruleId: String, eventChange: Object): Promise this method was deprecated. Marks the event depending on the action given. The results can vary depending on the time this
method is called. If an invalid action is given, it will be interpreted as 'ignored'.
Event action is either 'completed' or 'ignored'. Events will be marked based
off of the supplied eventChange object. The event ID and event action will be passed
through the eventChange object and not by URL parameters.
|
|
public |
|
Inherited Summary
From class AbstractService | ||
public get |
|
|
public set |
|
|
public |
|
|
private |
|
From class JsonApiService | ||
public |
options: * |
|
public |
Call a DELETE request on the main obj.type expecting JSON API information. |
|
public |
Call a GET request expecting JSON API information. |
|
public |
async getChildren(parent: Object, child: Object, options: String): Promise Call a GET request expecting JSON API information for children given a parent. |
|
public |
Call a POST request on the main obj.type expecting JSON API information. |
|
public |
Call a PATCH request on the main obj.type expecting JSON API information. |
Public Constructors
Public Members
Public Methods
public async delete(rule: Rule, cacheMode: String): Promise source
Call a DELETE request on the main obj.type expecting JSON API information.
Override:
JsonApiService#deleteExample:
import { ruleService } from 'clinical6';
// You will be able to delete a rule using `delete`.
ruleService.delete({ id: 23 });
// This will also clear the local storage of this type and id
public async get(params: Object, cacheMode: String): Promise<Rule[]|Rule> source
Call a GET request expecting JSON API information.
Override:
JsonApiService#getThrow:
If missing token or missing required parameters |
Example:
import { ruleService } from 'clinical6';
// You will be able to access these rules using the `get` method.
ruleService.get().then(rules => console.log(rules));
// Additionally, you can retrieve the subcategories for a specific rule with the `get`
// method, using the ID of the desired rule as a parameter.
ruleService.get(23).then(rule => console.log(rule));
public getEvents(ruleId: String): Promise source
Params:
Name | Type | Attribute | Description |
ruleId | String | The rule ID to check for events. (optional) |
Decorators:
- deprecate
public getEventsByDate(ruleId: String, date: String): Promise source
Decorators:
- deprecate
public getEventsByRule(ruleId: String): Promise source
Params:
Name | Type | Attribute | Description |
ruleId | String | The rule ID to check for events. (required) |
Decorators:
- deprecate
public getFilteredRecentEvents(ruleId: String, timeUnit: String): Promise source
Decorators:
- deprecate
Test:
- [unit] RuleService.getFilteredRecentEvents should throw an error when there is no ruleId
- [unit] RuleService.getFilteredRecentEvents should receive a valid response for a get request
- [unit] RuleService.getFilteredRecentEvents should receive a valid response for a get request with the timeUnit parameter
public getNextEvent(ruleId: String): Promise source
Params:
Name | Type | Attribute | Description |
ruleId | String | The rule ID to check for the next event. |
Decorators:
- deprecate
public getRecentEvents(timeUnit: String): Promise source
Params:
Name | Type | Attribute | Description |
timeUnit | String | The time cap for recent events. Must be either 'week' or 'month' (optional) |
Decorators:
- deprecate
public getUpcomingEvents(ruleId: String, timeUnit: String): Promise source
Decorators:
- deprecate
public async insert(rule: Rule, cacheMode: String): Promise<Rule> source
Call a POST request on the main obj.type expecting JSON API information.
Override:
JsonApiService#insertExample:
import { Rule, ruleService } from 'clinical6';
const rule = new Rule({...});
// you can insert a rule using the `insert` method.
ruleService.insert(mobileApplicationKey).then(rule => console.log(rule));
// you could also just call `save` on the rule if it doesn't have an id, which will also
// invoke the `insert` method
rule.save();
public markEvent(ruleId: String, eventId: String, eventAction: String): Promise source
Params:
Name | Type | Attribute | Description |
ruleId | String | Permanent link of the rule of the event to update. |
|
eventId | String | ID value of the event to update. |
|
eventAction | String | The optional event action indicates the action to mark the event with. Event action must either be 'completed' or 'ignored'. If no value or an invalid value is provided, the event action will be interpreted as 'ignored'. |
Decorators:
- deprecate
public markEventByObj(ruleId: String, eventChange: Object): Promise source
Params:
Name | Type | Attribute | Description |
ruleId | String | Permanent link of the rule of the event to update. |
|
eventChange | Object | Object with the changes to make for the event |
|
eventChange.id | Number | The ID of the event to mark. If no ID value is supplied no change will be made. (optional) |
|
eventChange.event_action | String | The optional event action indicates the action to mark the event with. Event action must either be 'completed' or 'ignored'. If no value or an invalid value is provided, the event action will be interpreted as 'ignored'. |
Decorators:
- deprecate
public async update(rule: Rule, cacheMode: String): Promise<Rule> source
Call a PATCH request on the main obj.type expecting JSON API information.
Override:
JsonApiService#updateExample:
import { Rule, ruleService } from 'clinical6';
const rule = new Rule({...});
// you can update a rule using the `update` method.
ruleService.update(rule).then(rule => console.log(rule));
// you could also just call `save` on the rule if it has an id, which will also
// invoke the `update` method
rule.save();