Search in sources :

Example 21 with QueueManager

use of com.vodafone360.people.service.io.QueueManager 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 22 with QueueManager

use of com.vodafone360.people.service.io.QueueManager 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 23 with QueueManager

use of com.vodafone360.people.service.io.QueueManager 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 24 with QueueManager

use of com.vodafone360.people.service.io.QueueManager 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)

Example 25 with QueueManager

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

the class GroupPrivacy method getGroups.

/**
 * Implementation of groupprivacy/getgroups API. Parameters are; [auth],
 * Integer pageindex [opt], Integer pagesize [opt]
 *
 * @param engine handle to IdentitiesEngine
 * @param pageindex Page index.
 * @param pagesize PAge size.
 * @return request id generated for this request
 */
public static int getGroups(BaseEngine engine, Integer pageindex, Integer pagesize) {
    if (LoginEngine.getSession() == null) {
        LogUtils.logE("GroupPrivacy.GetGroups() Invalid session, return -1");
        return -1;
    }
    Request request = new Request(FUNCTION_GET_GROUPS, Request.Type.GROUP_LIST, engine.engineId(), false, Settings.API_REQUESTS_TIMEOUT_GROUP_PRIVACY);
    if (pageindex != null) {
        request.addData("pageindex", pageindex);
    }
    if (pagesize != null) {
        request.addData("pagesize", pagesize);
    }
    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

QueueManager (com.vodafone360.people.service.io.QueueManager)29 Request (com.vodafone360.people.service.io.Request)28 ResponseQueue (com.vodafone360.people.service.io.ResponseQueue)2 DecodedResponse (com.vodafone360.people.service.io.ResponseQueue.DecodedResponse)2 AuthSessionHolder (com.vodafone360.people.datatypes.AuthSessionHolder)1 BaseDataType (com.vodafone360.people.datatypes.BaseDataType)1 ServerError (com.vodafone360.people.datatypes.ServerError)1 EngineId (com.vodafone360.people.engine.EngineManager.EngineId)1 ServiceUiRequest (com.vodafone360.people.service.ServiceUiRequest)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1