Search in sources :

Example 56 with Request

use of com.vodafone360.people.service.io.Request in project 360-Engine-for-Android by 360.

the class Auth method requestActivationCode.

/**
 * Implementation of "auth/requestactivationcode" API.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param username User-name for this account.
 * @param mobileNumber Mobile number for this activation code to be sent.
 * @return Request ID generated for this request.
 * @return -1 when username is NULL.
 * @throws NullPointerException when engine is NULL
 * @throws NullPointerException when mobileNumber is NULL
 */
public static int requestActivationCode(BaseEngine engine, String username, String mobileNumber) {
    if (engine == null) {
        throw new NullPointerException("Auth.requestActivationCode() engine cannot be NULL");
    }
    if (username == null) {
        LogUtils.logE("Auth.requestActivationCode() username must be specified");
        return -1;
    }
    if (mobileNumber == null) {
        throw new NullPointerException("Auth.requestActivationCode() mobileNumber cannot be NULL");
    }
    Request request = new Request(FUNCTION_REQUEST_ACTIVATION_CODE, Request.Type.STATUS, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData(USERNAME, username);
    request.addData(VALUE, mobileNumber);
    request.addData(FLAGS, ACTIVATE_MOBILE_CLIENT_FLAG);
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 57 with Request

use of com.vodafone360.people.service.io.Request in project 360-Engine-for-Android by 360.

the class Auth method getTermsAndConditions.

/**
 * Implementation of "auth/gettermsandconditions" API.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @return request ID generated for this request.
 * @throws NullPointerException when engine is NULL
 */
public static int getTermsAndConditions(BaseEngine engine) {
    if (engine == null) {
        throw new NullPointerException("Auth.getPublicKey() engine cannot be NULL");
    }
    String localString = getLocalString();
    Request request = new Request(FUNCTION_GET_TERMS_AND_CONDITIONS, Request.Type.TEXT_RESPONSE_ONLY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData(LANGUAGE_CULTURE, localString);
    request.addData(FLAGS, "0");
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    ApplicationCache.setTermsLanguage(localString);
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 58 with Request

use of com.vodafone360.people.service.io.Request in project 360-Engine-for-Android by 360.

the class Auth method activate.

/**
 * Implementation of "auth/activate" API.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param code Activation code for this account
 * @return Request ID generated for this request.
 * @return -1 when code is NULL.
 * @return -1 when LoginEngine.getSession() is NULL.
 * @throws NullPointerException when engine is NULL
 */
public static int activate(BaseEngine engine, String code) {
    if (engine == null) {
        throw new NullPointerException("Auth.activate() engine cannot be NULL");
    }
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Auth.activate() Invalid session, return -1");
        return -1;
    }
    if (code == null) {
        LogUtils.logE("Auth.activate() Code must not be NULL, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_ACTIVATE, Request.Type.STATUS, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData("code", code);
    request.addData(FLAGS, ACTIVATE_MOBILE_CLIENT_FLAG);
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 59 with Request

use of com.vodafone360.people.service.io.Request in project 360-Engine-for-Android by 360.

the class Auth method getSessionByCredentials.

/**
 * Implementation of "getsessionbycredentials" API. Used to login to an
 * existing VF360 account.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param username User-name for account.
 * @param password Password for account.
 * @param more Additional login details or NULL.
 * @return Request ID generated for this request.
 * @throws NullPointerException when engine is NULL
 * @throws NullPointerException when username is NULL
 * @throws NullPointerException when password is NULL
 */
public static int getSessionByCredentials(BaseEngine engine, String username, String password, Map<String, List<String>> more) {
    if (engine == null) {
        throw new NullPointerException("Auth.getSessionByCredentials() engine cannot be NULL");
    }
    if (username == null) {
        throw new NullPointerException("Auth.getSessionByCredentials() username cannot be NULL");
    }
    if (password == null) {
        throw new NullPointerException("Auth.getSessionByCredentials() password cannot be NULL");
    }
    String ts = "" + (System.currentTimeMillis() / 1000);
    Request request = new Request(FUNCTION_GET_SESSION, Request.Type.SIGN_IN, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData("hash", AuthUtils.getMd5Hash(SettingsManager.getProperty(Settings.APP_SECRET_KEY).toLowerCase() + "&" + ts + "&" + username.toLowerCase() + "&" + password.toLowerCase()));
    request.addData(TIMESTAMP, ts);
    request.addData(USERNAME, username.toLowerCase());
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 60 with Request

use of com.vodafone360.people.service.io.Request in project 360-Engine-for-Android by 360.

the class Auth method getUsernameState.

/**
 * Implementation of "auth/getusernamestate" API.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param username User name for this account.
 * @return Request id generated for this request.
 * @return -1 when username is NULL.
 * @throws NullPointerException when engine is NULL
 */
public static int getUsernameState(BaseEngine engine, String username) {
    if (engine == null) {
        throw new NullPointerException("Auth.getUsernameState() engine cannot be NULL");
    }
    if (username == null) {
        LogUtils.logE("Auth.GetUsernameState() username must not be NULL, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_USERNAME_STATE, Request.Type.TEXT_RESPONSE_ONLY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData(USERNAME, username);
    QueueManager queue = QueueManager.getInstance();
    int requestId = queue.addRequest(request);
    queue.fireQueueStateChanged();
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Aggregations

Request (com.vodafone360.people.service.io.Request)43 QueueManager (com.vodafone360.people.service.io.QueueManager)27 ServiceStatus (com.vodafone360.people.service.ServiceStatus)16 ArrayList (java.util.ArrayList)16 BaseDataType (com.vodafone360.people.datatypes.BaseDataType)12 ServiceUiRequest (com.vodafone360.people.service.ServiceUiRequest)12 DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)11 Suppress (android.test.suitebuilder.annotation.Suppress)10 DatabaseHelper (com.vodafone360.people.database.DatabaseHelper)9 IEngineEventCallback (com.vodafone360.people.engine.IEngineEventCallback)9 IContactSyncCallback (com.vodafone360.people.engine.contactsync.IContactSyncCallback)9 ProcessorFactory (com.vodafone360.people.engine.contactsync.ProcessorFactory)9 ServerError (com.vodafone360.people.datatypes.ServerError)6 IOException (java.io.IOException)6 Identity (com.vodafone360.people.datatypes.Identity)5 ByteArrayInputStream (java.io.ByteArrayInputStream)5 Bundle (android.os.Bundle)4 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)4 ContactChanges (com.vodafone360.people.datatypes.ContactChanges)4 ResponseQueue (com.vodafone360.people.service.io.ResponseQueue)4