API Redux
Classes
- Grp - Class representing a group of items
- Grp
- Interface
Class representing the interface route of the api
- Messages
- Obj - class representing a Single device
- Obj
- User
User - class representing a user
- Users
Users - class representing a group of users
Functions
- verify(targetLocation) ⇒
function gets and verifies the Bearer token
- login(username, password, projectId) ⇒
function will log in the user
- logout() ⇒
function will log the user out
- forgotPassword(username, projectId) ⇒
function sends an email to reset the password
- changePassword(oldPassword, newPassword) ⇒
function change the currently logged in user's password
- resetPassword(username, password, confirm, token, projectId) ⇒
function changes the user's password
- renew(auto) ⇒
function - isLoggedIn(state) ⇒
boolean checks if there is a user logged in
- isLoading(state) ⇒
boolean checks if the ui is attempting to log in or verify a user
- isVerifying(state) ⇒
boolean checks if the ui is attempting to verify a user
- isError(state) ⇒
boolean checks if there was an error on the most recent action taken
- getErrorMessage(state) ⇒
string - getUsername(state) ⇒
string - getUserId(state) ⇒
string - getProfile(state) ⇒
object - isLoading(state, path) ⇒
boolean checks if a query is loading
- isError(state, path) ⇒
boolean check if a query is in error
- isDone(state, path) ⇒
boolean check if a query has completed
- isList(state, path) ⇒
boolean check if a query result is a list
- isTable(state, path) ⇒
boolean check if a query result is a table
- isObject(state, path) ⇒
boolean check if a query result is an object
- getObject(state, path) ⇒
object gets the result of a query if it is an object
- getHistory(state, path, queryName) ⇒
object gets the result of a history query
- getList(state, path, opts) ⇒
array get the list result of a query
- getTable(state, path, opts) ⇒
array get the table result of a query
- setFilter(name, filter)
Registers a filter function against the filter type.
- getFilter()
Returns the filter function registerd at the name
- getTextFilter()
Returns the default text filter
- createPromise(method, path, body, options, type, extra) ⇒
function - list(path, parentId, type, options) ⇒
function - create(path, obj, parentId, type, options) ⇒
function - get(path, parentPath, options) ⇒
function - getHistory(path, parentPath, options, queryName) ⇒
function - remove(path, id, options) ⇒
function - update(path, data, parentPath, parentId, options) ⇒
function - createDeviceUser(path, obj, parentPath, options) ⇒
function - addDeviceUser(path, obj, parentId, options) ⇒
function creates a user, and then addes them to the device
- sendOutboundDeviceMessage(path, obj, parentId, options) ⇒
function sends an outbound message to a device
- updateDeviceUser(path, obj, parentId, options) ⇒
promise - removeDeviceUser(path, obj, parentId, options) ⇒
function - copy()
Shallow copies the state, as well as the lookup and data if needed
- getApiQueryable(query) ⇒
function - getApiQueryable(query) ⇒
function - defaultGetApiQueryable(query) ⇒
function - create(query) ⇒
function - getActionConstant(action, mode) ⇒
string - isSimpleTimeQuery(q) ⇒
boolean - isReversed(opts) ⇒
boolean - mergeItems(items, newItems, range) ⇒
array - getQueryChunks(opts, chunkSize) ⇒
object - getQueryOptions(opts) ⇒
object - receive(state, action)
behavior for the GET action
- update(state, action)
behavior for the UPDATE action
- add(state, action)
behavior for the ADD action
- remove(state, action)
behavior for the REMOVE action
- reducer(initialState, actionTypeBase, additionalReducers)
creates and returns a generic reducer
- list(opts) ⇒
function makes an api call to get the list of current users for the project
- create(item) ⇒
function makes an api call to create a new user
- get(item, opts) ⇒
function makes an api call to get a user
- remove(item) ⇒
function makes an api call to remove a user
- update(item, patchOps, opts) ⇒
function makes an api call to update a user
- forcePWReset(item, projectId) ⇒
function makes an api call sending an email to the provided user making them reset their password
- encodeQ(options)
turns a query object to a string to be appended to an http request url
- objectToQueryString(a)
turns an object into a string that can be used in a http request url
- buildParams(prefix, obj, add)
manipulates obj according to the add function provided to it
- getPatchOpsArray(patchOps)
transforms an object into an array of {path, value, op} objects
- combinePath(path, subpath)
checks for '/' and appends the subpath onto the path
- getId(id, throwIfNull)
returns id if id is string or id.id if id is an object
- getLastInPath(path)
returns the substring after the last '/'
Grp - Class representing a group of items
Grp
Kind: global class
- Grp
- new Grp(parentPath, id, attribute)
- .list(options) ⇒
function - .create(obj, options) ⇒
function - .get(id, options) ⇒
function - .update(id, data, options) ⇒
function - .delete(id, options) ⇒
function - .model(options) ⇒
function - .filter(filter)
- .obj(id) ⇒
Obj - .getList(state, opts) ⇒
object - .isTable(state, opts) ⇒
boolean - .getObject(state, id, opts) ⇒
object - .getModel(state) ⇒
object - .isLoading(state) ⇒
boolean - .isError(state) ⇒
boolean - .isDone(state) ⇒
boolean
new Grp(parentPath, id, attribute)
creates a group
| Param | Type | Description |
|---|---|---|
| parentPath | string | the path of the api call for the immediate parent |
| id | string | identifier for the group to be queried for |
| attribute | string | additional information to be added to the path |
grp.list(options) ⇒ function
makes an api call for the list of objects
Kind: instance method of Grp
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
grp.create(obj, options) ⇒ function
api call to create an item as a child of the current path
Kind: instance method of Grp
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| obj | object | item to be created |
| options | object | api options |
grp.get(id, options) ⇒ function
api call to get a child of the current path
Kind: instance method of Grp
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| id | string | id of the item to be returned |
| options | object | api options |
grp.update(id, data, options) ⇒ function
api call to update a child of the current path
Kind: instance method of Grp
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| id | string | id of the item to be updated |
| data | object | values of the item to be changed |
| options | object | api options |
grp.delete(id, options) ⇒ function
api call to delete a child of the current path
Kind: instance method of Grp
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| id | string | id of the item to be deleted |
| options | object | api options |
grp.model(options) ⇒ function
api call to get the model for the path
Kind: instance method of Grp
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
grp.filter(filter)
locally filters the results
Kind: instance method of Grp
| Param | Type | Description |
|---|---|---|
| filter | object | the filter object for the path |
grp.obj(id) ⇒ Obj
returns an instance of the obj class with the current path prepended
Kind: instance method of Grp
Returns: Obj - has the current path with the id
| Param | Type |
|---|---|
| id | string |
grp.getList(state, opts) ⇒ object
Kind: instance method of Grp
Returns: object - results, in the form of a list
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
| opts | object |
grp.isTable(state, opts) ⇒ boolean
Kind: instance method of Grp
Returns: boolean - whether or not the results can be returned as a table
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
| opts | object |
grp.getObject(state, id, opts) ⇒ object
Kind: instance method of Grp
Returns: object - returns the resulting object from the query
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
| id | string | id of the object |
| opts | object |
grp.getModel(state) ⇒ object
Kind: instance method of Grp
Returns: object - returns a model for the query
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
grp.isLoading(state) ⇒ boolean
Kind: instance method of Grp
Returns: boolean - whether the query is loading
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
grp.isError(state) ⇒ boolean
Kind: instance method of Grp
Returns: boolean - whether the query had an error
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
grp.isDone(state) ⇒ boolean
Kind: instance method of Grp
Returns: boolean - whether the query is finished
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
Interface
Class representing the interface route of the api
Kind: global class
- Interface
- new Interface(system, type)
- .list(options) ⇒
function - .filter(filter)
- .create(obj, options) ⇒
function - .delete(id, options) ⇒
function - .model(options) ⇒
function - .obj(id) ⇒
Obj - .getList(state, opts) ⇒
object - .getModel(state) ⇒
object - .isLoading(state) ⇒
boolean - .isError(state) ⇒
boolean - .isDone(state) ⇒
boolean
new Interface(system, type)
create the Interface
| Param | Type | Description |
|---|---|---|
| system | string | id or alias of the system to connect to |
| type | string | the alias of the type of blueprint/devices |
interface.list(options) ⇒ function
api call to get the list of devices of the provided type
Kind: instance method of Interface
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | to be included in the api call |
interface.filter(filter)
locally filters the results
Kind: instance method of Interface
| Param | Type | Description |
|---|---|---|
| filter | object | the filter object for the path |
interface.create(obj, options) ⇒ function
api call to create a device of the provided type
Kind: instance method of Interface
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| obj | object | device to be created |
| options | object | to be included in the api call |
interface.delete(id, options) ⇒ function
api call to delete a device of the provided type
Kind: instance method of Interface
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| id | string | id of the device to be deleted |
| options | object | to be included in the api call |
interface.model(options) ⇒ function
api call to get the model of a device of the provided type
Kind: instance method of Interface
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | to be included in the api call |
interface.obj(id) ⇒ Obj
returns an instance of the obj class with the current path prepended
Kind: instance method of Interface
Returns: Obj - has the current path with the id
| Param | Type |
|---|---|
| id | string |
interface.getList(state, opts) ⇒ object
Kind: instance method of Interface
Returns: object - results, in the form of a list
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
| opts | object |
interface.getModel(state) ⇒ object
Kind: instance method of Interface
Returns: object - returns a model for the query
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
interface.isLoading(state) ⇒ boolean
Kind: instance method of Interface
Returns: boolean - whether the query is loading
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
interface.isError(state) ⇒ boolean
Kind: instance method of Interface
Returns: boolean - whether the query had an error
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
interface.isDone(state) ⇒ boolean
Kind: instance method of Interface
Returns: boolean - whether the query is finished
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
Messages
Kind: global class
new Messages(parentPath)
creates Messages
| Param | Type | Description |
|---|---|---|
| parentPath | string | the path of the api call for the immediate parent |
messages.getMessages(state, queryName) ⇒ object
gets the sent outbound messages
Kind: instance method of Messages
Returns: object - the sent outbound messages
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
| queryName | string | identifier of the query |
Obj - class representing a Single device
Obj
Kind: global class
- Obj
- new Obj(parentPath, id, isInGroup)
- .get(options) ⇒
function - .history(options) ⇒
function - .create(obj, options) ⇒
function - .update(obj, options) ⇒
function - .delete(options) ⇒
function - .model(options) ⇒
function - .obj(id) ⇒
Obj - .grp(attribute) ⇒
Grp - .users() ⇒
object - .messages() ⇒
object - .getObject(state) ⇒
object - .getTable(state, opts) ⇒
object - .getModel(state) ⇒
object - .getHistory(state, queryName) ⇒
object - .isTable(state) ⇒
boolean - .isLoading(state) ⇒
boolean - .isError(state) ⇒
boolean - .isDone(state) ⇒
boolean
new Obj(parentPath, id, isInGroup)
creates an Object
| Param | Type | Description |
|---|---|---|
| parentPath | string | the path of the api call for the immediate parent |
| id | string | identifier for the group to be queried for |
| isInGroup | boolean | represents if the object is in a group |
obj.get(options) ⇒ function
makes an api call for the for the Object at the path
Kind: instance method of Obj
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
obj.history(options) ⇒ function
makes an api call to get the history of an object at the path
Kind: instance method of Obj
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| query.query | object | query params that the server will use |
| query.queryName | string | query identifier |
| options | object | api options |
obj.create(obj, options) ⇒ function
makes an api call to create an object at the path
Kind: instance method of Obj
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| obj | object | the object to be created |
| options | object | api options |
obj.update(obj, options) ⇒ function
makes an api call to update the object at the path
Kind: instance method of Obj
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| obj | object | the object values to be updated |
| options | object | api options |
obj.delete(options) ⇒ function
makes an api call to delete the object at the path
Kind: instance method of Obj
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
obj.model(options) ⇒ function
api call to get the model for the path
Kind: instance method of Obj
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
obj.obj(id) ⇒ Obj
Kind: instance method of Obj
Returns: Obj - object with the current path and the id provided
| Param | Type | Description |
|---|---|---|
| id | string | id of an obj |
obj.grp(attribute) ⇒ Grp
Kind: instance method of Obj
Returns: Grp - group class with the current path and attribute
| Param | Type | Description |
|---|---|---|
| attribute | string | the attribute representing a group on the current object |
obj.users() ⇒ object
makes an api call to get the users on the device
Kind: instance method of Obj
Returns: object - represents the users permissioned on the device
obj.messages() ⇒ object
makes an api access object for managing a device's outbound messages
Kind: instance method of Obj
Returns: object - the api access object
obj.getObject(state) ⇒ object
get the current object from the state
Kind: instance method of Obj
Returns: object - the object
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
obj.getTable(state, opts) ⇒ object
Kind: instance method of Obj
Returns: object - table of the results
| Param | Type | Description |
|---|---|---|
| state | object | current redux state |
| opts | object |
obj.getModel(state) ⇒ object
Kind: instance method of Obj
Returns: object - the model for the object
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
obj.getHistory(state, queryName) ⇒ object
gets the results of a specific query
Kind: instance method of Obj
Returns: object - the results of the query
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
| queryName | string | identifier of the query |
obj.isTable(state) ⇒ boolean
Kind: instance method of Obj
Returns: boolean - whether or not the results can be returned as a table
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
obj.isLoading(state) ⇒ boolean
Kind: instance method of Obj
Returns: boolean - whether the query is loading
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
obj.isError(state) ⇒ boolean
Kind: instance method of Obj
Returns: boolean - whether the query had an error
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
obj.isDone(state) ⇒ boolean
Kind: instance method of Obj
Returns: boolean - whether the query is finished
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
User
User - class representing a user
Kind: global class
- User
- new User(parentPath, parentId, id)
- .get(options) ⇒
function - .update() ⇒
function - .delete(options) ⇒
function - .remove(options) ⇒
function - .getObject(state) ⇒
object - .isLoading(state) ⇒
boolean - .isError(state) ⇒
boolean - .isDone(state) ⇒
boolean
new User(parentPath, parentId, id)
creates a User
| Param | Type | Description |
|---|---|---|
| parentPath | string | the path of the api call for the immediate parent |
| parentId | string | the id for the immediate parent |
| id | string | identifier for the user |
user.get(options) ⇒ function
Requests the object at this path
Kind: instance method of User
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
user.update() ⇒ function
Updates the object at this path
Kind: instance method of User
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
object | ||
| object.permissions | object | permissions of the user being updated |
| object.metadata | object | metadata of the user being created |
user.delete(options) ⇒ function
Deletes the object at the path
Kind: instance method of User
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
user.remove(options) ⇒ function
Deletes the object at the path
Kind: instance method of User
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
user.getObject(state) ⇒ object
gets the user of the current path
Kind: instance method of User
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
user.isLoading(state) ⇒ boolean
Kind: instance method of User
Returns: boolean - whether the query is loading
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
user.isError(state) ⇒ boolean
Kind: instance method of User
Returns: boolean - whether the query had an error
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
user.isDone(state) ⇒ boolean
Kind: instance method of User
Returns: boolean - whether the query is finished
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
Users
Users - class representing a group of users
Kind: global class
- Users
- new Users(parentPath, id)
- .list(options) ⇒
function - .create(object, options) ⇒
function - .add(user) ⇒
function - .update(id, data) ⇒
function - .delete(id, options) ⇒
function - .remove(id, options) ⇒
function - .user(id) ⇒
User - .getList(state, opts) ⇒
object - .isLoading(state) ⇒
boolean - .isError(state) ⇒
boolean - .isDone(state) ⇒
boolean
new Users(parentPath, id)
creates Users
| Param | Type | Description |
|---|---|---|
| parentPath | string | the path of the api call for the immediate parent |
| id | string | identifier for the user |
users.list(options) ⇒ function
make an api call for the list of users
Kind: instance method of Users
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| options | object | api options |
users.create(object, options) ⇒ function
makes an api call to create a user and permission them on the current path
Kind: instance method of Users
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| object | object | |
| object.user | object | represents the user to be created |
| object.permissions | object | represents the permissions of the user |
| object.metadata | object | metadata of the user to be created |
| options | object | api options |
users.add(user) ⇒ function
Adds a user with permission to the device. One of id, username, or user (object with id) is required.
Kind: instance method of Users
Returns: function - redux thunk function
| Param | Type |
|---|---|
| user | object |
| user.id | string |
| user.username | string |
| user.user | object |
| user.permissions | object |
| user.metadata | object |
users.update(id, data) ⇒ function
If permission is an array, it is sent as a patchOps. Otherwise, a a patch ops will be build to replace permissions and metdata.
Kind: instance method of Users
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| id | string | id of the user |
| data | object | |
| data.permissions | object | |
| data.metadata | object |
users.delete(id, options) ⇒ function
Deletes the user at the path
Kind: instance method of Users
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| id | string | user id |
| options | object | api options |
users.remove(id, options) ⇒ function
Deletes the object at the path
Kind: instance method of Users
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| id | string | user id |
| options | object | api options |
users.user(id) ⇒ User
Kind: instance method of Users
Returns: User - a user object for the given Id
| Param | Type | Description |
|---|---|---|
| id | string | user id |
users.getList(state, opts) ⇒ object
Kind: instance method of Users
Returns: object - list from the current state
| Param | Type | Description |
|---|---|---|
| state | object | current redux state |
| opts | object |
users.isLoading(state) ⇒ boolean
Kind: instance method of Users
Returns: boolean - whether the query is loading
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
users.isError(state) ⇒ boolean
Kind: instance method of Users
Returns: boolean - whether the query had an error
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
users.isDone(state) ⇒ boolean
Kind: instance method of Users
Returns: boolean - whether the query is finished
| Param | Type | Description |
|---|---|---|
| state | object | the current redux state |
verify(targetLocation) ⇒ function
gets and verifies the Bearer token
Kind: global function
Returns: function - redux thunk function
| Param | Type |
|---|---|
| targetLocation | string |
login(username, password, projectId) ⇒ function
will log in the user
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| username | string | |
| password | string | |
| projectId | string | imagine projectId, will use the project id from the api object passed to redux thunk if none provided |
logout() ⇒ function
will log the user out
Kind: global function
Returns: function - redux thunk function
forgotPassword(username, projectId) ⇒ function
sends an email to reset the password
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| username | string | the user that the email will be sent to |
| projectId | string | imagine projectId, will use the project id from the api object passed to redux thunk if none provided |
changePassword(oldPassword, newPassword) ⇒ function
change the currently logged in user's password
Kind: global function
Returns: function - redux thunk function
| Param | Type |
|---|---|
| oldPassword | string |
| newPassword | string |
resetPassword(username, password, confirm, token, projectId) ⇒ function
changes the user's password
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| username | string | |
| password | string | |
| confirm | string | 2nd password entry to confirm first is correct |
| token | string | api generated token |
| projectId | string |
renew(auto) ⇒ function
Kind: global function
Returns: function - redux thunk function
| Param | Type | Default |
|---|---|---|
| auto | number | 0 |
isLoggedIn(state) ⇒ boolean
checks if there is a user logged in
Kind: global function
Returns: boolean - if there is a user logged in or not
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
isLoading(state) ⇒ boolean
checks if the ui is attempting to log in or verify a user
Kind: global function
Returns: boolean - true if loading property is verifying or logging in
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
isVerifying(state) ⇒ boolean
checks if the ui is attempting to verify a user
Kind: global function
Returns: boolean - if loading property is verifying
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
isError(state) ⇒ boolean
checks if there was an error on the most recent action taken
Kind: global function
Returns: boolean - true if error occured
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
getErrorMessage(state) ⇒ string
Kind: global function
Returns: string - the message/reason for error
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
getUsername(state) ⇒ string
Kind: global function
Returns: string - username of currently logged in user
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
getUserId(state) ⇒ string
Kind: global function
Returns: string - id of currently logged in user
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
getProfile(state) ⇒ object
Kind: global function
Returns: object - profile of the currently logged in user
| Param | Type | Description |
|---|---|---|
| state | object | the current Auth redux state |
isLoading(state, path) ⇒ boolean
checks if a query is loading
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
isError(state, path) ⇒ boolean
check if a query is in error
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
isDone(state, path) ⇒ boolean
check if a query has completed
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
isList(state, path) ⇒ boolean
check if a query result is a list
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
isTable(state, path) ⇒ boolean
check if a query result is a table
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
isObject(state, path) ⇒ boolean
check if a query result is an object
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
getObject(state, path) ⇒ object
gets the result of a query if it is an object
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
getHistory(state, path, queryName) ⇒ object
gets the result of a history query
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
| queryName | string | name of the query |
getList(state, path, opts) ⇒ array
get the list result of a query
Kind: global function
Returns: array - array of items
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
| opts | object |
getTable(state, path, opts) ⇒ array
get the table result of a query
Kind: global function
Returns: array - array of items
| Param | Type | Description |
|---|---|---|
| state | object | the current interface redux object |
| path | string | string representing the query path sent to the api |
| opts | object |
setFilter(name, filter)
Registers a filter function against the filter type.
Kind: global function
| Param | Type | Description |
|---|---|---|
| name | string | the type name of the filter |
| filter | function | the function is given ( filter, items ) and should return a new list, filterer as needed. The supplied filter and list should NOT be modified. |
getFilter()
Returns the filter function registerd at the name
getTextFilter()
Returns the default text filter
createPromise(method, path, body, options, type, extra) ⇒ function
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| method | string | http method |
| path | string | api route to be queried |
| body | object | data to be sent in the api call |
| options | object | options to be sent in the api call |
| type | string | action type to be used to maintain the api-redux status |
| extra | object | additional information to be incuded in redux dispatches |
list(path, parentId, type, options) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| parentId | string | id of the parent device |
| type | string | action type to maintain the redux state |
| options | object | to be included in the api call |
create(path, obj, parentId, type, options) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| obj | object | the item to be created |
| parentId | string | id of the parent device |
| type | string | action type to maintain the redux state |
| options | object | to be included in the api call |
get(path, parentPath, options) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| parentPath | string | path to the parent device |
| options | object | to be included in the api call |
getHistory(path, parentPath, options, queryName) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| parentPath | string | path to the parent device |
| options | object | to be included in the api call |
| queryName | string | identifier to maintian different query statuses |
remove(path, id, options) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| id | string | device to be removed |
| options | object | to be included in the api call |
update(path, data, parentPath, parentId, options) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| data | object | data to update the device with |
| parentPath | string | path to the parent device |
| parentId | string | id of the parent device |
| options | object | to be included in the api call |
createDeviceUser(path, obj, parentPath, options) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| obj | object | user to be created and added to the device |
| parentPath | string | path to the parent device |
| options | object | to be included in the api call |
addDeviceUser(path, obj, parentId, options) ⇒ function
creates a user, and then addes them to the device
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| obj | object | user to be added to the device |
| parentId | string | id of the parent device |
| options | object | to be included in the api call |
sendOutboundDeviceMessage(path, obj, parentId, options) ⇒ function
sends an outbound message to a device
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| obj | object | message to be sent to the device |
| parentId | string | id of the parent device |
| options | object | to be included in the api call |
updateDeviceUser(path, obj, parentId, options) ⇒ promise
Kind: global function
Returns: promise - represents the result of the api call
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| obj | object | user of the device and their values to be updated |
| parentId | string | id of the parent device |
| options | object | to be included in the api call |
removeDeviceUser(path, obj, parentId, options) ⇒ function
Kind: global function
Returns: function - call to createPromise
| Param | Type | Description |
|---|---|---|
| path | string | route to be queried from the api |
| obj | object | user to be removed from the device |
| parentId | string | id of the parent device |
| options | object | to be included in the api call |
copy()
Shallow copies the state, as well as the lookup and data if needed
getApiQueryable(query) ⇒ function
Kind: global function
| Param | Type | Description |
|---|---|---|
| query | object | |
| query.api | object | an api object |
| query.type | string | |
| query.mode | string | |
| query.queryable | string |
getApiQueryable(query) ⇒ function
Kind: global function
| Param | Type | Description |
|---|---|---|
| query | object | |
| query.api | object | an api object |
| query.type | string | |
| query.mode | string | |
| query.queryable | string |
defaultGetApiQueryable(query) ⇒ function
Kind: global function
| Param | Type | Description |
|---|---|---|
| query | object | |
| query.api | object | an api object |
| query.type | string | |
| query.mode | string | |
| query.obj | string |
create(query) ⇒ function
Kind: global function
Returns: function - install function
| Param | Type |
|---|---|
| query | object |
| query.mode | string |
| query.getApiQueryable | object |
| query.chunkTime | string |
getActionConstant(action, mode) ⇒ string
Kind: global function
Returns: string - string representing the constant for the provided action
| Param | Type | Description |
|---|---|---|
| action | string | action being taken |
| mode | string |
isSimpleTimeQuery(q) ⇒ boolean
Kind: global function
Returns: boolean - represents whether the provided query is just time based or not
| Param | Type | Description |
|---|---|---|
| q | object | the query object |
isReversed(opts) ⇒ boolean
Kind: global function
Returns: boolean - represents whether the provided query is in descending order or not
| Param | Type | Description |
|---|---|---|
| opts | object | the query object |
mergeItems(items, newItems, range) ⇒ array
Kind: global function
Returns: array - array of items with newItems inserted in for the given range
| Param | Type | Description |
|---|---|---|
| items | array | current items |
| newItems | array | items to be merged in |
| range | array | tuple of start and end |
getQueryChunks(opts, chunkSize) ⇒ object
Kind: global function
Returns: object - options for an api call for a chunk of data
| Param | Type | Description |
|---|---|---|
| opts | object | |
| chunkSize | number | size of the api result queries |
getQueryOptions(opts) ⇒ object
Kind: global function
Returns: object - returns the opts object with correct start and end
| Param | Type | Description |
|---|---|---|
| opts | object | query options |
receive(state, action)
behavior for the GET action
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | current redux state |
| action | object | redux action |
update(state, action)
behavior for the UPDATE action
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | current redux state |
| action | object | redux action |
add(state, action)
behavior for the ADD action
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | current redux state |
| action | object | redux action |
remove(state, action)
behavior for the REMOVE action
Kind: global function
| Param | Type | Description |
|---|---|---|
| state | object | current redux stae |
| action | object | redux action |
reducer(initialState, actionTypeBase, additionalReducers)
creates and returns a generic reducer
Kind: global function
| Param | Type | Description |
|---|---|---|
| initialState | object | |
| actionTypeBase | string | determines what constants will be used for the action types |
| additionalReducers | * | function that will be called with state and action in the default case |
list(opts) ⇒ function
makes an api call to get the list of current users for the project
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| opts | object | options to be provided to the api call |
create(item) ⇒ function
makes an api call to create a new user
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| item | object | the new user to be created |
get(item, opts) ⇒ function
makes an api call to get a user
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| item | string | id of the user |
| opts | object | options to be inculded in the api call |
remove(item) ⇒ function
makes an api call to remove a user
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| item | string | id of the user |
update(item, patchOps, opts) ⇒ function
makes an api call to update a user
Kind: global function
Returns: function - redux thunk function
| Param | Type | Description |
|---|---|---|
| item | string | id of the user to be updated |
| patchOps | object | object with the values to be updated |
| opts | object | any additional options to be sent to the api |
forcePWReset(item, projectId) ⇒ function
makes an api call sending an email to the provided user making them reset their password
Kind: global function
Returns: function - redux thunk function
| Param | Type |
|---|---|
| item | string |
| projectId | string |
encodeQ(options)
turns a query object to a string to be appended to an http request url
Kind: global function
| Param | Type | Description |
|---|---|---|
| options | object | the parameters to be sent with a http request url |
objectToQueryString(a)
turns an object into a string that can be used in a http request url
Kind: global function
| Param | Type | Description |
|---|---|---|
| a | object | the object to be turned into a query string |
buildParams(prefix, obj, add)
manipulates obj according to the add function provided to it
Kind: global function
| Param | Type | Description | |
|---|---|---|---|
| prefix | string | ||
| obj | object \ | array | the object to be manipulated |
| add | function | function used to do the manipulation |
getPatchOpsArray(patchOps)
transforms an object into an array of {path, value, op} objects
Kind: global function
| Param | Type |
|---|---|
| patchOps | object |
combinePath(path, subpath)
checks for '/' and appends the subpath onto the path
Kind: global function
| Param | Type |
|---|---|
| path | string |
| subpath | string |
getId(id, throwIfNull)
returns id if id is string or id.id if id is an object
Kind: global function
| Param | Type | Default | Description | |
|---|---|---|---|---|
| id | string \ | object | ||
| throwIfNull | boolean | true | if true will throw an error if there is no id |
getLastInPath(path)
returns the substring after the last '/'
Kind: global function
| Param | Type |
|---|---|
| path | string |
