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 |
function
grp.list(options) ⇒ 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 |
function
grp.create(obj, options) ⇒ 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 |
function
grp.get(id, options) ⇒ 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 |
function
grp.update(id, data, options) ⇒ 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 |
function
grp.delete(id, options) ⇒ 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 |
function
grp.model(options) ⇒ 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 |
Obj
grp.obj(id) ⇒ 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 |
object
grp.getList(state, opts) ⇒ 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 |
boolean
grp.isTable(state, opts) ⇒ 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 |
object
grp.getObject(state, id, opts) ⇒ 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 |
object
grp.getModel(state) ⇒ Kind: instance method of Grp
Returns: object
- returns a model for the query
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
grp.isLoading(state) ⇒ Kind: instance method of Grp
Returns: boolean
- whether the query is loading
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
grp.isError(state) ⇒ Kind: instance method of Grp
Returns: boolean
- whether the query had an error
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
grp.isDone(state) ⇒ 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 |
function
interface.list(options) ⇒ 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 |
function
interface.create(obj, options) ⇒ 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 |
function
interface.delete(id, options) ⇒ 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 |
function
interface.model(options) ⇒ 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 |
Obj
interface.obj(id) ⇒ 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 |
object
interface.getList(state, opts) ⇒ 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 |
object
interface.getModel(state) ⇒ Kind: instance method of Interface
Returns: object
- returns a model for the query
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
interface.isLoading(state) ⇒ Kind: instance method of Interface
Returns: boolean
- whether the query is loading
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
interface.isError(state) ⇒ Kind: instance method of Interface
Returns: boolean
- whether the query had an error
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
interface.isDone(state) ⇒ 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 |
object
messages.getMessages(state, queryName) ⇒ 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 |
function
obj.get(options) ⇒ 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 |
function
obj.history(options) ⇒ 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 |
function
obj.create(obj, options) ⇒ 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 |
function
obj.update(obj, options) ⇒ 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 |
function
obj.delete(options) ⇒ 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 |
function
obj.model(options) ⇒ 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.obj(id) ⇒ 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 |
Grp
obj.grp(attribute) ⇒ 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 |
object
obj.users() ⇒ 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
object
obj.messages() ⇒ makes an api access object for managing a device's outbound messages
Kind: instance method of Obj
Returns: object
- the api access object
object
obj.getObject(state) ⇒ 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 |
object
obj.getTable(state, opts) ⇒ Kind: instance method of Obj
Returns: object
- table of the results
Param | Type | Description |
---|---|---|
state | object | current redux state |
opts | object |
object
obj.getModel(state) ⇒ Kind: instance method of Obj
Returns: object
- the model for the object
Param | Type | Description |
---|---|---|
state | object | the current redux state |
object
obj.getHistory(state, queryName) ⇒ 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 |
boolean
obj.isTable(state) ⇒ 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 |
boolean
obj.isLoading(state) ⇒ Kind: instance method of Obj
Returns: boolean
- whether the query is loading
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
obj.isError(state) ⇒ Kind: instance method of Obj
Returns: boolean
- whether the query had an error
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
obj.isDone(state) ⇒ 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 |
function
user.get(options) ⇒ Requests the object at this path
Kind: instance method of User
Returns: function
- redux thunk function
Param | Type | Description |
---|---|---|
options | object | api options |
function
user.update() ⇒ 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 |
function
user.delete(options) ⇒ Deletes the object at the path
Kind: instance method of User
Returns: function
- redux thunk function
Param | Type | Description |
---|---|---|
options | object | api options |
function
user.remove(options) ⇒ Deletes the object at the path
Kind: instance method of User
Returns: function
- redux thunk function
Param | Type | Description |
---|---|---|
options | object | api options |
object
user.getObject(state) ⇒ gets the user of the current path
Kind: instance method of User
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
user.isLoading(state) ⇒ Kind: instance method of User
Returns: boolean
- whether the query is loading
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
user.isError(state) ⇒ Kind: instance method of User
Returns: boolean
- whether the query had an error
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
user.isDone(state) ⇒ 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 |
function
users.list(options) ⇒ 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 |
function
users.create(object, options) ⇒ 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 |
function
users.add(user) ⇒ 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 |
function
users.update(id, data) ⇒ 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 |
function
users.delete(id, options) ⇒ 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 |
function
users.remove(id, options) ⇒ 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 |
User
users.user(id) ⇒ Kind: instance method of Users
Returns: User
- a user object for the given Id
Param | Type | Description |
---|---|---|
id | string | user id |
object
users.getList(state, opts) ⇒ Kind: instance method of Users
Returns: object
- list from the current state
Param | Type | Description |
---|---|---|
state | object | current redux state |
opts | object |
boolean
users.isLoading(state) ⇒ Kind: instance method of Users
Returns: boolean
- whether the query is loading
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
users.isError(state) ⇒ Kind: instance method of Users
Returns: boolean
- whether the query had an error
Param | Type | Description |
---|---|---|
state | object | the current redux state |
boolean
users.isDone(state) ⇒ Kind: instance method of Users
Returns: boolean
- whether the query is finished
Param | Type | Description |
---|---|---|
state | object | the current redux state |
function
verify(targetLocation) ⇒ gets and verifies the Bearer token
Kind: global function
Returns: function
- redux thunk function
Param | Type |
---|---|
targetLocation | string |
function
login(username, password, projectId) ⇒ 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 |
function
logout() ⇒ will log the user out
Kind: global function
Returns: function
- redux thunk function
function
forgotPassword(username, projectId) ⇒ 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 |
function
changePassword(oldPassword, newPassword) ⇒ change the currently logged in user's password
Kind: global function
Returns: function
- redux thunk function
Param | Type |
---|---|
oldPassword | string |
newPassword | string |
function
resetPassword(username, password, confirm, token, projectId) ⇒ 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 |
function
renew(auto) ⇒ Kind: global function
Returns: function
- redux thunk function
Param | Type | Default |
---|---|---|
auto | number | 0 |
boolean
isLoggedIn(state) ⇒ 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 |
boolean
isLoading(state) ⇒ 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 |
boolean
isVerifying(state) ⇒ 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 |
boolean
isError(state) ⇒ 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 |
string
getErrorMessage(state) ⇒ Kind: global function
Returns: string
- the message/reason for error
Param | Type | Description |
---|---|---|
state | object | the current Auth redux state |
string
getUsername(state) ⇒ Kind: global function
Returns: string
- username of currently logged in user
Param | Type | Description |
---|---|---|
state | object | the current Auth redux state |
string
getUserId(state) ⇒ Kind: global function
Returns: string
- id of currently logged in user
Param | Type | Description |
---|---|---|
state | object | the current Auth redux state |
object
getProfile(state) ⇒ Kind: global function
Returns: object
- profile of the currently logged in user
Param | Type | Description |
---|---|---|
state | object | the current Auth redux state |
boolean
isLoading(state, path) ⇒ 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 |
boolean
isError(state, path) ⇒ 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 |
boolean
isDone(state, path) ⇒ 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 |
boolean
isList(state, path) ⇒ 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 |
boolean
isTable(state, path) ⇒ 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 |
boolean
isObject(state, path) ⇒ 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 |
object
getObject(state, path) ⇒ 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 |
object
getHistory(state, path, queryName) ⇒ 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 |
array
getList(state, path, opts) ⇒ 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 |
array
getTable(state, path, opts) ⇒ 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
function
createPromise(method, path, body, options, type, extra) ⇒ 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 |
function
list(path, parentId, type, options) ⇒ 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 |
function
create(path, obj, parentId, type, options) ⇒ 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 |
function
get(path, parentPath, options) ⇒ 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 |
function
getHistory(path, parentPath, options, queryName) ⇒ 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 |
function
remove(path, id, options) ⇒ 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 |
function
update(path, data, parentPath, parentId, options) ⇒ 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 |
function
createDeviceUser(path, obj, parentPath, options) ⇒ 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 |
function
addDeviceUser(path, obj, parentId, options) ⇒ 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 |
function
sendOutboundDeviceMessage(path, obj, parentId, options) ⇒ 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 |
promise
updateDeviceUser(path, obj, parentId, options) ⇒ 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 |
function
removeDeviceUser(path, obj, parentId, options) ⇒ 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
function
getApiQueryable(query) ⇒ Kind: global function
Param | Type | Description |
---|---|---|
query | object | |
query.api | object | an api object |
query.type | string | |
query.mode | string | |
query.queryable | string |
function
getApiQueryable(query) ⇒ Kind: global function
Param | Type | Description |
---|---|---|
query | object | |
query.api | object | an api object |
query.type | string | |
query.mode | string | |
query.queryable | string |
function
defaultGetApiQueryable(query) ⇒ Kind: global function
Param | Type | Description |
---|---|---|
query | object | |
query.api | object | an api object |
query.type | string | |
query.mode | string | |
query.obj | string |
function
create(query) ⇒ Kind: global function
Returns: function
- install function
Param | Type |
---|---|
query | object |
query.mode | string |
query.getApiQueryable | object |
query.chunkTime | string |
string
getActionConstant(action, mode) ⇒ Kind: global function
Returns: string
- string representing the constant for the provided action
Param | Type | Description |
---|---|---|
action | string | action being taken |
mode | string |
boolean
isSimpleTimeQuery(q) ⇒ Kind: global function
Returns: boolean
- represents whether the provided query is just time based or not
Param | Type | Description |
---|---|---|
q | object | the query object |
boolean
isReversed(opts) ⇒ Kind: global function
Returns: boolean
- represents whether the provided query is in descending order or not
Param | Type | Description |
---|---|---|
opts | object | the query object |
array
mergeItems(items, newItems, range) ⇒ 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 |
object
getQueryChunks(opts, chunkSize) ⇒ 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 |
object
getQueryOptions(opts) ⇒ 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 |
function
list(opts) ⇒ 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 |
function
create(item) ⇒ 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 |
function
get(item, opts) ⇒ 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 |
function
remove(item) ⇒ 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 |
function
update(item, patchOps, opts) ⇒ 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 |
function
forcePWReset(item, projectId) ⇒ 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 |