Query
Query interface for dispatch, users, programs and statistics.
IdFromHandle
core.IdFromHandle({handle="process-time", entity="script"})
Run a dispatch query
- Object
handle:String
A handleentity
group | tracker | script | swimlane | cohort | program | user-labels | dispatch-labels | workflow | wiki | layout
Id from the handle
core.IdFromHandle({handle="process-time", entity="script"})
HandleFromId
core.HandleFromId({id="xxxx-xxxx-xxx..", entity="script"})
Run a dispatch query
- Object
id:String
A handleentity
group | tracker | script | swimlane | cohort | program | user-labels | dispatch-labels | workflow | wiki | layout
Handle from the id
QueryDispatch
core.QueryDispatch(query, optional)
Run a dispatch query
query:String
dispatch queryoptional: String array
optional items to load in the query
By default optional is "body", "data". Other optional items available include "attributes", "blocks", "actions", "comments", "labels", "hashtags", "userLocation*", "countComments"
Dispatch list
Example
local ls = core.QueryDispatch("current user, given tracker [something]")
for index, dispatch in pairs(ls) do
log.pairs(dispatch.data)
end
QueryDispatchRemote
core.QueryDispatchRemote({query="given tracker [report]", apiKey="..", apiSecret="..", orgId=".."})
Run a dispatch query to pull data from another org. The API key from that org is required to complete the query.
query:String
dispatch queryapiKey:UUID
Api key idapiSecret:String
Api key secretorgId:UUID
Org id to request the data from; api key should come from this org
Dispatch list
Example
local ls = core.QueryDispatch("current user, given tracker [something]")
for index, dispatch in pairs(ls) do
log.pairs(dispatch.data)
end
QueryUser
core.QueryUser(query)
QueryProgram
core.QueryProgram(query)
Run a program query
query:String
program query
ProgramInfo Array
QueryParticipant
core.QueryParticipant(query)
Run a program query
query:String
program participant query
ProgramParticipation Array
QueryStats
core.QueryStats(query)
Run a stats query
query:String
stats query
- Stats list object
- users: UserTotal Array
- results: UserStatistic Array
- start
- end
- operator
OrgList
core.OrgList()
Return the list of child orgs.
Org Array
OrgUserQuery
core.OrgUserQuery({org=id, query=string})
Run a user query on a specific child org
- Object
org:UUID
org idquery:String
user query
User Array
OrgChildAllowed
core.OrgChildAllowed(orgId)
Check if a child org is within scope.
orgId:UUID
org Id
Boolean
FindUserByEmail
core.FindUserByEmail(email)
Find user by email
email:String
email address
User
FindUserByExternalId
core.FindUserByExternalId(id)
Find user by external id registered for that org
id:String
external id
User
LastActivity
core.LastActivity(userId)
Check if a user was active within a specific time range
- Object
userId:UUID
user idfrom:Date
date in YYYY-MM-DD formatto:Date
date in YYYY-MM-DD formatignore:UUID[]
array of tracker ids; optional
Date or nil
QueryActions
core.QueryActions({dispatchId = id, event = "bookmark", groupBy = "payload"})
Get summary information about the count of a specific event.
- Object
dispatchId:UUID
user idevent:String
event to query such as like, vote, bookmarkgroupBy
payload |; group by payload or not
List of DispatchActionStatus objects
QueryActionList
core.QueryActionList({dispatchId = id, query = "all events"})
Get specific event details
- Object
dispatchId:UUID
user idquery:String
query
Query examples:
- all events
- given event [participant]
- given author [xxxx-xxxx-xxxx]
- given user [xxxx-xxxx-xxxx]
- (query clause) from (date clause)
List of DispatchAction objects
AccountFromId
core.AccountFromId(accountId)
Load account info
- UUID - the id of the account to find
AccountSearch object or nil
AccountsFromUser
core.AccountsFromUser(userId)
Get summary information about the count of a specific event.
- UUID - the id of the user to search for
List of AccountSearch objects
LoadWiki
core.LoadWiki(handle)
Load wiki content
- String - handle for the wiki content to load
Wiki content
FindOrgUsersByExternalId
Find a user by external id from any org.
core.FindOrgUsersByExternalId(externalId)
Find by external id
- String - external id
- id - user id
- orgId - org id
- externalId - external id that was provided
Caching
core.PutCache
core.GetCache
core.PutCache({
key=key,
data=org,
duration=timeout
})
local response = core.GetCache(key)