Session

simplicite~ Session

new Session(params)

Source:
Simplicite application session.
Parameters:
Name Type Description
params object Parameters
Properties
Name Type Attributes Default Description
url string Base URL of the Simplicite application
scheme string URL scheme (e.g. 'https') of the Simplicite application (not needed if url is set)
host string Hostname or IP address (e.g. 'myhost.mydomain.com') of the Simplicite application (not needed if url is set)
port number Port (e.g. 443) of the Simplicite application (not needed if url is set)
root string Root context URL (e.g. '/myapp') the Simplicite application (not needed if url is set)
endpoint boolean <optional>
'api' Endpoint ('api'|'ui'|'public')
username string <optional>
Username (not needed for public endpoint)
password string <optional>
Password (not needed for public endpoint)
authtoken string <optional>
Auth token (if set, username and password are not needed; not needed for public endpoint)
debug boolean <optional>
false Debug mode?
debugHandler function <optional>
Debug handler function
infoHandler function <optional>
Info handler function
warningHandler function <optional>
Warning handler function
errorHandler function <optional>
Error handler function
logHandler function <optional>
Log handler function

Members

authtoken :string

Source:
Auth token
Type:
  • string

(constant) constants

Source:
Constants

(constant) endpoint

Source:
Is used within generic UI?

grant :Grant

Source:
Grant
Type:
  • Grant

(constant) parameters :object

Source:
Parameters
Type:
  • object

password :string

Source:
Password
Type:
  • string

timeout :number

Source:
Default Value:
  • 30
Timeout (seconds)
Type:
  • number

username :string

Source:
Username
Type:
  • string

Methods

changePassword(pwd, optsopt) → {promise.<object>}

Source:
Change password
Parameters:
Name Type Attributes Description
pwd string Password
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
Returns:
A promise to the change password result
Type
promise.<object>

clear()

Source:
Clears all data (credentials, objects, ...)

debug(arg)

Source:
Debug handler
Parameters:
Name Type Description
arg any Argument

error(arg)

Source:
Error handler
Parameters:
Name Type Description
arg any Argument

getAppInfo(optsopt) → {promise.<object>}

Source:
Get application info
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
Returns:
A promise to the application info (also avialable as the appinfo member)
Type
promise.<object>

getBusinessObject(name, instanceopt) → {BusinessObject}

Source:
Get business object
Parameters:
Name Type Attributes Description
name string Business object name
instance string <optional>
Business object instance name, defaults to js_<object name>
Returns:
Business object
Type
BusinessObject

getExternalObject(name)

Source:
Get an external object
Parameters:
Name Type Description
name string External object name

getGrant(optsopt) → {promise.<Grant>}

Source:
Get grant (current user data)
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Default Description
inlinePicture boolean <optional>
false Inline user picture?
includeTexts boolean <optional>
false Include texts?
error function <optional>
Error handler function
Returns:
A promise to the grant (also available as the grant member)
Type
promise.<Grant>

getHealth(optsopt) → {promise.<object>}

Source:
Get health check (no need to be authenticated)
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Default Description
full boolean <optional>
false Full health check?
error function <optional>
Error handler function
Returns:
Promise to the health data
Type
promise.<object>

getNews(optsopt) → {promise.<array>}

Source:
Get news
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Default Description
inlineImages boolean <optional>
false Inline news images?
error function <optional>
Error handler function
Returns:
A promise to the list of news (also avialable as the news member)
Type
promise.<array>

getResourceURL(code, typeopt, objectopt, objIdopt)

Source:
Get a resource URL
Parameters:
Name Type Attributes Default Description
code string Resource code
type string <optional>
IMG Resource type (IMG=image (default), ICO=Icon, CSS=stylesheet, JS=Javascript, HTML=HTML)
object string <optional>
Object name (not required for global resources)
objId string <optional>
Object ID (not required for global resources)

getSysInfo(optsopt) → {promise.<object>}

Source:
Get system info
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
Returns:
A promise to the system info (also avialable as the sysinfo member)
Type
promise.<object>

indexSearch(request, objectopt, optsopt) → {promise.<array>}

Source:
Index search
Parameters:
Name Type Attributes Description
request string Index search request
object string <optional>
Object
opts object <optional>
Options
Properties
Name Type Attributes Default Description
metadata boolean <optional>
false Add meta data for each result
context number <optional>
Context
error function <optional>
Error handler function
Returns:
A promise to a list of index search records
Type
promise.<array>

info(arg)

Source:
Info handler
Parameters:
Name Type Description
arg any Argument

log(arg)

Source:
Log handler
Parameters:
Name Type Description
arg any Argument

login(optsopt) → {promise.<object>}

Source:
Login
Parameters:
Name Type Attributes Description
opts object <optional>
Options
Properties
Name Type Attributes Description
username string <optional>
Username
password string <optional>
Password
error function <optional>
Error handler function
Returns:
Promise to the login result
Type
promise.<object>

logout(callback, optsopt) → {promise.<object>}

Source:
Logout
Parameters:
Name Type Attributes Description
callback function Callback (called upon success)
opts object <optional>
Options
Properties
Name Type Attributes Description
error function <optional>
Error handler function
Returns:
Promise to the logout result
Type
promise.<object>

setAuthToken(tkn)

Source:
Set auth token
Parameters:
Name Type Description
tkn string Auth token

setPassword(pwd)

Source:
Set password
Parameters:
Name Type Description
pwd string Password

setUsername(usr)

Source:
Set username
Parameters:
Name Type Description
usr string Username

warn(arg)

Source:
Warning handler
Parameters:
Name Type Description
arg any Argument