Search in sources :

Example 61 with Request

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

the class Auth method getPrivacyStatement.

/**
 * Request Privacy statement from back-end.
 *
 * @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 getPrivacyStatement(BaseEngine engine) {
    if (engine == null) {
        throw new NullPointerException("Auth.getPublicKey() engine cannot be NULL");
    }
    String localString = getLocalString();
    Request request = new Request(FUNCTION_GET_PRIVACY_STATEMENT, 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.setPrivacyLanguage(localString);
    return requestId;
}
Also used : Request(com.vodafone360.people.service.io.Request) QueueManager(com.vodafone360.people.service.io.QueueManager)

Example 62 with Request

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

the class Auth method signupUserCrypted.

/**
 * Implementation of "auth/signupusercrypted" API. Encrypted signup to new
 * account.
 *
 * @param engine Handle to LoginEngine which handles requests using this
 *            API.
 * @param fullname Full name of user
 * @param username Username chosen for new account
 * @param password Password chosen for new account
 * @param timestamp Current timestamp.
 * @param email Email address associated with this account.
 * @param birthDate Birthday of user signing up (there is a minimum age
 *            limit for users).
 * @param msisdn MSIDN for user.
 * @param acceptedTAndC Whether user has accepted terms and conditions.
 * @param countryCode String identifier identifying country.
 * @param timezone Timezone identifier.
 * @param language Lauguage identifier.
 * @param mobileOperatorId ID of mobile operator.
 * @param mobileModelId Mobile device ID.
 * @param sendConfirmationMail True if confirmation email to be sent to
 *            user.
 * @param sendConfirmationSms True if confirmation SMS to be sent to user.
 * @param subscribeToNewsletter True if user wishes to subscribe to
 *            newsletter.
 * @return Request ID generated for this request.
 * @throws NullPointerException when engine is NULL
 * @throws NullPointerException when acceptedTAndC is NULL
 * @throws NullPointerException when mobileOperatorId is NULL
 * @throws NullPointerException when mobileModelId is NULL
 * @throws NullPointerException when sendConfirmationMail is NULL
 * @throws NullPointerException when sendConfirmationSms is NULL
 * @throws NullPointerException when subscribeToNewsletter is NULL
 */
public static int signupUserCrypted(BaseEngine engine, String fullname, String username, byte[] password, long timestamp, String email, String birthDate, String msisdn, Boolean acceptedTAndC, String countryCode, String timezone, String language, Long mobileOperatorId, Long mobileModelId, Boolean sendConfirmationMail, Boolean sendConfirmationSms, Boolean subscribeToNewsletter) {
    if (engine == null) {
        throw new NullPointerException("Auth.signupUserCrypted() engine cannot be NULL");
    }
    if (acceptedTAndC == null) {
        throw new NullPointerException("Auth.signupUserCrypted() acceptedTAndC cannot be NULL");
    }
    if (mobileOperatorId == null) {
        throw new NullPointerException("Auth.signupUserCrypted() mobileOperatorId cannot be NULL");
    }
    if (mobileModelId == null) {
        throw new NullPointerException("Auth.signupUserCrypted() mobileModelId cannot be NULL");
    }
    if (sendConfirmationMail == null) {
        throw new NullPointerException("Auth.signupUserCrypted() sendConfirmationMail cannot be NULL");
    }
    if (sendConfirmationSms == null) {
        throw new NullPointerException("Auth.signupUserCrypted() sendConfirmationSms cannot be NULL");
    }
    if (subscribeToNewsletter == null) {
        throw new NullPointerException("Auth.signupUserCrypted() subscribeToNewsletter cannot be NULL");
    }
    String ts = "" + (System.currentTimeMillis() / 1000);
    Request request = new Request(FUNCTION_SIGNUP_USER_CRYPTED, Request.Type.SIGN_UP, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData(FULLNAME, fullname);
    request.addData(USERNAME, username);
    request.addData(PASSWORD, password);
    request.addData(EMAIL, email);
    request.addData(BIRTHDATE, birthDate);
    request.addData(MSISDN, msisdn);
    request.addData(ACCEPTED_T_AND_C, acceptedTAndC.toString());
    request.addData(COUNTY_CODE, countryCode);
    request.addData(TIMESTAMP, ts);
    request.addData(TIMEZONE, timezone);
    request.addData(LANGUAGE, language);
    request.addData(MOBILE_OPERATOR_ID, mobileOperatorId.toString());
    request.addData(MOBILE_MODE_ID, mobileModelId.toString());
    request.addData(SEND_CONFIRMATION_MAIL, sendConfirmationMail.toString());
    request.addData(SEND_CONFIRMAITON_SMS, sendConfirmationSms.toString());
    request.addData(SUBSCRIBE_TO_NEWSLETTER, subscribeToNewsletter.toString());
    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 63 with Request

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

the class Auth method getPublicKey.

/**
 * Implementation of "auth/getpublickey" 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 getPublicKey(BaseEngine engine) {
    if (engine == null) {
        throw new NullPointerException("Auth.getPublicKey() engine cannot be NULL");
    }
    Request request = new Request(FUNCTION_GET_PUBLIC_KEY, Request.Type.RETRIEVE_PUBLIC_KEY, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_AUTH);
    request.addData("type", "all");
    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 64 with Request

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

the class Chat method sendChatMessage.

// function?
/**
 * Sends chat message to server
 *
 * @param msg - ChatMessage to be sent
 * @return request id
 */
public static int sendChatMessage(ChatMessage msg) {
    if (msg.getTos() == null) {
        LogUtils.logE("Chat.sentChatMessage() msg.mTos can't be null");
        return -1;
    }
    if (msg.getBody() == null) {
        LogUtils.logE("Chat.sentChatMessage() msg.mBody can't be null");
        return -1;
    }
    if (msg.getConversationId() == null) {
        LogUtils.logE("Chat.sentChatMessage() msg.mConversationId can't be null");
        return -1;
    }
    Request request = new Request(EMPTY, Request.Type.SEND_CHAT_MESSAGE, EngineId.PRESENCE_ENGINE, true, Settings.API_REQUESTS_TIMEOUT_CHAT_SEND_MESSAGE);
    request.addData(ChatMessage.Tags.BODY.tag(), msg.getBody());
    request.addData(ChatMessage.Tags.RECIPIENTS_LIST.tag(), msg.getTos());
    request.addData(ChatMessage.Tags.CONVERSATION_ID.tag(), msg.getConversationId());
    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 65 with Request

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

the class Contacts method getMe.

/**
 * Implementation of contacts/getme API. Parameters are; [auth]
 *
 * @param engine Handle to ContactSync engine
 * @return Request ID generated for this request.
 */
public static int getMe(BaseEngine engine) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("Contacts.GetMe() Invalid session, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_ME, Request.Type.COMMON, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_CONTACTS);
    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