Search in sources :

Example 1 with LogoutReply

use of me.semx11.autotip.api.reply.impl.LogoutReply in project Hyperium by HyperiumClient.

the class LogoutRequest method execute.

@Override
public LogoutReply execute() {
    HttpUriRequest request = GetBuilder.of(this).addParameter("key", sessionKey).build();
    Optional<Reply> optional = RequestHandler.getReply(this, request.getURI());
    return optional.map(reply -> (LogoutReply) reply).orElseGet(() -> new LogoutReply(false));
}
Also used : HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) LogoutReply(me.semx11.autotip.api.reply.impl.LogoutReply) RequestHandler(me.semx11.autotip.api.RequestHandler) SessionKey(me.semx11.autotip.api.SessionKey) RequestType(me.semx11.autotip.api.RequestType) GetBuilder(me.semx11.autotip.api.GetBuilder) Reply(me.semx11.autotip.api.reply.Reply) Optional(java.util.Optional) HttpUriRequest(org.apache.http.client.methods.HttpUriRequest) Request(me.semx11.autotip.api.request.Request) LogoutReply(me.semx11.autotip.api.reply.impl.LogoutReply) LogoutReply(me.semx11.autotip.api.reply.impl.LogoutReply) Reply(me.semx11.autotip.api.reply.Reply)

Example 2 with LogoutReply

use of me.semx11.autotip.api.reply.impl.LogoutReply in project Hyperium by HyperiumClient.

the class SessionManager method logout.

public void logout() {
    if (!loggedIn)
        return;
    LogoutReply reply = LogoutRequest.of(sessionKey).execute();
    if (!reply.isSuccess()) {
        Autotip.LOGGER.warn("Error during logout: {}", reply.getCause());
    }
    loggedIn = false;
    sessionKey = null;
    taskManager.cancelTask(TaskType.KEEP_ALIVE);
    tipQueue.clear();
}
Also used : LogoutReply(me.semx11.autotip.api.reply.impl.LogoutReply)

Aggregations

LogoutReply (me.semx11.autotip.api.reply.impl.LogoutReply)2 Optional (java.util.Optional)1 GetBuilder (me.semx11.autotip.api.GetBuilder)1 RequestHandler (me.semx11.autotip.api.RequestHandler)1 RequestType (me.semx11.autotip.api.RequestType)1 SessionKey (me.semx11.autotip.api.SessionKey)1 Reply (me.semx11.autotip.api.reply.Reply)1 Request (me.semx11.autotip.api.request.Request)1 HttpUriRequest (org.apache.http.client.methods.HttpUriRequest)1