Cortex Android
 All Classes Namespaces Functions Variables
nl.sense_os.cortex.coaching.backend.UserAPI Class Reference
Inheritance diagram for nl.sense_os.cortex.coaching.backend.UserAPI:
nl.sense_os.cortex.coaching.backend.CoachingAPI

Public Member Functions

User createUser (String email, String password, JSONObject user_info, String secret_code) throws IOException, RuntimeException
 
User getUser () throws IOException, RuntimeException
 
void deleteUser () throws IOException, RuntimeException
 
boolean updateUser (User user) throws Exception
 

Static Public Member Functions

static UserAPI getInstance (SensePlatform sensePlatform)
 

Protected Attributes

final String USER_END_POINT_PREFIX = "/users"
 
- Protected Attributes inherited from nl.sense_os.cortex.coaching.backend.CoachingAPI
final String RESPONSE_CODE = "http response code"
 
final String RESPONSE_CONTENT = "content"
 
String secret_code
 
SensePlatform mSensePlatform
 
SharedPreferences mAuthPrefs
 
CoachingEngine coachingEngine
 

Static Protected Attributes

static final String TAG = "UserAPI"
 
static String KEY_USER_ID = "user_id"
 
static String KEY_USER_INFO = "user_info"
 
static String KEY_EMAIL = "email"
 
static String KEY_PASSWORD = "password"
 
static String KEY_USER_TYPE = "user_type"
 
static String KEY_SECRET_CODE = "secret_code"
 
static UserAPI instance
 
- Static Protected Attributes inherited from nl.sense_os.cortex.coaching.backend.CoachingAPI
static String BASE_URL_STAGING = "http://coaching-api.staging.sense-os.nl"
 
static String BASE_URL_TESTING = "http://coaching-api.dev.sense-os.nl"
 
static final String RESPONSE_OK = "200"
 
static final String RESPONSE_CREATED = "201"
 
static final String RESPONSE_NO_CONENT = "204"
 
static final String REQUEST_METHOD_PUT = "PUT"
 
static final String REQUEST_METHOD_DELETE = "DELETE"
 

Additional Inherited Members

- Static Public Attributes inherited from nl.sense_os.cortex.coaching.backend.CoachingAPI
static final String BASE_URL_PRODUCTION = "https://coaching-api.sense-os.nl"
 
- Protected Member Functions inherited from nl.sense_os.cortex.coaching.backend.CoachingAPI
 CoachingAPI (SensePlatform sensePlatform)
 
Map< String, String > request (String endPoint, JSONObject content) throws IOException, RuntimeException
 
BACKEND_RELEASE getBackendRelease ()
 
Map< String, String > request (String endPoint, JSONObject content, String requestMethod) throws IOException, RuntimeException
 

Member Function Documentation

User nl.sense_os.cortex.coaching.backend.UserAPI.createUser ( String  email,
String  password,
JSONObject  user_info,
String  secret_code 
) throws IOException, RuntimeException

Creates the Coaching enabled CommonSense user

Will create a CommonSense user which is enabled added to the Coaching database. The current user will be logged out.

Parameters
emailThe email of the user
passwordThe md5 hashed password of the user
user_infothe JSONOBject user info
secret_codeThe secret registration code
Returns
The Coaching enabled user. Will return null if it fails.
void nl.sense_os.cortex.coaching.backend.UserAPI.deleteUser ( ) throws IOException, RuntimeException

Delete the CommonSense Coaching User

This will delete the user and all it's data from the Coaching database and CommonSense

User nl.sense_os.cortex.coaching.backend.UserAPI.getUser ( ) throws IOException, RuntimeException

Get the CommonSense Coaching User

This will return the user object from the Coaching database

Returns
The User object
boolean nl.sense_os.cortex.coaching.backend.UserAPI.updateUser ( User  user) throws Exception

Updates the User in the Coaching database

Updates an existing user in the Coaching database

Parameters
userThe User object
Returns
True if it was successful, false if it failed.

The documentation for this class was generated from the following file: